« first day (3414 days earlier)      last day (1533 days later) » 
01:00 - 16:0016:00 - 00:00

4:00 PM
@roganjosh how many times is keys bound?
 
I think the "we're making this hard on purpose" viewpoint is compatible with the "Dict views have a suite of convenient features that require them to be set-like rather than list-like, and the two are mutually exclusive" viewpoint. Surely during the dict interface design meeting, the "pros" column for set-like-ness contained "makes it harder for users to shoot themselves in the foot"
 
@Kevin Some of that could be alleviated by making the tuple-like rather than list-like?
 
One of the convenient features of dict views is that they update themselves when you mutate the dict. Doesn't play well with the immutability of tuples.
 
Part of me suspects there's some element of the implementation that makes the way the views are implemented far more efficient, for large dicts .
 
@AndrasDeak once with keys = d.keys(). The fact that it's a returned value doesn't matter, though?
 
4:05 PM
@CeliusStingher "python data model improvements" docs.python.org/3/whatsnew/3.7.html -> "the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec."
 
@Kevin Views are actually decently simple to implement, especially compared to maintaining keys, iterkeys and viewkeys. Since dict and set are very similar data structures, making views set-like is much easier than making them list-like.
 
@roganjosh what matters that keys refers to a single object in that block of code. If it were a list then d.pop() could only affect this list if d had a reference to the underlying same list and manually popped from that. But at that point you might try appending to that list and see the world explode.
@MisterMiyagi is "dict and set are very similar data structures" still true with the rewrite? Or are you talking about semantics?
 
I'm leaning 70% towards "still true with the rewrite"
 
Pair programming would be interesting "I'm about to blow up the world" would definitely spice things up in my day job :P
Not ashamed to be Pinky in the new Pinky and the Brain remake btw
 
@AndrasDeak a dict is still more similar to a set than to a list
 
4:09 PM
@AndrasDeak Sure, dict & set have diverged a bit, especially since the rewrite. But they're both based on hash tables.
 
The comment at github.com/python/cpython/blob/master/Objects/setobject.c#L2 suggests to me that sets and dicts originally had some common ground, and still do in some respects. "probe indices" are the same in both, for example. Whatever that means.
 
OK
@Kevin I bet it has to do with list_ass_slice
 
@Kevin Good to know, I wouldn't have thought of this.
 
@roganjosh In C, the standard allows a compiler to do anything if a program invokes undefined behaviour. About a decade or so ago, there was a humorous website about a fictitious OS in which undefined behaviour causes a thermonuclear device to be detonated. I suppose that site might be found in the Wayback Machine, but I can't remember its name.
 
Nasal demons do have quite a bit of power
 
user10984358
4:32 PM
if anyone has a min or two can you tell me how broad this udemy.com/course/the-ultimate-flask-course covers? I am not asking how good of a tutorial this is, I just want to know if it covers a wide area of flask (beginner perspective)
 
Please don't buy that
 
user10984358
lol, I have been reading some resources and a free alternative "Flask Mega-Tutorial" was what I chose, just wanted to see what paid ones offered
 
Use the mega tutorial that I repeatedly link in here. For Pete's sake, we have the guy who maintains Flask as a regular(ish) in here!
 
user10984358
poke is it?
 
nope
 
4:36 PM
Davidism
 
user10984358
ahh, is poke known for something then? I seem to remember him for something
 
he's a git guru, and raise from None is from him
 
user10984358
ahh
 
Wow. That course is $11.99 when I go to the webpage, but when I log in, it jumps to $79.99.
 
One good thing about stopping at my mum's for a bit is having Monty's company. I got him the same week I started learning programming (I think you can guess where the name came from) but he lives here now since when I had to move to London
 
4:44 PM
"The person who maintains XYZ" is uniquely unsuited to recommending a tutorial for XYZ, because having an encyclopedic knowledge of XYZ makes it hard to put themselves in the shoes of neophytes. </half-joking>
 
@roganjosh he's adorable :) Those toe beans <3
 
@AndrasDeak it's me fumbling around on mobile trying to be smart using the web view.
 
