workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
And also you can perform cool operations on set such as subtract which you can't on lists
2018-01-19T12:09:54.000807
Sadye
pythondev_help_Sadye_2018-01-19T12:09:54.000807
1,516,363,794.000807
30,024
pythondev
help
500 seconds to 1 second for a data structure change is definitely not normal
2018-01-19T12:09:55.001385
Floy
pythondev_help_Floy_2018-01-19T12:09:55.001385
1,516,363,795.001385
30,025
pythondev
help
you can iterate through a set or check for inclusion but you cannot index into it numerically
2018-01-19T12:10:43.000790
Leanora
pythondev_help_Leanora_2018-01-19T12:10:43.000790
1,516,363,843.00079
30,026
pythondev
help
``` >>> {1,2,3} - {1,2,4} {3} >>> [1,2,3] - [1,2,4] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for -: 'list' and 'list' ```
2018-01-19T12:10:50.000183
Sadye
pythondev_help_Sadye_2018-01-19T12:10:50.000183
1,516,363,850.000183
30,027
pythondev
help
its faster for some operations and slower for others
2018-01-19T12:11:10.001771
Leanora
pythondev_help_Leanora_2018-01-19T12:11:10.001771
1,516,363,870.001771
30,028
pythondev
help
its interesting, from a data structure perspective. python lists are more like bags
2018-01-19T12:11:34.001398
Floy
pythondev_help_Floy_2018-01-19T12:11:34.001398
1,516,363,894.001398
30,029
pythondev
help
and knowing the differences between structures and their operations is crucical to development. that’s a reason why most four year CS programs require two, if not three or more classes on data structures
2018-01-19T12:12:50.000734
Floy
pythondev_help_Floy_2018-01-19T12:12:50.000734
1,516,363,970.000734
30,030
pythondev
help
<@Floy> i am an ECE major i did have data structure class but never had heard of sets i'll look into it now Thanks for the help
2018-01-19T12:13:51.000291
Deja
pythondev_help_Deja_2018-01-19T12:13:51.000291
1,516,364,031.000291
30,031
pythondev
help
<@Floy> i know i was shocked too
2018-01-19T12:14:37.000837
Deja
pythondev_help_Deja_2018-01-19T12:14:37.000837
1,516,364,077.000837
30,032
pythondev
help
you had a class on data structures, but it didn’t cover sets?
2018-01-19T12:14:38.000946
Floy
pythondev_help_Floy_2018-01-19T12:14:38.000946
1,516,364,078.000946
30,033
pythondev
help
what did it cover?
2018-01-19T12:14:44.001076
Floy
pythondev_help_Floy_2018-01-19T12:14:44.001076
1,516,364,084.001076
30,034
pythondev
help
<@Floy> nope it covered stacks,queues,trees,graphs etc but not sets
2018-01-19T12:15:06.000317
Deja
pythondev_help_Deja_2018-01-19T12:15:06.000317
1,516,364,106.000317
30,035
pythondev
help
<@Floy> I thought bags were unordered like sets
2018-01-19T12:15:27.000069
Leanora
pythondev_help_Leanora_2018-01-19T12:15:27.000069
1,516,364,127.000069
30,036
pythondev
help
How did the subtraction took place?
2018-01-19T12:16:29.000361
Deja
pythondev_help_Deja_2018-01-19T12:16:29.000361
1,516,364,189.000361
30,037
pythondev
help
in school, we had to implement a bag data structure with ordering, such that it couold contain elements of any type added to it
2018-01-19T12:16:56.001107
Floy
pythondev_help_Floy_2018-01-19T12:16:56.001107
1,516,364,216.001107
30,038
pythondev
help
which is similar to python’s list
2018-01-19T12:17:12.000427
Floy
pythondev_help_Floy_2018-01-19T12:17:12.000427
1,516,364,232.000427
30,039
pythondev
help
sounds like all the pieces would mush together in the bag and make a complete mess :wink:
2018-01-19T12:17:22.000781
Monroe
pythondev_help_Monroe_2018-01-19T12:17:22.000781
1,516,364,242.000781
30,040
pythondev
help
fortunately, the ordering part was just rrequired to be insertion-order
2018-01-19T12:18:01.000003
Floy
pythondev_help_Floy_2018-01-19T12:18:01.000003
1,516,364,281.000003
30,041
pythondev
help
Ah ok, a bit of an expansion of a generic bag then and kind of like what python dicts do now
2018-01-19T12:18:34.000366
Leanora
pythondev_help_Leanora_2018-01-19T12:18:34.000366
1,516,364,314.000366
30,042
pythondev
help
pretty much
2018-01-19T12:18:45.000155
Floy
pythondev_help_Floy_2018-01-19T12:18:45.000155
1,516,364,325.000155
30,043
pythondev
help
<@Floy> are sets in python are just like the sets in mathematics?
2018-01-19T12:21:55.000346
Deja
pythondev_help_Deja_2018-01-19T12:21:55.000346
1,516,364,515.000346
30,044
pythondev
help
exactly
2018-01-19T12:22:10.001218
Floy
pythondev_help_Floy_2018-01-19T12:22:10.001218
1,516,364,530.001218
30,045
pythondev
help
and relational databases are an implementation of set theory
2018-01-19T12:22:20.000203
Floy
pythondev_help_Floy_2018-01-19T12:22:20.000203
1,516,364,540.000203
30,046
pythondev
help
<https://docs.python.org/3/tutorial/datastructures.html#sets>
2018-01-19T12:22:36.000903
Leanora
pythondev_help_Leanora_2018-01-19T12:22:36.000903
1,516,364,556.000903
30,047
pythondev
help
Wow i can't believe i didn't know them earlier
2018-01-19T12:22:36.001925
Deja
pythondev_help_Deja_2018-01-19T12:22:36.001925
1,516,364,556.001925
30,048
pythondev
help
would have made a lot of things easier
2018-01-19T12:22:48.000791
Deja
pythondev_help_Deja_2018-01-19T12:22:48.000791
1,516,364,568.000791
30,049
pythondev
help
Thank you guys
2018-01-19T12:23:17.001016
Deja
pythondev_help_Deja_2018-01-19T12:23:17.001016
1,516,364,597.001016
30,050
pythondev
help
I understand it now :relieved:
2018-01-19T12:23:55.001623
Deja
pythondev_help_Deja_2018-01-19T12:23:55.001623
1,516,364,635.001623
30,051
pythondev
help
:+1:
2018-01-19T12:24:05.001975
Leanora
pythondev_help_Leanora_2018-01-19T12:24:05.001975
1,516,364,645.001975
30,052
pythondev
help
and now you know, for use when you come across something like this again
2018-01-19T12:24:39.000702
Floy
pythondev_help_Floy_2018-01-19T12:24:39.000702
1,516,364,679.000702
30,053
pythondev
help
While we're on the subject there's also counters which is essentially a bag/multiset
2018-01-19T12:26:52.000839
Leanora
pythondev_help_Leanora_2018-01-19T12:26:52.000839
1,516,364,812.000839
30,054
pythondev
help
<https://docs.python.org/3/library/collections.html#collections.Counter>
2018-01-19T12:26:54.000057
Leanora
pythondev_help_Leanora_2018-01-19T12:26:54.000057
1,516,364,814.000057
30,055
pythondev
help
the data structure would probably be known more as a Hash Set, right? rather than just "set"?
2018-01-19T12:26:57.001758
Garrett
pythondev_help_Garrett_2018-01-19T12:26:57.001758
1,516,364,817.001758
30,056
pythondev
help
depends on the actual implementation behind the structure
2018-01-19T12:27:37.000487
Floy
pythondev_help_Floy_2018-01-19T12:27:37.000487
1,516,364,857.000487
30,057
pythondev
help
for example, you can have a tree structure, or a hash structure (java has both)
2018-01-19T12:27:54.000862
Floy
pythondev_help_Floy_2018-01-19T12:27:54.000862
1,516,364,874.000862
30,058
pythondev
help
including thread-safe implmenentations
2018-01-19T12:28:05.000582
Floy
pythondev_help_Floy_2018-01-19T12:28:05.000582
1,516,364,885.000582
30,059
pythondev
help
or even array based
2018-01-19T12:28:17.001149
Leanora
pythondev_help_Leanora_2018-01-19T12:28:17.001149
1,516,364,897.001149
30,060
pythondev
help
ArrayList is that
2018-01-19T12:28:27.001687
Floy
pythondev_help_Floy_2018-01-19T12:28:27.001687
1,516,364,907.001687
30,061
pythondev
help
but since python is hash based its probably safe to call it a hash set
2018-01-19T12:28:37.000676
Leanora
pythondev_help_Leanora_2018-01-19T12:28:37.000676
1,516,364,917.000676
30,062
pythondev
help
True
2018-01-19T12:28:44.000280
Floy
pythondev_help_Floy_2018-01-19T12:28:44.000280
1,516,364,924.00028
30,063
pythondev
help
from a CS perspective, its fun to analyze the differences between trees and hashes
2018-01-19T12:29:12.000044
Floy
pythondev_help_Floy_2018-01-19T12:29:12.000044
1,516,364,952.000044
30,064
pythondev
help
hmmm ArrayList allows duplicate values though right? (I haven't done java in forever so might be wrong here)
2018-01-19T12:29:19.001620
Leanora
pythondev_help_Leanora_2018-01-19T12:29:19.001620
1,516,364,959.00162
30,065
pythondev
help
oh, sorry. I was thinking something different
2018-01-19T12:29:47.001052
Floy
pythondev_help_Floy_2018-01-19T12:29:47.001052
1,516,364,987.001052
30,066
pythondev
help
yeah, all lists allow dupes
2018-01-19T12:29:53.000368
Floy
pythondev_help_Floy_2018-01-19T12:29:53.000368
1,516,364,993.000368
30,067
pythondev
help
What is the purpose of importing something like this: `foo = __import__('urllib.parse', globals(), locals())`
2018-01-19T15:20:41.001171
Majorie
pythondev_help_Majorie_2018-01-19T15:20:41.001171
1,516,375,241.001171
30,068
pythondev
help
uh...good question
2018-01-19T15:24:56.001690
Garrett
pythondev_help_Garrett_2018-01-19T15:24:56.001690
1,516,375,496.00169
30,069
pythondev
help
I suppose something could be wrong with the normal import mechanic so you need to jump directly to the behind-the-scenes functionality?
2018-01-19T15:25:48.000125
Garrett
pythondev_help_Garrett_2018-01-19T15:25:48.000125
1,516,375,548.000125
30,070
pythondev
help
but that seems like a super edge case and a bad idea
2018-01-19T15:26:08.000386
Garrett
pythondev_help_Garrett_2018-01-19T15:26:08.000386
1,516,375,568.000386
30,071
pythondev
help
I just came across it in a cryptobot I'm hacking
2018-01-19T15:30:57.000781
Majorie
pythondev_help_Majorie_2018-01-19T15:30:57.000781
1,516,375,857.000781
30,072
pythondev
help
`import urllib` `foo == urllib`
2018-01-19T15:34:38.001575
Majorie
pythondev_help_Majorie_2018-01-19T15:34:38.001575
1,516,376,078.001575
30,073
pythondev
help
&gt;&gt; True
2018-01-19T15:34:40.001677
Majorie
pythondev_help_Majorie_2018-01-19T15:34:40.001677
1,516,376,080.001677
30,074
pythondev
help
weird
2018-01-19T15:34:54.000254
Majorie
pythondev_help_Majorie_2018-01-19T15:34:54.000254
1,516,376,094.000254
30,075
pythondev
help
yeah, `import urllib as foo` would be the same (and better)
2018-01-19T15:37:17.000194
Garrett
pythondev_help_Garrett_2018-01-19T15:37:17.000194
1,516,376,237.000194
30,076
pythondev
help
yea, I replaced it. Thanks kenneth
2018-01-19T15:38:52.000183
Majorie
pythondev_help_Majorie_2018-01-19T15:38:52.000183
1,516,376,332.000183
30,077
pythondev
help
How do I convert a hex string to a color object (0x)?
2018-01-19T15:42:04.000635
Carissa
pythondev_help_Carissa_2018-01-19T15:42:04.000635
1,516,376,524.000635
30,078
pythondev
help
I tried hex(int(value)) and hex(value) but get errors for both
2018-01-19T15:42:21.000810
Carissa
pythondev_help_Carissa_2018-01-19T15:42:21.000810
1,516,376,541.00081
30,079
pythondev
help
``` &gt;&gt;&gt; int('AABBCC', base=16) 11189196 ```
2018-01-19T15:51:33.001345
Barney
pythondev_help_Barney_2018-01-19T15:51:33.001345
1,516,377,093.001345
30,080
pythondev
help
what's a color object?
2018-01-19T15:52:14.000761
Barney
pythondev_help_Barney_2018-01-19T15:52:14.000761
1,516,377,134.000761
30,081
pythondev
help
color* value
2018-01-19T15:55:17.001888
Carissa
pythondev_help_Carissa_2018-01-19T15:55:17.001888
1,516,377,317.001888
30,082
pythondev
help
idk
2018-01-19T15:55:21.000549
Carissa
pythondev_help_Carissa_2018-01-19T15:55:21.000549
1,516,377,321.000549
30,083
pythondev
help
the hex with the 0x, ik that its just cause # is for comments just dont know what its called
2018-01-19T15:55:43.001220
Carissa
pythondev_help_Carissa_2018-01-19T15:55:43.001220
1,516,377,343.00122
30,084
pythondev
help
You can use back ticks to put code type comments
2018-01-19T15:56:24.000288
Leanora
pythondev_help_Leanora_2018-01-19T15:56:24.000288
1,516,377,384.000288
30,085
pythondev
help
so `#AABBCC` would be the hex specification of a color value
2018-01-19T15:56:43.001129
Leanora
pythondev_help_Leanora_2018-01-19T15:56:43.001129
1,516,377,403.001129
30,086
pythondev
help
do you want to convert to an rgb value?
2018-01-19T15:58:07.000500
Leanora
pythondev_help_Leanora_2018-01-19T15:58:07.000500
1,516,377,487.0005
30,087
pythondev
help
I just want to be able to use it as a variable for setting the color of certain things.
2018-01-19T16:11:46.000075
Carissa
pythondev_help_Carissa_2018-01-19T16:11:46.000075
1,516,378,306.000075
30,088
pythondev
help
So basically how do I, in a python script, set a variable to a color from a hex string.
2018-01-19T16:12:21.000298
Carissa
pythondev_help_Carissa_2018-01-19T16:12:21.000298
1,516,378,341.000298
30,089
pythondev
help
<@Leanora>
2018-01-19T16:13:15.000160
Carissa
pythondev_help_Carissa_2018-01-19T16:13:15.000160
1,516,378,395.00016
30,090
pythondev
help
Sorry but I'm not sure what you mean when you say set a variable to a color. Are you using any particular library? If you for instance just say `black = '#000000'` then that variable would be set to a string that's the hex representation of the color black. If you want to set it to the actual hex numeric representati...
2018-01-19T16:15:49.001657
Leanora
pythondev_help_Leanora_2018-01-19T16:15:49.001657
1,516,378,549.001657
30,091
pythondev
help
When I do that I get this error TypeError: Expected discord.Colour, int, or Embed.Empty but received str instead.
2018-01-19T16:17:14.001165
Carissa
pythondev_help_Carissa_2018-01-19T16:17:14.001165
1,516,378,634.001165
30,092
pythondev
help
ok, you’re not providing too much context in which this is executing
2018-01-19T16:17:47.001345
Floy
pythondev_help_Floy_2018-01-19T16:17:47.001345
1,516,378,667.001345
30,093
pythondev
help
``` &gt;&gt;&gt; int('AABBCC', base=16) 11189196 ``` this is an int!
2018-01-19T16:17:51.000957
Barney
pythondev_help_Barney_2018-01-19T16:17:51.000957
1,516,378,671.000957
30,094
pythondev
help
what code are you running?
2018-01-19T16:17:52.000587
Floy
pythondev_help_Floy_2018-01-19T16:17:52.000587
1,516,378,672.000587
30,095
pythondev
help
It sounds like you're using some kind of library which is expecting one of those things. You can probably use what <@Barney> said to construct the right int representation from a hex string and pass that through or use the constructor for discord.Colour to make that object
2018-01-19T16:18:50.000651
Leanora
pythondev_help_Leanora_2018-01-19T16:18:50.000651
1,516,378,730.000651
30,096
pythondev
help
Just found it in the docs, thx.
2018-01-19T16:19:23.001243
Carissa
pythondev_help_Carissa_2018-01-19T16:19:23.001243
1,516,378,763.001243
30,097
pythondev
help
Sweet. For future questions, if you want more/better/faster help I'd take a read through <https://stackoverflow.com/help/how-to-ask>
2018-01-19T16:20:38.001045
Leanora
pythondev_help_Leanora_2018-01-19T16:20:38.001045
1,516,378,838.001045
30,098
pythondev
help
I will look at that, sorry.
2018-01-19T16:22:03.001180
Carissa
pythondev_help_Carissa_2018-01-19T16:22:03.001180
1,516,378,923.00118
30,099
pythondev
help
Hi ! I'm having trouble with mock and nosetests
2018-01-20T08:54:02.000891
Gwyn
pythondev_help_Gwyn_2018-01-20T08:54:02.000891
1,516,438,442.000891
30,100
pythondev
help
Does anyone know about it enough to help ? :slightly_smiling_face:
2018-01-20T08:54:08.000979
Gwyn
pythondev_help_Gwyn_2018-01-20T08:54:08.000979
1,516,438,448.000979
30,101
pythondev
help
(The problem is with mock, not nosetests tho)
2018-01-20T08:54:21.000673
Gwyn
pythondev_help_Gwyn_2018-01-20T08:54:21.000673
1,516,438,461.000673
30,102
pythondev
help
So I get it comes from the way i set the json return value to mock
2018-01-20T08:57:01.000463
Gwyn
pythondev_help_Gwyn_2018-01-20T08:57:01.000463
1,516,438,621.000463
30,103
pythondev
help
but I couldn't figure it out
2018-01-20T08:57:09.000679
Gwyn
pythondev_help_Gwyn_2018-01-20T08:57:09.000679
1,516,438,629.000679
30,104
pythondev
help
and I looked it up and no one had the same error :disappointed:
2018-01-20T08:57:25.001184
Gwyn
pythondev_help_Gwyn_2018-01-20T08:57:25.001184
1,516,438,645.001184
30,105
pythondev
help
I suppose you are using the `request` library ?
2018-01-20T08:58:50.000369
Micki
pythondev_help_Micki_2018-01-20T08:58:50.000369
1,516,438,730.000369
30,106
pythondev
help
there is a package to easily mock response
2018-01-20T08:59:01.000209
Micki
pythondev_help_Micki_2018-01-20T08:59:01.000209
1,516,438,741.000209
30,107
pythondev
help
<@Micki> Searched PyPi for `requests mock`
2018-01-20T08:59:11.000018
Hyo
pythondev_help_Hyo_2018-01-20T08:59:11.000018
1,516,438,751.000018
30,108
pythondev
help
Well, I was using the "normal" `mock` because that is what I found on the internet
2018-01-20T08:59:59.000006
Gwyn
pythondev_help_Gwyn_2018-01-20T08:59:59.000006
1,516,438,799.000006
30,109
pythondev
help
Though what the guys used in their tutorials were `requests.get` and i'm using `requests.request`
2018-01-20T09:00:31.000967
Gwyn
pythondev_help_Gwyn_2018-01-20T09:00:31.000967
1,516,438,831.000967
30,110
pythondev
help
`requests.get` is just a proxy to `requests.request('GET', ...)`
2018-01-20T09:02:07.000696
Micki
pythondev_help_Micki_2018-01-20T09:02:07.000696
1,516,438,927.000696
30,111
pythondev
help
oh okay :joy: So that shouldn't be the problem
2018-01-20T09:03:20.000939
Gwyn
pythondev_help_Gwyn_2018-01-20T09:03:20.000939
1,516,439,000.000939
30,112
pythondev
help
:thinking_face:
2018-01-20T09:03:22.001082
Gwyn
pythondev_help_Gwyn_2018-01-20T09:03:22.001082
1,516,439,002.001082
30,113
pythondev
help
Then I don't know what the problem is :confused:
2018-01-20T09:03:47.000003
Gwyn
pythondev_help_Gwyn_2018-01-20T09:03:47.000003
1,516,439,027.000003
30,114
pythondev
help
the problem is you are mocking `response.json()` to return `info` but you never call it
2018-01-20T09:04:57.000223
Micki
pythondev_help_Micki_2018-01-20T09:04:57.000223
1,516,439,097.000223
30,115
pythondev
help
instead you use `json.loads(response.content)`
2018-01-20T09:05:12.000662
Micki
pythondev_help_Micki_2018-01-20T09:05:12.000662
1,516,439,112.000662
30,116
pythondev
help
Ooooh
2018-01-20T09:05:23.000188
Gwyn
pythondev_help_Gwyn_2018-01-20T09:05:23.000188
1,516,439,123.000188
30,117
pythondev
help
:facepalm:
2018-01-20T09:05:26.000537
Gwyn
pythondev_help_Gwyn_2018-01-20T09:05:26.000537
1,516,439,126.000537
30,118
pythondev
help
okay so I changed the test code from `mock_get.return_value.json.return_value` to `mock_get.return_value.content = info` and now the error is `TypeError: the JSON object must be str, bytes or bytearray, not 'list'`
2018-01-20T09:06:48.001010
Gwyn
pythondev_help_Gwyn_2018-01-20T09:06:48.001010
1,516,439,208.00101
30,119
pythondev
help
This has to be witht he way I set my `info` variable I suppose
2018-01-20T09:07:14.000745
Gwyn
pythondev_help_Gwyn_2018-01-20T09:07:14.000745
1,516,439,234.000745
30,120
pythondev
help
you have two choice. either mock `response.json()` to return `info` as you did and call `response.json()`
2018-01-20T09:08:11.000152
Micki
pythondev_help_Micki_2018-01-20T09:08:11.000152
1,516,439,291.000152
30,121
pythondev
help
or mock `response.content` to return a json encoded string and decode it using `json.loads(response.content)` afterwards
2018-01-20T09:08:41.000121
Micki
pythondev_help_Micki_2018-01-20T09:08:41.000121
1,516,439,321.000121
30,122
pythondev
help
to encode `info` as a json string you can use `json.dumps(info)`
2018-01-20T09:09:07.000190
Micki
pythondev_help_Micki_2018-01-20T09:09:07.000190
1,516,439,347.00019
30,123