« first day (3315 days earlier)      last day (1649 days later) » 
00:00 - 19:0019:00 - 00:00

wim
12:48 AM
 
 
3 hours later…
3:22 AM
@wim Removed
cbg
 
 
1 hour later…
4:44 AM
@smci not sure it is relevant? Because it's 1) a meta post 2) about R 3) a tag discussion, doesn't seem to have to do with pandas or the fact that people keep asking why they don't see any changes when they didn't assign back
 
5:06 AM
@cs95 It is relevant, that's why I mentioned it. 2) It's not about R, it's about Python, R, Java, C++ and JS (and other languages with a concept of mutability or in-place), and it says so. 3) It's not solely a tag discussion, it also enquires about the terms' definitions, and how exactly they differ, and which language uses which term. It mentions multiple concepts, several of which are not tags. 1) Hence I put it on meta, to capture the definitions across languages.
... The first sentence even explicitly says " language-agnostic"
 
5:32 AM
@smci I meant that it isn't relevant in the context of discussing the possibility of a canonical post for pandas.
or at least, I don't see how it is
 
6:24 AM
I realized often that when i want to ask a question, during writing, i realized my problem and solved it, strangely.
 
cbg guys o/
 
6:55 AM
cbg
 
 
1 hour later…
user10984358
8:22 AM
hello guys, is the usage of Walrus operator (and asking to install 3.8) actually justified if my code has 100+ re.search considering there is a new framework that is being developed that has some code (<20) written in pre 3.8?
 
having 100+ re.search calls sounds like a refactor would do your code base more good than the walrus operator possibly can
 
user10984358
half the re.search captures (something: somevalue ) but the goal is to capture only those "somethings" that are needed, and hence the regexes
 
anyway, we can't answer that question because it all depends on how important <3.8 support is for your project. If you're the only person using it, sure, use all the 3.8 features you want. If you're planning to upload it to pypi, probably don't
 
user10984358
there are 3 other people working on this, if I can stress the importance enough then yeah, the main aim is to move from the perl code base, so I am guessing using new features is a good idea?
 
Sounds like you should revisit whether regexes were a good call in the first place or not.
 
user10984358
8:28 AM
I am thinking of doing splits by ':' and do a membership test, that should reduce some
 
@TheNamesAlc if you benchmark it, it's possible a native parser for that format is going to be faster than regex
 
For that part, i wonder, is there an issue in collecting all the key value pairs first, (by splitting and so on as you said) and only filter it out later?
 
if performance is why you're only looking for some
 
Also, I don't think anything we say should be advocated as: use 3.8. Don't read it that way, we don't know all the details about your work, and neither should we. Make a call yourself based on your requirements, and who you're writing the code for, and so on.
 
user10984358
I guess I will test the normal approach vs the regex, I just assumed the Perl monks who wrote the code knew regex was better, its not all key:value some are nested within "blocks" which isnt needed so i can't just do line by line parsing
 
