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
like you wanted to reinstall it
2019-01-26T12:59:00.626700
Ashley
pythondev_help_Ashley_2019-01-26T12:59:00.626700
1,548,507,540.6267
4,421
pythondev
help
it should be something like "Installation repair/diagnostic" or something
2019-01-26T12:59:31.627200
Ashley
pythondev_help_Ashley_2019-01-26T12:59:31.627200
1,548,507,571.6272
4,422
pythondev
help
aha ok, thnx
2019-01-26T13:01:20.627600
Janessa
pythondev_help_Janessa_2019-01-26T13:01:20.627600
1,548,507,680.6276
4,423
pythondev
help
np
2019-01-26T13:02:04.627800
Ashley
pythondev_help_Ashley_2019-01-26T13:02:04.627800
1,548,507,724.6278
4,424
pythondev
help
There was decorator for adding a function that is not a method to a class, what was it
2019-01-26T14:02:12.629000
Coleen
pythondev_help_Coleen_2019-01-26T14:02:12.629000
1,548,511,332.629
4,425
pythondev
help
I think you might be thinking of monkey-patching
2019-01-26T14:03:10.629300
Hiroko
pythondev_help_Hiroko_2019-01-26T14:03:10.629300
1,548,511,390.6293
4,426
pythondev
help
`@staticmethod`?
2019-01-26T14:03:21.629700
Sasha
pythondev_help_Sasha_2019-01-26T14:03:21.629700
1,548,511,401.6297
4,427
pythondev
help
I wouldn't worry about that for now
2019-01-26T14:03:23.629800
Ashley
pythondev_help_Ashley_2019-01-26T14:03:23.629800
1,548,511,403.6298
4,428
pythondev
help
Try to keep the functions in a class related to the state of the object
2019-01-26T14:03:39.630300
Ashley
pythondev_help_Ashley_2019-01-26T14:03:39.630300
1,548,511,419.6303
4,429
pythondev
help
<@Thomasina> thats it
2019-01-26T14:04:00.631100
Coleen
pythondev_help_Coleen_2019-01-26T14:04:00.631100
1,548,511,440.6311
4,430
pythondev
help
If they don't use `self`, then it probably doesn't need to be a function for that class
2019-01-26T14:04:02.631300
Ashley
pythondev_help_Ashley_2019-01-26T14:04:02.631300
1,548,511,442.6313
4,431
pythondev
help
I like `@staticmethod` for db models for entity utility functions. They don't use `self`, but produce instances that do. :upside_down_face:
2019-01-26T14:31:37.636000
Somer
pythondev_help_Somer_2019-01-26T14:31:37.636000
1,548,513,097.636
4,432
pythondev
help
is using **kwargs in function arguments considered evil?
2019-01-26T14:57:46.637400
Coleen
pythondev_help_Coleen_2019-01-26T14:57:46.637400
1,548,514,666.6374
4,433
pythondev
help
Depends on how you use it. Passing arguments from a child class to a superclass, for instance, is pretty standard.
2019-01-26T15:01:18.638500
Sasha
pythondev_help_Sasha_2019-01-26T15:01:18.638500
1,548,514,878.6385
4,434
pythondev
help
no, from one func to another
2019-01-26T15:01:39.638900
Coleen
pythondev_help_Coleen_2019-01-26T15:01:39.638900
1,548,514,899.6389
4,435
pythondev
help
Again, depends. Sometimes it's an elegant simplification, other times it's an obscure hack, heh heh.
2019-01-26T15:05:23.639800
Sasha
pythondev_help_Sasha_2019-01-26T15:05:23.639800
1,548,515,123.6398
4,436
pythondev
help
its just that the number of parameters is so large
2019-01-26T15:05:37.640100
Coleen
pythondev_help_Coleen_2019-01-26T15:05:37.640100
1,548,515,137.6401
4,437
pythondev
help
an if i change it in one function i need to change it in the other as well
2019-01-26T15:05:49.640500
Coleen
pythondev_help_Coleen_2019-01-26T15:05:49.640500
1,548,515,149.6405
4,438
pythondev
help
very error probe
2019-01-26T15:05:59.640800
Coleen
pythondev_help_Coleen_2019-01-26T15:05:59.640800
1,548,515,159.6408
4,439
pythondev
help
prone
2019-01-26T15:06:01.641000
Coleen
pythondev_help_Coleen_2019-01-26T15:06:01.641000
1,548,515,161.641
4,440
pythondev
help
A large number of parameters that's common across functions is often a sign that you should be putting them together into a class that holds the parameter information.
2019-01-26T15:07:09.641800
Sasha
pythondev_help_Sasha_2019-01-26T15:07:09.641800
1,548,515,229.6418
4,441
pythondev
help
that's what i was worried about :smile:
2019-01-26T15:07:43.642100
Coleen
pythondev_help_Coleen_2019-01-26T15:07:43.642100
1,548,515,263.6421
4,442
pythondev
help
Or possibly make a simple compound object that holds the parameters together, like a dataclass / named tuple.
2019-01-26T15:09:40.643100
Sasha
pythondev_help_Sasha_2019-01-26T15:09:40.643100
1,548,515,380.6431
4,443
pythondev
help
New in version 3.7 :slightly_smiling_face:
2019-01-26T15:21:43.643300
Coleen
pythondev_help_Coleen_2019-01-26T15:21:43.643300
1,548,516,103.6433
4,444
pythondev
help
If I have a multiline f-string like ``` f""" j = {self.j} ! resulting j of ph-pairs parity = {self.parity} ! parity of ph-pairs 1:+ 0:-""" ```
2019-01-26T16:03:10.644100
Coleen
pythondev_help_Coleen_2019-01-26T16:03:10.644100
1,548,518,590.6441
4,445
pythondev
help
How can I align the string on the !
2019-01-26T16:03:36.644400
Coleen
pythondev_help_Coleen_2019-01-26T16:03:36.644400
1,548,518,616.6444
4,446
pythondev
help
Not knowing how many characters self.j or self.parity will have
2019-01-26T16:04:03.645000
Coleen
pythondev_help_Coleen_2019-01-26T16:04:03.645000
1,548,518,643.645
4,447
pythondev
help
Use `\t`, and don't use huge f-strings like that
2019-01-26T16:04:57.645400
Jonas
pythondev_help_Jonas_2019-01-26T16:04:57.645400
1,548,518,697.6454
4,448
pythondev
help
Why not
2019-01-26T16:05:05.645600
Coleen
pythondev_help_Coleen_2019-01-26T16:05:05.645600
1,548,518,705.6456
4,449
pythondev
help
It's actually much longer, like a page
2019-01-26T16:05:29.645900
Coleen
pythondev_help_Coleen_2019-01-26T16:05:29.645900
1,548,518,729.6459
4,450
pythondev
help
It's a input file that I write to disk
2019-01-26T16:05:44.646300
Coleen
pythondev_help_Coleen_2019-01-26T16:05:44.646300
1,548,518,744.6463
4,451
pythondev
help
and all the rows are in the same format?
2019-01-26T16:06:10.646700
Jonas
pythondev_help_Jonas_2019-01-26T16:06:10.646700
1,548,518,770.6467
4,452
pythondev
help
var = something ! comment
2019-01-26T16:06:45.647200
Coleen
pythondev_help_Coleen_2019-01-26T16:06:45.647200
1,548,518,805.6472
4,453
pythondev
help
yes
2019-01-26T16:06:46.647400
Coleen
pythondev_help_Coleen_2019-01-26T16:06:46.647400
1,548,518,806.6474
4,454
pythondev
help
`"\n".join(f'{key} = {value} !{comment}' for key, value, comment in list_of_things)`
2019-01-26T16:07:23.648200
Jonas
pythondev_help_Jonas_2019-01-26T16:07:23.648200
1,548,518,843.6482
4,455
pythondev
help
f strings (and multi-line strings) are not a templating language, if you've got a huge "page long" string
2019-01-26T16:07:54.649100
Jonas
pythondev_help_Jonas_2019-01-26T16:07:54.649100
1,548,518,874.6491
4,456
pythondev
help
I'd look at something else
2019-01-26T16:08:03.649500
Jonas
pythondev_help_Jonas_2019-01-26T16:08:03.649500
1,548,518,883.6495
4,457
pythondev
help
Or use a template language
2019-01-26T16:08:03.649600
Hiroko
pythondev_help_Hiroko_2019-01-26T16:08:03.649600
1,548,518,883.6496
4,458
pythondev
help
<https://wiki.python.org/moin/Templating>
2019-01-26T16:08:07.649800
Hiroko
pythondev_help_Hiroko_2019-01-26T16:08:07.649800
1,548,518,887.6498
4,459
pythondev
help
What's the drawback on long f-strings?
2019-01-26T16:08:20.650100
Coleen
pythondev_help_Coleen_2019-01-26T16:08:20.650100
1,548,518,900.6501
4,460
pythondev
help
It's like a template with no grammar and no dependencies
2019-01-26T16:08:33.650600
Coleen
pythondev_help_Coleen_2019-01-26T16:08:33.650600
1,548,518,913.6506
4,461
pythondev
help
it's hard to read, looks terrible, impossible to extend when you need it, and anyone who looks at this will go 'wtf'
2019-01-26T16:09:19.651400
Jonas
pythondev_help_Jonas_2019-01-26T16:09:19.651400
1,548,518,959.6514
4,462
pythondev
help
:smile:
2019-01-26T16:09:28.651600
Coleen
pythondev_help_Coleen_2019-01-26T16:09:28.651600
1,548,518,968.6516
4,463
pythondev
help
:smile: but yeah like a couple of lines long is stretching it. you also run into alignment issues at the start
2019-01-26T16:10:01.652200
Jonas
pythondev_help_Jonas_2019-01-26T16:10:01.652200
1,548,519,001.6522
4,464
pythondev
help
and will have to dedent the first characters of each line. Looks horrible
2019-01-26T16:10:20.652800
Jonas
pythondev_help_Jonas_2019-01-26T16:10:20.652800
1,548,519,020.6528
4,465
pythondev
help
I'm using ``` def trim(docstring): if not docstring: return '' # Convert tabs to spaces (following the normal Python rules) # and split into a list of lines: lines = docstring.expandtabs().splitlines() # Determine minimum indentation (first line doesn't count): indent = float("inf") ...
2019-01-26T16:10:49.653200
Coleen
pythondev_help_Coleen_2019-01-26T16:10:49.653200
1,548,519,049.6532
4,466
pythondev
help
for that
2019-01-26T16:10:55.653400
Coleen
pythondev_help_Coleen_2019-01-26T16:10:55.653400
1,548,519,055.6534
4,467
pythondev
help
imagine a world
2019-01-26T16:11:02.653700
Jonas
pythondev_help_Jonas_2019-01-26T16:11:02.653700
1,548,519,062.6537
4,468
pythondev
help
where you didn't have to do that :joy:
2019-01-26T16:11:06.653900
Jonas
pythondev_help_Jonas_2019-01-26T16:11:06.653900
1,548,519,066.6539
4,469
pythondev
help
hahaha
2019-01-26T16:11:15.654200
Coleen
pythondev_help_Coleen_2019-01-26T16:11:15.654200
1,548,519,075.6542
4,470
pythondev
help
oh boy. <http://jinja.pocoo.org/docs/2.10/> plz
2019-01-26T16:11:24.655000
Jonas
pythondev_help_Jonas_2019-01-26T16:11:24.655000
1,548,519,084.655
4,471
pythondev
help
or the comprehension above
2019-01-26T16:11:31.655400
Jonas
pythondev_help_Jonas_2019-01-26T16:11:31.655400
1,548,519,091.6554
4,472
pythondev
help
i feel you're gonna tell me that world exists
2019-01-26T16:11:36.655700
Coleen
pythondev_help_Coleen_2019-01-26T16:11:36.655700
1,548,519,096.6557
4,473
pythondev
help
Template engine
2019-01-26T16:11:45.656100
Hiroko
pythondev_help_Hiroko_2019-01-26T16:11:45.656100
1,548,519,105.6561
4,474
pythondev
help
Jinja2
2019-01-26T16:11:51.656400
Hiroko
pythondev_help_Hiroko_2019-01-26T16:11:51.656400
1,548,519,111.6564
4,475
pythondev
help
but i never used it..
2019-01-26T16:12:00.656800
Coleen
pythondev_help_Coleen_2019-01-26T16:12:00.656800
1,548,519,120.6568
4,476
pythondev
help
it will take ages to set up
2019-01-26T16:12:06.657300
Coleen
pythondev_help_Coleen_2019-01-26T16:12:06.657300
1,548,519,126.6573
4,477
pythondev
help
The string-format functions can take a field width, like `f"{value:&lt;10}"` to left-justify into 10 characters. So you can get column alignment within some range like that.
2019-01-26T16:12:10.657600
Sasha
pythondev_help_Sasha_2019-01-26T16:12:10.657600
1,548,519,130.6576
4,478
pythondev
help
Ages? No.
2019-01-26T16:12:24.658200
Hiroko
pythondev_help_Hiroko_2019-01-26T16:12:24.658200
1,548,519,144.6582
4,479
pythondev
help
how do you know it will if you've never used it? :thinking_face:
2019-01-26T16:12:39.658900
Jonas
pythondev_help_Jonas_2019-01-26T16:12:39.658900
1,548,519,159.6589
4,480
pythondev
help
What's your goal with this? Is it a one off, to be forgotten when complete? Or is it to be worked on and maintained or extended?
2019-01-26T16:13:02.660300
Hiroko
pythondev_help_Hiroko_2019-01-26T16:13:02.660300
1,548,519,182.6603
4,481
pythondev
help
the time it took you to write the trim() method
2019-01-26T16:13:10.660500
Jonas
pythondev_help_Jonas_2019-01-26T16:13:10.660500
1,548,519,190.6605
4,482
pythondev
help
All I have is this ``` text_to write_to_file = f""" j = {self.j} ! resulting j of ph-pairs parity = {self.parity} ! parity of ph-pairs 1:+ 0:- ediffmaxu = 200.0 ! maximal excitation-energy particles ediffmaxd ...
2019-01-26T16:13:18.661100
Coleen
pythondev_help_Coleen_2019-01-26T16:13:18.661100
1,548,519,198.6611
4,483
pythondev
help
I would argue that applying good practices to either is a time saver
2019-01-26T16:13:29.661600
Hiroko
pythondev_help_Hiroko_2019-01-26T16:13:29.661600
1,548,519,209.6616
4,484
pythondev
help
Using the right tool for the right job
2019-01-26T16:13:38.662000
Hiroko
pythondev_help_Hiroko_2019-01-26T16:13:38.662000
1,548,519,218.662
4,485
pythondev
help
So I generate this and write it to file, that's all.
2019-01-26T16:14:01.662900
Coleen
pythondev_help_Coleen_2019-01-26T16:14:01.662900
1,548,519,241.6629
4,486
pythondev
help
Right now, your existing solution is a significant code smell
2019-01-26T16:14:06.663000
Hiroko
pythondev_help_Hiroko_2019-01-26T16:14:06.663000
1,548,519,246.663
4,487
pythondev
help
But what happens when you need to change it?
2019-01-26T16:14:16.663400
Hiroko
pythondev_help_Hiroko_2019-01-26T16:14:16.663400
1,548,519,256.6634
4,488
pythondev
help
I just edit the f-string
2019-01-26T16:14:26.664000
Coleen
pythondev_help_Coleen_2019-01-26T16:14:26.664000
1,548,519,266.664
4,489
pythondev
help
Or you hand it off to someone else to update it
2019-01-26T16:14:31.664500
Hiroko
pythondev_help_Hiroko_2019-01-26T16:14:31.664500
1,548,519,271.6645
4,490
pythondev
help
Personally, I would not thank you for dumping that in my lap :grinning:
2019-01-26T16:14:57.666200
Hiroko
pythondev_help_Hiroko_2019-01-26T16:14:57.666200
1,548,519,297.6662
4,491
pythondev
help
look, you can use whatever tool you want for the job <@Coleen>. If you wanted to embed this whole f string in a perl script that's executed by a shell command, go for it
2019-01-26T16:15:16.666900
Jonas
pythondev_help_Jonas_2019-01-26T16:15:16.666900
1,548,519,316.6669
4,492
pythondev
help
hahah
2019-01-26T16:15:24.667200
Coleen
pythondev_help_Coleen_2019-01-26T16:15:24.667200
1,548,519,324.6672
4,493
pythondev
help
but some tools are just not great.
2019-01-26T16:15:27.667500
Jonas
pythondev_help_Jonas_2019-01-26T16:15:27.667500
1,548,519,327.6675
4,494
pythondev
help
guys guys cmon
2019-01-26T16:15:30.667700
Coleen
pythondev_help_Coleen_2019-01-26T16:15:30.667700
1,548,519,330.6677
4,495
pythondev
help
f-strings are not great for writing a template in. You're duplicating lines everywhere
2019-01-26T16:15:44.668100
Jonas
pythondev_help_Jonas_2019-01-26T16:15:44.668100
1,548,519,344.6681
4,496
pythondev
help
break your lines up into a list
2019-01-26T16:15:49.668500
Jonas
pythondev_help_Jonas_2019-01-26T16:15:49.668500
1,548,519,349.6685
4,497
pythondev
help
pass this list into a template, or a comprehension
2019-01-26T16:15:56.668800
Jonas
pythondev_help_Jonas_2019-01-26T16:15:56.668800
1,548,519,356.6688
4,498
pythondev
help
then you won't have the issue you have *right now* where you need to go through 40+ lines of f-strings copy-pasting whatever alignment hack you come up with
2019-01-26T16:16:17.669400
Jonas
pythondev_help_Jonas_2019-01-26T16:16:17.669400
1,548,519,377.6694
4,499
pythondev
help
But then I don't see it nicely written all together
2019-01-26T16:16:25.669600
Coleen
pythondev_help_Coleen_2019-01-26T16:16:25.669600
1,548,519,385.6696
4,500
pythondev
help
So say I use a template, because I still want to have it all written out like this
2019-01-26T16:17:13.670400
Coleen
pythondev_help_Coleen_2019-01-26T16:17:13.670400
1,548,519,433.6704
4,501
pythondev
help
Where would be the gain
2019-01-26T16:17:22.670700
Coleen
pythondev_help_Coleen_2019-01-26T16:17:22.670700
1,548,519,442.6707
4,502
pythondev
help
No whitespaces at the begining?
2019-01-26T16:17:33.671100
Coleen
pythondev_help_Coleen_2019-01-26T16:17:33.671100
1,548,519,453.6711
4,503
pythondev
help
Im not arguing, just want to understand
2019-01-26T16:17:49.671400
Coleen
pythondev_help_Coleen_2019-01-26T16:17:49.671400
1,548,519,469.6714
4,504
pythondev
help
:slightly_smiling_face:
2019-01-26T16:18:09.672000
Coleen
pythondev_help_Coleen_2019-01-26T16:18:09.672000
1,548,519,489.672
4,505
pythondev
help
right now, not much, because you've already sunk X time into doing it this way. The real gain would be personal, you can see the before and after, experience using the right tool for the job, and then you can personally compare the two solutions and come to your own understanding of what is better
2019-01-26T16:18:39.673100
Jonas
pythondev_help_Jonas_2019-01-26T16:18:39.673100
1,548,519,519.6731
4,506
pythondev
help
perhaps we are all wrong, but maybe, just perhaps not.
2019-01-26T16:18:48.673500
Jonas
pythondev_help_Jonas_2019-01-26T16:18:48.673500
1,548,519,528.6735
4,507
pythondev
help
im sure you're actually right
2019-01-26T16:19:08.674100
Coleen
pythondev_help_Coleen_2019-01-26T16:19:08.674100
1,548,519,548.6741
4,508
pythondev
help
either way, the time we have spent discussing this, you could have done it
2019-01-26T16:19:09.674300
Jonas
pythondev_help_Jonas_2019-01-26T16:19:09.674300
1,548,519,549.6743
4,509
pythondev
help
For what it's worth, I'm on <@Coleen>’s side here. It's a pretty compact, obvious way to represent what he's trying to achieve. "Explicit is better than implicit."
2019-01-26T16:19:10.674400
Sasha
pythondev_help_Sasha_2019-01-26T16:19:10.674400
1,548,519,550.6744
4,510
pythondev
help
Using a template is just as explicit...?
2019-01-26T16:20:09.675100
Jonas
pythondev_help_Jonas_2019-01-26T16:20:09.675100
1,548,519,609.6751
4,511
pythondev
help
yes but introduces external dependency
2019-01-26T16:20:46.675800
Coleen
pythondev_help_Coleen_2019-01-26T16:20:46.675800
1,548,519,646.6758
4,512
pythondev
help
It is essentially a template. I'm not sure what's gained by pulling in a library to do the same thing a built-in feature handles.
2019-01-26T16:20:54.676000
Sasha
pythondev_help_Sasha_2019-01-26T16:20:54.676000
1,548,519,654.676
4,513
pythondev
help
Would you make the same argument in a discussion about requests vs urllib?
2019-01-26T16:21:19.676300
Jonas
pythondev_help_Jonas_2019-01-26T16:21:19.676300
1,548,519,679.6763
4,514
pythondev
help
If not, what's the difference here?
2019-01-26T16:21:45.676500
Jonas
pythondev_help_Jonas_2019-01-26T16:21:45.676500
1,548,519,705.6765
4,515
pythondev
help
"experimental python 3 support", really?
2019-01-26T16:22:52.677400
Coleen
pythondev_help_Coleen_2019-01-26T16:22:52.677400
1,548,519,772.6774
4,516
pythondev
help
just playing devils advocate. A list comprehension is a hell of a lot better than jinja, and better than essentially an unrolled one.
2019-01-26T16:23:37.678300
Jonas
pythondev_help_Jonas_2019-01-26T16:23:37.678300
1,548,519,817.6783
4,517
pythondev
help
But don't you need to unroll everything anyway to set up the input to the comprehension? You're not going to get away with less than one line per line.
2019-01-26T16:24:40.678900
Sasha
pythondev_help_Sasha_2019-01-26T16:24:40.678900
1,548,519,880.6789
4,518
pythondev
help
It's stable as hell in python 3, that section of the docs is really old. jinja 2.7 was released in *2013*
2019-01-26T16:25:18.679100
Jonas
pythondev_help_Jonas_2019-01-26T16:25:18.679100
1,548,519,918.6791
4,519
pythondev
help
ok, sounds good then :slightly_smiling_face:
2019-01-26T16:27:52.679400
Coleen
pythondev_help_Coleen_2019-01-26T16:27:52.679400
1,548,520,072.6794
4,520