« first day (3023 days earlier)      last day (2149 days later) » 

00:52
Hey, does anyone have any experience with e-commerce websites?
01:25
Posted my forward fill question on the site if anyone has a solution: stackoverflow.com/questions/54357758/…
 
2 hours later…
03:28
@piRSquared I don't mean to keep nagging you with these kinds of questions, but I took some actions on some old answers I wanted you to confirm are justified.
1) I added an answer to [this old question](https://stackoverflow.com/questions/21415661/logic-operators-for-boolean-indexing-in-pandas/54358361#54358361)
2) I then took the liberty of closing [this newer question](https://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o?noredirect=1&lq=1) as duplicate of the older question, as the underlying cause for the questions was identi
looks like formatting is bork. Sorry about that.
 
4 hours later…
08:04
Morning
08:14
Afternoon.
Evening.
afternoon
Happy Friday!
PEP 572 (assignment expressions) is officially merged! 🎉 I still can’t believe that I implemented a new syntax in one of my favorite languages. 🙌🏻 #walrusoperator #python
5
08:37
@shad0w_wa1k3r So. It has come to this. :(
I think at this point the only thing we can do is, move on and accept the new life :-p
09:08
@shad0w_wa1k3r i still dont really get what the heck this := is supposed to do
It's pretty straight-forward, it helps you reduce a couple of lines of code (fact) in exchange for the readability (opinion).
so its basically just a way to write less lines of code
haha, that was what i was just gonna say
it seems pretty meh all around
or maybe, to put it in a pro-572 way, a less-redundant way of assignments.
09:12
does it make any performance improvements?
none or negligible
and how does that compare to general performance losses for the core language?
no idea, if you do find something on that, do post here :)
yea, im curious if its just benign or bloatware
It's reasoning should be all there in the PEP.
09:49
@Skyler It should have zero impact on runtime, and a microscopic impact on compilation time. It'll make it possible to do certain things in comprehensions that currently require computing certain things 2 (or more) times, or re-writing it as a proper for loop instead of a comprehension.
The worry is that people will therefore write less readable code, packing too much into their comprehensions.
10:19
I like the functionality. I am going to gradually start incorporating it into my posts as more and more switch to 3.7...
10:29
@coldspeed good luck with asspressions on 3.7
Sorry, 3.8
I'll blame you personally for abuse I see on SO
ha, bring it on
Don't use eval, don't use dynamic variable names. Don't use asspressions.
naw, it wasn't added into the language to receive the same treatment eval and globals have
at the very least
10:32
Guido's intentions are irrelevant
it's your responsibility not to teach antipatterns on SO
^
Soon we'll have people asking all sorts of questions related to := ...
A whole new class of hurt!
Being hip and clever « not letting noobs write crap code
this is where the fun begins
Is it just me or the "impact" / "people reached" numbers suddenly go up?
10:37
I don't understand the need to revolt just to preserve that extra line of code you could ditch if you did use them
@Skyler you can search the transcript for "asspression" for earlier discussions
oh okay, this was already discussed. I'll read through those as well.
@coldspeed useful in 10% of use cases, applicable but harmful in 90%. Need a non-noob to know the difference.
@coldspeed ad nauseam
would a lambda function technically fall under that label
Only @Arne will be happy :P ^
10:39
So then why not advertise it for the 10% of cases it would be good for and warn noobs to be responsible with it the rest of the time
@shad0w_wa1k3r I'm at 1.1M and I don't recall celebrating the 1M (searched my twitter to no avail)
@coldspeed IMO the need comes from "how bad can it be when it is done bad".
@coldspeed that's the least one should do when using it. Will be as useful as warning against exec with code using exec
@Skyler a bit, but lambdas aren't that less readable
Hmm
I haven't completely changed my mind but I do understand where you're coming from
i guess we'll elevate asspressions to hax0rz status. Only pros can use it
seconded :-p
That's my intention. Use responsibly -> not fit for SO
Search the transcript also for "572" and the real name for discussions not involving me
10:51
hey @shad0w_wa1k3r i just peeked at your twitter, tad off topic but any places you'd recommend looking into for getting started in blockchain (especially if i can reuse my experience in python)
getting started in blockchain is too broad, narrow your purpose :)
exactly the question i was hoping for, ethereum development in particular
@AndrasDeak Okay, will do
i know it uses solidity for "smart contracts" but dont quite fully get the dapp idea, is it just a VM thats a container for any other project in another language?
You'll have to read up 2-3 different articles / tutorials on EVM (Ethereum VM) for that. Try starting with github.com/ethereum/wiki/wiki/…
Solidity is just a language that you write the contracts in, which are then processed by the EVM. Ethereum has quite some projects (including VM implementation I think) that are Python based.
Should be easily googleable / github searchable.
10:59
also have you found any communities you found particularly helpful to join?
Haven't actively looked for it, but there's ethereum.stackexchange.com & reddit.com/r/ethereum
If you want to actively dive into smart contracts & / or DAPPs then Python won't be as helpful as JavaScript.
Yea, I've been getting that impression. Joined both a bit ago but figured i might as well ask, what are you focusing on in the blockchain world btw?
Last but not the least, there are MOOCs & mini courses cropping up everywhere - coursera.org/courses?query=blockchain
@Skyler We're quite off-topic now, so to keep it short, I really love new tech. specially the one that can have a larger than life impact.
Okay, thanks for the info
you're welcome. If you have anything additional, we can continue on twitter DM / tweets.
11:06
>>> values = range(10)
>>> evens = [last_even := val for val in values if not val % 2]
>>> last_even
8
Yaaaay, variables leak from the listcomp again! Finally, we're back to python 2 <3
sure, I'll have to log on my twitter for the first time in like a year but if something comes up thanks for the offer
@AndrasDeak Is that intended behaviour or just buggy?
@AndrasDeak nice, I was worried they would change that. I won't have to update that 2014/2018 picture :D
@shad0w_wa1k3r absolutely intended
@shad0w_wa1k3r 100% intended
Isn't it great?
11:07
damn
it's more or less one of the use cases in the PEP, although that use case needs initialization before the list comp
search for "total" at python.org/dev/peps/pep-0572
okay thanks
@vaultah hehe
I love that example. Softens my already moderate stand against it.
But then I look at this - foo(x := 3, cat='vector') and I don't know why...
The fact that I can't even guess what the correct syntax is or what the statement means, after all these years of Python programming...
Also there's this:
17
Q: With assignment expressions in Python 3.8, why do we need to use `as` in `with`?

