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
yep
2019-01-25T20:51:34.566200
Ashley
pythondev_help_Ashley_2019-01-25T20:51:34.566200
1,548,449,494.5662
4,321
pythondev
help
what happens when you run `python --version`
2019-01-25T20:51:58.566600
Ashley
pythondev_help_Ashley_2019-01-25T20:51:58.566600
1,548,449,518.5666
4,322
pythondev
help
2.7.15
2019-01-25T20:52:09.566900
Elza
pythondev_help_Elza_2019-01-25T20:52:09.566900
1,548,449,529.5669
4,323
pythondev
help
Python 2.7.15 :: Anaconda, Inc.
2019-01-25T20:52:15.567100
Elza
pythondev_help_Elza_2019-01-25T20:52:15.567100
1,548,449,535.5671
4,324
pythondev
help
and when you run `python2 --version`?
2019-01-25T20:52:38.567800
Ashley
pythondev_help_Ashley_2019-01-25T20:52:38.567800
1,548,449,558.5678
4,325
pythondev
help
I get Python 2.7.15
2019-01-25T20:52:53.568000
Elza
pythondev_help_Elza_2019-01-25T20:52:53.568000
1,548,449,573.568
4,326
pythondev
help
so, to be clear, when you run `python --version`, it spits out `Python 2.7.15 :: Anaconda, Inc.`, and when you run `python2 --version`, you get `Python 2.7.15`, correct?
2019-01-25T20:54:15.569100
Ashley
pythondev_help_Ashley_2019-01-25T20:54:15.569100
1,548,449,655.5691
4,327
pythondev
help
well its actually py2 I apologize
2019-01-25T20:55:04.569600
Elza
pythondev_help_Elza_2019-01-25T20:55:04.569600
1,548,449,704.5696
4,328
pythondev
help
which is this py2=“/usr/local/bin/python2”
2019-01-25T20:55:11.569900
Elza
pythondev_help_Elza_2019-01-25T20:55:11.569900
1,548,449,711.5699
4,329
pythondev
help
ok, either way, it looks like those are different python executables, meaning different environments
2019-01-25T20:55:57.570700
Ashley
pythondev_help_Ashley_2019-01-25T20:55:57.570700
1,548,449,757.5707
4,330
pythondev
help
one has `bs4` installed, and the other doesn't
2019-01-25T20:56:13.571200
Ashley
pythondev_help_Ashley_2019-01-25T20:56:13.571200
1,548,449,773.5712
4,331
pythondev
help
ah I see
2019-01-25T20:57:07.571400
Elza
pythondev_help_Elza_2019-01-25T20:57:07.571400
1,548,449,827.5714
4,332
pythondev
help
Another question is dotenv a builtin module from python?
2019-01-25T20:57:27.571900
Elza
pythondev_help_Elza_2019-01-25T20:57:27.571900
1,548,449,847.5719
4,333
pythondev
help
I don't believe so
2019-01-25T20:58:26.572100
Ashley
pythondev_help_Ashley_2019-01-25T20:58:26.572100
1,548,449,906.5721
4,334
pythondev
help
ok
2019-01-25T20:58:35.572300
Elza
pythondev_help_Elza_2019-01-25T20:58:35.572300
1,548,449,915.5723
4,335
pythondev
help
huh thanks for the help
2019-01-25T21:00:05.572500
Elza
pythondev_help_Elza_2019-01-25T21:00:05.572500
1,548,450,005.5725
4,336
pythondev
help
np
2019-01-25T21:17:01.572700
Ashley
pythondev_help_Ashley_2019-01-25T21:17:01.572700
1,548,451,021.5727
4,337
pythondev
help
Yes
2019-01-25T21:59:00.572800
Chester
pythondev_help_Chester_2019-01-25T21:59:00.572800
1,548,453,540.5728
4,338
pythondev
help
Thanks for this, will try to implement an iterator protocol!
2019-01-26T02:03:02.573200
Conchita
pythondev_help_Conchita_2019-01-26T02:03:02.573200
1,548,468,182.5732
4,339
pythondev
help
For one of my apps that is meant to run continously, I noticed it stopped running. When I ssh into my server I see the screen session from where I was running the app is `deattached`
2019-01-26T02:19:32.574500
Conchita
pythondev_help_Conchita_2019-01-26T02:19:32.574500
1,548,469,172.5745
4,340
pythondev
help
Excluding human interaction, what could lead to a screen becoming `deattached`?
2019-01-26T02:20:22.575400
Conchita
pythondev_help_Conchita_2019-01-26T02:20:22.575400
1,548,469,222.5754
4,341
pythondev
help
I think that would happen if the ssh connection the screen was started from got disconnected. Normally you would purposefully detach the screen session so it would continue to run while you're not on a live connection.
2019-01-26T02:23:42.576500
Sasha
pythondev_help_Sasha_2019-01-26T02:23:42.576500
1,548,469,422.5765
4,342
pythondev
help
How do you purposefully detach the screen session to allow it to run after I log off?
2019-01-26T02:25:18.577100
Conchita
pythondev_help_Conchita_2019-01-26T02:25:18.577100
1,548,469,518.5771
4,343
pythondev
help
CTRL+A D, I believe.
2019-01-26T02:25:40.577400
Sasha
pythondev_help_Sasha_2019-01-26T02:25:40.577400
1,548,469,540.5774
4,344
pythondev
help
You should be able to reattach to the old screen session and see if your app printed out any errors.
2019-01-26T02:27:36.577900
Sasha
pythondev_help_Sasha_2019-01-26T02:27:36.577900
1,548,469,656.5779
4,345
pythondev
help
Ok thanks, will try it out. Have a :taco: <@Sasha>
2019-01-26T02:28:09.578500
Conchita
pythondev_help_Conchita_2019-01-26T02:28:09.578500
1,548,469,689.5785
4,346
pythondev
help
Can anybody help me wiith this one ? <https://codereview.stackexchange.com/questions/212270/api-client-querying-data-out-of-an-endpoint>
2019-01-26T10:29:58.581100
Roxanne
pythondev_help_Roxanne_2019-01-26T10:29:58.581100
1,548,498,598.5811
4,347
pythondev
help
Guys perhaps you could help me out a bit to flesh out a class that would implement a certain behaviour. So basically the way I want to use it is: ``` MyData['zero']['excited'].method() ```
2019-01-26T11:13:04.582500
Coleen
pythondev_help_Coleen_2019-01-26T11:13:04.582500
1,548,501,184.5825
4,348
pythondev
help
The backstory is that I use a nested dict so far, and I want to add some methods to it.
2019-01-26T11:13:42.583200
Coleen
pythondev_help_Coleen_2019-01-26T11:13:42.583200
1,548,501,222.5832
4,349
pythondev
help
The dict is ``` MYDATA = { # mapping from executable names to what they represent 'zero' : { 'ground' : 'dish', 'excited' : 'ztes' }, 'finite' : { 'ground' : 'skys', 'excited' : 'ftes' } } ```
2019-01-26T11:15:13.583700
Coleen
pythondev_help_Coleen_2019-01-26T11:15:13.583700
1,548,501,313.5837
4,350
pythondev
help
DO I have to know algorithms before learning python?
2019-01-26T11:24:32.584300
Wendi
pythondev_help_Wendi_2019-01-26T11:24:32.584300
1,548,501,872.5843
4,351
pythondev
help
Why not learn both at the same time: <http://interactivepython.org/runestone/static/pythonds/index.html>
2019-01-26T11:25:56.584800
Coleen
pythondev_help_Coleen_2019-01-26T11:25:56.584800
1,548,501,956.5848
4,352
pythondev
help
<@Coleen> what kinds of methods?
2019-01-26T11:29:06.586600
Chester
pythondev_help_Chester_2019-01-26T11:29:06.586600
1,548,502,146.5866
4,353
pythondev
help
Yea so for example the kind of stuff I'm doing with the nested dict right now: ``` # check if input files are present in the workspace for temp in ('zero', 'finite'): for state, suffix in zip(('ground', 'excited'), ("_dis.dat", "_start.dat")): fpath = os.path.join(args.workspace, CODE_NAME[t...
2019-01-26T11:32:49.587400
Coleen
pythondev_help_Coleen_2019-01-26T11:32:49.587400
1,548,502,369.5874
4,354
pythondev
help
There could be a method `input_file()` which returns the corresponding file name, ie `MyData['zero']['ground'].input_file()` would return `dish_dis.dat`,
2019-01-26T11:33:57.588100
Coleen
pythondev_help_Coleen_2019-01-26T11:33:57.588100
1,548,502,437.5881
4,355
pythondev
help
Not sure it's the right abstraction, but something like this is what I had in mind.
2019-01-26T11:37:28.588600
Coleen
pythondev_help_Coleen_2019-01-26T11:37:28.588600
1,548,502,648.5886
4,356
pythondev
help
Then another method `MyData.all_input_files()` would return a list containing all input file names: [`dish_dis,dat`, `skys_dis,dat`, `ztes_start.dat`, `ftes_start.dat`]
2019-01-26T11:38:57.590200
Coleen
pythondev_help_Coleen_2019-01-26T11:38:57.590200
1,548,502,737.5902
4,357
pythondev
help
Or `MyData['zero'].input_files()` would return `[dish_dis,dat, ztes_start.dat]` and `MyData['ground'].input_files()` would return `[dish_dis,dat, skys_dis,dat]`
2019-01-26T11:43:44.591500
Coleen
pythondev_help_Coleen_2019-01-26T11:43:44.591500
1,548,503,024.5915
4,358
pythondev
help
Does it make sense?
2019-01-26T11:45:37.591800
Coleen
pythondev_help_Coleen_2019-01-26T11:45:37.591800
1,548,503,137.5918
4,359
pythondev
help
That syntax is possible due to dynamic nature of python, but I would advise to implement a more common api: instead of `MyData['zero']['ground'].input_file()` do `MyData.input_file('zero', 'ground')`
2019-01-26T11:47:34.593100
Chester
pythondev_help_Chester_2019-01-26T11:47:34.593100
1,548,503,254.5931
4,360
pythondev
help
Same for `MyData['zero'].input_files()`: do `MyData.input_files('zero')` instead
2019-01-26T11:48:43.593500
Chester
pythondev_help_Chester_2019-01-26T11:48:43.593500
1,548,503,323.5935
4,361
pythondev
help
I see.
2019-01-26T11:48:55.593700
Coleen
pythondev_help_Coleen_2019-01-26T11:48:55.593700
1,548,503,335.5937
4,362
pythondev
help
And I would store the nested dict inside the class right?
2019-01-26T11:49:09.594100
Coleen
pythondev_help_Coleen_2019-01-26T11:49:09.594100
1,548,503,349.5941
4,363
pythondev
help
Yes
2019-01-26T11:49:13.594300
Chester
pythondev_help_Chester_2019-01-26T11:49:13.594300
1,548,503,353.5943
4,364
pythondev
help
``` class MyData: def __init__(self, data): self._data = data def input_file(self, first, second): return self._data[first][second] + '_dis.dat' ``` Something like that.
2019-01-26T11:50:31.595400
Chester
pythondev_help_Chester_2019-01-26T11:50:31.595400
1,548,503,431.5954
4,365
pythondev
help
:slightly_smiling_face:
2019-01-26T11:50:43.595600
Coleen
pythondev_help_Coleen_2019-01-26T11:50:43.595600
1,548,503,443.5956
4,366
pythondev
help
Btw, there is nothing wrong with not having methods on your `MyData` class and write functions instead, that operate on dictionaries
2019-01-26T11:51:38.596800
Chester
pythondev_help_Chester_2019-01-26T11:51:38.596800
1,548,503,498.5968
4,367
pythondev
help
what do you mean?
2019-01-26T11:52:03.597100
Coleen
pythondev_help_Coleen_2019-01-26T11:52:03.597100
1,548,503,523.5971
4,368
pythondev
help
``` def input_file(data, first, second): return data[first][second] + '_dis.dat' ```
2019-01-26T11:53:17.598400
Chester
pythondev_help_Chester_2019-01-26T11:53:17.598400
1,548,503,597.5984
4,369
pythondev
help
Where `data` is your dictionary
2019-01-26T11:53:27.598700
Chester
pythondev_help_Chester_2019-01-26T11:53:27.598700
1,548,503,607.5987
4,370
pythondev
help
Oh you mean not writing a class at all
2019-01-26T11:53:41.599100
Coleen
pythondev_help_Coleen_2019-01-26T11:53:41.599100
1,548,503,621.5991
4,371
pythondev
help
Exactly
2019-01-26T11:53:45.599300
Chester
pythondev_help_Chester_2019-01-26T11:53:45.599300
1,548,503,625.5993
4,372
pythondev
help
But I feel the dict and these functions belong together.
2019-01-26T11:54:02.599900
Coleen
pythondev_help_Coleen_2019-01-26T11:54:02.599900
1,548,503,642.5999
4,373
pythondev
help
Maybe, maybe not - you can always refactor a bunch of functions into a class later.
2019-01-26T11:54:52.600500
Chester
pythondev_help_Chester_2019-01-26T11:54:52.600500
1,548,503,692.6005
4,374
pythondev
help
And since the nested dict was a global constant before, should I make this class a singleton?
2019-01-26T11:55:12.601100
Coleen
pythondev_help_Coleen_2019-01-26T11:55:12.601100
1,548,503,712.6011
4,375
pythondev
help
Extracting methods from classes, on the other hand, may be difficult because of uncontrollable implicit dependencies on `self`
2019-01-26T11:55:20.601300
Chester
pythondev_help_Chester_2019-01-26T11:55:20.601300
1,548,503,720.6013
4,376
pythondev
help
You see, singletons are a thing in java, but in python there is nothing wrong with a regular global variable :slightly_smiling_face:
2019-01-26T11:56:02.601900
Chester
pythondev_help_Chester_2019-01-26T11:56:02.601900
1,548,503,762.6019
4,377
pythondev
help
Because of how imports work in python, you get singleton behavior out of the box
2019-01-26T11:56:24.602600
Chester
pythondev_help_Chester_2019-01-26T11:56:24.602600
1,548,503,784.6026
4,378
pythondev
help
Yes, but if the variable becomes a class?
2019-01-26T11:56:30.602800
Coleen
pythondev_help_Coleen_2019-01-26T11:56:30.602800
1,548,503,790.6028
4,379
pythondev
help
You'll need to instantiate it somewhere, yeah. `my_data = MyData()`. And only then you'll be able to call methods on `my_data`
2019-01-26T11:57:07.603900
Chester
pythondev_help_Chester_2019-01-26T11:57:07.603900
1,548,503,827.6039
4,380
pythondev
help
But the problem is I will have to instantiate it at the top level of the module.
2019-01-26T11:57:38.604400
Coleen
pythondev_help_Coleen_2019-01-26T11:57:38.604400
1,548,503,858.6044
4,381
pythondev
help
Why is this a problem?
2019-01-26T11:57:46.604700
Chester
pythondev_help_Chester_2019-01-26T11:57:46.604700
1,548,503,866.6047
4,382
pythondev
help
Because it's used in various functions.
2019-01-26T11:57:52.604900
Coleen
pythondev_help_Coleen_2019-01-26T11:57:52.604900
1,548,503,872.6049
4,383
pythondev
help
Because it creates a global var.
2019-01-26T11:58:03.605300
Coleen
pythondev_help_Coleen_2019-01-26T11:58:03.605300
1,548,503,883.6053
4,384
pythondev
help
So I read global constants are OK in Python, but not global vars?
2019-01-26T11:58:41.605700
Coleen
pythondev_help_Coleen_2019-01-26T11:58:41.605700
1,548,503,921.6057
4,385
pythondev
help
Uhm
2019-01-26T11:59:09.606100
Chester
pythondev_help_Chester_2019-01-26T11:59:09.606100
1,548,503,949.6061
4,386
pythondev
help
There are no constants in python
2019-01-26T11:59:45.607000
Chester
pythondev_help_Chester_2019-01-26T11:59:45.607000
1,548,503,985.607
4,387
pythondev
help
<@Coleen> global constants are fine in Python because they are unchanging, hence the name "constant", but global variables are a code smell (usually) because things in multiple parts of your code migght depend on those things and have to change them, but you can't know which parts will do so, or when they'll do it, so ...
2019-01-26T12:00:47.608100
Ashley
pythondev_help_Ashley_2019-01-26T12:00:47.608100
1,548,504,047.6081
4,388
pythondev
help
<@Chester> is right that there are no constants in python
2019-01-26T12:00:59.608400
Ashley
pythondev_help_Ashley_2019-01-26T12:00:59.608400
1,548,504,059.6084
4,389
pythondev
help
but you can create objects that you treat as constants
2019-01-26T12:01:09.608700
Ashley
pythondev_help_Ashley_2019-01-26T12:01:09.608700
1,548,504,069.6087
4,390
pythondev
help
and that's fine
2019-01-26T12:01:24.609000
Ashley
pythondev_help_Ashley_2019-01-26T12:01:24.609000
1,548,504,084.609
4,391
pythondev
help
how
2019-01-26T12:01:27.609400
Coleen
pythondev_help_Coleen_2019-01-26T12:01:27.609400
1,548,504,087.6094
4,392
pythondev
help
you'll see that commonly done to avoid things like "magic numbers"
2019-01-26T12:01:36.609800
Ashley
pythondev_help_Ashley_2019-01-26T12:01:36.609800
1,548,504,096.6098
4,393
pythondev
help
by giving them a name in capitals? :slightly_smiling_face:
2019-01-26T12:01:53.610400
Coleen
pythondev_help_Coleen_2019-01-26T12:01:53.610400
1,548,504,113.6104
4,394
pythondev
help
you just create an object in the global namespace of a module like any other
2019-01-26T12:02:00.610700
Ashley
pythondev_help_Ashley_2019-01-26T12:02:00.610700
1,548,504,120.6107
4,395
pythondev
help
Yes. A capitalized variable doesn't differ from a non-capitalized variable.
2019-01-26T12:02:18.611400
Chester
pythondev_help_Chester_2019-01-26T12:02:18.611400
1,548,504,138.6114
4,396
pythondev
help
all-caps names are a good indicator to othhers that they are constants, and you should definitely do that
2019-01-26T12:02:22.611500
Ashley
pythondev_help_Ashley_2019-01-26T12:02:22.611500
1,548,504,142.6115
4,397
pythondev
help
but what makes them ok is how they are meant to be used
2019-01-26T12:02:38.611800
Ashley
pythondev_help_Ashley_2019-01-26T12:02:38.611800
1,548,504,158.6118
4,398
pythondev
help
but if someone else takes my code and he doesn't know how this class is meant to be used?
2019-01-26T12:03:11.612800
Coleen
pythondev_help_Coleen_2019-01-26T12:03:11.612800
1,548,504,191.6128
4,399
pythondev
help
for example, if I create this: `NY_TAX_RATE = 0.0725`, that's fine
2019-01-26T12:03:15.613000
Ashley
pythondev_help_Ashley_2019-01-26T12:03:15.613000
1,548,504,195.613
4,400
pythondev
help
that's why you make them all caps
2019-01-26T12:03:33.613500
Ashley
pythondev_help_Ashley_2019-01-26T12:03:33.613500
1,548,504,213.6135
4,401
pythondev
help
because it tells other developers that they shouldn't change those things
2019-01-26T12:03:45.614000
Ashley
pythondev_help_Ashley_2019-01-26T12:03:45.614000
1,548,504,225.614
4,402
pythondev
help
similarly, python doesn't have private attributes
2019-01-26T12:04:02.614700
Ashley
pythondev_help_Ashley_2019-01-26T12:04:02.614700
1,548,504,242.6147
4,403
pythondev
help
<@Coleen> to solve that particular problem, we write docstrings for classes, methods and functions. In these docstrings we show examples and explain how this class/method/function should be used
2019-01-26T12:04:14.615200
Chester
pythondev_help_Chester_2019-01-26T12:04:14.615200
1,548,504,254.6152
4,404
pythondev
help
but we try to tell other developers when we want them to treat an attribute as private by starting it with a `_`, e.g. `_super_secret_thing`
2019-01-26T12:04:32.615700
Ashley
pythondev_help_Ashley_2019-01-26T12:04:32.615700
1,548,504,272.6157
4,405
pythondev
help
that too
2019-01-26T12:04:41.615900
Ashley
pythondev_help_Ashley_2019-01-26T12:04:41.615900
1,548,504,281.6159
4,406
pythondev
help
:slightly_smiling_face:
2019-01-26T12:04:52.616200
Coleen
pythondev_help_Coleen_2019-01-26T12:04:52.616200
1,548,504,292.6162
4,407
pythondev
help
the abstractions were written because you wanted your code to be easy to use
2019-01-26T12:05:10.616600
Ashley
pythondev_help_Ashley_2019-01-26T12:05:10.616600
1,548,504,310.6166
4,408
pythondev
help
if people are finding it easier to use your "private" attributes than the other things meant for that, then you either didn't make something easy to use, or you didn't document it sufficiently enough
2019-01-26T12:05:50.617500
Ashley
pythondev_help_Ashley_2019-01-26T12:05:50.617500
1,548,504,350.6175
4,409
pythondev
help
on a related note, the bit about global objects that aren't constants being a code smell is what <@Chester> was saying regarding "singleton behavior out of the box". But that's why it's a code smell
2019-01-26T12:09:54.618700
Ashley
pythondev_help_Ashley_2019-01-26T12:09:54.618700
1,548,504,594.6187
4,410
pythondev
help
I see
2019-01-26T12:14:07.619300
Coleen
pythondev_help_Coleen_2019-01-26T12:14:07.619300
1,548,504,847.6193
4,411
pythondev
help
Thanks guys!
2019-01-26T12:16:20.619600
Coleen
pythondev_help_Coleen_2019-01-26T12:16:20.619600
1,548,504,980.6196
4,412
pythondev
help
np!
2019-01-26T12:25:11.619800
Ashley
pythondev_help_Ashley_2019-01-26T12:25:11.619800
1,548,505,511.6198
4,413
pythondev
help
hello may i ask you guys something, idid install windows and linux along each other but after i shut down linux and open my pc again to activate windows, windows get stucked or i can hear the sound of operating system opening but screen is black still and i have to force shut down again and again until it opens normal...
2019-01-26T12:33:01.621900
Janessa
pythondev_help_Janessa_2019-01-26T12:33:01.621900
1,548,505,981.6219
4,414
pythondev
help
<@Janessa> I'd guess it's either a corrupted install of windows, loose/janky video cable to the display, bad video driver (try rebooting a few times into safe mode to see if it consistently boots with no problems), or a bad GPU
2019-01-26T12:45:49.623600
Ashley
pythondev_help_Ashley_2019-01-26T12:45:49.623600
1,548,506,749.6236
4,415
pythondev
help
<@Ashley> actually i had windows just installed linux along with it with partitions
2019-01-26T12:48:10.624500
Janessa
pythondev_help_Janessa_2019-01-26T12:48:10.624500
1,548,506,890.6245
4,416
pythondev
help
yeah, it could still be something like a bad sector on yourr hard drive
2019-01-26T12:48:49.624800
Ashley
pythondev_help_Ashley_2019-01-26T12:48:49.624800
1,548,506,929.6248
4,417
pythondev
help
IIRC the install disc for windows should have an analysis tool you can run to see if anything is messed up
2019-01-26T12:49:19.625400
Ashley
pythondev_help_Ashley_2019-01-26T12:49:19.625400
1,548,506,959.6254
4,418
pythondev
help
can i download this tool?
2019-01-26T12:55:31.626000
Janessa
pythondev_help_Janessa_2019-01-26T12:55:31.626000
1,548,507,331.626
4,419
pythondev
help
oh, no you just boot into the install media that you installed it from
2019-01-26T12:58:53.626400
Ashley
pythondev_help_Ashley_2019-01-26T12:58:53.626400
1,548,507,533.6264
4,420