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
But yeah, don’t do that - use `None`, and if a value wasn’t given, set it in the function.
2018-03-09T06:05:50.000109
Zack
pythondev_help_Zack_2018-03-09T06:05:50.000109
1,520,575,550.000109
38,124
pythondev
help
Thank you <@Zack>
2018-03-09T06:06:14.000142
Gia
pythondev_help_Gia_2018-03-09T06:06:14.000142
1,520,575,574.000142
38,125
pythondev
help
np. and just so I’m clear - it’s fine to use lteral values like an integer or float as default arguments. It’s mutable values, and references to other arguments that you need to avoid
2018-03-09T06:07:28.000202
Zack
pythondev_help_Zack_2018-03-09T06:07:28.000202
1,520,575,648.000202
38,126
pythondev
help
+1 to <@Zack>. Another example for why you want to avoid mutable arguments is this: ``` def foo(l=[]): l.append('a') return l ``` Try running `foo()` several times and see if the result is what you expect!
2018-03-09T06:09:37.000325
Dierdre
pythondev_help_Dierdre_2018-03-09T06:09:37.000325
1,520,575,777.000325
38,127
pythondev
help
Oh I get it now!
2018-03-09T06:09:59.000148
Gia
pythondev_help_Gia_2018-03-09T06:09:59.000148
1,520,575,799.000148
38,128
pythondev
help
cos lists and dicts are mutable!
2018-03-09T06:10:04.000346
Gia
pythondev_help_Gia_2018-03-09T06:10:04.000346
1,520,575,804.000346
38,129
pythondev
help
yup, exactly
2018-03-09T06:10:11.000208
Zack
pythondev_help_Zack_2018-03-09T06:10:11.000208
1,520,575,811.000208
38,130
pythondev
help
:slightly_smiling_face:
2018-03-09T06:10:15.000254
Gia
pythondev_help_Gia_2018-03-09T06:10:15.000254
1,520,575,815.000254
38,131
pythondev
help
i had a long break from Python, but things are slowly coming back!
2018-03-09T06:10:29.000175
Gia
pythondev_help_Gia_2018-03-09T06:10:29.000175
1,520,575,829.000175
38,132
pythondev
help
another kind of related question I have is this
2018-03-09T06:10:47.000010
Gia
pythondev_help_Gia_2018-03-09T06:10:47.000010
1,520,575,847.00001
38,133
pythondev
help
that’s okay, that’s a pretty non-obvious gotcha that gets a lot of people
2018-03-09T06:11:07.000114
Zack
pythondev_help_Zack_2018-03-09T06:11:07.000114
1,520,575,867.000114
38,134
pythondev
help
inside my plot2d_w2slices function I call another function, plot2d
2018-03-09T06:11:22.000305
Gia
pythondev_help_Gia_2018-03-09T06:11:22.000305
1,520,575,882.000305
38,135
pythondev
help
It has completely screwed me over before
2018-03-09T06:11:25.000374
Dierdre
pythondev_help_Dierdre_2018-03-09T06:11:25.000374
1,520,575,885.000374
38,136
pythondev
help
and pass most of the same arguments to it
2018-03-09T06:11:31.000352
Gia
pythondev_help_Gia_2018-03-09T06:11:31.000352
1,520,575,891.000352
38,137
pythondev
help
how can i avoid repeating myself
2018-03-09T06:11:48.000041
Gia
pythondev_help_Gia_2018-03-09T06:11:48.000041
1,520,575,908.000041
38,138
pythondev
help
here, a simple example to illustrate
2018-03-09T06:11:55.000361
Gia
pythondev_help_Gia_2018-03-09T06:11:55.000361
1,520,575,915.000361
38,139
pythondev
help
```def foo(a,b,c,d, e=None, f=None): bar(a,b,c,d,f) ````
2018-03-09T06:12:41.000213
Gia
pythondev_help_Gia_2018-03-09T06:12:41.000213
1,520,575,961.000213
38,140
pythondev
help
(If you found the advice from jkelly useful, you can give him/her a taco like this `@jkelly :taco:`)
2018-03-09T06:12:47.000155
Dierdre
pythondev_help_Dierdre_2018-03-09T06:12:47.000155
1,520,575,967.000155
38,141
pythondev
help
<@Zack> :taco:
2018-03-09T06:13:01.000372
Gia
pythondev_help_Gia_2018-03-09T06:13:01.000372
1,520,575,981.000372
38,142
pythondev
help
nom nom nom.
2018-03-09T06:13:50.000025
Zack
pythondev_help_Zack_2018-03-09T06:13:50.000025
1,520,576,030.000025
38,143
pythondev
help
and :taco: to <@Dierdre> for the excellent example
2018-03-09T06:14:01.000065
Zack
pythondev_help_Zack_2018-03-09T06:14:01.000065
1,520,576,041.000065
38,144
pythondev
help
One solution is to use `**kwargs`, this is what matplotlib does a lot. I'm not such a fan, because it means the docstring is not as clear and the function no longer autocompletes args. but this is what it could look like: ``` def foo(**kwargs): bar(**kwargs) ```
2018-03-09T06:15:25.000258
Dierdre
pythondev_help_Dierdre_2018-03-09T06:15:25.000258
1,520,576,125.000258
38,145
pythondev
help
<@Dierdre> :taco:
2018-03-09T06:15:56.000042
Gia
pythondev_help_Gia_2018-03-09T06:15:56.000042
1,520,576,156.000042
38,146
pythondev
help
Yes, I've seen that. I wonder if there is a functional approach to solving this.
2018-03-09T06:17:14.000069
Gia
pythondev_help_Gia_2018-03-09T06:17:14.000069
1,520,576,234.000069
38,147
pythondev
help
Alternatively, depending on the structure, etc, you could create a class: ``` class Foo: def __init__(self, a, b, c, d, e=None, f=None): self.a, self.b, self.c, self.d, self.e, self.f = a, b, c, d, e, f def foo(self): # use a, b, c etc. def bar(self) self.foo() ```
2018-03-09T06:17:46.000010
Dierdre
pythondev_help_Dierdre_2018-03-09T06:17:46.000010
1,520,576,266.00001
38,148
pythondev
help
But again, I'm not sure if this is really the best option because then you have to create a class when you want to call the function
2018-03-09T06:18:28.000099
Dierdre
pythondev_help_Dierdre_2018-03-09T06:18:28.000099
1,520,576,308.000099
38,149
pythondev
help
It may be a little but too OO for some people
2018-03-09T06:18:41.000175
Dierdre
pythondev_help_Dierdre_2018-03-09T06:18:41.000175
1,520,576,321.000175
38,150
pythondev
help
is there also a functional approach?
2018-03-09T06:20:15.000217
Gia
pythondev_help_Gia_2018-03-09T06:20:15.000217
1,520,576,415.000217
38,151
pythondev
help
like currying or something
2018-03-09T06:20:49.000218
Gia
pythondev_help_Gia_2018-03-09T06:20:49.000218
1,520,576,449.000218
38,152
pythondev
help
I don't know about that but I did find this: <https://stackoverflow.com/a/3137022/4244912>
2018-03-09T06:21:07.000233
Dierdre
pythondev_help_Dierdre_2018-03-09T06:21:07.000233
1,520,576,467.000233
38,153
pythondev
help
I don't see why you couldn't do something like this as well: <https://stackoverflow.com/a/36321/4244912>
2018-03-09T06:23:04.000032
Dierdre
pythondev_help_Dierdre_2018-03-09T06:23:04.000032
1,520,576,584.000032
38,154
pythondev
help
reminds me of Python decorators, which are callables which return objects
2018-03-09T06:24:20.000059
Dierdre
pythondev_help_Dierdre_2018-03-09T06:24:20.000059
1,520,576,660.000059
38,155
pythondev
help
Yes, it is very much in that style.
2018-03-09T06:24:33.000209
Gia
pythondev_help_Gia_2018-03-09T06:24:33.000209
1,520,576,673.000209
38,156
pythondev
help
<https://github.com/hchasestevens/hchasestevens.github.io/blob/master/notebooks/the-decorators-they-wont-tell-you-about.ipynb>
2018-03-09T06:24:53.000173
Dierdre
pythondev_help_Dierdre_2018-03-09T06:24:53.000173
1,520,576,693.000173
38,157
pythondev
help
did you try <#C8UK1J3DM|pipenv>
2018-03-09T11:27:27.000194
Desire
pythondev_help_Desire_2018-03-09T11:27:27.000194
1,520,594,847.000194
38,158
pythondev
help
Can anyone help with .gitattributes? trying to get it to ignore my css, js , and html files.
2018-03-09T12:48:42.000607
Gregoria
pythondev_help_Gregoria_2018-03-09T12:48:42.000607
1,520,599,722.000607
38,159
pythondev
help
<https://github.com/Jflick58/TeachPythonWithMinecraft>
2018-03-09T12:48:51.000401
Gregoria
pythondev_help_Gregoria_2018-03-09T12:48:51.000401
1,520,599,731.000401
38,160
pythondev
help
Wouldn't that belong in `.gitignore`?
2018-03-09T12:51:01.000508
Garrett
pythondev_help_Garrett_2018-03-09T12:51:01.000508
1,520,599,861.000508
38,161
pythondev
help
and `.gitattributes` not `.gitattribute`
2018-03-09T12:51:19.000249
Kristin
pythondev_help_Kristin_2018-03-09T12:51:19.000249
1,520,599,879.000249
38,162
pythondev
help
no gitignore won't include the file at all when pushing. I want them in the repo, but as this is a python thing I don't want the language to display as css
2018-03-09T12:58:53.000424
Gregoria
pythondev_help_Gregoria_2018-03-09T12:58:53.000424
1,520,600,333.000424
38,163
pythondev
help
huh?
2018-03-09T12:59:17.000117
Floy
pythondev_help_Floy_2018-03-09T12:59:17.000117
1,520,600,357.000117
38,164
pythondev
help
‘display as css’??
2018-03-09T12:59:29.000343
Floy
pythondev_help_Floy_2018-03-09T12:59:29.000343
1,520,600,369.000343
38,165
pythondev
help
GitHub assumes the repo is for the language w/ the most lines of code
2018-03-09T12:59:50.000002
Garrett
pythondev_help_Garrett_2018-03-09T12:59:50.000002
1,520,600,390.000002
38,166
pythondev
help
It affects nothing but GitHub's label on the repo
2018-03-09T12:59:59.000718
Garrett
pythondev_help_Garrett_2018-03-09T12:59:59.000718
1,520,600,399.000718
38,167
pythondev
help
<https://github.com/alexkaratarakis/gitattributes> bunch of examples here
2018-03-09T13:02:14.000752
Kristin
pythondev_help_Kristin_2018-03-09T13:02:14.000752
1,520,600,534.000752
38,168
pythondev
help
ah, right. so gitattribute will tell github’s linguistic package to ignore those files
2018-03-09T13:02:30.000492
Floy
pythondev_help_Floy_2018-03-09T13:02:30.000492
1,520,600,550.000492
38,169
pythondev
help
¯\_(ツ)_/¯
2018-03-09T13:02:41.000024
Garrett
pythondev_help_Garrett_2018-03-09T13:02:41.000024
1,520,600,561.000024
38,170
pythondev
help
yeah, TIL
2018-03-09T13:02:52.000310
Floy
pythondev_help_Floy_2018-03-09T13:02:52.000310
1,520,600,572.00031
38,171
pythondev
help
didn’t know that before
2018-03-09T13:02:55.000297
Floy
pythondev_help_Floy_2018-03-09T13:02:55.000297
1,520,600,575.000297
38,172
pythondev
help
but regardless, <@Gregoria> paths aren’t matching
2018-03-09T13:03:03.000185
Floy
pythondev_help_Floy_2018-03-09T13:03:03.000185
1,520,600,583.000185
38,173
pythondev
help
``` static/* linguist-vendored Templates/* linguist-vendored```
2018-03-09T13:03:10.000548
Floy
pythondev_help_Floy_2018-03-09T13:03:10.000548
1,520,600,590.000548
38,174
pythondev
help
would be better to match filetypes than paths
2018-03-09T13:03:18.000028
Kristin
pythondev_help_Kristin_2018-03-09T13:03:18.000028
1,520,600,598.000028
38,175
pythondev
help
`.gitattribute` is located in the repostitory root, so when specifying paths, use that as root
2018-03-09T13:04:02.000392
Floy
pythondev_help_Floy_2018-03-09T13:04:02.000392
1,520,600,642.000392
38,176
pythondev
help
eg, `Flask_Starter_Code/static/*`
2018-03-09T13:04:21.000455
Floy
pythondev_help_Floy_2018-03-09T13:04:21.000455
1,520,600,661.000455
38,177
pythondev
help
Hi there, new to this slack group and have a question about PyCharm, specifically running setup.py install. I want to run setup.py install for the package I'm working on before I re-run pytest which depends on the package. The issue is PyCharm has a lock on the '.egg' file so the install fails. Can anyone help (slash a...
2018-03-09T13:29:56.000118
Jeana
pythondev_help_Jeana_2018-03-09T13:29:56.000118
1,520,602,196.000118
38,178
pythondev
help
You shouldn't need to install the package for running pytest
2018-03-09T13:32:35.000620
Micki
pythondev_help_Micki_2018-03-09T13:32:35.000620
1,520,602,355.00062
38,179
pythondev
help
Hi <@Jeana>, I'm not a big user of Pycharm and other big IDEs exactly for this reason. However, I'd suggest running `pip install -e .` instead of `python setup.py install`
2018-03-09T13:33:04.000104
Dierdre
pythondev_help_Dierdre_2018-03-09T13:33:04.000104
1,520,602,384.000104
38,180
pythondev
help
Don't think that solves your problems though
2018-03-09T13:33:24.000527
Dierdre
pythondev_help_Dierdre_2018-03-09T13:33:24.000527
1,520,602,404.000527
38,181
pythondev
help
:+1: it's always best to install via pip than setup.py
2018-03-09T13:34:19.000423
Micki
pythondev_help_Micki_2018-03-09T13:34:19.000423
1,520,602,459.000423
38,182
pythondev
help
great thanks for the feedback - I'm going to try your suggestions
2018-03-09T13:36:53.000243
Jeana
pythondev_help_Jeana_2018-03-09T13:36:53.000243
1,520,602,613.000243
38,183
pythondev
help
Last resort - close pycharm, do your install, open it up again. Closing it should relinquish the lock
2018-03-09T13:37:29.000489
Dierdre
pythondev_help_Dierdre_2018-03-09T13:37:29.000489
1,520,602,649.000489
38,184
pythondev
help
yeah that works - I can close pycharm and run the install from the command line but I don't want to have to close pycharm each time to install and run tests again
2018-03-09T13:38:50.000226
Jeana
pythondev_help_Jeana_2018-03-09T13:38:50.000226
1,520,602,730.000226
38,185
pythondev
help
Also, make sure you're installing in an environment of some sort. I use conda envs, but I know there are other tools like venv or pyenv
2018-03-09T13:39:04.000284
Dierdre
pythondev_help_Dierdre_2018-03-09T13:39:04.000284
1,520,602,744.000284
38,186
pythondev
help
I must be doing something wrong. Would pip install -e help with the locking problem? I am using a venv though
2018-03-09T13:39:26.000261
Jeana
pythondev_help_Jeana_2018-03-09T13:39:26.000261
1,520,602,766.000261
38,187
pythondev
help
I don't think `pip install` would help with the lock
2018-03-09T13:39:49.000358
Dierdre
pythondev_help_Dierdre_2018-03-09T13:39:49.000358
1,520,602,789.000358
38,188
pythondev
help
is your code public ? pytest should test your local files not the installed one
2018-03-09T13:40:10.000422
Micki
pythondev_help_Micki_2018-03-09T13:40:10.000422
1,520,602,810.000422
38,189
pythondev
help
it's not public. I'
2018-03-09T13:41:47.000004
Jeana
pythondev_help_Jeana_2018-03-09T13:41:47.000004
1,520,602,907.000004
38,190
pythondev
help
I'm thinking I'm importing the module to be tested incorrectly in pytest - should I be importing using relative path?
2018-03-09T13:42:13.000174
Jeana
pythondev_help_Jeana_2018-03-09T13:42:13.000174
1,520,602,933.000174
38,191
pythondev
help
not necessarily
2018-03-09T13:43:47.000309
Micki
pythondev_help_Micki_2018-03-09T13:43:47.000309
1,520,603,027.000309
38,192
pythondev
help
how is your directory structure ?
2018-03-09T13:44:10.000306
Micki
pythondev_help_Micki_2018-03-09T13:44:10.000306
1,520,603,050.000306
38,193
pythondev
help
you can look here for an example g#slack-sansio
2018-03-09T13:45:31.000365
Micki
pythondev_help_Micki_2018-03-09T13:45:31.000365
1,520,603,131.000365
38,194
pythondev
help
<https://github.com/pyslackers/slack-sansio>
2018-03-09T13:45:32.000241
Hyo
pythondev_help_Hyo_2018-03-09T13:45:32.000241
1,520,603,132.000241
38,195
pythondev
help
it's a simple app and the code/module to be tested is sibling directory to the tests folder
2018-03-09T13:47:49.000199
Jeana
pythondev_help_Jeana_2018-03-09T13:47:49.000199
1,520,603,269.000199
38,196
pythondev
help
root/my_module/mycode
2018-03-09T13:48:05.000534
Jeana
pythondev_help_Jeana_2018-03-09T13:48:05.000534
1,520,603,285.000534
38,197
pythondev
help
root/tests/testcode
2018-03-09T13:48:11.000029
Jeana
pythondev_help_Jeana_2018-03-09T13:48:11.000029
1,520,603,291.000029
38,198
pythondev
help
I actually used this post as an example: <https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/>
2018-03-09T13:49:23.000086
Jeana
pythondev_help_Jeana_2018-03-09T13:49:23.000086
1,520,603,363.000086
38,199
pythondev
help
ok then if starting pytest from root you should be able to import `my_module` in your tests files without the need to install them
2018-03-09T13:50:41.000578
Micki
pythondev_help_Micki_2018-03-09T13:50:41.000578
1,520,603,441.000578
38,200
pythondev
help
I always install my packages as I'm writing them otherwise I can't get the relative imports working reliably
2018-03-09T13:51:30.000236
Dierdre
pythondev_help_Dierdre_2018-03-09T13:51:30.000236
1,520,603,490.000236
38,201
pythondev
help
¯\_(ツ)_/¯
2018-03-09T13:51:46.000515
Dierdre
pythondev_help_Dierdre_2018-03-09T13:51:46.000515
1,520,603,506.000515
38,202
pythondev
help
An article I'm using currently: <https://amir.rachum.com/blog/2017/07/28/python-entry-points/>
2018-03-09T13:52:13.000520
Dierdre
pythondev_help_Dierdre_2018-03-09T13:52:13.000520
1,520,603,533.00052
38,203
pythondev
help
haha ok appreciate both perspectives
2018-03-09T13:52:33.000047
Jeana
pythondev_help_Jeana_2018-03-09T13:52:33.000047
1,520,603,553.000047
38,204
pythondev
help
so ogaday do you not use any IDE?
2018-03-09T13:52:41.000123
Jeana
pythondev_help_Jeana_2018-03-09T13:52:41.000123
1,520,603,561.000123
38,205
pythondev
help
it sounds like if I'm not doing relative imports for pytest it will be a problem with doing repeated installs b/c of Pycharm's lock
2018-03-09T13:53:27.000189
Jeana
pythondev_help_Jeana_2018-03-09T13:53:27.000189
1,520,603,607.000189
38,206
pythondev
help
just to close the loop - I ended up just using pip install -e (since I should be installing it in developer mode) which obviated the need to re-install each time code changed. Thanks for your help!
2018-03-09T14:45:57.000031
Jeana
pythondev_help_Jeana_2018-03-09T14:45:57.000031
1,520,606,757.000031
38,207
pythondev
help
has anyone had an issue where a module that does exist under site-packages is for some reason unable to be imported by another module that's been imported into your main application?
2018-03-09T15:10:56.000027
Shante
pythondev_help_Shante_2018-03-09T15:10:56.000027
1,520,608,256.000027
38,208
pythondev
help
I am trying to import the boto3 library to do some file management and the code works fine in my development environment on my local machine, however I have spun up an AWS Linux 2 EC2 instance to run the code on and now whenever I try and call `boto3.client('s3', aws_access_key_id=key, aws_secret_access_key=secret)` it...
2018-03-09T15:13:14.000076
Shante
pythondev_help_Shante_2018-03-09T15:13:14.000076
1,520,608,394.000076
38,209
pythondev
help
However when navigating into my environment to double check, I can clearly see that the exceptions module in question does in fact exist exactly where it is supposed to, I doubt this is an AWS realted issue and maybe something more to do with python itself, but I am at a loss as to how this isn't working
2018-03-09T15:15:20.000291
Shante
pythondev_help_Shante_2018-03-09T15:15:20.000291
1,520,608,520.000291
38,210
pythondev
help
I ran into a similar issue and it was my own dumb fault
2018-03-09T15:17:25.000402
Elisha
pythondev_help_Elisha_2018-03-09T15:17:25.000402
1,520,608,645.000402
38,211
pythondev
help
i could type `pip list` and see my module, but importing failed
2018-03-09T15:17:36.000297
Elisha
pythondev_help_Elisha_2018-03-09T15:17:36.000297
1,520,608,656.000297
38,212
pythondev
help
this was because I had aliased `python` to `/usr/bin/python3.6` (i think was the path) and was running a .py file from within a pyenv
2018-03-09T15:18:17.000575
Elisha
pythondev_help_Elisha_2018-03-09T15:18:17.000575
1,520,608,697.000575
38,213
pythondev
help
that in turn caused my pyenv to not be looking for modules where I thought it should
2018-03-09T15:18:34.000041
Elisha
pythondev_help_Elisha_2018-03-09T15:18:34.000041
1,520,608,714.000041
38,214
pythondev
help
in my case removing the alias solved the issue, when im not in a pyenv the system looks in the default location, when im in the pyenv the system looks in my pyenv modules
2018-03-09T15:19:10.000690
Elisha
pythondev_help_Elisha_2018-03-09T15:19:10.000690
1,520,608,750.00069
38,215
pythondev
help
Actually my solution (that I literally just now realized) was much more simple
2018-03-09T15:20:03.000021
Shante
pythondev_help_Shante_2018-03-09T15:20:03.000021
1,520,608,803.000021
38,216
pythondev
help
the ol' rubber duck
2018-03-09T15:20:15.000342
Elisha
pythondev_help_Elisha_2018-03-09T15:20:15.000342
1,520,608,815.000342
38,217
pythondev
help
I had named the script I was writing the same thing by accident as the name of the module boto3 was trying to reference
2018-03-09T15:20:20.000229
Shante
pythondev_help_Shante_2018-03-09T15:20:20.000229
1,520,608,820.000229
38,218
pythondev
help
oh haha rip
2018-03-09T15:20:29.000288
Elisha
pythondev_help_Elisha_2018-03-09T15:20:29.000288
1,520,608,829.000288
38,219
pythondev
help
been there
2018-03-09T15:20:30.000484
Elisha
pythondev_help_Elisha_2018-03-09T15:20:30.000484
1,520,608,830.000484
38,220
pythondev
help
2 hours just gone, I should of realized the only thing that changed from my dev environment was the name of the file
2018-03-09T15:20:55.000582
Shante
pythondev_help_Shante_2018-03-09T15:20:55.000582
1,520,608,855.000582
38,221
pythondev
help
oh Firdays
2018-03-09T15:20:59.000177
Shante
pythondev_help_Shante_2018-03-09T15:20:59.000177
1,520,608,859.000177
38,222
pythondev
help
40 mins till beer o' clock you're almost there
2018-03-09T15:21:16.000367
Elisha
pythondev_help_Elisha_2018-03-09T15:21:16.000367
1,520,608,876.000367
38,223