« first day (2132 days earlier)      last day (2830 days later) » 

1:00 PM
I sometimes find it strange that Python makes such a noise about implicit conversion, but then does implicit Boolean conversion of any value when a condition is being evaluated.
 
@holdenweb that's probably to be expected inside a conditional statement:)
 
Morning cabbage.
 
cbg
 
cbg MT
 
I've found that the few places Python does to the implicit thing it's because the explicit thing would be really noisy/awkward
 
1:06 PM
@AndrasDeak the miracle is twofold: the woman in picture is the OP. And an answer to a question for which I place a bounty is not bad.
if you multiply them then we get a very low P :D
 
@AnttiHaapala heh:D
 
*woman in OP's avatar is a photo of the poster, not some random stolen pic.
 
yeah I got that:)
 
I certainly wasn't arguing the behaviour should be changed
 
@AnttiHaapala It's great to see that Karin is actually actively answering questions.
 
1:18 PM
not only that, I did some "dubious stalking" and found out she also has done something with Pyramid :D
 
Hopefully, she won't object to that kind of stalking. :)
 
:P
strictly at professional level :D
 
Cheers for the help earlier guys, especially you clements
 
@IntrepidBrit always a pleasure :)
 
1:30 PM
@AnttiHaapala watch out Mrs Haapala!
If I have a question about VMWare virtual network appliances, would that be serverfault or superuser?
 
@RobertGrant Is it in the role of sysadmin? If yes - serverfault, if you're doing it for kicks & grins/personally then superuser
 
Does anyone use VMWare networking personally? :D
 
sometimes I find there's an overlap, because I'm personally the sysadmin for my machines, and technically I have a side business. But usually I post on superuser :P
 
Thanks - maybe I'll try superuser as they have an NSX tag
 
1:37 PM
@vaultah not sure it is a typo..
 
that's why I said "as typo" ;)
 
Ah, no, it is, because elsewhere they do use self._extension.
 
Nah, that's a conceptual misunderstanding, I would have thought.
 
hey, can anyone tell me whats wrong? I have a piece of code outside a class:
parent, child = multiprocessing.Pipe()
so, when I tried to put it inside the class I did:
self.parent, self.child = multiprocessing.Pipe()
which returned a TabError (inconsistent use of tabs and spaces in indentation)
I checked the indentatin multiple times, so I guess there's a problem with the syntax?
 
I did a radical rewrite of a question earlier, the original was almost incomprehensible. I normally don't like to make major changes like that, but in this case I felt that my edit didn't go against the OP's intention. And they haven't complained. :) The question's not great, but at least the OP made an attempt at writing some code, even if it's not up to the task he's trying to perform. stackoverflow.com/questions/38995881/…
 
1:39 PM
Yeah lots of typo closes aren't typos, they're misunderstandings of concepts deemed by experts to be too basic to not be typos
 
@RobertGrant I guess I'm guilty of doing that in the past, but I'm not really happy about it, and I try not to do it these days.
 
anyway, I voted to close that Q because it "was resolved in a manner unlikely to help future readers"
 
I don't think that the OP there realises why they've put _extension in the last line of their code. Probs cargo culting. On the other hand, I'm just trying to read their mind. Who knows?
It's no great loss to the sum of human knowledge, I guess.
Which you could say about a lot of things, when I come to think about it.
 
guys, if sending a coding assignment to a company, how important is the looks of it? Applied as front end web dev
 
I need to convince a lawyer to let me design database model we store legal documents in, but there is a consultant on the other side who is selling the database on the idea that the lawyer can do it.
 
1:44 PM
@corvid how it works is best, but on top of that obviously polish can help, appropriate to the job. Should be tidy, even if it's basic.
 
@corvid The person who reads your code assignment will probably be grading it on correctness and maintainability, since that defines whether he'll want to work with you.
 
@corvid if it's not a transpiled, minified mess then what's the point of frontend?
5
 
Take the extra time to make it nice. At worst it'll show you care about it.
 
Hmm, sorry
I'm trying to fix the tabs and spaces issues
sublime text always seems to scramble them
 
@davidism Oh you mean I am doing it right then
 
1:47 PM
@kelthar View -> indentation -> indent using spaces
 
I've gotten a web developer job because the "test assignment" I turned in was only semi-polished (add few obvious things) and correct as that showed you get stuff done right and on time (according to old boss)
 
