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
you can get into overloading and what not
2018-02-19T22:03:40.000057
Kacie
pythondev_help_Kacie_2018-02-19T22:03:40.000057
1,519,077,820.000057
34,924
pythondev
help
but beyond custom stuff
2018-02-19T22:04:05.000202
Kacie
pythondev_help_Kacie_2018-02-19T22:04:05.000202
1,519,077,845.000202
34,925
pythondev
help
as its built right out of the box no
2018-02-19T22:04:11.000154
Kacie
pythondev_help_Kacie_2018-02-19T22:04:11.000154
1,519,077,851.000154
34,926
pythondev
help
a dictionary is just a container
2018-02-19T22:04:26.000148
Kacie
pythondev_help_Kacie_2018-02-19T22:04:26.000148
1,519,077,866.000148
34,927
pythondev
help
a desk/box to keep your stuff in there for later use
2018-02-19T22:04:40.000168
Kacie
pythondev_help_Kacie_2018-02-19T22:04:40.000168
1,519,077,880.000168
34,928
pythondev
help
thanks, this is all so basic i know, so thanks for your patience. i learned OOP on C++ many years ago, and now my most recent OOP is PowerShell which is very loosey goosey
2018-02-19T22:04:50.000008
Coreen
pythondev_help_Coreen_2018-02-19T22:04:50.000008
1,519,077,890.000008
34,929
pythondev
help
python is the way :slightly_smiling_face:
2018-02-19T22:04:59.000140
Kacie
pythondev_help_Kacie_2018-02-19T22:04:59.000140
1,519,077,899.00014
34,930
pythondev
help
its a hashtable
2018-02-19T22:05:04.000176
Kacie
pythondev_help_Kacie_2018-02-19T22:05:04.000176
1,519,077,904.000176
34,931
pythondev
help
powershell hashtable syntax is a little different so i was making some wrong assumptions :slightly_smiling_face: also complicated by some custom implementations of Python basic object types on this particular platform i'm working with
2018-02-19T22:05:50.000007
Coreen
pythondev_help_Coreen_2018-02-19T22:05:50.000007
1,519,077,950.000007
34,932
pythondev
help
<https://docs.python.org/3/tutorial/datastructures.html#dictionaries>
2018-02-19T22:07:12.000012
Kacie
pythondev_help_Kacie_2018-02-19T22:07:12.000012
1,519,078,032.000012
34,933
pythondev
help
whats the most pythonic way to return an object from a list when one of its attributes matches a condition?
2018-02-20T00:39:50.000020
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:39:50.000020
1,519,087,190.00002
34,934
pythondev
help
for instance, i have a list of objects with the attribute `id`, what would be the most pythonic way to find the object where `id` is == something without doing a nested for loop
2018-02-20T00:40:36.000119
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:40:36.000119
1,519,087,236.000119
34,935
pythondev
help
Do you mean something prettier than: ``` for i in collection: if i.id == 'my_id': return i ``` ?
2018-02-20T00:41:39.000217
Sadye
pythondev_help_Sadye_2018-02-20T00:41:39.000217
1,519,087,299.000217
34,936
pythondev
help
yeah
2018-02-20T00:42:36.000165
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:42:36.000165
1,519,087,356.000165
34,937
pythondev
help
especially when i have a list of `id`s that i need to iterate over to find those objects in the list
2018-02-20T00:42:52.000062
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:42:52.000062
1,519,087,372.000062
34,938
pythondev
help
for instance, the way I am trying to avoid, because it feels wrong
2018-02-20T00:44:55.000162
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:44:55.000162
1,519,087,495.000162
34,939
pythondev
help
maybe a cheat list comprehension with `any()`?
2018-02-20T00:46:55.000067
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:46:55.000067
1,519,087,615.000067
34,940
pythondev
help
or something like
2018-02-20T00:49:29.000149
Jacquelyn
pythondev_help_Jacquelyn_2018-02-20T00:49:29.000149
1,519,087,769.000149
34,941
pythondev
help
something like this, yeah
2018-02-20T00:57:17.000079
Sadye
pythondev_help_Sadye_2018-02-20T00:57:17.000079
1,519,088,237.000079
34,942
pythondev
help
So looking for a little help with posting a local image to an api and downloading the optimised image. Here's the code below that works in curl: ```curl -L -F file=@'LockUp.png' -o 'optimized.png' '<https://im2.io/username/full>'```
2018-02-20T07:53:20.000366
Dorie
pythondev_help_Dorie_2018-02-20T07:53:20.000366
1,519,113,200.000366
34,943
pythondev
help
so it takes the image called LockUp.png out of the directory im running bash in, and sending it to the https address, I'm trying to replicate this in python but can't get a 200 status code
2018-02-20T07:54:23.000146
Dorie
pythondev_help_Dorie_2018-02-20T07:54:23.000146
1,519,113,263.000146
34,944
pythondev
help
<@Dorie> you might want to hide your key ?
2018-02-20T07:54:35.000315
Micki
pythondev_help_Micki_2018-02-20T07:54:35.000315
1,519,113,275.000315
34,945
pythondev
help
<@Micki> Thanks :stuck_out_tongue:
2018-02-20T07:55:07.000309
Dorie
pythondev_help_Dorie_2018-02-20T07:55:07.000309
1,519,113,307.000309
34,946
pythondev
help
in python `requests` as a file argument
2018-02-20T07:55:38.000052
Micki
pythondev_help_Micki_2018-02-20T07:55:38.000052
1,519,113,338.000052
34,947
pythondev
help
see <https://stackoverflow.com/questions/22567306/python-requests-file-upload>
2018-02-20T07:55:41.000375
Micki
pythondev_help_Micki_2018-02-20T07:55:41.000375
1,519,113,341.000375
34,948
pythondev
help
```url = '<https://im2.io/username/quality=high/LockUp.png>' files = {'upload_file': open('LockUp.png', 'rb')} r = <http://requests.post|requests.post>(url, files=files)``` So here's the code, but I can't seem to get this to work, do you have any ideas
2018-02-20T08:07:04.000311
Dorie
pythondev_help_Dorie_2018-02-20T08:07:04.000311
1,519,114,024.000311
34,949
pythondev
help
the `quality=high` part looks weird
2018-02-20T08:09:01.000534
Micki
pythondev_help_Micki_2018-02-20T08:09:01.000534
1,519,114,141.000534
34,950
pythondev
help
what status code do you get back ? and with any content?
2018-02-20T08:09:14.000393
Micki
pythondev_help_Micki_2018-02-20T08:09:14.000393
1,519,114,154.000393
34,951
pythondev
help
check this out
2018-02-20T08:09:16.000418
Floy
pythondev_help_Floy_2018-02-20T08:09:16.000418
1,519,114,156.000418
34,952
pythondev
help
<https://curl.trillworks.com/>
2018-02-20T08:09:17.000309
Floy
pythondev_help_Floy_2018-02-20T08:09:17.000309
1,519,114,157.000309
34,953
pythondev
help
```import requests files = { 'file': ('LockUp.png', open('LockUp.png', 'rb')), } response = requests.get('<https://im2.io/username/full>', files=files)```
2018-02-20T08:09:49.000022
Floy
pythondev_help_Floy_2018-02-20T08:09:49.000022
1,519,114,189.000022
34,954
pythondev
help
Status Code 400, as for quality <https://imageoptim.com/api/post?username=vnkhpkrhkl#opt-quality>
2018-02-20T08:10:00.000395
Dorie
pythondev_help_Dorie_2018-02-20T08:10:00.000395
1,519,114,200.000395
34,955
pythondev
help
Ok so if i use ```files = {'upload_file': open('LockUp.png', 'rb')} url = '<https://im2.io/username/full/>' r = <http://requests.post|requests.post>(url, files=files)``` the response header is ```{'Date': 'Tue, 20 Feb 2018 13:29:23 GMT', 'Content-Type': 'image/png', 'Content-Length': '30909', 'Connection': 'keep-alive'...
2018-02-20T08:29:58.000122
Dorie
pythondev_help_Dorie_2018-02-20T08:29:58.000122
1,519,115,398.000122
34,956
pythondev
help
and the .text response is giberish so I guess this is progress, the only thing I'm missing is I need to save the optimised image locally with in the same request?
2018-02-20T08:30:56.000220
Dorie
pythondev_help_Dorie_2018-02-20T08:30:56.000220
1,519,115,456.00022
34,957
pythondev
help
what is `r.status_code`?
2018-02-20T08:31:06.000568
Brande
pythondev_help_Brande_2018-02-20T08:31:06.000568
1,519,115,466.000568
34,958
pythondev
help
200
2018-02-20T08:31:28.000027
Dorie
pythondev_help_Dorie_2018-02-20T08:31:28.000027
1,519,115,488.000027
34,959
pythondev
help
<http://docs.python-requests.org/en/master/user/quickstart/#binary-response-content>
2018-02-20T08:31:48.000075
Floy
pythondev_help_Floy_2018-02-20T08:31:48.000075
1,519,115,508.000075
34,960
pythondev
help
so there’s no data attribute? everything is in json?
2018-02-20T08:32:11.000355
Floy
pythondev_help_Floy_2018-02-20T08:32:11.000355
1,519,115,531.000355
34,961
pythondev
help
Yeah I was about to say it’s kicking back an image, probably in binary, and you just need to convert and save it
2018-02-20T08:32:19.000575
Brande
pythondev_help_Brande_2018-02-20T08:32:19.000575
1,519,115,539.000575
34,962
pythondev
help
```with open('LockUpOptim.png', 'wb') as fd: for chunk in r.iter_content(chunk_size=128): fd.write(chunk)```
2018-02-20T08:35:01.000237
Dorie
pythondev_help_Dorie_2018-02-20T08:35:01.000237
1,519,115,701.000237
34,963
pythondev
help
Added that and got it working, thanks for the help ^_^
2018-02-20T08:35:18.000015
Dorie
pythondev_help_Dorie_2018-02-20T08:35:18.000015
1,519,115,718.000015
34,964
pythondev
help
<https://stackoverflow.com/questions/48889170/change-checkbox-list-based-on-optionmenu-answer-with-tkinter>
2018-02-20T10:27:35.000602
Gwyn
pythondev_help_Gwyn_2018-02-20T10:27:35.000602
1,519,122,455.000602
34,965
pythondev
help
<https://stackoverflow.com/questions/48889170/change-checkbox-list-based-on-optionmenu-answer-with-tkinter>
2018-02-20T10:52:26.000332
Gwyn
pythondev_help_Gwyn_2018-02-20T10:52:26.000332
1,519,123,946.000332
34,966
pythondev
help
Anyone help on the above SO question ? I'm really stuk on it
2018-02-20T11:29:44.000044
Gwyn
pythondev_help_Gwyn_2018-02-20T11:29:44.000044
1,519,126,184.000044
34,967
pythondev
help
if i have the name of a variable stored in a different variable: is there a way to check the value of the variable referenced by the text? E.g., a = True. b = 'a'.
2018-02-20T11:50:55.000007
Coreen
pythondev_help_Coreen_2018-02-20T11:50:55.000007
1,519,127,455.000007
34,968
pythondev
help
honestly, if you’re trying to do that, use a dictionary
2018-02-20T11:55:33.000743
Floy
pythondev_help_Floy_2018-02-20T11:55:33.000743
1,519,127,733.000743
34,969
pythondev
help
you’ll be much happier
2018-02-20T11:55:37.000934
Floy
pythondev_help_Floy_2018-02-20T11:55:37.000934
1,519,127,737.000934
34,970
pythondev
help
<https://stackoverflow.com/questions/9437726/how-to-get-the-value-of-a-variable-given-its-name-in-a-string>
2018-02-20T11:55:51.000139
Gwyn
pythondev_help_Gwyn_2018-02-20T11:55:51.000139
1,519,127,751.000139
34,971
pythondev
help
yeah, but using globals is a major code smell
2018-02-20T11:56:29.000027
Floy
pythondev_help_Floy_2018-02-20T11:56:29.000027
1,519,127,789.000027
34,972
pythondev
help
yeah I know :confused:
2018-02-20T11:56:42.000856
Gwyn
pythondev_help_Gwyn_2018-02-20T11:56:42.000856
1,519,127,802.000856
34,973
pythondev
help
and if this came up in a review, I’d have some pointed questions as to why
2018-02-20T11:56:53.000288
Floy
pythondev_help_Floy_2018-02-20T11:56:53.000288
1,519,127,813.000288
34,974
pythondev
help
dictionary may be possible but would take some refactoring. for various reasons, i need to store some logic externally. one approach is to automatically generate the code for the logic in the application, another is to evaluate the externally stored code in my application
2018-02-20T12:00:50.000906
Coreen
pythondev_help_Coreen_2018-02-20T12:00:50.000906
1,519,128,050.000906
34,975
pythondev
help
simple if/then statements. if variable A is (value), set variable B to true
2018-02-20T12:01:33.000706
Coreen
pythondev_help_Coreen_2018-02-20T12:01:33.000706
1,519,128,093.000706
34,976
pythondev
help
using `locals()['foo']` is somewhat less icky than `globals()`, provided the variable of interest is in local scope
2018-02-20T12:07:06.000065
Fumiko
pythondev_help_Fumiko_2018-02-20T12:07:06.000065
1,519,128,426.000065
34,977
pythondev
help
`getattr` is what I'd normally choose to do this, but it's slightly messy to do it if you're just using local variables
2018-02-20T12:10:48.000755
Fumiko
pythondev_help_Fumiko_2018-02-20T12:10:48.000755
1,519,128,648.000755
34,978
pythondev
help
<@Fumiko> thanks, using locals()[ should work for me
2018-02-20T12:18:59.000116
Coreen
pythondev_help_Coreen_2018-02-20T12:18:59.000116
1,519,129,139.000116
34,979
pythondev
help
one problem with using locals is that some of the variables are objects. is there a reliable way around that? using eval() works, but i see the good arguments against doing so
2018-02-20T13:14:36.000601
Coreen
pythondev_help_Coreen_2018-02-20T13:14:36.000601
1,519,132,476.000601
34,980
pythondev
help
if the variables are objects, then use getattr. ```class A: def __init__(self): self.foo = 'yay' ob = A() getattr(ob, 'foo') &gt;&gt;&gt; 'yay'```
2018-02-20T13:33:15.000550
Fumiko
pythondev_help_Fumiko_2018-02-20T13:33:15.000550
1,519,133,595.00055
34,981
pythondev
help
since my object name is unknown, i would need to do getattr(locals()['object_name'], 'foo'), correct? and i guess have two conditions: one where the variable name contains a period, and one when it does not?
2018-02-20T13:36:37.000379
Coreen
pythondev_help_Coreen_2018-02-20T13:36:37.000379
1,519,133,797.000379
34,982
pythondev
help
`getattr` also takes a default so you could cheat with `getattr(ob, 'foo', getitem(ob, foo))` for cases where you have a list/dict/etc
2018-02-20T13:36:39.000264
Garrett
pythondev_help_Garrett_2018-02-20T13:36:39.000264
1,519,133,799.000264
34,983
pythondev
help
import json foodyo=json.loads(open('foodyo_output.json').read()) def recurr(dic,n): if dic['selected']==1: print("-"*n,"&gt;",dic['name']) n=n+5 l=dic['children'] for v in l: recurr(v,n) for i in foodyo['body']['Recommendations']: name=i['RestaurantName'] ...
2018-02-20T13:40:47.000674
Russel
pythondev_help_Russel_2018-02-20T13:40:47.000674
1,519,134,047.000674
34,984
pythondev
help
Hello all This code gives me an extra space after printing - n times on line 5
2018-02-20T13:41:17.000141
Russel
pythondev_help_Russel_2018-02-20T13:41:17.000141
1,519,134,077.000141
34,985
pythondev
help
Any input on how to resolve this?
2018-02-20T13:41:31.000813
Russel
pythondev_help_Russel_2018-02-20T13:41:31.000813
1,519,134,091.000813
34,986
pythondev
help
So you're getting `------ &gt; Nigam` or similar?
2018-02-20T13:42:49.000423
Garrett
pythondev_help_Garrett_2018-02-20T13:42:49.000423
1,519,134,169.000423
34,987
pythondev
help
Yaa
2018-02-20T13:42:54.000623
Russel
pythondev_help_Russel_2018-02-20T13:42:54.000623
1,519,134,174.000623
34,988
pythondev
help
I think you'd be looking for the `sep` argument
2018-02-20T13:43:48.000476
Leanora
pythondev_help_Leanora_2018-02-20T13:43:48.000476
1,519,134,228.000476
34,989
pythondev
help
<https://docs.python.org/3/library/functions.html#print>
2018-02-20T13:43:50.000265
Leanora
pythondev_help_Leanora_2018-02-20T13:43:50.000265
1,519,134,230.000265
34,990
pythondev
help
Yeah, `sep` might help. Or use string formatting instead of printing multiple items.
2018-02-20T13:44:36.000312
Garrett
pythondev_help_Garrett_2018-02-20T13:44:36.000312
1,519,134,276.000312
34,991
pythondev
help
That would be the more "correct" way to do it
2018-02-20T13:45:34.000050
Leanora
pythondev_help_Leanora_2018-02-20T13:45:34.000050
1,519,134,334.00005
34,992
pythondev
help
Sep actually did the job
2018-02-20T13:47:11.000725
Russel
pythondev_help_Russel_2018-02-20T13:47:11.000725
1,519,134,431.000725
34,993
pythondev
help
i have a thing that i’m trying to make python 2 and 3 compat. i’ve got a folder and in python 2 i can do from folder import function, in 3 ihave to say ‘import folder’
2018-02-20T13:47:39.000347
Tobias
pythondev_help_Tobias_2018-02-20T13:47:39.000347
1,519,134,459.000347
34,994
pythondev
help
For sure they both work, using string formatting just gives you more flexibility
2018-02-20T13:47:47.000034
Leanora
pythondev_help_Leanora_2018-02-20T13:47:47.000034
1,519,134,467.000034
34,995
pythondev
help
Thanks alot <@Leanora> <@Garrett>
2018-02-20T13:48:11.000599
Russel
pythondev_help_Russel_2018-02-20T13:48:11.000599
1,519,134,491.000599
34,996
pythondev
help
Ooh okay cool will experiment with that too..
2018-02-20T13:48:31.000745
Russel
pythondev_help_Russel_2018-02-20T13:48:31.000745
1,519,134,511.000745
34,997
pythondev
help
Here's some formatting documentation: <https://docs.python.org/3.1/library/string.html#format-examples>
2018-02-20T13:48:44.000339
Leanora
pythondev_help_Leanora_2018-02-20T13:48:44.000339
1,519,134,524.000339
34,998
pythondev
help
<@Tobias> <http://python-future.org/compatible_idioms.html#imports-relative-to-a-package>
2018-02-20T14:03:19.000430
Leanora
pythondev_help_Leanora_2018-02-20T14:03:19.000430
1,519,135,399.00043
34,999
pythondev
help
thanks!
2018-02-20T14:03:29.000783
Tobias
pythondev_help_Tobias_2018-02-20T14:03:29.000783
1,519,135,409.000783
35,000
pythondev
help
looks like i will want to use from __future__ by default for imports, yes?
2018-02-20T14:23:37.000792
Tobias
pythondev_help_Tobias_2018-02-20T14:23:37.000792
1,519,136,617.000792
35,001
pythondev
help
Anyone know how to use pandas well?.... I am trying to import two CSVs and use Pandas to give me the differences between them.
2018-02-20T16:20:34.000097
Melanie
pythondev_help_Melanie_2018-02-20T16:20:34.000097
1,519,143,634.000097
35,002
pythondev
help
Hi, actually I'm learning about client-server
2018-02-20T17:10:55.000051
Mose
pythondev_help_Mose_2018-02-20T17:10:55.000051
1,519,146,655.000051
35,003
pythondev
help
programming, as start point I'm trying to do a basic Voice Chat using pyzmq with the req-rep pattern.
2018-02-20T17:11:40.000278
Mose
pythondev_help_Mose_2018-02-20T17:11:40.000278
1,519,146,700.000278
35,004
pythondev
help
Do you know sources to read sample code of this pattern with a server with multiple clients
2018-02-20T17:12:10.000349
Mose
pythondev_help_Mose_2018-02-20T17:12:10.000349
1,519,146,730.000349
35,005
pythondev
help
I've been searching but every project is using the push-pull patttern
2018-02-20T17:13:23.000610
Mose
pythondev_help_Mose_2018-02-20T17:13:23.000610
1,519,146,803.00061
35,006
pythondev
help
Anyone know how to check the python version already inside a virtualenv?
2018-02-20T17:15:15.000512
Porsha
pythondev_help_Porsha_2018-02-20T17:15:15.000512
1,519,146,915.000512
35,007
pythondev
help
if you open a python interpretter
2018-02-20T17:15:57.000515
Mose
pythondev_help_Mose_2018-02-20T17:15:57.000515
1,519,146,957.000515
35,008
pythondev
help
it should say the python version
2018-02-20T17:16:06.000520
Mose
pythondev_help_Mose_2018-02-20T17:16:06.000520
1,519,146,966.00052
35,009
pythondev
help
something like
2018-02-20T17:16:45.000465
Mose
pythondev_help_Mose_2018-02-20T17:16:45.000465
1,519,147,005.000465
35,010
pythondev
help
If you know the virtualenv path, you can go to the bin folder
2018-02-20T17:17:28.000046
Floy
pythondev_help_Floy_2018-02-20T17:17:28.000046
1,519,147,048.000046
35,011
pythondev
help
user@host$python Python 3.6.4 (default, Jan 5 2018, 02:13:53) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information
2018-02-20T17:17:42.000143
Mose
pythondev_help_Mose_2018-02-20T17:17:42.000143
1,519,147,062.000143
35,012
pythondev
help
it's the same process in the virtualenv
2018-02-20T17:17:57.000283
Mose
pythondev_help_Mose_2018-02-20T17:17:57.000283
1,519,147,077.000283
35,013
pythondev
help
<@Porsha> you can also create a virtualenv with a specific version
2018-02-20T17:18:30.000150
Mose
pythondev_help_Mose_2018-02-20T17:18:30.000150
1,519,147,110.00015
35,014
pythondev
help
using `virtualenv --python=python3.6 Venv `
2018-02-20T17:18:37.000605
Mose
pythondev_help_Mose_2018-02-20T17:18:37.000605
1,519,147,117.000605
35,015
pythondev
help
YEah I'm aware of that
2018-02-20T17:18:47.000307
Porsha
pythondev_help_Porsha_2018-02-20T17:18:47.000307
1,519,147,127.000307
35,016
pythondev
help
running `python` in the terminal will launch your default python
2018-02-20T17:19:46.000220
Porsha
pythondev_help_Porsha_2018-02-20T17:19:46.000220
1,519,147,186.00022
35,017
pythondev
help
so check your bin folder as <@Floy> said
2018-02-20T17:19:50.000195
Mose
pythondev_help_Mose_2018-02-20T17:19:50.000195
1,519,147,190.000195
35,018
pythondev
help
`ls /bin`
2018-02-20T17:20:00.000283
Mose
pythondev_help_Mose_2018-02-20T17:20:00.000283
1,519,147,200.000283
35,019
pythondev
help
you should get something like :
2018-02-20T17:20:14.000163
Mose
pythondev_help_Mose_2018-02-20T17:20:14.000163
1,519,147,214.000163
35,020
pythondev
help
what am I checking for?
2018-02-20T17:20:19.000619
Porsha
pythondev_help_Porsha_2018-02-20T17:20:19.000619
1,519,147,219.000619
35,021
pythondev
help
`activate activate.csh activate.fish activate_this.py easy_install easy_install-3.6 flask pip pip3 pip3.6 python python3 python3.6 python-config wheel`
2018-02-20T17:20:21.000418
Mose
pythondev_help_Mose_2018-02-20T17:20:21.000418
1,519,147,221.000418
35,022
pythondev
help
as you see there is a symbolic link to you python interpreter
2018-02-20T17:20:52.000428
Mose
pythondev_help_Mose_2018-02-20T17:20:52.000428
1,519,147,252.000428
35,023