"The widget frobnicator is the most important feature of my wonderful library, and therefore I will only recommend tutorials that cover it in chapter 1". But, oh no, the frobnicator is the most complicated feature, and you have to understand 90% of the rest of the library before you can use it productively. Only a madman would put it in chapter 1.
 
@Kevin Probe indices are the indices where an item might be. It's just the __hash__ part of the __hash__-and-__eq__ lookup protocol.
If the __eq__ fails for the initial index, a fallback index is computed from the hash. Repeat.
@roganjosh awwwwww.
 
@AndrasDeak adorable, yes. But dont be fooled; as my mum says "he'll get where water can't". He's unbelievable - he's worked out how to open most human doors with those toe beans :)
 
4:51 PM
well...cats
 
user10984358
for some reason it reminds me of Wim's SO pic :/
 
@wim Looks good to me, added.
Today's project maintainer style is "accepts pull requests without testing or reading all the way through"
 
@Kevin probably won't matter, but I'd escape all those . characters
 
@toonarmycaptain a guy at work bought a python course and I yam you not, the part I saw was just copy-pasted from the docs
 
@roganjosh That's sad. Although Python's docs are pretty good compared to some languages, from what I can tell.
 
5:01 PM
The guy probably knows more about string methods than me. He can't actually build anything, but... he knows strings alright
 
I think the unescaped periods are "safe" since there aren't any valid URLs that would have anything other than a literal period in that position, but I agree that semantically, they should be literal periods.
It took me two days to respond to wim's ping, so I think it's only fair that I ignore this suggestion for two days as well.
The stars are not right for regex work today anyway
 
I wonder where "stars are aligned" comes from. Their relative position to each other shouldn't change so... aligned with what?
 
with your inner chakras, obviously
 
@Kevin how about metalstackoverflow.com or even notatallstackoverflow.com?
 
Probably when the phrase was in popular sincere usage, a "star" was simply any point of light in the sky. So Venus, Mars, etc were stars as far as they were concerned.
[citation needed]
 
5:11 PM
@roganjosh everything moves, some of them are just far away en.wikipedia.org/wiki/Fixed_stars
 
@AndrasDeak Hmm, true. I was more focusing on the dot preceding "com", which I'm still pretty sure is safe.
 
That one is, yeah
 
@Aran-Fey <facepalm> I knew it would be something obvious
 
Let's keep in mind that the consequences of a too-permissive url pattern is... a share button may appear on a page you might not expect, or maybe your JS console will display a "couldn't find element" exception
 
@AndrasDeak sure, but I'm just curious about the origin of the phrase
 
5:14 PM
Thanks a lot for the link @AndrasDeak just got back
 
If the bad guy has control over notatallstackoverflow.com and tricks you into visiting it, then he can already show you whatever HTML he desires, no userscript required, so there's not much of an attack vector here
 
Also: mildly oxidized cabbages everyone
 
The cabbage patch is on fire!?
 
I think you need to take better care of your cabbages
 
@roganjosh personally, I think "when the fixed stars rearrange themselves from our view point" gives some extra gravitas to "stars align" ;)
@Kevin true, but would you want to break the poor fellow's site?
 
5:16 PM
I was about to say. This is more a concern of politeness than security.
 
In other news, I'm irked that wikipedia mentions no nominal size for walnuts, whereas "walnut-sized" is a fairly straightforward anthropocentric measurement
 
what is the use of a generator?
 
I will happily accept any pull request that permits whatever.stackexchange.com and rejects whateverstackexchange.com
 
whats the improvement over a function?
 
@Permian electricity
 
5:18 PM
funny
 
I decided I would use these terms according to the time of the day. So when I first open the chat inthe morning you will hear me say "Fresh cabbages!" and then they oxidize throughout the days...
 
style question: how would you mark fields that aren't meant to be used by mere mortals but are guaranteed to be stable for the enlightened? Kinda like __dunder__ but without the stigma of blasphemy?
 
@AndrasDeak You know, I had something similar typed, and thought better of it. I was wrong, and I apologise.
 
you snooze, you lose!
 