Antti HaapalaNow that PEP 572 has been accepted, Python 3.8 is destined to have assignment expressions, so we can use an assignment expression in with to write a quite natural looking with f := open('file.txt'): for l in f: print(f) instead of with open('file.txt') as f: for l in f: ...

11:14
@shad0w_wa1k3r well that part would be normal with new syntax, but it is way too easy to write code that takes a minute to read per line, even when you do know the syntax
def foo(answer = p := 42):  # INVALID
    ...
def foo(answer=(p := 42)):  # Valid, though not great style
    ...
like, why?
I think I should stop reading into this for now, that was enough to spoil my weekend a bit :-p
I'm all fine with learning the changes & understanding their impacts on game mechanics when new Dota2 (MMORPG) patches come out, but this is just too much.
11:52
cbg
12:24
cbg folks
hey guys, is it possible to import a module which contains a class with the same name, and the class is referenced in __all__ list in the __init__.py file?
Yes. That sounds just like datetime.datetime.
I want to do the n-dimensional equivalent of generating all combinations of vectors [[1,1],[0,1],[0,0],[1,0]] in a list comprehension
@marxin Wait, why is there __all__ in the __init__.py? Are you talking about subpackages?
you might have to provide an MCVE
in the init, there is from A import A, __all__ = ['A'], so init exposes A class only. I would like to import a A module instead of a class
12:27
@Skyler itertools.product
product(range(2), repeat=3) should work for 3d for instance
@marxin well you can't have both A.A and A in the same namespace under name A
how about import A as A_module; from A import A as A_class, with whatever names you really want?
its real life situation, tbh I dont think there is a way to access a module directly anymore in this case, let me prepare a Mcve
and if its with [-1,1] instead of [0,1] equivalent the only change there is range(-1,2,2) in the 3d example
please see comments for a structure
acually should be from .A import A
12:34
@Skyler yeah, or just pass a list or any other iterable. You can also take the product of different iterables along each dimension by passing multiple iterables to product.
@marxin which one? You have two of those imports. And where are you running that code from? And is the package installed?
cbg. I have a class and there are a couple of methods that repeat a couple of lines code at the start (looking whether kwarg was set; if not, use the self's value). I thought it would be pretty neat to write a decorator to that the argument of self and do that same work. So I wrote this:

    def date_setter(ctx):
       def wrap(old_func):
            def new_func(*args, **kwargs):
                    date_from = ctx.date_from if 'date_from' not in kwargs else kwargs['date_from']
                date_to = ctx.date_to if 'date_to' not in kwargs else kwargs['date_to']
How do I then extract the value as a list, when i tried printing the result is, <itertools.product object at 0x7f4db5e12d70>
just type cast as list?
@Skyler it's a generator, just like zip or map on python 3
@Skyler if you want to consume it in a list comp just loop over it. Otherwise yes.
but the size grows very rapidly with the number of dimensions, so beware
actually, I can take as the first arg
*it
oh ok, so if i want I can iterate over that object in a comprehension
12:38
Yes, that's the point. Memory-efficient.
however in my current use case the actual goal was to generate the list so i can just cast it as a list
good to know
@marxin so the problem is that in your __init__.py what happens is that from A import A actually means "from the package A import the module A(.py). Too many things by the same name.
and if you meant that adding a relative import there fixes it, then yes, because .A then will mean "A(.py) the module in this package"
I feel like it is useless to even look at the pandas tag when jezrael is around
actually i need to get [[0,0,0]... not [(0,0,0)...
it's still useful to try and find dupes to things he answers
@Skyler are you sure?
They usually don't make a difference. You can always map(list, ...), but ew
Why do you need lists?
12:46
well, im feeding this into an np.array as a set of transformations
so do that and see what happens :P
and then there is going to be nested iterations, its a convex hull optimization
So?
Neither of those need lists
it would need to match with the data I'm dotting it with though
Find a problem before you start fixing it
12:49
yea, writing up
Numpy always works with array-likes
>>> import numpy as np
>>> from itertools import product
>>> transforms=np.array(list(product(range(2), repeat=3)))
>>> print(transforms)
[[0 0 0]
 [0 0 1]
 [0 1 0]
 [0 1 1]
 [1 0 0]
 [1 0 1]
 [1 1 0]
 [1 1 1]]
looks all good, tyvm
No problem
There's also x,y,z = np.mgrid[:2, :2, :2]
That will give you 3d arrays with each corresponding triple a point
that's pretty cool, thanks for the info
Or np.mgrid[:2, :2, :2].T.reshape(-1, 3) for something similar to what you have now
But that's probably less clear
12:55
cbg
whats the -1 for reshape doing
"Compute what comes here"
oh ok
@AndrasDeak i wont do it like that, just hypothetically im wondering if its possible to import this module
13:14
@marxin I don't understand what you're saying there.
What you have imports the module. Using from .A import A instead would let you import the class. If you want both, keep what you have and add A_class = A.A or something to the current version to get the class from the module
13:28
@AndrasDeak sorry people find it hard to understand me all the time.. I've created some basic structure to show what Im asking for, ufile.io/lqbgf, see test.py file, its explained there
@marxin how about a github gist?
You might also want to just rename a few things :P
13:55
I really wont do anything like this, I was just wondering if there is any alternative method to access stuff that is "shadowed"
>>> abs = lambda x: x**2
>>> #oops, I can't access the built-in abs() any more
... #... or can I?
...
>>> __builtins__.abs(-23)
23
@marxin but then the whole module/class/import thing is a red herring, yes?
del abs would also make the original abs accessible, but now I wonder why... Does the name resolution system have special logic for the builtins module?
ok... assignment expressions merged and...
`import somemodule as SomeAlias `
?
13:58
>>> with f := open('file.txt'):
  File "<stdin>", line 1
    with f := open('file.txt'):
           ^
SyntaxError: invalid syntax
which I guess is good
time to downvote that silly question
`with open('file.txt') as f:
...`
Looks like there is special logic: "Names are resolved in the top-level namespace by searching the global namespace, i.e. the namespace of the module containing the code block, and the builtins namespace, the namespace of the module builtins."
@AlexYu please see this for formatting code in chat (including practice options in the sandbox)
@AnttiHaapala maybe that needs parentheses
13:59
@AndrasDeak I've fixed it
If you had asked me ten minutes ago, I might have guessed that all the names in builtins get dumped unceremoniously into the global namespace at the start of the program. But no.
works with parens
Oh, I didn't see the edit
@AlexYu there's this saying about teaching your mother yadayada...
When you say assignment expressions are merged, do I have to pull / compile from git, or is there an installer available for lazy Windows users such as myself?
Is it in 3.7.2? I couldn't find the changelog with fifteen seconds of googling.
14:04
@Kevin yes, you just need to execute c:\windows\system32\bin\timetravel.exe and travel to October to download it
@AndrasDeak Thank you. No edit or I'm missing something?
no edit beyond 2 minutes
@AlexYu 2 minute window
@Kevin del abs
14:07
If you're saying "assignment expressions have been available since last October, have you been living under a rock?", metaphorically yes. I only update Python biannually. If you're saying "It won't be formally available until next October, I'm using a super-experimental patch", that's fine, I'm not in a hurry.
3.8.0 final will be released in October
@Kevin yes, no
merged as in "into master"
I found the changelog with an additional five seconds of googling FWIW
>>> { (a:=c + 5): (b:= c +6) for c in range(10) }, a, b
({5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 14: 15}, 14, 15)
requires parentheses in there ... dunno why
>>> [ a := c + 5 for c in range(10) ]
[5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>> a
14
>>> { a := c + 5 for c in range(10) }
  File "<stdin>", line 1
    { a := c + 5 for c in range(10) }
        ^
symmetry?
I wonder if it's parsing that as a dict comprehension
Depends on whether the tokenizer sees := as one token I guess
14:19
[TokenInfo(type=58 (ENCODING), string='utf-8', start=(0, 0), end=(0, 0), line=''), TokenInfo(type=54 (OP), string=':=', start=(1, 0), end=(1, 2), line=':='), TokenInfo(type=4 (NEWLINE), string='', start=(1, 2), end=(1, 3), line=''), TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')]
I interpret this to mean that the tokenizer does see it as one token. That's good. Not terribly likely that it's trying to read it as a dict comp, then
Where in the docs can I even find what := assignment expressions even do? I've seen them before, but they're more mysterious than lambdas (which I understand now).
cbg btw
I would check the PEPs, and in fact I will do so now
That's the one
14:23
Reading. They sound like (probably totally wrong here) macros?
I have a feeling I won't really grasp assExps until I can use them in a REPL
Which will be 3.8?
That's the plan yes
>Case in point: Guido found several examples where a programmer repeated a subexpression, slowing down the program, in order to save one line of code, e.g. instead of writing:

match = re.match(data)
group = match.group(1) if match else None

>they would write:

group = re.match(data).group(1) if re.match(data) else None
The main use case is for regexen
14:25
That's slower? Wow.
I have ambivalent feelings about this feature
Slower because re.match is called twice
I wouldn't equate them to macros. All it's really doing is allowing you to bind values to names in contexts where that ordinarily wouldn't be allowed
@PaulMcG :doh:
Didn't think about it
@Kevin What's the difference from regular variables?
Same as regular variables, the difference is where it can be used
14:28
if (match := pattern.search(data)) is not None:
    # Do something with match
I get it, so it's like C style assignments-inside-conditionals, loops, etc.
Where you can evaluate the expression at the same time as the assignemnt.
You got it
I only learned you couldn't do that in Python by trying to do it naively.
@coldspeed Seems fine to me. I like the answer. And the dupe seems appropriate. But keep in mind that to assume there is a definitive right/wrong is incorrect. Everyone has an opinion and can express it in different ways. In a sense, you are expressing yourself in an attempt to be useful or add value to the community. The community judges your efforts based on the average (or sum) of the application of their personal interpretations of the community ethos.
It's easy to trick yourself into thinking that Python already had assignment expressions by observing that f(a=1) is legal syntax
Which I only recently learned can bite you in the butt: docs.python-guide.org/writing/gotchas f(a=[])
14:31
I can guess that some will see what you've done as a grab for reputation and not see the effort that it took to produce your answer and how it is useful. In the end, I'd suggest that you be you. If you feel it is right and that you've done well by the community, then stick with it. My opinion is that you've added tremendous value and that you should be proud.
[y := f(x), y**2, y**3]
I have a general workflow question about a Django site I’m building. The site features interactive crop models gleaned from ag related journal pubs that I find interesting. I need to harvest real time local weather data from an api so the models can provide real time estimates of various growth parameters. All historic data will be precompiled up to the beginning of 2019 and stored locally on server.
My question lies in getting the real time weather data to my fancy front end charts. Should I write a python script that hangs out and gathers the data on a daily basis in the background, adds it to the historic data, then passes it to the template through a souped up view--or should I be focusing on writing a javascript solution for this task?
That one is slightly confusing to me, Doesn't this stuff get evaluated right to left?
Nah, elements in list literals are evaluated left to right
Ah.
14:41
@W.Dodge it depends on how real time it has to be
Well, anyway, I like these assignment expressions, but I can see why they would be controversial.
while line := fp.readline(): instead of for line in fp:
Is there a point to that though? I mean, I see it totally for regexen like PaulMcG said, and other, generally pretty simple use cases, but that example is precisely why it would be controversial, imo.
imo this feature is not needed
@marxin In reality, up-to-yesterday is good enough for any subsequent crop management decisions the models might inform.
14:45
It's a convenience operation. But, technically, isn't everything in a programming language just a convenience operation?
I think first approach is good in this case, especially that past weather data is more accurate I guess
Most kinds of expressions evaluate left-to-right. Indexed assignment (e.g. x[0] = 1) kind of evaluates right to left, in the sense that the expression on the right evaluates before x.__setitem__ gets called. But it couldn't work any other way.
@malan we discussed this a lot here when it started. The gist is that opponents fear that it is useful in too few, too specific use cases, and leads to unreadable code in much more cases
I can see that. Considering there's only like 3 situations where I'd use them and a ton of cases where they can be used.
searching "572" and "assignment expression" and "asspression" in the room transcript will lead you to numerous discussions
14:48
Or, hmm, that's a bad example since there's not much actual evaluation going on, on the x[0] side. Here's something with a little more substance.
>>> def f():
...     print("Calling f.")
...     return [0]
...
>>> def g():
...     print("Calling g.")
...     return 1
...
>>> f()[0] = g()
Calling g.
Calling f.
One question I have, why are they creating a special syntax for something that's the default in languages like C? Would it break code to just make if x = (y == z): legal?
@malan because that use case in C causes more harm than benefit
it has to be new syntax so it doesn't trip up people
@AndrasDeak From obfuscation or real danger?
lets just use python 2.8
I can get the trip up people bit
14:50
The PEP talks a little bit about that: Why not just turn existing assignment into an expression?
I have one question, can we pass both x and y values in this loop, ''for x,y in enumerate(data):''
@malan typos and confusion
@aryan for i, (x, y) in enumerate(data):
@aryan what do you mean "pass both x and y"?
So it's more an issue of readability than, like, exceptions or vulnerability.
No "x is dangerous" here.
Like goto
14:51
It is written, "readability counts"
most anti-patterns revolve around readability
@AndrasDeak..both values are predefined, for example : for batch_id, batch_data in enumerate(train_iter: where batch_id is int and batch_data is list.
@Kevin I was interested in how the right side of the operator was evaluated, i.e., if it's evaluated from left to right on the right side of the operator or not
In [1]: def f():
   ...:     print("Falling f.")
   ...:     return [0]
   ...:

In [2]: def g():
   ...:     print("Calling g.")
   ...:     return 1
   ...:

In [3]: def h():
   ...:     print("Calling h.")
   ...:     return 2
   ...:

In [4]: f()[0] = g(), h()
Calling g.
Calling h.
Falling f.
@aryan if you have x=3 before a loop and then you do for x in [5,6,7]: ... then you'll lose the original 3 once the loop starts. If this doesn't answer your question I don't understand what you're asking.
So it is evaluated from immediately to the right of the assignment rightward, then the assigned is evaluated.
14:55
I'm trying to think of a counterexample of "everything in an expression is evaluated left-to-right" but nothing comes to mind.
@AndrasDeak..both values are predefined, for example : for batch_id, batch_data in enumerate(train_iter): where batch_id is int and batch_data is list.
ML question - when doing cross validation (say 3 fold) you end up with 3 separate models and you average the performance across these (acc, prec, fscrore) ….say you found that the algorithm you just tested gave you a really high score and you want to use it for your problem. What is the next step to building the production model? (i.e. what data do you use to build the final model)
@AndrasDeak I have a predefined vales of batch_id and batch_data, I just want to start enumeration from there.
Searching "right to left" in the docs, I see that chained exponentiation operators are evaluated right to left, but not necessarily operands. so f() ** g() **h() will probably print "f" then "g" then "h", even though the second ** gets calculated before the first.
@aryan what do you mean "start enumeration from there"?
execute the loop body for those values before the first iteration?
for x,y in in itertools.chain([(x,y)], train_iter): will probably work
that will prepend the original values for x and y as a "zeroth" iteration
14:59
Perhaps "start enumeration from there" means "I want the first index yielded by enumerate to be something other than 0", in which case you can supply a start argument
But I would suggest choosing different names. Mostly storing the original values in a temporary pair of names for clarity
>>> for idx, x in enumerate("abc", 5):
...     print(idx, x)
...
5 a
6 b
7 c
xy_init = x,y
for x,y in in itertools.chain([xy_init], train_iter):
    ...
... Do you want to iterate over both batch_data and train_iter in tandem, using batch_id as the beginning index? Maybe you want for idx, (x,y) in enumerate(zip(batch_data, train_iter), batch_id):
Trying to reverse-engineer the requirements here based on what I know about which names already exist before the loop
@Kevin, actually I am getting batch_id and batch_data values from my previous loop, I want to pass these values in enumerate. 'for batch_id, batch_data in tqdm(enumerate(train_iter)):'
15:07
ugh
I'm afraid copy-pasting the code you've already shown me doesn't improve my understanding of the situation :-)
mylast = mylast[1]
yield mylast[0]
How does that even work, isn't mylast now a single variable instead of a lsit?
The type of mylast at the end of that snippet is the same as the type of mylast[1] at the beginning. It may or may not be a list, depending on the original contents.
Here's an example where the type wouldn't change:
>>> mylast = [[1,2,3], [4,5,6]]
>>> print(type(mylast))
<class 'list'>
>>> print(mylast)
[[1, 2, 3], [4, 5, 6]]
>>> mylast = mylast[1]
>>> print(type(mylast))
<class 'list'>
>>> print(mylast)
[4, 5, 6]
I hadn't considered other types of lists.
It is quite frequent that something that confuses me is the result of being overly blockheaded.
"Isn't it a single variable instead of a list?" implies that a list doesn't count as a single variable. I don't think this is the case. In the code x = [1,2,3], x is a single variable, despite referring to a list.
15:12
You just have to check your assumptions. How could mylast[0] even work? Is there a way for that to work?
"Scalar" might be a better term in this context. 1 is a scalar, [1,2,3] isn't.
@Kevin Okay, I meant list of integers.
Or single integer*
@AndrasDeak..Is there any solution so that I don't have to remove enumerate function and store values in batch_id and batch_data?
mylast = [1,2,3]
mylast = mylast[1]
yield mylast[0]
Would utterly break, no?
no, it would just raise an error :P
15:15
@aryan We're reaching the limit of the amount of help we can provide, given our fuzzy picture of what the problem is. If you can construct a MCVE, along with a detailed description of exactly the output you expect your code to produce, then we could assist much more effectively.
@aryan I can't help until you show an example of what you have and what you want to happen. Dummy lists with a few items will do, and omit things like tqdm. It will be too long, so post it in a code paste service and post the link here.
I guess in other languages "utterly break" can mean a range between "return the wrong exit code" and "memory leak that slowly results in a computer beign unusable."
Second time today that my copy-paste buffer had an old value... Is my ctrl-c button broken or what
What os?
Windows 10
15:17
broken.
I say, typing on a Windows 10 machine.
I'm used to Windows being broken, but only in the usual ways.
My dad had to deal with BSOD's for a week after an update. Ended up reinstalling. Still BSOD. Had to edit registry values.
That's just absurd.
And I use arch.
Literally, Windows 10 breaks more from updates than a rolling release OS notorious for broken updates.
Thank you @Kevin, @AndrasDeak. I will do that.
@AndrasDeak..This is the code snippet, maybe you would able to understand now. paste.ofcode.org/EcKuu6eHxa9NWZxrZfmssT
You've fallen a little short of an MCVE, there. When I run that code, I get SyntaxError on the ... line.
15:27
12 mins ago, by Andras Deak
@aryan I can't help until you show an example of what you have and what you want to happen. Dummy lists with a few items will do, and omit things like tqdm. It will be too long, so post it in a code paste service and post the link here.
@Kevin Has anyone ever put malicious code in an MCVE? It seems silly to just run it.
If you're thinking "well, yeah, it won't run on your machine unless I assign values to all my variables and write complete syntactically correct Python", you're exactly right. If you're thinking "but that's a lot of work", you're exactly right.
@malan yes and no
you only execute things that are visibly harmless
Yeah, I would think. I guess Kevin is being Kevin and I'm being autistic.
Always check that the MCVEs you run don't contain lines such as eval(fetch_from_internet("notmalware dot biz"))
15:29
if you click the link you can see 3 lines of non-executing code
Rereading Kevin's quote " I get SyntaxError on the ... line." I lol.
and unless you're autistic I'd advise against calling yourself autistic in a deprecating manner
I am.
More Asperger's, but, according to the DSM...
that being said I'm not sure how autism comes into play when reading code
It came in from not recognizing the sarcasm.
15:31
ah, I see
Correction: I get a SyntaxError on the "...." line. If it had actually been "...", that would have been legal syntax.
>>> ...
Ellipsis
otherwise you'd get NameErrors
That's a joke, right? What!? Is it like pass or something?
@malan yup
That's awesome. I had no idea.
15:32
it's used instead of pass and in third party libs like numpy
I thought it was just pseudocode!
arr[..., i] is the same as arr[:,:,:,i] for a 4d numpy array
In many cases, Python looks just like pseudocode :-)
well I'd argue that you shouldn't do things like
while 'sentinel' not in f.readline():
    ...
even though it's functionally the same as having pass there
sorry guys for my silly mistakes, I am very new to python and still a learner. :)
15:34
@aryan that's fine. But you have to practice asking. Read stackoverflow.com/help/mcve and codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question for pointers on how to ask
The bottom line is: imagine yourself seeing the problem only through your example. Will you understand it? Can you reproduce it?
this goes for any kind of problem solving, not just programming
Knowing which questions to ask, and how, to maximize your learning experience, is itself something that's not trivial to learn
Thank you both of you, I will keep that in mind. :)
I wish we had a canonical target for "When I do print(int("01")), it doesn't show the leading zero. How do I make my ints keep the formatting style of the string they were converted from?"
15:46
sounds common enough
anyone here a selenium master? this: stackoverflow.com/questions/54270367/… has eluded me for days
i have no idea why it's happening, but it's forcing me to close down a bunch of browsers after my tests run
(also that comic is awesome)
@AmagicalFishy always use the generic tag, that might explain a lack of views
It's hard to write an answer that satisfies everyone though because "just keep it as a string" only works for 50% of use cases. Same for "convert to int, but provide formatting information via f string or format when printing"
I added it now
oh man. thank you so much. i didn't realize i was missing that
15:48
Woe to the user that needs to reflect the formatting style of the string, but doesn't know anything about the formatting style until runtime
And 90% of these questions are written by OPs that have no real understanding of the type system, so you have to explain that from the ground up
Is there a way to define an f-string as a template, but evaluate it later? (Though I guess I could always wrap it in a lambda.)
@Kevin Like all the questions about "how do I remove the brackets and commas from my list?"
Perhaps there should simply be a canonical answer that says "Learn to program. Start here." and include a list of free resources.
Not very welcoming...
I get it. But questions like those seem to be from people who aren't even interested in understanding the basics of programming.
@PaulMcG lambda would be the quickest approach. You "template" an f string the same way you template any other piece of code -- by putting it in a function
15:55
For example, see this question
I just have to think of an f-string as an executable expression, not an actual string
Back in the early days of dupe hammering, one enterprising user created a post along the lines of "Q: I am a big dummy, what should I do? A: here are some tutorials to read", and used it to close various questions. Things did not go well for that user.
In other words, someone already did that.
Does it still exist?
I don't think so. In any case, resource recommendations aren't really in SO's wheelhouse, even if you avoid calling the reader a big dummy.

« first day (3023 days earlier)      last day (2149 days later) »