8:34 AM
You can ask the people who wrote it whether they did any comparisons (here, im assuming the people who wrote it are among the 3 others you're working with)
 
user10984358
that is a very old code, 2006, and they are not here :/
 
So youre migrating old code eh?
 
user10984358
That's what interns are for
 
This is the best time to refactor things if needed. I'd say, no harm in setting up a test as needed.
But i'd also be careful not to accidentally introduce new bugs in the process
You can make an argument for making two "sprints" out of it. One, you get all the code over to python as is. Then you dedicate a cycle to refactor
That way, one advantage is you can actually analyse how much time a section of a code takes, and whether refactoring for logic is worth the time invested or not.
(But you should definitely consider a refactor. )
 
user10984358
I have a working 'as-is' python code, so now I try all my other approaches?
 
8:37 AM
Yes, but i do recommend running a profiler first
See if the regions you're concerned about also coincide with high times. Those are your best "gain" regions.
 
user10984358
thanks for the advice! going to do that
 
Also, with the code ported over as-is, are you able to check whether everything works as it should? Some simple inputs, sample outputs.
If yes, i'd recommend making simple "checks" out of them. Kind of like a test suite.
It's a safeguard against yourself when you start refactoring things. Sometimes people do things for a reason, and it's not immediately obvious what the reason is.
(And other times...we won't talk about those :P)
 
user10984358
lol, the code is pretty well documented and the need of regexes were justified, they even went as far as to explain the regex
 
whahahaha it never stops amazing me how bad Django is
 
How goes the struggles Antti :P
 
8:43 AM
so, we want to audit all database transactions...
... so we're like "ok let's write middleware"
... except middleware is executed only outside of transactions
> Django’s default behavior is to run in autocommit mode. Each query is immediately committed to the database, unless a transaction is active. See below for details.
 
hey, that's even worse than sqlalchemy's autoflush=True default
 
I don't really know enough about databases to be able to comment on this. But curious, why is committing queries bad?
 
@Arne no tshi
@ParitoshSingh because everything else works so in the web land that if it returns 500 infernal server error then it didn't do any changes.
except django :P
 
Ohh. Oh!
 
@Arne so, still fancy using django?
 
8:51 AM
i never planned to =D
and the chances following your colorful descriptions are now firmly <0
my last employer made heavy use of django and they were always trying to get us to work with it. when I left I was a bit remorseful about never taking them up on the offer, seems I didn't miss too much good stuff
 
Well, to be fair to it, Django offers a "suite" experience of doing things. Im sure it has to have gotten a few things right, there's pretty vocal advocates for it too. It's just, there's upsides and downsides to a package deal. You have to decide based on what you need to use. (Unless you've decided, and are still forced to work against your wishes because of existing Infrastructures. Sorry Antti :P)
 
there needs to be vocal opposition to it because otherwise people think it is a nobrainer and perfetto.
ok so in django 1.5 there was transaction middle ware
 
link You probably saw this already, but it seems like you'd need to disable transaction management if working with middleware
(disclaimer: i don't understand the jargon terms beyond what their english meanings seem to imply. I might have interpreted it wrong)
 
9:28 AM
@Arne What's wrong with autoflush? :P
 
jie
9:55 AM
can anyone help me https://stackoverflow.com/questions/58832028/why-my-qstyleditemdelegate-couldnt-set-qcombobox-decorated-color-and-set-icon
qt question
 
It's enough to ask once, and that's already one more than what we ask for concerning new questions on main
 
jie
@AndrasDeak you had remote my link
 
If you mean I removed it, yes. There's still one version of your link left.
 
@IljaEverilä not 100% sure if serious, but we had a problem where a transaction failed midway and it couldn't be rolled back because parts of it already got flushed. We could only fix it by setting autoflush=False for the session. At least that's what I remember about the issue
 
10:17 AM
i'm sorry hi all
this might be an english question more than python
 
hello
 
i'm doing dropdown list in wtforms
hello
i'm reading this part and i got confused
Note that the choices keyword is only evaluated once, so if you want to make a dynamic drop-down list, you’ll want to assign the choices list to the field after instantiation. Any inputted choices which are not in the given choices list will cause validation on the field to fail.
Select fields with static choice values:

class PastebinEntry(Form):
    language = SelectField(u'Programming Language', choices=[('cpp', 'C++'), ('py', 'Python'), ('text', 'Plain Text')])
what do they mean by that part " you’ll want to assign the choices list to the field after instantiation. Any inputted choices which are not in the given choices list will cause validation on the field to fail."
what is the point of having (value,label) in every choice ?
could anyone explain for me what the document is trying to say ? "you’ll want to assign the choices list to the field after instantiation"
 
In defining my own python classes, do I need something like @override to override default implementations for methods like __repr__()?
 
@diamond I think the bullet point right after it that says "Select fields with dynamic choice values:" explains what it means
"Select fields with static choice values:" -> _if you want to make a dynamic drop-down list, ..." -> "Select fields with dynamic choice values:", and the second example assigns a list to the field
 
@Zeta.Investigator no
 
10:25 AM
@Arne Thanks. Why in Java we did so?
what was the reasoning behind it?
 
I bet java doesn't have monkeypatching either
 
@Zeta.Investigator I don't know any java, sorry
 
How to prevent python classes from accepting new instance variables? Like if I create a Car class I just want it to have color and mileage instance variables and not something else like brand
 
the usual strategy is to just not write more.
 
Let's step back: how can you define private members for classes?
 
10:29 AM
@AndrasDeak We cant'. Just adhere to naming it with _name
@Arne But it's client that is invoking and creating stuff
 
you build classes dynamically?
 
Why does it bother you if a client defines new attributes in a child class?
 
@AndrasDeak thanks a lot , i have no idea why i didnt see it, i was sure that he was talking on the static example for some reason.

just quick question just to make sure .
Select fields keep a choices property which is a sequence of (value, label)
why do we have value and label ? i cant determined why this is useful , i can just ajax the label and assign whatever i want in the database .
 
or perhaps I misunderstood
@diamond sorry, no idea about web stuff, I could only help with the English.
 
@AndrasDeak Not child class. Client just instantiates my_car = Car(stuff) and then adds like my_car.brand = "sony"
 
10:31 AM
ok thank you @AndrasDeak :)
 
@Zeta.Investigator And why does that bother you? :P
 
@Arne no
@AndrasDeak I don't know. Coming from Java I thought we should limit stuff we can do to prevent future bugs and it seems reasonable
 
If a client monkeypatches your class and then experiences problems due to it, they deserve it.
 
@Arne were you using mysql by happenstance?
 
10:33 AM
@alkasm which part?
 
I wish rollbacks would...not let the same edits happen again one minute later.
 
@AndrasDeak But I guess Python's interpreter should throw at least a warning when such thing happens
 
Simply outputting the field without iterating its subfields will result in a <ul> list of radio choices.

class wtforms.fields.SelectField(default field arguments, choices=[], coerce=unicode, option_widget=None)
Select fields keep a choices property which is a sequence of (value, label) pairs. The value portion can be any type in theory, but as form data is sent by the browser as strings, you will need to provide a function which can coerce the string representation back to a comparable object.
 
@alkasm actually it looks like an edit that was "improve edit"ed, but the improvement removed the entirety of the original edit :/ Should've been "reject and edit"
 
10:34 AM
@Arne 99,9% serious, I've seen it cause trouble extremely rarely, and it saves you from making queries with stale data. Not being able to rollback sounds really bad, that should not happen and seems more related to the underlying DBMS. Flush essentially just emits INSERT, UPDATE, and DELETE statements for objects in the session that have changed.
 
@alkasm want me to ping the approver?
 
@AndrasDeak how does that work?
 
@Zeta.Investigator That would be silly, because it happens very often. __init__ methods add new attributes to objects all the time
__new__ methods too, sometimes
 
@alkasm you type @ and then the name of the user :P
 
nvm i will google it
 
10:36 AM
@AndrasDeak oh, lol, I thought you were saying something else. Well I was mostly annoyed at edit 6; I rolled back that users edit and they edited it again. Not talking about edit 8.
 
@alkasm ah, that's bad too
 
@AnttiHaapala Meant to ask the same thing :D
 
@AnttiHaapala yeah, I was
 
@Arne cringe...
 
@Arne Were you using MyISAM tables or DDL?
 
10:42 AM
@IljaEverilä I don't know what either means =/ dialect says mysql and driver mysqlconnector, db version is 5.6.44
@AnttiHaapala is mysql bad? I thought it was pretty standard
 
in before "so is Django"
 
so is Django
 
@IljaEverilä I'd like to explain the problem more accurately, but I was just trying to get it to work, and when I googled my error message I found a SO post saying "deactivate autoflush"
 
you're welcome
 
@Arne ah, good old "first to the line" debugging ;D
 
10:45 AM
it had lots of upvotes ^^
 
@Arne MyISAM is the older (original?) storage engine in MySQL and it does not have transactions. DDL is Data Definition Language, basically your CREATE <something> commands, and MySQL does not have transactional DDL. Put another way, it issues an implicit COMMIT before it performs your DDL, which of course causes all kinds of trouble.
 
I guess I'll have to read up more with MySQL in particular
 
@Arne just check the second-most-upvoted answer too, and the comments ;)
 