@MisterMiyagi A single underscore?
 
5:19 PM
Selling points of generators:
- lazy -- they only do just enough to give you the next value, and no more
- enables wacky flow-of-control tricks, sometimes with the use of `.send()`
 
@toonarmycaptain nah, that's protected aka "don't touch and tell outside the family"
 
itertools.count yields every number from 0 to infinity. It would be pretty useless if it wasn't lazy - it would take infinite time to return the infinite sized list.
 
@Permian Generators aren't an not an improvement over functions. The two are different kinds.
 
@MisterMiyagi remember kids, touching might also be a problem inside the family
 
Like apples and door hinges.
 
5:21 PM
@Permian well, let's say I need a range of numbers for 0 to 1 million that increments by 1. I have a choice. I could plaster the whole house in wallpaper with every single number. If you asked me what comes after 999987, I could locate that number somewhere and and find the next one. Or I could just add 1 to whatever number you asked for last
 
@shad0w_wa1k3r I finally got an answer to my question. Thanks for all your help :)
 
@MisterMiyagi "not to be used by mere mortals" is ~private, but private is ~don't rely on it, which contradits the stability. Which is to say you might be too strict in your rejection of an underscore. Use an underscore and document its stability in some local docs?
 
@MisterMiyagi Maybe that depends on context? I understood .__variable to be a "don't mess with this as it will break things and/or change on you" and ._other_variable to be part of the implementation but ok to access if you know what you're doing.
 
I'd probably go with single underscore here
 
Prepend !!! to the attribute name. Sure, you won't be able to use dot lookup, but this will filter out users who don't know or want to use getattr
3
 
5:25 PM
Introducing the `` dscape `` convention for the cool kids!
 
 
Too rad for SO chat, it seems.
 
Pythons_privacy_model.png
 
@Vasilis did you fix this? I'm planning to go where we have actual interwebs in the countryside
 
5:44 PM
@AndrasDeak This is what I have right now, but it is kinda brittle alongside the actual private bits.
 
@MisterMiyagi Maybe have the actual private bits ._prepend_and_appended_ with underscores, and the ._use_me_but_at_your_own_risk with just a prepended underscore?
 
_sunder_ attributes? I like that.
 
sounds like asking for trouble :)
 
@MisterMiyagi I use .public_var for something I expect to be accessed/part of the documented API, ._var for something that 'can' be used but isn't explicitly part of the public API, and .__no_no for something that shouldn't be. Is that not conventional?
@AndrasDeak Everyone needs a hobby ;)
 
@AndrasDeak well, in principle my question is "what's the equivalent C++ friends", which kinda sets the mood...
 
5:52 PM
asking for trouble does check out
 
@toonarmycaptain In Java/C++/C#/... terms, conventionally name is public, _name is protected and __name is private.
 
@toonarmycaptain Mine was searching for a builtin that would complete the general gist of "torn asunder" etc. I haven't managed it yet.
 
Or in other words "free_for_all", "_family_affair" and "__hands_off".
 
Raymond H describes '__' more akin to Java's final, in that they are not overridable in subclasses, and that this whole private/protected/public business is just jnonsense.
Since _name is only protected by convention, vs. the way protected is compiler-enforced in other languages.
I just this week had one of our devs ask me how to enforce a base class's a() method call the base class b() method, even if a() and b() are overridden in a subclass. Solution is to make change b() to __b(). Even if the subclass also defines __b(), the base class will only see its own __b() due to the implicit name mangling.
I think RH's example was __getitem called from get in dict. Subclasses can't override __getitem even if they wanted to.
Well, it would be possible for the sub to implement _Base__b(), as it turns out. Name mangling only helps so much.
 
6:18 PM
So "name" is public, "_name" is public-but-are-you-sure-you-know-what-youre-doing, and "__name" is hidden-in-the-freezer-so-if-you-really-want-it-you-know-where-to-get-it-but-its-going-to-be-painful.
Just got a PR to change all the __names in pyparsing to _names, and all I can say is, I'm glad someone finally got around to doing that.
 