@Kelthar "TabError (inconsistent use of tabs and spaces in indentation)" Just don't mix tabs and spaces. Use spaces. Set your editor to convert Tab keypresses to 4 spaces, and to make tabs visible, just in case some accidentally sneak into your script.
 
and my dependency tree is deeper than the roots of Yggdrasill
 
stackoverflow.com/q/38997336 too broad or recommendation
 
I also lost one cause I didn't add a jquery calendar (even though C# with ASP can do that all on its own and I used that)
 
1:49 PM
I always use the tab button, but I still get this error... But followed your advice, let's see how it goes
 
that seems like a small dependency tree for web
@Kelthar did you change the auto-indent to 4 spaces? as that can cause it too - if seperate settings
 
user6568562
@Kelthar From what I understood, the lexer recognize a difference between four strokes on the space bar, and one stroke on the tab key. I encountered many users on forums having this tab error issue on Notepad ++
 
user6568562
You need to either stick to using tabs, or go to settings replace the tab with four spaces.
 
@Kelthar If your file is already "contaminated" with Tab chars you'll need to fix them. I don't know sublime, but there should be a simple way to change existing tabs to spaces.
 
“Trump has had a "gnawing agitation" and "felt 'boxed in'" for weeks, Costa reports.” — can't wait for the Trump unboxing!
 
user6568562
1:51 PM
I believe the latter is what's best [ :
 
in sublime - the setting is "detect indentation" (needs to be false) as this can detect where tabs or spaces on load and then over-take your default settings
 
sed -i 's/\t/    /g'
? :)
 
@randomhopeful @PM2Ring @JGreenwell Yes, I think I fixed it thanks, sublime has an option to convert all tabs to spaces
 
{
    "tab_size": 4,
    "translate_tabs_to_spaces": true,
    "detect_indentation": false
}
^ what is in my settings file
 
user6568562
@Kelthar That's the one [ :
 
Back when they sold it, I would convert Tab Clears to spaces on a local newsagent's shelves. Loved that stuff.
 
@randomhopeful In Python 3 it's simple: it throws an error if you try to indent with a mixture of tabs and spaces. In Python 2 it's arcane because Python uses fixed tab stops with a width of 8 columns, so the conversion of a sequence of mixed tab and space chars does not convert to a fixed number of spaces: what happens depends on the column location of the start of the sequence.
 
user6568562
@Kelthar You should definitely check this section (and the whole page), it will explain to you most of the syntax errors that noobs get.
 
@RobertGrant I see what you did there. :) I never liked Tab, but I hate all artificial sweeteners.
 
Ah I love them. I drink coke with no caffeine or sugar in it. It's basically black sweetened carbonated water.
 
1:59 PM
bleh
 
Tab was good, Mountain Dew was better, Vault was dangerous, and COFFEE IS KING!
;)
 
@RobertGrant she doesn't even use that surname :D
 
Yeah I thought she might not, but you know what I mean :)
 
The Haapalady
 
@WayneWerner I think it's finding it, isn't it? regexr.com/3e1j5 However, I know its not entirelly accurate because it's matching all occurrences of e/w as well. — hl95 2 mins ago
How you know that the OP hasn't tested the code they've written against the sample input they've provided :facepalm:
@JGreenwell Bawls is better
Jolt is j.... why are there no "terrific" adjectives that start with J?
 
