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
“Curated by Rahul Chaudhary — every Thursday”
2017-07-25T18:26:59.288531
Duane
pythondev_help_Duane_2017-07-25T18:26:59.288531
1,501,007,219.288531
87,303
pythondev
help
Can try
2017-07-25T18:30:39.362650
Elane
pythondev_help_Elane_2017-07-25T18:30:39.362650
1,501,007,439.36265
87,304
pythondev
help
i’m trying to actually write good tests for once in my life, and I have this argparse piece in my code, when i run `pytest -v` it passes the `-v` flag to argparse even though i’m calling `parse_args(['-f'])`
2017-07-25T20:18:24.148772
Marlon
pythondev_help_Marlon_2017-07-25T20:18:24.148772
1,501,013,904.148772
87,305
pythondev
help
Maybe just mock out the arg parse calls?
2017-07-25T20:47:34.529478
Signe
pythondev_help_Signe_2017-07-25T20:47:34.529478
1,501,015,654.529478
87,306
pythondev
help
Hi folks, i’m looking for a way to add requirement.txt better. If I install a new python package X, it have some other dependencies like Y,Z. If I add only X into requirement.txt, then I can get auto download Y,Z when installing my app in a new env. Or I use `pip freeze` to dump `X,Y,Z` into requirement.txt. Which way I should follow? I feel like the former make my txt look cleaner and bring the same value, is that right?
2017-07-26T03:48:33.577106
Hermina
pythondev_help_Hermina_2017-07-26T03:48:33.577106
1,501,040,913.577106
87,307
pythondev
help
<@Hermina> In my opinion it's better to add only depends that is needed by your project and leave pip decide what else should be installed.
2017-07-26T03:53:43.677673
Fleta
pythondev_help_Fleta_2017-07-26T03:53:43.677673
1,501,041,223.677673
87,308
pythondev
help
so you mean we should avoid pip freeze?
2017-07-26T03:54:29.693151
Hermina
pythondev_help_Hermina_2017-07-26T03:54:29.693151
1,501,041,269.693151
87,309
pythondev
help
I mean what I say)
2017-07-26T03:59:14.788559
Fleta
pythondev_help_Fleta_2017-07-26T03:59:14.788559
1,501,041,554.788559
87,310
pythondev
help
haha alright
2017-07-26T03:59:30.794032
Hermina
pythondev_help_Hermina_2017-07-26T03:59:30.794032
1,501,041,570.794032
87,311
pythondev
help
what kind of project are we talking about here? if it’s a library, you’ll want to avoid being so specific. if it’s the end product, you’ll definitely want to be freezing your dependencies to exact versions
2017-07-26T04:05:05.916062
Junita
pythondev_help_Junita_2017-07-26T04:05:05.916062
1,501,041,905.916062
87,312
pythondev
help
in both cases i would say to freeze all dependencies with `pip freeze` anyways and then put `pip list --outdated` as part of your continuous integration process to let you know about newer versions
2017-07-26T04:10:29.030438
Marcie
pythondev_help_Marcie_2017-07-26T04:10:29.030438
1,501,042,229.030438
87,313
pythondev
help
I think it’s problematic for a library to specifically require a version of its dependencies, since unlike say npm Python dependencies are global
2017-07-26T04:14:23.115494
Junita
pythondev_help_Junita_2017-07-26T04:14:23.115494
1,501,042,463.115494
87,314
pythondev
help
I’m pretty sure if I have two dependencies, A and B, which both depend on C, and they specify different versions of C, there is going to be a problem, right?
2017-07-26T04:14:51.125833
Junita
pythondev_help_Junita_2017-07-26T04:14:51.125833
1,501,042,491.125833
87,315
pythondev
help
yeah don't do that
2017-07-26T04:15:17.135032
Ciera
pythondev_help_Ciera_2017-07-26T04:15:17.135032
1,501,042,517.135032
87,316
pythondev
help
Also, there are some cool services like PyUp which can scan your dependencies and open a pull request automatically when there are updates
2017-07-26T04:16:04.151957
Junita
pythondev_help_Junita_2017-07-26T04:16:04.151957
1,501,042,564.151957
87,317
pythondev
help
Has any one here once have tried to implement a proxy server using twisted ?
2017-07-26T07:24:24.149456
Hyman
pythondev_help_Hyman_2017-07-26T07:24:24.149456
1,501,053,864.149456
87,318
pythondev
help
Hi , I'm looking for way to profile a python module loaded from a pickle file with cProfile ?
2017-07-26T07:31:29.274494
January
pythondev_help_January_2017-07-26T07:31:29.274494
1,501,054,289.274494
87,319
pythondev
help
Is there another way to create args dynamically for a function?. I'm currently doing: ``` arg = {a_variable: 'something'} func(**arg) ```
2017-07-26T08:12:28.062100
Mariano
pythondev_help_Mariano_2017-07-26T08:12:28.062100
1,501,056,748.0621
87,320
pythondev
help
well there’s `*args`, which is based on the order (as opposed to `**kwargs`, using keywords as you did)
2017-07-26T08:16:08.141766
Junita
pythondev_help_Junita_2017-07-26T08:16:08.141766
1,501,056,968.141766
87,321
pythondev
help
what is it about `*args, **kwargs` that’s not working for you?
2017-07-26T08:16:41.153918
Junita
pythondev_help_Junita_2017-07-26T08:16:41.153918
1,501,057,001.153918
87,322
pythondev
help
i think kwargs is the way to go, same as you're doing
2017-07-26T08:16:50.157251
Ocie
pythondev_help_Ocie_2017-07-26T08:16:50.157251
1,501,057,010.157251
87,323
pythondev
help
It works for me. I was just thinking that there might be a better way to do it.
2017-07-26T09:08:35.462525
Mariano
pythondev_help_Mariano_2017-07-26T09:08:35.462525
1,501,060,115.462525
87,324
pythondev
help
Actually the args needs to have keywords <@Junita>
2017-07-26T09:08:55.472402
Mariano
pythondev_help_Mariano_2017-07-26T09:08:55.472402
1,501,060,135.472402
87,325
pythondev
help
cool, just pointing out there’s also *args which handles positional arguments
2017-07-26T09:09:39.493893
Junita
pythondev_help_Junita_2017-07-26T09:09:39.493893
1,501,060,179.493893
87,326
pythondev
help
i think that's what i'm going to have to do. i get this gut feeling that i'm doing testing wrong. my tests always are more code and logic than the actual fucntions
2017-07-26T09:25:30.049240
Marlon
pythondev_help_Marlon_2017-07-26T09:25:30.049240
1,501,061,130.04924
87,327
pythondev
help
Getting an odd error in a dictionary'
2017-07-26T10:05:30.477076
Myong
pythondev_help_Myong_2017-07-26T10:05:30.477076
1,501,063,530.477076
87,328
pythondev
help
I basically have a dictionary with 4 main keys, and their values lead to other keys where in turn their values are integers
2017-07-26T10:06:08.501530
Myong
pythondev_help_Myong_2017-07-26T10:06:08.501530
1,501,063,568.50153
87,329
pythondev
help
However when attempting to do something like `{'key': self.val1 + self.val2}` where `val1` and `val2` are both integers, I get TypeError that they must be str, not int.
2017-07-26T10:07:06.537769
Myong
pythondev_help_Myong_2017-07-26T10:07:06.537769
1,501,063,626.537769
87,330
pythondev
help
So can I not perform addition when setting values in a dictionary?
2017-07-26T10:07:39.557689
Myong
pythondev_help_Myong_2017-07-26T10:07:39.557689
1,501,063,659.557689
87,331
pythondev
help
dict keys are strings
2017-07-26T10:07:51.565767
Meg
pythondev_help_Meg_2017-07-26T10:07:51.565767
1,501,063,671.565767
87,332
pythondev
help
so I suspect its your key identification that's ht eissue
2017-07-26T10:08:11.578185
Meg
pythondev_help_Meg_2017-07-26T10:08:11.578185
1,501,063,691.578185
87,333
pythondev
help
Most likely you're just wrong about what val1 and val2 are. Probably they are different types
2017-07-26T10:08:26.587834
Gabriele
pythondev_help_Gabriele_2017-07-26T10:08:26.587834
1,501,063,706.587834
87,334
pythondev
help
Which is one reason why using a dict instead of something typesafe is a bad idea
2017-07-26T10:08:42.597671
Gabriele
pythondev_help_Gabriele_2017-07-26T10:08:42.597671
1,501,063,722.597671
87,335
pythondev
help
what if you do `{'key': int(val1) + int(val2)}`?
2017-07-26T10:09:02.611205
Meg
pythondev_help_Meg_2017-07-26T10:09:02.611205
1,501,063,742.611205
87,336
pythondev
help
yeah I'll try that real quick
2017-07-26T10:09:10.615928
Myong
pythondev_help_Myong_2017-07-26T10:09:10.615928
1,501,063,750.615928
87,337
pythondev
help
Hmm I guess I'm attempting to index a string with a dict key, so something is going on in the for loop to go through the dict. let me check
2017-07-26T10:11:02.686808
Myong
pythondev_help_Myong_2017-07-26T10:11:02.686808
1,501,063,862.686808
87,338
pythondev
help
Hi there, I'm trying to solve Project Euler (Moving from WebDev to Math, like that more)... In problem 10, I have to find the sum of all primes from 2 -&gt; 2 Mil... So I wrote this method: ```primes = [2] def isPrime(n): if(n == 2): return True for x in primes: if(n % x == 0): return False primes.append(n) return True ``` Question is "is this method correct?"
2017-07-26T10:20:15.041158
Lana
pythondev_help_Lana_2017-07-26T10:20:15.041158
1,501,064,415.041158
87,339
pythondev
help
no
2017-07-26T10:25:02.230662
Gabriele
pythondev_help_Gabriele_2017-07-26T10:25:02.230662
1,501,064,702.230662
87,340
pythondev
help
Consider what happens if you call `isPrime(8)`
2017-07-26T10:25:27.247215
Gabriele
pythondev_help_Gabriele_2017-07-26T10:25:27.247215
1,501,064,727.247215
87,341
pythondev
help
(Also, stylistically, you don't need the parentheses around the if statements - it's not Java[Script] :)
2017-07-26T10:25:58.267767
Gabriele
pythondev_help_Gabriele_2017-07-26T10:25:58.267767
1,501,064,758.267767
87,342
pythondev
help
<@Meg> Dict keys are strings? Are other data types converted to strings when used as the key then? I've used several non-string objects as keys.
2017-07-26T10:42:50.943165
Meghan
pythondev_help_Meghan_2017-07-26T10:42:50.943165
1,501,065,770.943165
87,343
pythondev
help
well, technically keys are hashes
2017-07-26T10:48:00.152745
Meg
pythondev_help_Meg_2017-07-26T10:48:00.152745
1,501,066,080.152745
87,344
pythondev
help
string hash, I believe
2017-07-26T10:49:00.193614
Meg
pythondev_help_Meg_2017-07-26T10:49:00.193614
1,501,066,140.193614
87,345
pythondev
help
but I was wrong
2017-07-26T10:49:10.200196
Meg
pythondev_help_Meg_2017-07-26T10:49:10.200196
1,501,066,150.200196
87,346
pythondev
help
to be used as a dictionary key, &gt;To be used as a dictionary key, an object must support the hash function (e.g. through __hash__), equality comparison (e.g. through __eq__ or __cmp__), and must satisfy the correctness condition above.
2017-07-26T10:49:36.217999
Meg
pythondev_help_Meg_2017-07-26T10:49:36.217999
1,501,066,176.217999
87,347
pythondev
help
<https://wiki.python.org/moin/DictionaryKeys>
2017-07-26T10:49:42.221668
Meg
pythondev_help_Meg_2017-07-26T10:49:42.221668
1,501,066,182.221668
87,348
pythondev
help
<@January> hi
2017-07-26T10:52:48.346734
Suellen
pythondev_help_Suellen_2017-07-26T10:52:48.346734
1,501,066,368.346734
87,349
pythondev
help
shouldn't it work even if you profile the whole application that loads a module?
2017-07-26T10:53:09.360949
Suellen
pythondev_help_Suellen_2017-07-26T10:53:09.360949
1,501,066,389.360949
87,350
pythondev
help
i.e. that module will be profiled too as a part of a bigger profiling...
2017-07-26T10:53:19.367374
Suellen
pythondev_help_Suellen_2017-07-26T10:53:19.367374
1,501,066,399.367374
87,351
pythondev
help
OK thanks. and what about sub processing ? will it profile those as well ?
2017-07-26T10:54:29.415847
January
pythondev_help_January_2017-07-26T10:54:29.415847
1,501,066,469.415847
87,352
pythondev
help
In other words, you can't use mutable things as dictionary keys.
2017-07-26T10:55:06.440442
Ruben
pythondev_help_Ruben_2017-07-26T10:55:06.440442
1,501,066,506.440442
87,353
pythondev
help
Strings like "Helo" and tuples like (1,2,3) are immutable. But a list is mutable, so you can't use a list as a key.
2017-07-26T10:55:34.459443
Ruben
pythondev_help_Ruben_2017-07-26T10:55:34.459443
1,501,066,534.459443
87,354
pythondev
help
I'd guess that no
2017-07-26T10:55:39.462680
Suellen
pythondev_help_Suellen_2017-07-26T10:55:39.462680
1,501,066,539.46268
87,355
pythondev
help
bingo
2017-07-26T10:56:14.486221
Meg
pythondev_help_Meg_2017-07-26T10:56:14.486221
1,501,066,574.486221
87,356
pythondev
help
I mean, depending on what you mean. Time spent on waiting for a subprocess to finish is going to end up on a cProfile output
2017-07-26T10:56:25.494610
Suellen
pythondev_help_Suellen_2017-07-26T10:56:25.494610
1,501,066,585.49461
87,357
pythondev
help
or basically any data structure other than tuples
2017-07-26T10:56:27.495697
Meg
pythondev_help_Meg_2017-07-26T10:56:27.495697
1,501,066,587.495697
87,358
pythondev
help
But no detailed insight, because it's an entirely separate program.
2017-07-26T10:56:49.511431
Suellen
pythondev_help_Suellen_2017-07-26T10:56:49.511431
1,501,066,609.511431
87,359
pythondev
help
and fronzensets
2017-07-26T10:57:22.534174
Suellen
pythondev_help_Suellen_2017-07-26T10:57:22.534174
1,501,066,642.534174
87,360
pythondev
help
yes as I thought , Thanks a lot
2017-07-26T11:24:50.656984
January
pythondev_help_January_2017-07-26T11:24:50.656984
1,501,068,290.656984
87,361
pythondev
help
What exactly is a hash? I hear the term all the time but I'm not clear what it means.
2017-07-26T12:54:49.087767
Staci
pythondev_help_Staci_2017-07-26T12:54:49.087767
1,501,073,689.087767
87,362
pythondev
help
hash = dictionary in some contexts
2017-07-26T12:55:27.110449
Duane
pythondev_help_Duane_2017-07-26T12:55:27.110449
1,501,073,727.110449
87,363
pythondev
help
no way
2017-07-26T12:56:15.139307
Suellen
pythondev_help_Suellen_2017-07-26T12:56:15.139307
1,501,073,775.139307
87,364
pythondev
help
nope
2017-07-26T12:58:44.228759
Meg
pythondev_help_Meg_2017-07-26T12:58:44.228759
1,501,073,924.228759
87,365
pythondev
help
<https://en.wikipedia.org/wiki/Hash_function>
2017-07-26T12:59:02.239917
Meg
pythondev_help_Meg_2017-07-26T12:59:02.239917
1,501,073,942.239917
87,366
pythondev
help
there are some good pycon talks on dicts
2017-07-26T12:59:45.266487
Johana
pythondev_help_Johana_2017-07-26T12:59:45.266487
1,501,073,985.266487
87,367
pythondev
help
<https://www.youtube.com/watch?v=66P5FMkWoVU>
2017-07-26T13:07:44.553640
Marilyn
pythondev_help_Marilyn_2017-07-26T13:07:44.553640
1,501,074,464.55364
87,368
pythondev
help
That one has some good info on how dicts use hashes to store information
2017-07-26T13:08:16.572391
Marilyn
pythondev_help_Marilyn_2017-07-26T13:08:16.572391
1,501,074,496.572391
87,369
pythondev
help
<@Bruno> loves the dict.
2017-07-26T13:10:07.636319
Johana
pythondev_help_Johana_2017-07-26T13:10:07.636319
1,501,074,607.636319
87,370
pythondev
help
~Hi ppl, I came to barg.. ask for help _obviously_ :slightly_smiling_face:, about `wand` especially image.crop() method, I have my nose right in the docs of this method, re-reading at least 20 times, but I can't get this, the description says `img.crop(10, 20, 50, 100)` where `Its parameters are left, top, right, bottom in order.` but what the.. that means ? top what ? it _should_ be rectangle... so I assume it can't be size of sides, obviously it should be points (x1,y1) and (x2,y2), but it won't accept zero for top, left~ _During writing my question I found it could be because wand counts from one and not zero._
2017-07-26T13:10:32.651447
Pedro
pythondev_help_Pedro_2017-07-26T13:10:32.651447
1,501,074,632.651447
87,371
pythondev
help
Hence off by one errors! That's really frustrating
2017-07-26T13:11:00.667585
Beula
pythondev_help_Beula_2017-07-26T13:11:00.667585
1,501,074,660.667585
87,372
pythondev
help
What is the best way to package a python application for easy distribution to someone who may not have python
2017-07-26T13:17:02.878422
Myong
pythondev_help_Myong_2017-07-26T13:17:02.878422
1,501,075,022.878422
87,373
pythondev
help
pyinstaller if you are on the same OS
2017-07-26T13:19:23.961031
Beula
pythondev_help_Beula_2017-07-26T13:19:23.961031
1,501,075,163.961031
87,374
pythondev
help
<http://sedimental.org/the_packaging_gradient.html#bringing_your_own_python>
2017-07-26T13:19:36.968905
Marilyn
pythondev_help_Marilyn_2017-07-26T13:19:36.968905
1,501,075,176.968905
87,375
pythondev
help
You can create a binary, effectively, that bundles in an interpreter and the dependencies
2017-07-26T13:19:37.969743
Beula
pythondev_help_Beula_2017-07-26T13:19:37.969743
1,501,075,177.969743
87,376
pythondev
help
I have some settings that the user can change based on their needs, should all those settings be put as `input()` to prompt a user?
2017-07-26T13:21:17.028924
Myong
pythondev_help_Myong_2017-07-26T13:21:17.028924
1,501,075,277.028924
87,377
pythondev
help
You could have your application read a config
2017-07-26T13:22:11.060843
Marilyn
pythondev_help_Marilyn_2017-07-26T13:22:11.060843
1,501,075,331.060843
87,378
pythondev
help
I think it would depend on how many settings there are to change
2017-07-26T13:22:26.069743
Marilyn
pythondev_help_Marilyn_2017-07-26T13:22:26.069743
1,501,075,346.069743
87,379
pythondev
help
Something like this <https://docs.python.org/3.6/library/configparser.html>
2017-07-26T13:25:11.165027
Marilyn
pythondev_help_Marilyn_2017-07-26T13:25:11.165027
1,501,075,511.165027
87,380
pythondev
help
does anybody have experience with AWS file uploads? my app has trello integration and when a file is uploaded, a link is written to the trello card. the problem is that these links expire, so is there a way to replace that link with something that will be re-provisioned once clicked?
2017-07-26T13:25:35.179739
Magdalena
pythondev_help_Magdalena_2017-07-26T13:25:35.179739
1,501,075,535.179739
87,381
pythondev
help
<@Myong> If you can I'd usually generate a default on first start if it doesn't exist, then allow that to be customized
2017-07-26T13:36:58.588560
Beula
pythondev_help_Beula_2017-07-26T13:36:58.588560
1,501,076,218.58856
87,382
pythondev
help
something like `self.whatever = something if something else input('blah')`
2017-07-26T13:38:26.640456
Myong
pythondev_help_Myong_2017-07-26T13:38:26.640456
1,501,076,306.640456
87,383
pythondev
help
Depends on if your people are technical or not, but yeah you could do that if the config doesn't exist
2017-07-26T13:42:10.773558
Beula
pythondev_help_Beula_2017-07-26T13:42:10.773558
1,501,076,530.773558
87,384
pythondev
help
So the `.exe` isn't interactive unless I use a gui like `tkinter` I believe
2017-07-26T13:43:48.831337
Myong
pythondev_help_Myong_2017-07-26T13:43:48.831337
1,501,076,628.831337
87,385
pythondev
help
does anyone know of a simple maze generation library?
2017-07-26T13:58:21.374096
Thelma
pythondev_help_Thelma_2017-07-26T13:58:21.374096
1,501,077,501.374096
87,386
pythondev
help
I can build one but I want to use prebuild so it is easier and faster
2017-07-26T13:59:10.404960
Thelma
pythondev_help_Thelma_2017-07-26T13:59:10.404960
1,501,077,550.40496
87,387
pythondev
help
<https://github.com/boppreh/maze>
2017-07-26T14:04:23.603757
Meg
pythondev_help_Meg_2017-07-26T14:04:23.603757
1,501,077,863.603757
87,388
pythondev
help
yeah saw that might use it thanks <@Meg>
2017-07-26T14:10:09.812840
Thelma
pythondev_help_Thelma_2017-07-26T14:10:09.812840
1,501,078,209.81284
87,389
pythondev
help
whoah there
2017-07-26T14:24:12.313030
Bruno
pythondev_help_Bruno_2017-07-26T14:24:12.313030
1,501,079,052.31303
87,390
pythondev
help
Does anyone use `configparser`? Pretty sure I've asked this before, but just wondering
2017-07-26T14:30:15.533669
Myong
pythondev_help_Myong_2017-07-26T14:30:15.533669
1,501,079,415.533669
87,391
pythondev
help
I usually use `yaml` for configuration
2017-07-26T14:31:27.579033
Ciera
pythondev_help_Ciera_2017-07-26T14:31:27.579033
1,501,079,487.579033
87,392
pythondev
help
i’ve used it before. it’s pretty nice. i also like yaml.
2017-07-26T14:34:11.677044
Johana
pythondev_help_Johana_2017-07-26T14:34:11.677044
1,501,079,651.677044
87,393
pythondev
help
I'm just trying to figure out if it's best practice to grab data for each variable with the configparser module individually like when needed, or setup something like `glob.py` and set them all at once in there
2017-07-26T14:34:19.681397
Myong
pythondev_help_Myong_2017-07-26T14:34:19.681397
1,501,079,659.681397
87,394
pythondev
help
configparser is ini files so if your used to microsoft world its less parity.
2017-07-26T14:34:44.696370
Johana
pythondev_help_Johana_2017-07-26T14:34:44.696370
1,501,079,684.69637
87,395
pythondev
help
Because it seems that when you're compiling if the object that holds all the config stuff doesn't exist and you attempt to import them into some sort of globals file you get errors
2017-07-26T14:36:36.762137
Myong
pythondev_help_Myong_2017-07-26T14:36:36.762137
1,501,079,796.762137
87,396
pythondev
help
so I'm trying to see what most do
2017-07-26T14:36:43.765695
Myong
pythondev_help_Myong_2017-07-26T14:36:43.765695
1,501,079,803.765695
87,397
pythondev
help
Like should I grab the values and set them as attributes as part of classes/objects
2017-07-26T14:37:14.784228
Myong
pythondev_help_Myong_2017-07-26T14:37:14.784228
1,501,079,834.784228
87,398
pythondev
help
<@Johana> <@Ciera> are you just using `pyyaml`?
2017-07-26T14:43:23.002051
Myong
pythondev_help_Myong_2017-07-26T14:43:23.002051
1,501,080,203.002051
87,399
pythondev
help
yeah.
2017-07-26T14:43:55.020514
Ciera
pythondev_help_Ciera_2017-07-26T14:43:55.020514
1,501,080,235.020514
87,400
pythondev
help
so I can essentially just load in the yaml, store it in a settings variable and import the settings variable everywhere
2017-07-26T14:44:23.037041
Myong
pythondev_help_Myong_2017-07-26T14:44:23.037041
1,501,080,263.037041
87,401
pythondev
help
exactly. You might want to perform some check on it or put some default value but yeah that's the idea
2017-07-26T14:46:12.101212
Ciera
pythondev_help_Ciera_2017-07-26T14:46:12.101212
1,501,080,372.101212
87,402