10:50 AM
hmm, we did really simple stuff I think, none of those
maybe our workflow is just borked
 
@Arne it included MySQL so I'd say so :P
 
@AnttiHaapala :|
 
sinning is OK if you repent.
 
I'll relay it to our VP of engineering :p
 
@Arne Please also relay their response.
 
10:57 AM
+1
 
"ok, we'll use oracle then"
btw, this is more or less the part that didn't like autoflush dpaste.de/eJLi
 
that would be 100 % atomic in postgresql, no
 
?
 
*nothing is changed or everything is changed.
 
Hello everyone
 
11:12 AM
ok, trying to turn autoflush back on then. we probably had an unrelated bug then and just didn't understand enough
@PrabalTiwari hi
 
but you were using mysql
 
are they really so different?
 
@Arne Nothing out of the ordinary there :\
 
yes, they're totally so different and even more
oracle is fine btw :P
compared to mysql :'D
 
If you have the dime, that is.
@Arne MySQL used to be slow in adopting new SQL features, and outright refused to implement some old ones (CHECK constraints, anyone?) They've also had some interesting takes on data integrity here and there, especially when it comes to conversions.
Ah, MySQL 8 supports hash joins! dev.mysql.com/doc/refman/8.0/en/hash-joins.html
And transforming EXISTS / NOT EXISTS to semijoin / antijoin.
 
