« first day (3988 days earlier)      last day (954 days later) » 

12:48 AM
cbg
@EnthusiastiC isnt this why they have ctrl+f5 hotkey to replay last execution statement via interpreter?
 
 
5 hours later…
6:05 AM
hello all, I want to see how the __iter__() dunder method is actually implemented in CPython, anyone know where its located or how I would know where to find it. The Cpython implementation is here: github.com/python/cpython/tree/main/Objects
 
The __iter__ method of what? lists? tuples? strings?
 
Oh, the methods for different types are implemented differently in C? If so then for lists and tuples then
 
list.__iter__ is here, but all that does is return a ListIterator object. So you probably wanna look at this instead
 
6:32 AM
I see.. thanks
 
 
3 hours later…
9:47 AM
cabbage
 
Is there a chat room for Database / Postgres questions?
I have a Django application and I wonder what happens if a transaction fails and I don't do a rollback. Will all other DB interactions fail?
 
A transaction usually means that rollback happens automatically on failure. How do you avoid doing a rollback?
 
Ah, I thought that needs to be done manually.
The rollback takes (a bit of) time. Could it happen that other requests hit the DB before the rollback is finished? Would those requests then succeed?
 
10:14 AM
Databases won't commit intermediate steps of a transaction to the "truth" data seen by queries. They will accumulate the changes and then commit them all at once ("at once" might involve locking, but is much faster than you preparing the transaction).
 
 
2 hours later…
12:08 PM
cbg guys
if I have control over the input, would it be better to filter the input or handle the condition in my code? eg: input = stream of numbers, program should add only odd numbers
should I only allow odd numbers to my code and add everything or is it better to allow all numbers then add numbers that are odd?
 
sounds like you have a needless constraint, because you could also add every number, not just odds
If the task is to only add odd numbers, you could still have a generic add() function that can add even elephants. But you'd have to at one point weed out odd numbers.
If non-odd-numbers are forbidden by your API then you should raise right after input if someone gives you a non-odd-number.
 
A function that only sums up odd numbers is less flexible than a function that removes even numbers from an iterable and a function that sums up all elements in an iterable
 
the raise exception suggestion by Andras looks good, and Aran also makes sense with the flexibility point, thanks guys
I got logged out right after I sent the message, weird :/
 
Consider also the robustness principle: "be conservative in what you send, be liberal in what you accept"
 
so I must expect less but be open to more?
 
12:22 PM
I usually expect the worst because things can only improve from there
 
IMO this principle is one that can often be ignored if you have thoroughly considered your goals and whether they benefit from "robustness"
Not all code needs to be robust. A rock-paper-scissors bot doesn't have to bend over backwards and accept user input like "stone".
See also the Criticism section on that page, which discusses real-life examples of the principle's negative consequences
 
12:47 PM
One of its formulations is "be contravariant in the input type and covariant in the output type" so it can't be bad, am I right, Miyagi?
 
1:09 PM
MisterMiyagi doesn't reply because he accepts only messages containing the exact text "MisterMiyagi"
 
1:19 PM
That's lame, he should try to be more contravariant about it
 
2:03 PM
@Kevin That's "Herr Doktor Mister Miyagi", to be precise.
@AndrasDeak Ja!
cbg: Greeting
 
Sir Miyagi, not-quite-first of his name
 
Ballpark first
 
first enough for horseshoes and hand grenades
 
There's just a finite amount of each of us in the world. That's practically the same as uniqueness.
 
I mean, y'all can still grow more cells
 
2:19 PM
There are uncountably infinite Kevins which is why it's so hard to get rid of me
 
3:08 PM
"We are legion. We are Infinite. We Are Kevins. Expect Us"
 
3:51 PM
That's me, almost always irrational, and everywhere dense
(Confidence that this math joke makes consistent use of math terms: 40%)
 
In Python, you use whitespaces and indentations to indicate different levels of code. This makes it optically appealing and intuitive to understand.

Other languages, for example C++, rely more on braces and semicolons. While this might not be visually appealing and beginner-friendly, it makes the code a lot more maintainable. For bigger projects, this is a lot more useful.
does this make sense? This sounds like bs to me, how are does syntax noise help with maintainability?
 
Language wars rarely make sense.
If you want to talk sense: A properly maintained project is properly indented; explicit block markers are redundant then. The off-side rule is better for maintained projects, whereas block markers are better for projects that need maintenance.
 
The amount of noise in most other languages annoys me way more than it should. Also the fact that most people don't mind the noise too. Also cbg :D I was in Portugal on holidays, fun times :)
I see time has moved on, since there are new starred messages :P
 
4:07 PM
"Appealing" and "intuitive" are subjective so I just mentally insert "to me, the author" after each of them
 
@Kevin in general yes, but in this case the appeal is objective and comes from the entropy, it's high in python compared to other languages
 
If you just want to shut up people complaining how unmaintainable/insecure/dangerous/… Python is, I recommend screaming "Rust or bust!" at the top of your lungs. That should cover most people even willing to talk to people tainted by the snake.
 
What if I told you... I find whitespace and brackety languages about equally appealing
 
Pitchtorches for sale! Get yours now!
 
@Kevin madman.
 
4:13 PM
I give only a 10% chance that this is because of brainwashing or Stockholm Syndrome etc
 
The ideal language is as short as possible considering readability. So I prefer to type just enter instead of ; enter
 
"readability [to me, the author]"
 
I mean to some degree it's subjective, but how does ; add readability?
 
I just think they're neat :-)
 