things like that sometimes get frowned upon, for hiding the actual code history for mostly style reasons
 
We are in the middle of a huge refactor anyway (breaking up a 7000+ line monolith module into submodules), so now is the time for stuff like this. We also black'ened all the project code.
 
with my nervous hands I have planned to start learning flask after a vacation which i have shortly.. lots of bugging incoming here :P
 
6:36 PM
@anky_91 I think flask is model-view-template paradigm, like Django. From my experience with that format, the hardest part is realizing that many of the cool front end features you actually want require a knowledge of JS, but getting your server to populate an html template or store info in DB was not terribly hard
 
@Dodge Is there a python backend with a different format where you can get those features without a knowledge of JS?
 
Switch to .NET, sometimes we kind of have cool front end features that you might expect require javascript, but don't
Such as: partial postbacks, and, uh,,,
 
@toonarmycaptain Not sure, so I guess you are saying that I should have realized that JS was requisite from the onset? Well yeah, but if you know nothing then you might think something like Django is all you need, which I did
 
@Dodge Nothing about you, just hopeful for myself, lol.
 
@Dodge thank you, i will keep in mind
 
6:42 PM
Everything without JS is basically make a change in a box or dropdown etc and hit a submit button, nothing gets updated in real time or as soon as the box is clicked etc.
 
Ok, I tell a half-lie. Partial postbacks are powered by javascript, but it's all autogenerated, so you don't have to write any of it yourself.
Similarly, I would not be completely astonished if there was a Python framework that gives you real-time updates and suchlike without having to write any JS
It's technically feasible, the only question is whether anyone bothered to make it
 
There is a python base web browser so...
 
So Python is probably Turing complete, yes
 
can't find the name, like V8 engine but python based, I know I didn't dream that
 
@anky_91 it will take you a few days I think. Happy to help you where I can
 
6:50 PM
@roganjosh I m banking on you guys ;) Thanks in advance
 
I admit I'm a little skeptical that this browser exists. Web browsers are so horrendously complicated that I can't expect any sane developer to work on one. For this reason, I must also doubt the existence of the browser I am using now.
 
rbrb for now
 
The framework is not so tough and with your knowledge of pandas, that's why I'm guesstimating a few days
 
wim
@Kevin hah, I already forked the gist
thanks anyway, for great justice
 
So it goes.
 
wim
6:59 PM
as an aside, I'd love to see the logo for metalstackoverflow.com 🤘
@toonarmycaptain this is not conventional.
 
@wim I wonder if someone owns it, it's not got a "buy this site" thing, for me it just
 
wim
.var and documented is public, .var and documented might be more similar to your interpretation of ._var, except in practice it's usually just a minor docs bug / omission.
._var means undocumented / discourage use. using it is immediately hacky and code smell.
._var AND documented is rare, but exists in some poorly thought out API (e.g. namedtuple _asdict)
.__var has nothing to do with public/private and is invoking name mangling "feature"
 
How about .var and undocumented?
 
wim
oops, I meant to say that in the first message. too late to edit so here it is again:
.var and documented is public, .var and undocumented might be more similar to your interpretation of ._var, except in practice it's usually just a minor docs bug / omission.
 
Ok, got it 👍
For the record, docs.python.org/3.8/tutorial/classes.html#private-variables is where single-underscore and double-underscore names are described. It doesn't have a lot to say about what double underscore names are "for", semantically
 
7:08 PM
Do you mean undocumented as in 'not documented as part of the public API'? I'm taking my understanding from leading underscore for "non-public methods and instance variables" in PEP8.
 
wim
to me undocumented just means "not present in the docs"
 
@Kevin I didn't realise it said " It should be considered an implementation detail and subject to change without notice." of _single_underscore.
 
wim
the usage for double underscore names is very niche
 
All of my functions are undocumented }:-)
 
wim
the docs section that Kevin linked is pretty clear that single underscore is the closest analogue to "private" variables, but private variables are not really a thing in Python.
 
7:14 PM
The only time I really use single underscore is when I need to store data for a property
 