11:30 AM
@Arne for example mysql did this wrong:
UPDATE foo SET bar = baz, baz = bar
 
Is that still a thing in 8?
 
Hi everyone I am hoping to get some advise on Flask configuration from you. So - I have all my code in app\_init_.py (package and factory method approach) and run the code using SET FLASK_APP = app and then FLASK RUN. The flask run command auto detects the factory method (create_app) and starts the project. To pass config into the factory method, before calling flask run I have to write SET FLASK_APP=app:create_app('someconfig').
Question: I want to use an environemnt variable when creating the app so my colleague advised me to create a new file called run.py outside the package with foll. code: from app import create_app followed by app = create_app() #pass any params if needed (example environemnt varialbe) and use if name__=='__main' to launch app.run(). Then he advised me to set FLASK_APP = run.py and do flask run. Or use python run.py.
 
11:47 AM
Please may I have some feedback about my concern
 
12:20 PM
thanks for the help guys. I turned autoflush on and nothing broke, and I learned a bunch =)
 
something might break again ... :P
 
12:38 PM
@variable Could you format your code? One way is to use SO chat formatter as suggested by Antti, another way is share your code via gist.github.com
 
12:50 PM
@TheLittleNaruto, @AnttiHaapala - this is conceptual question, I have no issues/error with the code. Do I still need to provide code?
 
I know nothing about flask, but I don't see a reason to create a new script just because you want to use an environment variable. Why don't you use the env variable in app, what do you need run.py for?
 
Unit testing will be problem if I use the env var in run.py. Unless I use it like this - SET FLASK_APP=app:create_app('someconfig')
 
hi guys
i'm trying to add class to items in WTForms Dropdown
i'm using bootstrap
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown button
  </button>
  <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
    <a class="dropdown-item" href="#">Action</a>
    <a class="dropdown-item" href="#">Another action</a>
    <a class="dropdown-item" href="#">Something else here</a>
  </div>
</div>
idealy that is how it should look like in html
but in WTForms it uses Jinja.
{{ form.Dchoices(class="dropdown-menu") }}
 
@variable alright, I don't think I'm qualified to answer your question. I have no clue about this stuff
 
that made it to disappear compeletly , when i removed the class it worked but without any or any style
 
1:05 PM
@AnttiHaapala just another ✨ learning opportunity ✨
 
@variable In our project, we don't have FLASK_APP=app:create_app('someconfig') instead we have this app = Flask("MY_PROJECT_SAMPLE_NAME") , Does it do anything else?
 
How are you running your project? using flask run or python app.py ?
And are you implementing the factory pattern to create app ?
 
if __name__ == "__main__":
    app.run(host="0.0.0.0")
after all the routers implementations, I have:
 
This is the default inbuilt flask development server
WHich is not recomended for production use
How are you running your project? using flask run or python app.py ?
 
for production we are using Ngnix with uwsgi
 
1:16 PM
Ok I have a question here - so nginx and uwsgi take the app object and spin up multiple threads and processes?
 