user6568562
2:03 PM
@PM2Ring I see ! I didn't know for Python 2. The columns idea seems to be a whole less of headaches. I'll have to check the reasons behind these new rules in Python 3, one day [ :
 
but apparently Jolt is banned in Arkansas, because we're stupid.
 
@WayneWerner jocund?
 
mmmmmmm maaaayyybe
 
did Bawls exist in the 90s, was listing 90s drinks (could have added Surge was totally radical)
 
that's more "cheerful"
 
2:05 PM
if talking about newer drinks - Red Line is pure evil
 
en.wikipedia.org/wiki/Bawls introduced in '97
so, late 90s
 
there you go then - never got into BAWLs until military (so 06+) - no idea why
 
yes it is
 
user6568562
@PM2Ring Oh, maybe because of the way tokenization work in Python 3. Where it pushes each indent on top of the stack,, then compares each new indentation level to the levels already present. If an indent or dedent doesn't seem to be consistent, the exception is raised.
 
user6568562
2:09 PM
In the face of ambiguity, refuse the temptation to guess. I think I'll tattoo that on my body, someday.
3
 
@WayneWerner Perhaps it's because high-caffeine drinks mixed with spirits can be a bad combination. The speediness of the caffeine can increase the tendency to aggression in people who are already prone to be aggressive when drunk. And people tend to drink more because the speediness can make it seem like they aren't as drunk as they actually, or they simply just end up drinking more because the caffeine keeps them active longer.
 
I think its cause it was introduced in the 80s and people freaked out about energy drinks when they first came out (still do in fact, just noticeably less)
 
@randomhopeful Sadly, I can't find anyone on Google who has the Zen of Python tattooed on their body.
 
@randomhopeful The reason for the new "don't mix tabs & spaces" rule is simple: too many people got into problems mixing tabs & spaces in earlier versions of Python. So it's better for the program to fail noisily than for it to function but behave incorrectly because your indentation is legal but not what you think it is.
 
@PM2Ring Yeah, but we didn't ban energy drinks. Red Bull, 5-hour energy drinks, Mt. Dew, <insert randomly highly caffeinated beverage here> are all totally OK here. Heck, I think even those alcoholic caffeinated beverages are legal here.
 
2:12 PM
@WayneWerner I think Martijn has the Zen of Python encoded into his DNA. ;)
 
but I haven't found anywhere that sells Bawls, and last time I was looking I came across something that said we outlawed Jolt
@PM2Ring Don't we all?
 
I don't think Monster is intrisically less offensive to the conscience than Jolt, it's just energy drinks have become blase at this point.
 
user6568562
@WayneWerner Well, as long as they tattooed it on their mind : P I was impressed by Zen of Python. That was the first thing I've ever read on the language and I thought : This must be learned
 
Definitely one of the reasons I <3 Python so much
 
user6568562
@PM2Ring Oh I see! Imagine if an elif is falsely indented to another if statement on a Robot with a machine gun ! That would be even more horrible than a robot with a machine gun correctly programmed
 
2:16 PM
There is a multitude of wisdom found there, and you can keep finding new-- and exciting --points that you never realized before
@randomhopeful especially if the elif means you are the one that dies
 
user6568562
@WayneWerner True : D
 
I mean, death sucks (most of the time), but it sucks even more when it happens to me
at least I assume so - it hasn't happened yet :P
I'm basing this on the fact that I'm making crêpes right now, and crêpes are delicious, so if I died before I got to eat the crêpes, that would be bad, ergo, death of me is bad. QED.
 
mmmmmh crepes
we call them palacsinta
 
does that mean "delicious thin pancakes"? If not, you should call them something that means that :)
 
I need to make flap jacks again
 
2:23 PM
It does. Palacsinta conveys all the meaning it needs.
 
:D
does anyone else find themselves keeping to (or altering) recipes so that they are left with a balanced amount of eggs in the carton?
 
Sounds a little OCD to me
 
definitely
 
user6568562
I find myself giving up on recipes for I can't cook to save my life. I'm pretty sure that there's a summon-satan hidden step in recipes no one wants to tell me about
 
@WayneWerner no
 
2:27 PM
of course, looking at my office/desk is all it takes for one to know that it's just a little OCD
 
But we take anthropocentric recipes (having spoonfulls, cups and pinches as units) and calibrate them to volumes and masses. Makes everything reproducible.
 
user6568562
@AndrasDeak Sorcery, I say !
 
any sufficiently advanced technology...
 
we have a killer cocoa sponge cake recipe:)
 
Okay, so before I say anything I want to stress that I understand 100% that this is not good code and it a completely contrived example of something that was really, really confusing to me. I understand what's happening here but I'm wondering specifically if there's an existing SO question dealing with this. If there isn't I'm going to make one because this, at least to me, was extremely non-intuitive at first.
So that being said here we go:
>>> l = [[1,2],[3,4]] * 2 # duplication of _references_ not of values
>>> l
[[1, 2], [3, 4], [1, 2], [3, 4]]
>>> l[0] += [2.5]
>>> l
[[1, 2, 2.5], [3, 4], [1, 2, 2.5], [3, 4]] # changing the value of one reference changes them all
>>> t = [(1,2),(3,4)] * 2
>>> t
[(1, 2), (3, 4), (1, 2), (3, 4)]
>>> t[0] += (2.5,)
>>> t
[(1, 2, 2.5), (3, 4), (1, 2), (3, 4)] # however tuples are _immutable_ so a new tuple is created.
 
