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
I was doing `newfunc(afunc(*args))` in a recursive call. but `afunc` doesn’t take params, just returns a tuple
2019-01-20T11:05:04.860500
Hiroko
pythondev_help_Hiroko_2019-01-20T11:05:04.860500
1,547,982,304.8605
3,221
pythondev
help
with ```In [24]: def newfunc(*args): ...: newfunc(*afunc()) ...:```
2019-01-20T11:05:39.861000
Hiroko
pythondev_help_Hiroko_2019-01-20T11:05:39.861000
1,547,982,339.861
3,222
pythondev
help
and called with `newfunc(1, 2), I get a recursionerror
2019-01-20T11:05:55.861400
Hiroko
pythondev_help_Hiroko_2019-01-20T11:05:55.861400
1,547,982,355.8614
3,223
pythondev
help
which is to be expected, since no base case is defined
2019-01-20T11:06:03.861700
Hiroko
pythondev_help_Hiroko_2019-01-20T11:06:03.861700
1,547,982,363.8617
3,224
pythondev
help
you can also do `x, y, *z = (1,2,3,4,5,6,7)`
2019-01-20T11:08:36.862100
Jonas
pythondev_help_Jonas_2019-01-20T11:08:36.862100
1,547,982,516.8621
3,225
pythondev
help
or `x, *y, z = (1,2,3,4,5,6)`
2019-01-20T11:08:50.862400
Jonas
pythondev_help_Jonas_2019-01-20T11:08:50.862400
1,547,982,530.8624
3,226
pythondev
help
Ew
2019-01-20T11:10:02.862700
Marita
pythondev_help_Marita_2019-01-20T11:10:02.862700
1,547,982,602.8627
3,227
pythondev
help
ew?
2019-01-20T11:10:45.863000
Jonas
pythondev_help_Jonas_2019-01-20T11:10:45.863000
1,547,982,645.863
3,228
pythondev
help
The syntax for that. I’m assuming that where the asterisk is is where most of the elements are going?
2019-01-20T11:11:49.863900
Marita
pythondev_help_Marita_2019-01-20T11:11:49.863900
1,547,982,709.8639
3,229
pythondev
help
seems clean to me. `x, *y, z` means x is the first element, z is the last and everything in-between goes into y
2019-01-20T11:14:04.864700
Jonas
pythondev_help_Jonas_2019-01-20T11:14:04.864700
1,547,982,844.8647
3,230
pythondev
help
Yeah. Just not a fan of the syntax. Personal preference. :)
2019-01-20T11:15:37.865500
Marita
pythondev_help_Marita_2019-01-20T11:15:37.865500
1,547,982,937.8655
3,231
pythondev
help
unpacking syntax is only beautiful in the eyes of the dev who wrote it xD anyone else would have an issue with it.
2019-01-20T11:21:27.866200
Lessie
pythondev_help_Lessie_2019-01-20T11:21:27.866200
1,547,983,287.8662
3,232
pythondev
help
What alternative would you suggest?
2019-01-20T11:23:03.866700
Hiroko
pythondev_help_Hiroko_2019-01-20T11:23:03.866700
1,547,983,383.8667
3,233
pythondev
help
Slices. [0], [-1], [1:-2]
2019-01-20T11:35:51.868000
Marita
pythondev_help_Marita_2019-01-20T11:35:51.868000
1,547,984,151.868
3,234
pythondev
help
Once you see the newer tuple unpacking, it's significantly cleaner imo
2019-01-20T11:38:52.868500
Bethany
pythondev_help_Bethany_2019-01-20T11:38:52.868500
1,547,984,332.8685
3,235
pythondev
help
so it would be `x[0], y[-1], z[1:-2] = (1,2,3,4,5,6,7)`?
2019-01-20T11:40:38.869100
Jonas
pythondev_help_Jonas_2019-01-20T11:40:38.869100
1,547,984,438.8691
3,236
pythondev
help
that seems horrific to me
2019-01-20T11:40:44.869300
Jonas
pythondev_help_Jonas_2019-01-20T11:40:44.869300
1,547,984,444.8693
3,237
pythondev
help
I’d store the set into a variable and use slices. arr = (1,2,3,4,5,6,7) x, y, z = arr[0], arr[1:-2], arr[-1]
2019-01-20T12:01:49.871700
Marita
pythondev_help_Marita_2019-01-20T12:01:49.871700
1,547,985,709.8717
3,238
pythondev
help
That, to me, is worse readability than the existing python implementation
2019-01-20T12:07:13.872500
Hiroko
pythondev_help_Hiroko_2019-01-20T12:07:13.872500
1,547,986,033.8725
3,239
pythondev
help
My personal preference. I’d rather have code that I know what it does at first glance instead of having to look up what the asterisk does in a tuple unpacking.
2019-01-20T12:13:12.874400
Marita
pythondev_help_Marita_2019-01-20T12:13:12.874400
1,547,986,392.8744
3,240
pythondev
help
But tuple unpacking and the behavior of an asterisk is default in python and would have questions about your approach when reviewing any PR that includes this.
2019-01-20T12:17:16.877200
Hiroko
pythondev_help_Hiroko_2019-01-20T12:17:16.877200
1,547,986,636.8772
3,241
pythondev
help
And would there be some performance differences between the two, with slicing being less performant?
2019-01-20T12:19:03.880100
Hiroko
pythondev_help_Hiroko_2019-01-20T12:19:03.880100
1,547,986,743.8801
3,242
pythondev
help
It's like iterating over indices (using `for idx in range(len(iterable))` instead of just iterating over elements (or using `enumerate`). For a yesterday C(++) student `for idx, elem in enumerate(iterable)` may look worse, but this is how python works
2019-01-20T12:19:39.880800
Chester
pythondev_help_Chester_2019-01-20T12:19:39.880800
1,547,986,779.8808
3,243
pythondev
help
This is what any python programmer expects to see
2019-01-20T12:20:07.881200
Chester
pythondev_help_Chester_2019-01-20T12:20:07.881200
1,547,986,807.8812
3,244
pythondev
help
And yes, if you don't use `enumerate` much in your code, you'll need to look up what it does
2019-01-20T12:20:48.881700
Chester
pythondev_help_Chester_2019-01-20T12:20:48.881700
1,547,986,848.8817
3,245
pythondev
help
Can anybody help me with this question ? <https://codereview.stackexchange.com/q/211781/166600>
2019-01-20T12:25:53.882100
Roxanne
pythondev_help_Roxanne_2019-01-20T12:25:53.882100
1,547,987,153.8821
3,246
pythondev
help
none of that is particularly pythonic :confused:
2019-01-20T12:27:25.882600
Jonas
pythondev_help_Jonas_2019-01-20T12:27:25.882600
1,547,987,245.8826
3,247
pythondev
help
the reason the `process_matches` is slow is the mongodb insert I expect
2019-01-20T12:27:59.882800
Jonas
pythondev_help_Jonas_2019-01-20T12:27:59.882800
1,547,987,279.8828
3,248
pythondev
help
and it’s full of mixed concerns
2019-01-20T12:29:22.883000
Jonas
pythondev_help_Jonas_2019-01-20T12:29:22.883000
1,547,987,362.883
3,249
pythondev
help
what do you mean with mixed concerns ?
2019-01-20T12:34:42.883200
Roxanne
pythondev_help_Roxanne_2019-01-20T12:34:42.883200
1,547,987,682.8832
3,250
pythondev
help
how should I tackle this instead ?
2019-01-20T12:35:05.883400
Roxanne
pythondev_help_Roxanne_2019-01-20T12:35:05.883400
1,547,987,705.8834
3,251
pythondev
help
<@Roxanne> IMO for python and other languages in general, your biggest enemy will likely be your ability to maintain, rewrite, and extend upon large amounts of code. If you have a giant function, you should break it down anyway, regardless of performance. Whenever you have a slice of code that you can sum up with a sim...
2019-01-20T12:51:55.891500
Ashley
pythondev_help_Ashley_2019-01-20T12:51:55.891500
1,547,988,715.8915
3,252
pythondev
help
my trade off was basically having to : 1. Keep in self a big list of dictionaries (up to 20 mbs) 2. Do 3 `for` iteartions in separated methods instead of 1 (process_telemetry, process_match_scores, process_players_scores) But actually makes sense if I end up, for instance, having better control of test or using async...
2019-01-20T12:56:22.894200
Roxanne
pythondev_help_Roxanne_2019-01-20T12:56:22.894200
1,547,988,982.8942
3,253
pythondev
help
Hi guys by using flask app in my dB I’ve got a student data such as attendance and marks in front end if a user types his number the result will be display like you’re eligible for scholarship how to write using flask
2019-01-20T13:56:11.897600
Mercy
pythondev_help_Mercy_2019-01-20T13:56:11.897600
1,547,992,571.8976
3,254
pythondev
help
what is your question, <@Mercy>?
2019-01-20T14:04:19.898000
Hiroko
pythondev_help_Hiroko_2019-01-20T14:04:19.898000
1,547,993,059.898
3,255
pythondev
help
How to write that query and display the output as you’re eligible for sch or not eligible
2019-01-20T14:05:24.899400
Mercy
pythondev_help_Mercy_2019-01-20T14:05:24.899400
1,547,993,124.8994
3,256
pythondev
help
have you gone through the Flask tutorial or the sqlalchemy tutorial?
2019-01-20T14:06:43.899900
Hiroko
pythondev_help_Hiroko_2019-01-20T14:06:43.899900
1,547,993,203.8999
3,257
pythondev
help
Yes
2019-01-20T14:07:06.900500
Mercy
pythondev_help_Mercy_2019-01-20T14:07:06.900500
1,547,993,226.9005
3,258
pythondev
help
sounds like you have a two part problem: db query and result display in the browser
2019-01-20T14:07:09.900800
Hiroko
pythondev_help_Hiroko_2019-01-20T14:07:09.900800
1,547,993,229.9008
3,259
pythondev
help
as far as the first, it would depend on what you have for your db schema in sqlalchmey, assuming you’re using that for your flask app
2019-01-20T14:09:14.901600
Hiroko
pythondev_help_Hiroko_2019-01-20T14:09:14.901600
1,547,993,354.9016
3,260
pythondev
help
the second would depend on whether you’re using flask to render a template, or sending it to the browser in an API response to be rendered with javascript
2019-01-20T14:09:41.902500
Hiroko
pythondev_help_Hiroko_2019-01-20T14:09:41.902500
1,547,993,381.9025
3,261
pythondev
help
Sqlalchmey
2019-01-20T14:09:42.902600
Mercy
pythondev_help_Mercy_2019-01-20T14:09:42.902600
1,547,993,382.9026
3,262
pythondev
help
I don’t know sqlalchemy or flask, sorry
2019-01-20T14:11:41.903000
Hiroko
pythondev_help_Hiroko_2019-01-20T14:11:41.903000
1,547,993,501.903
3,263
pythondev
help
but there is a <#C0LN2AD7T|flask> channel here, as well as <#C1PB8ME48|sqlalchemy>. you could possibly ask there for some more targeted help if you don’t get relevant help here
2019-01-20T14:12:17.904200
Hiroko
pythondev_help_Hiroko_2019-01-20T14:12:17.904200
1,547,993,537.9042
3,264
pythondev
help
Currently using VSCode for my project. Does anyone know how to get rid of the red lines on Opencv methods. Like, ``` import cv2 ... blur = cv2.GaussianBlur(img, Kernel_Shape, sigma) ``` The `cv2` to will be underlined. This is because vscode cannot find the package. But it is there.
2019-01-20T14:12:38.904600
Shanna
pythondev_help_Shanna_2019-01-20T14:12:38.904600
1,547,993,558.9046
3,265
pythondev
help
<https://github.com/Microsoft/vscode-python/issues/1993>
2019-01-20T14:14:15.904900
Hiroko
pythondev_help_Hiroko_2019-01-20T14:14:15.904900
1,547,993,655.9049
3,266
pythondev
help
I have the hardest times with code snippets in Slack.....
2019-01-20T14:14:56.906100
Shanna
pythondev_help_Shanna_2019-01-20T14:14:56.906100
1,547,993,696.9061
3,267
pythondev
help
specifically, make sure the `pylint` and `opencv-python` packages are installed to the venv you’re using
2019-01-20T14:15:01.906200
Hiroko
pythondev_help_Hiroko_2019-01-20T14:15:01.906200
1,547,993,701.9062
3,268
pythondev
help
with that, a screenshot would probably be better, since you can’t replicate the vscode editor experience here
2019-01-20T14:15:20.906700
Hiroko
pythondev_help_Hiroko_2019-01-20T14:15:20.906700
1,547,993,720.9067
3,269
pythondev
help
but check out that issue
2019-01-20T14:15:31.907000
Hiroko
pythondev_help_Hiroko_2019-01-20T14:15:31.907000
1,547,993,731.907
3,270
pythondev
help
Its pretty much that issue. Thanks! And sorry about the crappy message when you first read it.
2019-01-20T14:16:01.907600
Shanna
pythondev_help_Shanna_2019-01-20T14:16:01.907600
1,547,993,761.9076
3,271
pythondev
help
I do find it interesting how it only happens with this package.
2019-01-20T14:17:01.908000
Shanna
pythondev_help_Shanna_2019-01-20T14:17:01.908000
1,547,993,821.908
3,272
pythondev
help
¯\_(ツ)_/¯
2019-01-20T14:17:52.908100
Hiroko
pythondev_help_Hiroko_2019-01-20T14:17:52.908100
1,547,993,872.9081
3,273
pythondev
help
hope that helps.
2019-01-20T14:19:14.908400
Hiroko
pythondev_help_Hiroko_2019-01-20T14:19:14.908400
1,547,993,954.9084
3,274
pythondev
help
<@Hiroko> :taco:
2019-01-20T14:23:21.908900
Shanna
pythondev_help_Shanna_2019-01-20T14:23:21.908900
1,547,994,201.9089
3,275
pythondev
help
i use os.stat to find the size, but the size i get is in bytes, how to get the size in gb
2019-01-20T15:18:08.909100
Lanelle
pythondev_help_Lanelle_2019-01-20T15:18:08.909100
1,547,997,488.9091
3,276
pythondev
help
if you know the byte size, convert it
2019-01-20T15:20:24.909400
Hiroko
pythondev_help_Hiroko_2019-01-20T15:20:24.909400
1,547,997,624.9094
3,277
pythondev
help
its a fairly simple conversion. 1 GB is 1^e+9 bytes
2019-01-20T15:21:04.910100
Hiroko
pythondev_help_Hiroko_2019-01-20T15:21:04.910100
1,547,997,664.9101
3,278
pythondev
help
4952197120 is the byte size, should i just divide by `1000000000`
2019-01-20T15:21:05.910200
Lanelle
pythondev_help_Lanelle_2019-01-20T15:21:05.910200
1,547,997,665.9102
3,279
pythondev
help
no, that number is 100,000,000
2019-01-20T15:21:28.910500
Hiroko
pythondev_help_Hiroko_2019-01-20T15:21:28.910500
1,547,997,688.9105
3,280
pythondev
help
you want to divide by 1 billion….
2019-01-20T15:21:36.910800
Hiroko
pythondev_help_Hiroko_2019-01-20T15:21:36.910800
1,547,997,696.9108
3,281
pythondev
help
hmm but the number is not accurate...
2019-01-20T15:24:50.911100
Lanelle
pythondev_help_Lanelle_2019-01-20T15:24:50.911100
1,547,997,890.9111
3,282
pythondev
help
Sometimes a GB is considered to be 2^30, or 1073741824 bytes.
2019-01-20T15:30:09.911900
Sasha
pythondev_help_Sasha_2019-01-20T15:30:09.911900
1,547,998,209.9119
3,283
pythondev
help
depends if you want GB or GiB
2019-01-20T15:34:01.912100
Hiroko
pythondev_help_Hiroko_2019-01-20T15:34:01.912100
1,547,998,441.9121
3,284
pythondev
help
^
2019-01-20T15:34:11.912300
Ashley
pythondev_help_Ashley_2019-01-20T15:34:11.912300
1,547,998,451.9123
3,285
pythondev
help
"Giga" is the decimal-based prefix, while "Gibi" is the binary-based prefix
2019-01-20T15:35:04.913200
Ashley
pythondev_help_Ashley_2019-01-20T15:35:04.913200
1,547,998,504.9132
3,286
pythondev
help
I am copying files over network; now my condition is total file sizes are greater than 100; it should not proceed the batch fully instead it should - split the batches in equal sizes and copy it
2019-01-20T15:56:24.914400
Lanelle
pythondev_help_Lanelle_2019-01-20T15:56:24.914400
1,547,999,784.9144
3,287
pythondev
help
how do i split the batches in equal sizes
2019-01-20T15:56:33.914800
Lanelle
pythondev_help_Lanelle_2019-01-20T15:56:33.914800
1,547,999,793.9148
3,288
pythondev
help
files are stored in a list
2019-01-20T15:56:39.915200
Lanelle
pythondev_help_Lanelle_2019-01-20T15:56:39.915200
1,547,999,799.9152
3,289
pythondev
help
why are you doing this in python and not using rsync?
2019-01-20T15:58:38.915800
Hiroko
pythondev_help_Hiroko_2019-01-20T15:58:38.915800
1,547,999,918.9158
3,290
pythondev
help
<@Hiroko> this python program internally calls rsync
2019-01-20T16:00:45.917100
Lanelle
pythondev_help_Lanelle_2019-01-20T16:00:45.917100
1,548,000,045.9171
3,291
pythondev
help
:thumbsup: so why do you need to batch based on file size?
2019-01-20T16:01:42.918500
Hiroko
pythondev_help_Hiroko_2019-01-20T16:01:42.918500
1,548,000,102.9185
3,292
pythondev
help
i use multithreading to copy files in parallel
2019-01-20T16:02:15.919600
Lanelle
pythondev_help_Lanelle_2019-01-20T16:02:15.919600
1,548,000,135.9196
3,293
pythondev
help
so the file sizes range from 10gb to 15gb. i dont want to clog the network at once
2019-01-20T16:02:33.920200
Lanelle
pythondev_help_Lanelle_2019-01-20T16:02:33.920200
1,548,000,153.9202
3,294
pythondev
help
<https://www.cyberciti.biz/faq/how-to-set-keep-rsync-from-using-all-your-bandwidth-on-linux-unix/>
2019-01-20T16:03:34.920400
Hiroko
pythondev_help_Hiroko_2019-01-20T16:03:34.920400
1,548,000,214.9204
3,295
pythondev
help
You can use a transfer speed limiter with rsync
2019-01-20T16:03:58.921200
Hiroko
pythondev_help_Hiroko_2019-01-20T16:03:58.921200
1,548,000,238.9212
3,296
pythondev
help
<@Hiroko> hmm nice one. but i dont think this will exactly fit my need
2019-01-20T16:04:59.921600
Lanelle
pythondev_help_Lanelle_2019-01-20T16:04:59.921600
1,548,000,299.9216
3,297
pythondev
help
any other better approaches to control this in python
2019-01-20T16:05:30.922100
Lanelle
pythondev_help_Lanelle_2019-01-20T16:05:30.922100
1,548,000,330.9221
3,298
pythondev
help
I want to split a list into batches
2019-01-20T16:05:42.922400
Lanelle
pythondev_help_Lanelle_2019-01-20T16:05:42.922400
1,548,000,342.9224
3,299
pythondev
help
What do you have so far?
2019-01-20T16:06:08.922800
Hiroko
pythondev_help_Hiroko_2019-01-20T16:06:08.922800
1,548,000,368.9228
3,300
pythondev
help
Would help to see something
2019-01-20T16:06:22.923200
Hiroko
pythondev_help_Hiroko_2019-01-20T16:06:22.923200
1,548,000,382.9232
3,301
pythondev
help
``` test=partial(copy_archive,to_local=False) with ThreadPoolExecutor(max_workers=workers) as executor: result = list(executor.map(test, source, destination))```
2019-01-20T16:06:47.923500
Lanelle
pythondev_help_Lanelle_2019-01-20T16:06:47.923500
1,548,000,407.9235
3,302
pythondev
help
source is a list of file
2019-01-20T16:07:03.923700
Lanelle
pythondev_help_Lanelle_2019-01-20T16:07:03.923700
1,548,000,423.9237
3,303
pythondev
help
``` total_size = sum(os.path.getsize(file) for file in source) if total_size &gt; 100000000000: &lt;&lt;&lt; then split the source list into batches &gt;&gt;&gt;```
2019-01-20T16:07:48.924300
Lanelle
pythondev_help_Lanelle_2019-01-20T16:07:48.924300
1,548,000,468.9243
3,304
pythondev
help
ok, so what you want to do is a variant of the knapsack problem
2019-01-20T16:10:14.924700
Hiroko
pythondev_help_Hiroko_2019-01-20T16:10:14.924700
1,548,000,614.9247
3,305
pythondev
help
you have a number of sacks that can hold X number of items based on provided constraints, like weight, item dimensions, etc
2019-01-20T16:10:59.925600
Hiroko
pythondev_help_Hiroko_2019-01-20T16:10:59.925600
1,548,000,659.9256
3,306
pythondev
help
here, you want to split up your source list into a series of packages with Y limit for total file size
2019-01-20T16:11:33.926200
Hiroko
pythondev_help_Hiroko_2019-01-20T16:11:33.926200
1,548,000,693.9262
3,307
pythondev
help
suree
2019-01-20T16:11:46.926400
Lanelle
pythondev_help_Lanelle_2019-01-20T16:11:46.926400
1,548,000,706.9264
3,308
pythondev
help
<https://en.wikipedia.org/wiki/Knapsack_problem>
2019-01-20T16:12:47.926600
Hiroko
pythondev_help_Hiroko_2019-01-20T16:12:47.926600
1,548,000,767.9266
3,309
pythondev
help
yes, how would i implement something simple in python
2019-01-20T16:13:51.927100
Lanelle
pythondev_help_Lanelle_2019-01-20T16:13:51.927100
1,548,000,831.9271
3,310
pythondev
help
I would read about it and google. try to come up with your solution
2019-01-20T16:15:09.927600
Hiroko
pythondev_help_Hiroko_2019-01-20T16:15:09.927600
1,548,000,909.9276
3,311
pythondev
help
and when you run into trouble, post what you have here and what the problem you’re having is
2019-01-20T16:15:23.928000
Hiroko
pythondev_help_Hiroko_2019-01-20T16:15:23.928000
1,548,000,923.928
3,312
pythondev
help
I don’t think you’ll find a receptive audience to do the work for you
2019-01-20T16:16:01.928500
Hiroko
pythondev_help_Hiroko_2019-01-20T16:16:01.928500
1,548,000,961.9285
3,313
pythondev
help
:+1:
2019-01-20T16:16:32.928700
Lanelle
pythondev_help_Lanelle_2019-01-20T16:16:32.928700
1,548,000,992.9287
3,314
pythondev
help
Ok as of now I am able to do something like this ```#batch = a[:len(source)/2] #batch1 = a[len(source)/2:]```
2019-01-20T16:32:27.929700
Lanelle
pythondev_help_Lanelle_2019-01-20T16:32:27.929700
1,548,001,947.9297
3,315
pythondev
help
is there a library or anything (:newbie alert:) that can provide an interface that i can filter data like the autofilter function in popular spreadsheets today? the data is currently in csv file or mongo (preferred - network based) edited for spelling typo: _data_ *not* _date_
2019-01-20T18:32:46.931300
Joye
pythondev_help_Joye_2019-01-20T18:32:46.931300
1,548,009,166.9313
3,316
pythondev
help
yep
2019-01-20T19:41:26.931900
Ashley
pythondev_help_Ashley_2019-01-20T19:41:26.931900
1,548,013,286.9319
3,317
pythondev
help
not network based, as that would require the thing on the other end of the network to support it, and then that would just be the interface you'd filter with
2019-01-20T19:42:25.932900
Ashley
pythondev_help_Ashley_2019-01-20T19:42:25.932900
1,548,013,345.9329
3,318
pythondev
help
but you can just ingest the CSV, and use `datetime` and the `strptime` method to check the date and time of each row and do sommething based on that
2019-01-20T19:45:56.934000
Ashley
pythondev_help_Ashley_2019-01-20T19:45:56.934000
1,548,013,556.934
3,319
pythondev
help
is there a best practice as far as creating functions that depend on importing other modules. ie: put the import inside the function, or wait till someone attempts to call it and wait for it to error out to identify the dependency and import at the top of the program?
2019-01-20T22:59:13.935000
Stacy
pythondev_help_Stacy_2019-01-20T22:59:13.935000
1,548,025,153.935
3,320