Ok I though that the app factory function is used by servers to spin up multiple app objects. But in your case you have 1 app object and still the servers are able to spin up mutiple processes thats great
 
We have created one service with uwsgi python script which will run our flask app internally
 
i got it to work :D
 
I think I got it wrong that multiple app objects are required by servers
 
1:18 PM
And we pointed our domain to this service via sock file using Ngnix
so that it'll be accessible to outer world
@variable Ngnix and uwsgi are there to handle that
 
Ok so it is sufficient to have one app object and rest is managed by those servers thats great to know - what is this concept called
 
concept? mmm! No idea! Even I started Python recently, so I might not be knowing many terms.
1. You'll need to create a service on Ubuntu/Windows which will run your flask app internally
 
Hi I have a doubt how do you convert bgr to hsv range lower_blue = np.array([110,50,50])
upper_blue = np.array([130,255,255])
in this page they are tracking blue color ball . but i dont know how do they write those color spaces docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html
 
1:34 PM
Does anyone know how to set variables in unittests
 
@fixture
def inputString():
    return "some string"
 
19:04
Does anyone know how to set ENVIRONMENT variables in unittests?
Got it to work using: >> with mock.patch.dict('os.environ', {'mytemp': 'testing'}):
>> print(os.environ['mytemp'])
But before the with block, is it not able to fetch my os envrionment. Why is that? Example: In command promt I have set mytemp = 100 and tried echo %mytemp% which shows 100. But the python code outside the with block os.environ['mytemp'] fails. Why is this?
 
1:52 PM
you executed that echo command inside your python program?
 
No in command line
cmd
 
so then the question is probably "why can the command line see the envvar but python can't"
and we can't answer that
 
I thought the OS environ is a glovbal setting at os level
Which it is clearly not - I tried 2 cmd prompts and it appears to be global only for the cmd session in which it was set
 
every process has its own environment
which it (usually) inherits from its parent process
 
ok
 
1:58 PM
cbg
 
I invoked get() from a LifoQueue which is empty. Now the python interpreter is stuck forever. How can I return from this wait? Ctrl+C or D or Z doesn't work
I'm in ipython in Windows
 
spamming Ctrl+C sometimes works
 
hammertime --- stop
 
2:19 PM
@Aran-Fey Doesn't work...I think there is sth wrong with ipython implementation
 
2:39 PM
It sounds like it's adhering exactly to the specification, which says "[get(True, None)] goes into an uninterruptible wait on an underlying lock. This means that no exceptions can occur, and in particular a SIGINT will not trigger a KeyboardInterrupt."
The one thing I find endlessly frustrating about threaded programs is that they almost always ignore my attempts to kill them when they hang
Half serious solution: create a LifoQueue subclass and override get(True, None) so that instead of going into an uninterruptable wait, it waits for five seconds at a time in an infinite loop, which should give Python the chance to detect a SIGINT and crash appropriately
 
cabbage all\
Well I managed to mess up my linux install royally - lost power while it was upgrading to Disco Dingo last night. Now it seems there's something wrong with the kernal :D
 
2:56 PM
cbg
 
@toonarmycaptain worst thing about 19 is the awesome feature that allowed for users to simply right click a file and use copy to copy the file path is broken. I downgraded as a result. Also TensorFlow 2 requires a CUDA library that wont work on 19.
 
x-nautilus-clipboard ftw
 
import queue

class ReceptiveLifoQueue(queue.LifoQueue):
    """like LifoQueue, except it doesn't ignore SIGINT"""
    def get(self, block=True, timeout=None):
        if block == True and timeout is None:
            while True:
                try:
                    return self.get(True, 1)
                except queue.Empty:
                    pass
        else:
            return super().get(block, timeout)

q = ReceptiveLifoQueue()
print("About to perform get on an empty queue. Press ctrl-c to quit.")
 
@Dodge Good to know.
 
I feel like there's probably a good reason not to do it like this. Periodically freeing the lock that you don't want anybody else to have (except the sigint detector) is probably a ripe opportunity for race conditions
 
3:01 PM
@Kevin So once a second you get a few microseconds where you can trigger a keyboard interrupt?
 