2:30 PM
my desk has scribbles from where I wasn't paying attention when writing down specs and wrote on my desk
 
@JGreenwell windex will take care of that
 
yeah, I do it all the time
 
@mikeTheLiar what's the confusion there?
 
@mikeTheLiar tuples and lists have += defined differently, I think. For lists it mutates, for tuples it just does t[0] = t[0] + (2.5,), which is a new tuple
 
The thing that didn't click for me at first was the immutable/mutable difference in the way it works.
 
2:32 PM
first I should copy them to something - or just screw the user who wants 10 new features on a project that is suppose to be done
 
there's a magic method that if you define, allows a non-trivial adding lke this
__iadd__?
 
@AndrasDeak like I said, I understand what's going on here. It just took me a while to figure out why lists worked one way and ints/floats/strings/whatever worked differently
 
usual disclaimer: I'm mostly guessing:P
@mikeTheLiar OK, so this
 
@AndrasDeak you ever seen "Good Eats"? If not you should it feels like cooking with science a lot :)
 
@JGreenwell not yet:)
 
2:33 PM
@AndrasDeak OK, so this
 
How to greet Neo-Nazis properly: theguardian.com/world/2016/aug/17/…
 
@mikeTheLiar what I meant is "what do you intend to ask on SO?":)
 
DSM
Morning cabbage.
 
FWIW...
 
@DSM cbg
 
2:35 PM
In [4]: dis.dis('x = [0]; x += [1]')
  1           0 LOAD_CONST               0 (0)
              3 BUILD_LIST               1
              6 STORE_NAME               0 (x)
              9 LOAD_NAME                0 (x)
             12 LOAD_CONST               1 (1)
             15 BUILD_LIST               1
             18 INPLACE_ADD
             19 STORE_NAME               0 (x)
             22 LOAD_CONST               2 (None)
             25 RETURN_VALUE
In [5]: dis.dis('x = (0,); x += (1,)')
  1           0 LOAD_CONST               3 ((0,))
              3 STORE_NAME               0 (x)
              6 LOAD_NAME                0 (x)
              9 LOAD_CONST               4 ((1,))
             12 INPLACE_ADD
             13 STORE_NAME               0 (x)
             16 LOAD_CONST               2 (None)
             19 RETURN_VALUE
 
@AndrasDeak well the exact phrasing I haven't figured out yet because I can't think that doesn't include already understanding what's going on
 
so, yeah, the INPLACE_ADD would be the kicker here
 
I'm talking about a self-answered question FWIW. Basically what I wish I had found last night when I was trying to figure this out
 
@AnttiHaapala :D
 
2:36 PM
@mikeTheLiar ah, I see.
 
@AnttiHaapala Very nice
Another great show is "America's Worst Cooks"
 
@AndrasDeak even my wife who uses Python professionally was confused when I showed it to her
 
@mikeTheLiar are you lying?
 
I have all the Good Eats cookbooks specifically cause he gives measurements by weight
 
@AndrasDeak Mike knows much, tells some. Mike knows many things that others do not.
No, but seriously, I'm not lying. But she's a scientist not a programmer
So less attention to how the code works and just that it does, in fact, work.
 
2:39 PM
@WayneWerner America's Worst Cooks is a lie! My grandmother was the worst cook ever (she ruined cereal and milk, not kidding) where are the people who light the kitchen on fire - those are the worst cooks ;)
 
@mikeTheLiar work or "work"?
 
@JGreenwell They actually did light kitchens on fire.
My favorite.... the one girl put brown sugar and vanilla together - "Did I just make chocolate?!?"
 
@AndrasDeak this would've been very useful. I'll ponder making the question or not. It's the sort of thing that makes perfect sense once you understand it. But otherwise it's very confusing
@AnttiHaapala I barely understand what she does at all (bioinformatics) so I take it on faith that it actually works
 
@mikeTheLiar If you did, I'd probably close it as a dup of the one Andras linked :P
 
Dupes are not bad
Dupes are a signpost
 
2:42 PM
@WayneWerner a guy from Nigeria stayed with us for a while, but it was really interesting to see what wasn't obvious to him: one time he put just hot chocolate powder in a mug, and put that in a microwave, because he thought the liquid somehow appeared out of the powder and filled up the mug.
 
"You're asking the wrong question, the answer's over here"
 
DSM
That doesn't mean that we should aim to actively create them, though..
 
@WayneWerner fortunately that doesn't air here:P
 