wim
the mangling is a very weird feature, it's sort of a hack to avoid name clashes with names which may be defined by subclasses. I didn't understand what it was really about for many years, and incorrectly assumed it just meant "really private".
 
@wim I document most all my variables and methods!
@wim I will wholeheartedly admit that my understanding of "private" is essentially only from python and this chatroom, so my usage is probably coloured by this, compared to someone more familiar with C/Java etc
 
@roganjosh that is inspirational :)
 
wim
7:30 PM
there was a good answer on SO somewhere that explained very clearly how/what mangling was all about but I can't find it anymore :( should have starred it.
 
7:43 PM
@wim Is it this one?
 
@wim Maybe this? stackoverflow.com/a/52903693/4014959 There's some good info in other answers there, too.
toonarmycaptain's looks better than mine.
 
@wim I'm confused by your use of "private". The system(s) I know use the modifiers "private == class only", "protected == subclasses only", "public == everyone". As far as Python "guarantees" anything, .__name mangling implements "class only" (aka private), and ._name only-if-you-know-what-you-do implies "subclasses only" (aka protected with a pinch of friend).
 
@anky_91 I'm not very good with front end stuff so I tend to start with some base outlines. This is my own reference
Some bootstrap 4 stuff in there. No idea if it's any use and possibly encourages cargo culting, but that's what I use as I find stuff
 
In practice __names end up making debugging difficult, esp. with pdb, since you have to pre-mangle the attribute to view it (or just pp vars(obj) the whole object to see it)
 
wim
It was not any of those ones, it was a many-years late answer on a very old question that had a useless but highly upvoted top answer.
@MisterMiyagi I don't mean private in the way it's used in C++ nor java, only in the casual sense
My inkling is that if n00bs think _var is like the exclam in "don't touch var!" then they assume __var is just like adding more emphasis "don't touch var!!"
(at least that's what I assumed when I was a n00b)
 
8:07 PM
tbh, I've never really understood either. I can think of only once where I actually meddled in the internals of a library to get things done
 
I've probably propagated that assumption by jokingly suggesting name mangling every time a querent insists that they need something to be as inaccessible as possible
 
8:23 PM
<subtly bumping that close request with some nonsense posted since>
 
Hey guys, anybody ever use PyGithub? It has these paginated lists in it and I wanted to pull ~16k issues from the github repo. I only was seeing like 1000 of these and wasnt sure if Im swarming the api and making it angry or if maybe paginatedlists are looped over differently
g = Github(ACCESS_TOKEN) # Initialize the GitHub client
print(g.get_user().get_repos()) # Getting your list of repositories
list_of_issues=[]
repo = g.get_repo("bitcoin/bitcoin")
issues = repo.get_issues()
for issue in issues:
    list_of_issues.append(issue)
 
"like" 1000 or actually bang-on 1000? The latter would suggest an API limit
 
len(issue) came out as like 1047
exact number im forgetting, lost the output window but dont want to run again until im sure im not going killing my api request limit
1000-1100
 
If you look at the issues in a regular browser, how many pages are there?
 
get_issues() only returns open issues per default
 
wim
8:30 PM
@PM2Ring Raymond's explanation is not very convincing:
> But why __perimeter instead of _perimeter? Because _perimeter still gives derived class the chance to override
and so does _Circle__perimeter.
 
Any argument about OOP that uses shapes as an example is automatically doomed, because shapes do not neatly fit into the "is a" paradigm. A square is a rectangle, but it would be weird for the Square class to have separately adjustable height and width attributes.
 
wim
if the intention is really to prevent that, it will use a random UUID4 or something, not just prepending the class name
he also doesn't explain why you would do this, and add the weird feature into language:
def area(self):
    p = self.__perimeter()
    r = p / math.pi / 2.0
    return math.pi * r ** 2.0
instead of doing this, and adding no weird feature into language:
def area(self):
    p = Circle.perimeter(self)
    r = p / math.pi / 2.0
    return math.pi * r ** 2.0
 
hmm
 
wim
I think Ned's answer is probably the best one there, but he doesn't go into enough detail about why you might want to do that mangling in the first place.
 
thanks, that seems about on the right order @Aran-Fey
any chance you might know if each issue request counts as an API Call (i.e.: can only 5000 in an hour)
 
8:37 PM
Janky solution: count the number of API calls with wireshark
 
nah, each request yields a bunch of issues at once. I don't know how many, but it's definitely a lot more than one
 
here is the get_issues implementation. It seems to be 95% option parsing.
 
You can try looking at PaginatedList, but that probably won't tell you anything either. The answer is probably in Github's API docs
 
Here is PaginatedList. It refers to developer.github.com/v3/#pagination, which I think indicates that each page is its own request.
So 16k issues will require 160-640 requests
 
Survey: does anyone here maintain a strong distinction between "disc" and "disk"?
 
8:57 PM
A recent question on the main site shows the program's unexpected output... As a youtube video. That's a new one.
@roganjosh No.
 
Kevin has spoken. I need not try and fix the rule in my head :)
 