Right. And I think that maybe it will also (eventually) trigger a keyboard interrupt even if you do it during the one second block.
That's what it seems to do on my machine. YMMV
 
oh, it does. I didn't expect it to work like that
 
I was surprised as well
 
Laugh if you will, but I upgraded the machine I drive the TV my kids use to Dingo and then Ermine. I like the name/image for Disco Dingo, and that's the main reason I'm upgrading. I don't think I've used either of those two features.
 
I read that as, "I upgraded the machine I drive, the TV, [and] my kids [to use] Dingo and then Ermine"
Do not upgrade your kids to use Dingo, it will void their warranty
 
3:07 PM
Yes, but Dingo's don't bark.
I feel like it's worth it.
 
Disco Dingo barely beats Bionic Beaver in coolness
What happened to "C"?
 
The irony here is that this beat up, cracked case, mouse-right-click broken craiglist-free laptop Ive in my kids' room has a 7th or 8th gen i7 8-core, and a 1TB SSD, so it upgraded in about half an hour, vs at least 3hrs for my machine. If I trusted it not to die unexpectedly, I'd be using it myself. It runs Kerbal Space Program smoother than on any machine I've ever used.
@Dodge Cosmic Cuttlefish?
 
Was that one? Hmmm
 
wiki.ubuntu.com/Releases lists them all, although you have to scroll down to "End of Life" to find Cosmic Cuttlefish
 
Cuttlefish are hard to spot
 
3:16 PM
I'm curious why Cuttlefish is EOLed, but Tahr and Xerus aren't. You'd think they would sunset them in chronological order.
 
You would.
 
Maybe it's kind of like how you can find lots of people using Python 2.7, but not many people using 3.1 through 3.5ish
The chart at en.wikipedia.org/wiki/Ubuntu_version_history#Version_timeline suggests that this is a regular pattern
 
Yeah Tahr and Xerus are LTS or long term support releases
That's why I was unaware of the Cuttlefish release because it was just one of the briefly supported interim releases
 
Ok, makes sense
 
Well Bonic Beaver just finished setting up, from my trusty USB image, maybe I'll go Eoan Ermine instead of Disco Dingo. I like the Dingo name and symbol, but I didn't realise it was only supported until the New Year.
 
3:33 PM
@toonarmycaptain Trusty or Bionic?! So confusing! :P
 
:47833572 :p
I have to say that even though I've toyed with trying another distribution, I've grown quite fond of Ubuntu's release names. So much more fun than 7, 8, 10.
 
I'll wait for 20.04, quite happy with bionic so far
 
7, 8, 10 is fun if you hear that 9 might have been skipped due to lazy coding ;)
 
Before LTS was explained to me I thought that was exactly the situation with Cuttlefish
"Currently supported recent versions are B, D, and E. Does C have an unpatchable vulnerability or something?"
 
4:15 PM
Just to be clear I meant bgr.com/2014/10/02/windows-10-vs-windows-9 ;)
 
Ah, I see. Not lazy coding by the OS devs, but by the application devs.
 
Well I remembered it as an internal issue...
 
Does anyone know how to find the sum of an infinite series that contains a complex (imaginary) number in Sympy?
 
wim
4:50 PM
@AnttiHaapala that's BS
you can do a transaction middleware
the default behaviour of autocommit changed sometimes but you could always set it up however you want
@AnttiHaapala more hyperbole
MySQL is fine. Not as good as postgres but they are both fine.
stop scaring people from perfectly fine and mature technologies with your rants :P
 
5:26 PM
Yes, we can do a transaction middleware in a code base that had none.
Unfortunately we're not doing a blog right now so MySQL won't do. Need to have fully transactional DDL and audits.
 
wim
there are good reasons also for allowing middleware to run outside of the transaction, what, you want to forbid it?
Django has the flexibility to do either, so you're making false claims
and the implication that MySQL is only suitable for a blog is borderline trolling, sure for transactional ddl then postgres will be your better choice but that doesn't imply that mysql is only suitable for a blog.
 
5:44 PM
I am hoping to get some help to understand instance relative = true setting in Flask. Itseems when application is installed it used the below as instance folders. Bit confused as to how to add files into them. $PREFIX/lib/python2.X/site-packages/myapp $PREFIX/var/myapp-instance
 