I have no problem having a question closed as a dupe if it helps someone else find the answer in the future
 
The cargo culting of beverages
 
2:42 PM
if it did I guess my wife would hit the TV :d
 
It is(was?) on Netflix
 
no netflix here :D
(in this household that is)
 
@randomhopeful "I think I'll tattoo that on my body, someday" - that sounds like a guess.
 
@DSM says who? I'm saying, "I had this question. I was asking the wrong thing. Here's the (wrong) question that I was asking and a link to the question I should've been asking".
 
I only remember vanilla chicken girl @WayneWerner
 
2:43 PM
This is not theoretical. This is an actual problem that I faced as a programmer
 
@JGreenwell lol. She was the best. "STOP PUTTING VANILLA IN YOUR CHICKEN!"
 
@mikeTheLiar yup
 
maybe need to re-watch/watch more - Cutthroat Kitchen is on in background here cause Food Network is the only thing we can all agree on as acceptable
and work safe
 
My wife really likes that one. I certainly enjoy it.
 
and I promised to stop messing with Apple watches
 
2:45 PM
It's impressive what some of the people can do
 
At any rate I need to go back to work
 
sorry
 
user6568562
@RobertGrant Damn you with your perceptive analysis : P
 
Eek! Good call! Updated code =D — Karin 46 mins ago
 
Oh man.. the one thing that was so dumb on Cutthroat Kitchen - the lady had I think $12,500 left and her opponent only had like $1,500 I think? But she didn't outbid her on the last sabotage!
and she lost, naturally
 
2:46 PM
@randomhopeful :D
 
DSM
@mikeTheLiar: well, says me, which is why I'm the one who said it. House policy on Meta seems to feel otherwise, see here.
 
I understand how Stack Exchange works. You don't need to explain it to me.
 
lol
 
DSM
Wait, what? I just said that Meta disagrees with me, and linked to it. What more would you have me do?
 
you're so missing DSM there
Anyway, the real catch is making it a question that's helpful yet doesn't assume knowledge of the answer. That should be pretty hard.
 
2:49 PM
some of it is still on Netflix apparently
 
@AndrasDeak yeah that's kinda where I'm stuck a little bit. What I was asking last night was basically "wait WTF?" Which isn't really Google-able
 
yup
 
I love working on code written by scientists (as a developer turned academic): those people can make code that makes your eyeballs bleed and your brain implode
 
"love"
I hope I'd only cause minor seizures.
 
and all you'll ever hear to the answer "why did you do this?!" is "well, it worked didn't it?"
 
2:51 PM
heh:D
 
DSM
@JGreenwell: hey, now. Code by professional devs can be just as bad, and with much less excuse..
 
don't fix what ain't broken; don't overdo what can be kludged
 
....or "I don't know I just copied it from SO" - which happened yesterday
@DSM true enough
 
@DSM the guy who teaches with eval galore in intro python... is he a programmer?
or "CS" which is the twilight zone between scientists and programmers:P
 
according to his bio he was a developer in the 70s (or early 80s I forget the exact date)
 
2:53 PM
wat? :D
 
DSM
In one of the codebases I've inherited, there's the line
exec 'plt.{key}("{value}")'.format(key=k, value=v)
 
certainly at least not a software engineer
 
:DD
 
DSM
which is not how matplotlib is meant to be used..
 
@DSM quickly, make it Python 3 compliant
 
2:54 PM
I feel that XKCD reference coming on
 
@DSM nothing is meant to be used like that
 
@DSM however here's the problem, you never know what is in for k, v :D
 
@AndrasDeak if your talking about this giant bleep head
 
@JGreenwell I believe I am:D
bleepity bleep
 
k, v = 'some.more.dots', 'this is", "a way to pass", 4, "arguments'
 
user6568562
2:57 PM
@AnttiHaapala Pretty scary
 
70s - not even listed on CV anymore it seems - I only know cause I encountered him a while ago
 
or k='title'; v='"); <something nasty> #' :D
 
I remember the discussion we had in here, where we were all agog, and enraged by the massive WTFs in his "teach you to code do the wrong things everywhere"
rbrb, cooking time
 
rhubarb
 
yep, he is the one with (in a def main():) the line celsius = eval(input("What is the Celsius temperature? ")) to teach to new programmers
 
2:58 PM
@mikeTheLiar A self-answered question for this sounds fine to me, if you can come up with a good title for it that will help other people who find themself in the same situation you were in when you discovered this stuff. It doesn't have to be closed as a dupe if you can't find a close enough match, but you should probably link it to some existing questions that also discuss this topic.
 