Yes, one is a three dimensional object, one is a storage device in computers.
I should note that I don't care in the overarching scheme of things, but as a matter of etymology and linguistics, I care.
 
Both are storage mediums
 
Good: hard disk, floppy disk, compact disc
Bad: hard disc, floppy disc, compact disk
 
@roganjosh I generally think of "disc" for playable media, compact disc, digital video disc, laserdisc, and "disk" for the things we store stuff on in our computers (which might include media files, but could be any kind). But I'm pretty flex - you could even say DASD (pronounced "DAZ-dee") and I'd know what you were talking about.
 
9:01 PM
@Kevin Well, that's the opposite of saying you don't care :P
 
@roganjosh Better? I didn't think of CDs.
 
The definition is here but I haven't committed it to memory. This discussion suggests that I probably should
I live off the idea that the recipient of my comments knows which spinny thing I'm referring to, but maybe I need to be correct with the terminology
 
@roganjosh "disk" is the stuff used inside computers/servers for online storage of data. "disc" is a frisbee.
 
What about "disque"?
 
Controversial fact opinion: I vaguely remember reading/hearing somewhere that there's a real vs American dialect of English divide on this, as with many things, and I'll readily accept that Americans have decided to be wrong on this one as well.
 
9:06 PM
Americans can't even agree whether to say "pop" or "soda"
 
@PaulMcG Is that really in use? I'd presume it's a Frenchified version of disc?
@PaulMcG Don't look at me, I call them "fizzy drinks". Although I've toyed with "not/ought to be beer" or similar.
 
Hello
 
@PaulMcG I still write "cheque" - "check" doesn't feel right to me.
 
9:10 PM
"Check" is awful. Thank god they are being obsoleted
@BálintCséfalvay Please see the room rules. You should wait >48 hours before posting here. You also linked to an answer, not your question.
 
@roganjosh Where you are. Here there are some things where I either have to post a cheque or pay a $2 fee to pay online. I would probably choose to not patronise a business that only accepts cash or cheque (aside from a fast food place or bar, maybe), apparently they still exist around here.
 
"Check" instead of "Cheque" and "Tire" instead of "Tyre" really bugs me. I guess it's incumbent on me to get "disc" and "disk" correct if I'm gonna complain about these things :)
@toonarmycaptain post a cheque? Where is this?
 
@toonarmycaptain It isn't in use here, but who is to say what those French are up to?
There is a popular barbecue place here in Austin, called The Salt Lick. They briefly had one of their location in an especially ritzy area of town, with appropriate up-market/up-priced menu, and I dubbed it The Salt Licque (which I pronounced "leek").
rbrb, maybe back online later
 
au revoir
 
9:43 PM
@Kevin getting close to "interpretative dance" territory
 
10:12 PM
<bizarre image of being on a dance machine and exceptions scrolling up> Hint: json.JSONDecodeError is LLUDL
 
"it doesn't work" is only barely better than "the following five minutes depict how my program makes me feel"
 
10:25 PM
Well, fancy footwork can fix that
 
 
1 hour later…
01:00 - 16:0016:00 - 00:00

« first day (3414 days earlier)      last day (1533 days later) »