6:00 PM
Another question. I am looking at this code: >>> l=[1,2,3,4,5,6]
>>> for i in l:
... l.pop(0)
... print(l)
...
Output:
1
[2, 3, 4, 5, 6]
2
[3, 4, 5, 6]
3
[4, 5, 6]
This example is picked from a SO question. I want to know why 2nd iteration popped 2
Should it not pop 3 as pointer will increment at new iteration?
 
wim
no pointers in Python
for loop is more similar to "for-each" loop that you may be familiar with from other languages.
 
pop isn't affected by your loop
you pop the 0th element, not the ith element
 
wim
the more interesting question is why this for loop doesn't leave you with an empty list
(left as an exercise for the reader)
 
@TheLittleNaruto nginx doesn't do that. Nginx will redirect traffic to another server that is hosting your app
Or I'm trying to get my head around what's being said there. If you're referring to just threads and processes, in a respective order, then maybe, but it doesn't read very clearly to me since the statement bundles two separate systems together.
 
6:17 PM
@wim since for loop calls iter, and an iter has next method. At the end of 1st iteration, when next is called, should it now see 3 instead of 2. I am always confused.
 
wim
yeah but you called l.pop(0) not l.pop(i)
 
The iterator does see 3 next, which you can confirm by adding print(i)
but pop is unrelated to the iterator
 
wim
man I can't believe that installing pip still installs easy_install.py. what's the point?
even setuptools docs says "Easy Install is deprecated. Do not use it. Instead use pip."
so why does pip install easy_install then, duh
 
@Aran-Fey makes sense thanks
Why does it not show 4 followed by [5, 6]
 
6:33 PM
because after the 3rd iteration, it tries to access the 4th element, but there are only 3 elements left
 
@cs95 Yes it is relevant. Your question is about which functions operate in-place, and mutability. ("why is my pandas dataframe not being updated when I call this function"). As per my Meta post, this question and these terms arise for Python, R, C++, Java, JS etc. And that's best answered in a language-agnostic way where possible, not having each language community hijack terms like mutate with a language&package-specific defnition which doesn't apply to other communities can't understand
@wim Does anything out there still use it/touch it for backward-compatibility?
 
wim
don't think so, I created github.com/pypa/pip/issues/7351 to track.
 
#this code:
for item in seq:
    do_thing(item)

#... is effectively equivalent to this code:
i = 0
while i < len(seq):
    item = seq[i]
    do_thing(item)
    i += 1
@variable in your code, after the third iteration, the value of i is 3, and the length of your list is 3, so the while condition fails and the loop ends. That's why it loops three times and not six.
 
wim
for loop in python is about as surprise-less as can possibly be
people that expect it to do anything different than what it does may have stockholm syndrome from using other languages
 
Curious readers may be interested in the listiteratorobject, which is responsible for this sort of thing
If I were BDFL I would make it illegal to change the size of a list while you're iterating over it
 
6:49 PM
Enlightening
 
wim
I'm glad you're not BDFL because that is a useful feature
 
Under my great and terrible rule, purity beats practicality
 
hey guys what kind of issue tracking do your use for your projects?
 
wim
github for open source
jira at $EMPLOYER
 
A file named "problems.txt" on my desktop
I wish I was kidding
 
wim
6:52 PM
$ head -1 problems.txt
- move issue tracking to issue tracker
 
hehe thats kind of what my company is doing right now, spreadsheets, but I want to suggest a better alternative
 
^^heh
 
how do you like jira @wim
 
wim
on a scale of 0 to 10, about epsilon
wow, the setuptools bootstrap process generates the .egg-info dir three times github.com/pypa/setuptools/blob/v41.6.0/bootstrap.py#L51-L56
 
6:54 PM
so a 5?
 
Pft
 
wim
no, epsilon as in "let ε > 0"
 
so marginally above zero?
 
wim
right, "I'll admit it's not useless"
I don't like it much and there are many things I wish it did differently
 
well anyway your the third person I've heard from who wasn't totally a fan
 
00:00 - 19:0019:00 - 00:00

« first day (3315 days earlier)      last day (1649 days later) »