@AndrasDeak or v = '"; DROP TABLE STUDENTS;-- # eh forgot this is in Python'
 
yeah, I couldn't come up with a simple thing to inject:(
 
user6568562
@WayneWerner 's prophecy have been fulfilled :D
 
I'm told it's better to always leave something for the imagination, anyway.
 
I wonder how "install all the modules" guy is going, and whether he still has a usable machine...
 
user559633
3:03 PM
I bet he let his dreams be dreams.
 
@PM2Ring He'd be done by now if it wasn't for the windows updates. He's sitting at 10% right now.
 
If I see any more code from his books on SO, I'm tempted to see if it can be add to the SOPython warning about the other horrible book (currently only seen like 3 so trying to ignore and hope it goes away - college he taught at is losing its accreditation I think so that should help)
 
@AndrasDeak installing all of chocolatey won't have helped
 
@AndrasDeak :giggles:
 
@JGreenwell sounds right:D
 
3:05 PM
nope, I'm wrong - it lost its accredidation in 2014 : NCACS is gone
 
awwww
 
@JGreenwell never heard of him before but the first bit of sample code I came across on that site looks crazy
 
FWIW, when I started learning Python it was common to see examples using input instead of raw_input. And using eval on the contents of sys.argv to convert commandline args.
 
run all the things, we're all consenting adults here.
oops.
 
oh, that is some shifty stuff - their "about us" lists them as accredited and has link to confirm but if you dig deeper they only have specialized accreditation (i.e. only specific programs)
 
3:09 PM
my computer says I am now in the hands of dark forces.
 
user6568562
One among the things that made me not watching YT tutorials about Python anymore was one guy saying : "Think of function parameters as hotel rooms where arguments can come to stay a while."
 
user6568562
I was attempted to ask if these arguments usually steal towels and soap bottles.
 
user559633
that metaphor actually makes it more confusing
 
user6568562
Exactly [ :
 
I like YouTube Python stuff but would advise sticking with good sources of information (i.e. Python Conference videos, MIT Opencourseware, etc)
really like that all the Conference post their stuff cause I rarely am able to make those
 
3:12 PM
cbg all
 
user559633
to gain my knowledge, i climb mountains and steal it from the mouth of dragons
 
I prefer physical books to youtube 99.9 % of the time .... I prefer online tutorials (not video) in general i think
 
user6568562
@JGreenwell Yes ! I'm loving the MIT courses on Intro to CS and Intro to CS math. I was talking about the amateurish tutorials. They come from a very good place, but that doesn't justify their existence. Bob Martin's lectures are also a treat
 
quick question: I'm learning the main() and I was wondering if writing nested functions within a main and runnning them within the main()would be considered acceptable to python orthodoxy?
def main():
	def jobs():
		print("steve")

	def tones():
		print("what the heck")
		return 1

	def haha():
		print("ha ha")

	print("lololol")
	haha()
	tones()
	jobs()

main()
 
actually, the accreditation thing is what I'm working on here - as a lot of for-profits just lost accreditation so analyze a bunch of factors/variables on accepting students from these institutions (as are all the other still accredited universities around here)
 
3:15 PM
there is no main
 
user559633
@AndyK that's fine.
 
@tristan cool
 
@randomhopeful When I see bad metaphors like that I'm tempted to reply with a Monty Python quote
Doctor: The human brain (we hear the sound of a dog barking in the background) is like an enormous fish, it is flat and slimy and has gills through which it can see. (the sound of a gun firing)

Mrs. Eggers: There we are.

Doctor: (we hear the sound of what sounds like meat sizzling on a hot plate) Should one of these gills fail to open the messages transmitted by the lungs don't reach the brain. It is as simple as that.
 
@JoranBeasley I'm not a visual learner so lectures help me more (but I use all to help increase retention)
 
@AndrasDeak can you explain or it is more of a joke...?
 
3:16 PM
main is just a name
 
main is a Java thang
 
you could call it bob
 
Almost entirely a joke:) Mostly that ^ and that ^^
 
and it would function exactly the same
 
just like there's no self
 
user559633
3:17 PM
@AndyK You don't need to define a main function as an entry point in Python.
 
as far as nested functions they are common enough
 
I should make a "main" function in one of my tutorial then change it to "bob" just to mess with people coming from Java to Python
 