sure there is codegolf and shorter is not always better and readability is an interesting topic, but I wouldn't consider {} and ; as being included in those discussions.
@Kevin I guess you like to type :)
 
4:17 PM
[I look at my post count]
I think you may be on to something
 
have you played the typing of the dead: overkill? It's a game based on typing fast it's fun :D
 
I'm poking fun at the topic a little but I do think there are some interesting insights to be gained by observing trends of what people consider readable or not readable. I don't want to handwave everything away by saying subjectivity is impossible to examine. Suppose the majority of humans have the subjective opinion "a smiling baby is nicer to look at than a mound of dirt". Perhaps this says something interesting and objective about human nature, even though it's entirely a matter of opinion.
I played Typing Of The Dead once or twice, back in the day. I think I'm better at it than regular House Of The Dead. It's a fun and original premise, although it didn't leave me hungry for more
 
@Kevin yeah 3.5h hours was enough for me
 
I'd love to see some peer reviewed research on "syntax psychology", with the aim of measuring just how much a semicolon impacts reading speed and comprehension, and so forth. Compare to color psychology, which comes to conclusions like "red light can make you feel hungry" and AFAICT this is a legitimate and replicable phenomenon
It makes a red flag go up in my brain because it has the same shape as claims like "this quartz crystal will boost your energy" but there's like sixty citations on that page and it's hard to argue against that much research
 
4:37 PM
@Kevin Let me know if you find any. So far the only things I found that were somewhat robust are from Larry Wall.
 
4:50 PM
When I am fantastically wealthy, I will set the task to one of my finer think tanks
 
5:11 PM
@FĂ©lixAdriyelGagnon-Grenier hey, new name?? :P
 
5:55 PM
Has anyone ever tried making a drinking game out of w3schools for Python?
 
6:14 PM
No, but if you want help, I guess I could lend some time fleshing it out
 
Drink every time you spot an error? Or is that too hardcore?
 
<hearty laugh>
(Actually, I don't think I could survive Alpha release of the game on those rules)
 
"Drink when they say 'array' and mean 'list'?"... Naaah, still too unhealthy.
 
I'm hardly used to booze right now, so I don't dare try.
Perhaps apple juice?
 
Cider is apple juice
"infused" with "stuff". I need to work on my advertising skills
Fermentation is inherently natural, so I guess we could call it a natural product. Incidentally, that's my no.1 annoyance with adverts - "made with natural products" as though they can't be bad. botulinum is also a natural product, and also the most toxic known to man. Then again, people put it in their face, so most people probably wouldn't like my TED talk
 
6:26 PM
{relative} often says "I don't trust that product, it has chemicals in it" and I'm sure at this point that they're doing it to poke fun at me, because by now they must know my rant about "water is a chemical too" word-for-word
 
My second is "1 million people can't be wrong" when it's already known that the majority of drivers in the UK don't know what National Speed Limit is. So, yes, they definitely can demonstrably be wrong. But I risk descending into a rant so I'll stop :P
 
Mind you, "it has a lot of different chemicals in it, and I'm pretty sure a bunch of them were discovered a month ago" is somewhat legitimate
I, too, dislike "natural product", but I take it a step farther. All observable matter is natural because it has existed in one form or another since the big bang.
 
@roganjosh I get icky every time something is praised as "tested by scientists/doctors/experts". It's nice that they tested it, but what were the results?
 
It doesn't matter if you need a world-class laboratory and industrial wossname in order to manufacture a plastic coke bottle, it's still natural because it's made of things that we dug out of the ground
 
@Kevin I've watched some pitches on Dragon's Den where they get kicked out because the ingredients include E-numbers, or there's an MSDS about compounds included. Water has one too so, ummm
 
6:40 PM
Formaldehyde is naturally occurring both in the atmosphere and within most living organisms. Phenol is naturally occurring in coal tar and assorted petroleums. Put them together and you get 100% natural plastic, all ingredients courtesy of mother Gaia. More specifically, you get bakelite.
 
@MisterMiyagi Not-agonising-death, obvs!
I have a weird image of a scientist with a clipboard just putting an X in the "patient contorted" checkbox.
 
@roganjosh Dumb, but I'll call that "second-degree dumb" because even a smart businessperson might say "I refuse to market a product with scary looking ingredients, because dumb consumers won't buy it"
 
It's made of things that we dug out of the ground and results in Not-agonising-death!
We might need to discuss the rooms/6 PR strategy, folks.
 
@MisterMiyagi Children of the Earth?
 
7:01 PM
@Kevin The fun MRI/NMR issue. I don't actually know whether "nuclear" causes the same anxiety these days
Or maybe we can't know because we just removed it from public-facing names
 
7:22 PM
@YashTalaiche the only thing worse than just dumping a homework question is suggesting that I'm part of a "multilevel network marketing system"
If, instead, you were staging a question in multiple parts, please feel free to post again saying that and giving use forewarning (and, say "hi" maybe?). My experience from main suggests that opening with things like that message aren't going to be cooperative but rather requests for solving a problem
 
yes sorry but i have to submit tomorrow then I told it directly, I try it with general tree but not work at all
 
Your time pressures are not our concern. It's also not an excuse to just treat others as solution machines. People here may be able to help you, but you wouldn't just walk into a room and give people an exam paper silently, would you?
 
7:37 PM
ok that's my fault
 
@roganjosh well...
 
@AndrasDeak shush
 
I'll just go back to my game of solitary w3schools
 
If I add with party: it maybe overstates our situation :P
 

« first day (3988 days earlier)      last day (954 days later) »