I think they are gross personally ... but even i sometimes use them
 
user6568562
@PM2Ring Haha :D ! The gills part killed me
 
user559633
For cheap pipelines, I typically do functools partials and iterator over a tuple of the functions
 
3:18 PM
@tristan can you explain a bit more, please?
 
user559633
@AndyK On which one? Not needing main or partials?
 
sorry andy i think on this google is going to be your friend
 
def jobs():
    print("steve")

def main():
    jobs()

if __name__ == '__main__':
    main()
 
@AndyK You can do that, but you shouldn't: "Flat is better than nested."
 
@PM2Ring what's the point of the main()then ...?
 
3:19 PM
@AndyK you tell us, you wrote it
 
user559633
@AndyK You don't need a main(). That's an entry point method named by convention for languages that expect/are-programmed-to-use it.
 
You should generally have some kind of block on the top level, to avoid code from running when you import the program by any chance
 
@AndyK Using main() is fine, but don't nest a bunch of functions definitions in it like that. Instead do it like davidism's example
 
I got it @PM2Ring & @davidism
 
Excellent
 
3:23 PM
@JoranBeasley definitely will be looking at google for the main. I'm not knowledgeable enough on that point
 
@AndyK Well, main() is used probably because Dennis Ritchie (or other CS guru) decided it to be the entry point of some language
 
ok
 
my last postproc script had a do_stuff() :P
 
@AndrasDeak Also, although doing everything in the global scope is ok for a quick one-off script or some simple example code it's really not a good practice. Code inside a function runs faster than code in the global scope because local variable lookups are faster than global lookups.
 
@PM2Ring ah, interesting. Thanks:)
 
3:28 PM
@PM2Ring Never thought about that speed difference xD Always learning
 
I guess lots of Python programmers know that when you're writing a "proper program" that everything should go into functions with a single entry point for the script (conventionally named main), but we don't usually use that structure for our SO example code, since it's a distraction from the main purpose of our code snippet. But I guess that's sending a bad message to newbies.
 
Read our room rules. Please don't post recent messages here.
 
In MATLAB (older versions, at least), the JIT compiler only works on functions, not scripts; making the former considerably faster in many cases.
 
user6568562
@PM2Ring You set clear some confusion I had. I'll keep your note about lookup in mind [ :
 
user6568562
I should have read it when my brain was shutting down as I accidentally encountered Python's aliasing for the fist time : P
 
3:35 PM
it's your aliasing:P
 
@AndrasDeak One common optimization trick is to "import" a global name into a function as a default arg.
 
user6568562
@AndrasDeak Haha : D Ok, I admit to my full responsibility for that incident. You were the one who explained the error raised by my gibberish, if I recall correctly : P
 
@PM2Ring yeah, that sounds very reasonable now:)
@randomhopeful possible;)
Hmm... @PM2Ring is that also true for module names? I don't see why not. Of course I see why it's preferred to have the imports on the top level, but still it's an interesting consideration
 
I don't know how to into async testing :\
 
3:51 PM
@AndrasDeak I guess you could localize a module name like that, but I don't recall ever seeing it, but it is commonly done with individual names from modules, eg, def f(seq, choice=random.choice):
 
I think I've got (or almost got) the main(). I read this piece from Poke who helps me quite tremendously
The purpose is basically that you can define a central entrypoint, if, and only if, the script is directly run on its own. Because __name__ will only ever be equal to '__main__', if it is run on its own. Putting your script’s actual content into a separate function allows other scripts to import said function and run it whenever they want it, so it won’t run immediately when the script is imported.
 
In which situation, using the main()would be considered a bad idea?
 
user559633
@davidism Yay, glad to see it's an official one
 
user559633
3:54 PM
Wonder if he'll make a D-Butt one.
 
> I, for one, hope there'll be a day when we no longer have to look for the dog on fire to support our feelings
 
user559633
When does No Man's Skyrim come out?
 
user6568562
@tristan : D
 
I'm blaming sexist pigs for my stick figure-based Flash game "No Person's Sky" being panned in reviews
 
user559633
3:59 PM
@RobertGrant Haha, what? My game, Bro Man's Sky, a procedurally generated drinking game of masking earnest feelings, is currently ranked 420 out of 24/7 on Steam
 
user6568562
I blame poor makerting for the lack of audience to my channel : " No Man's Sky News"
 

« first day (2132 days earlier)      last day (2830 days later) »