« first day (2175 days earlier)      last day (2777 days later) » 

12:01 AM
Do bugs have terms of indenture?
 
For the OPs that keep asking about more pythonic things, I wonder how they define pythonic
 
first you must sacrifice a snake
 
that is true
 
granted, if someone is going around killing pythons I don't think anyone will disagree with their definition of "pythonic"
 
thats my pandas question i linked to ... the guy was doing single_value in some_set
which i argued is pretty damn pythonic
instead he accepted pandas.iloc[-1].isin(some_set)
 
12:04 AM
@DSM Actually, yeah. A formula was waaay off for a variable, but the result was later discarded. In a very subtle way, so it wasn't obvious at all that we've never used that value in the past 10 years...only now I do want to use it.
 
^^ :P
 
lol - its dead Andras. Don't go digging up the zombie
 
no, I have to use it now:D
But good news---the moment I realized the fcksource, I fixed it in 5 minutes, for first try
 
okay, just keep an intern or undergrad student around in case you start hearing bra..in...ns
 
now my result with the new code matches the control output so well that I'm suspecting a logistics error (i.e. me not using the executable that I think I'm using) :D
but no, it's actually working D:
I have no words
 
12:11 AM
mmhmmm..... picks up his boom stick in anticipation
 
speaking of boomsticks Ash vs Evil Dead is almost as good as army of darkness
 
^^ yes
it's so ridiculous it's fantastic
 
there's a new Evil Dead?
 
show
 
:O There's a new Evil Dead!
I'll have to check that out
 
well, all this success in life less buggy code is making me tired:)
rhubarb, all
 
DSM
Rhubarb for Andras.
 
night Andras
 
if anybody has some votes to spare (oh, past midnight UTC!), this gimme teh codez is stuck at 4
thank you, kind sir
*tips hat*
\o
 
lol, really @idjaw - had to Canadian those comments up?
;)
 
12:18 AM
hehehe
it just comes out
I can't help it
 
(are you sorry?)
 
501 helpful flags :D
 
woosh
 
I'm actually not sure if I should be happy about that though (that's a lot of bad posts)
 
I'm actually surprised mine is so low
150
 
12:19 AM
I think when you get close votes most people stop flagging
 
(yup, until 10k)
 
but 10k is all magical and stuff - so it don't count
 
DSM
I've only got 139 helpfuls. Shog irritated me off the queue once, so these days I mostly only flag when something is egregious.
 
(then you get access to the NATO tool, which is great for NAA/VLQ flags)
(I just had to check one more thing in the code...........)
 
DSM
Sleep!
 
12:21 AM
self.sleep(when='now')
 
he's young - he doesn't know how precious sleep is yet
 
I remember when I used to be able to function 3 hours of sleep
 
what is helpful flags?
lol
are*
 
I think I only have so many flags cause I got so annoyed at seeing robo-reviewing that I just jumped on Review to have at least one "Un-salvageable" on bad questions/answers
I need 6 hours minimum anymore
 
i need like 8.5 ... luckily most places dont hold programmers to that "be here at 8am sharp" mentality :P
 
12:26 AM
^^ yeah. I'm really happy about that
 
btw. it can suck when starting over as a teacher as there are so many young, just got out of college, teachers and always fun to hear the "I was up until 2 a.m. working on my lesson plans, then got up at 5 to jog, then....."
 
hehe
 
are u a teacher JGreenwell?
 
luckily math teachers seem to be just old - seriously I'm the youngest and I'm no spring chicken
 
12:29 AM
university? or HS?
 
yep, pick up adjuncts when I can and 5th grade math/science for the main job
 
oh I see... I could probably still handle 5th grade math i think
 
I asked this Q earlier but I think I oversimplified what was going on. So I have made it a little closer to the actual code. I'd be curious to hear what people think about the cleanest way to solve this:

I want to be able to call functionA in another file by using
import myfile
data = myfile.functionA("file.csv")

Here is ~what I have:
# myfile.py
# this is what I was trying to do, but
# got a NameError on line 2 of 'functionC'
# because the a4, a5, a6, a7 are only defined
# in functionA.
# what's the cleanest way to fix this problem?
 
DSM
For long programs it's easier to dump them into something like pastebin.com. (Among other things, you don't have to worry about chat's unfortunate indentation rules.)
 
hmm, good idea, I will do that next time sorry
 
12:32 AM
its basically long division, decimals, fractions, basic geometry, some area/volume - other basic subjects. Benefits are good though and kids actually get excited about stuff which is nice change from college students
 
ah, I indented but when I unindented my own comments it must have unindented everything
 
@doublefelix yeah everything has to be indented or it doesn't count
 
DSM
Hence "unfortunate indentation rules". :-)
 
I'm new to this chat so still learning, but next time I'll separate the comments from the code or use pastebin
 
DSM
Anyway, if it's that few elements, just pass them. Explicit is better than implicit. If you have lots, i.e. dozens, then maybe you'd consider an intermediate object like a dict (or a namedtuple or something else), but the right answer would depend on what the objects actually are. Plus it's much easier to write unittests if your code units are independent.
 
12:43 AM
Okay. So pass them is the right answer then. Good to know thanks :)
 
DSM
Well, probably. :-) As I said, it depends on the content of the variables -- if there are a bunch of variables which don't really make sense disconnected from each other, then those it makes sense to combine. But starting by passing them, and going from there, is a sound policy.
 
1:08 AM
@DSM what about giving a4, a5, a6, a7 placeholder values at the beginning (globally, not within a function) and then declaring them as global a4, global a5, global a6, global a7 when I need to use them within another function? it seems easier than running them through all the intermediate functions.
 
global is usually a bad choice
in every language I've ever used
 
DSM
Do Yankees use "blek" like we do up here?
 
pretty much - if you mean bleck (like "yuck")
 
Is that because they can be confused for local variables? Contextually I think it would be clear they are not locals but I'm open to whatever
 
DSM
Using globals for things makes it much harder to follow control/data flow, and much harder to write good tests. And if you're not writing tests, then do whatever you want: your code's going to be buggy and you're not going to know it, so it scarcely matters. :-)
 
1:12 AM
confusion with local variables is one reason, scalability nightmares is another, there are a ton more just look up "global variables are evil"
 
haha, ok understood. I will pass them then. Thanks for the advice.
 
22
Q: Why are global variables evil?

LarsVegasI was trying to find a good source that explains why the use of global is considered to be bad practice in python (and in programming in general). Can somebody point me to one or explain here?

 
 
4 hours later…
6:03 AM
cbg
 
 
1 hour later…
7:09 AM
cabbage
 
7:28 AM
Morning \o
 
7:43 AM
Cabbage!
 
7:54 AM
Cabbage!
The sopython site is so helpful <3
4
 
Cbg
@DSM If someone accuses you of making a bug, set it free. If it doesn't come back to you, it was never yours to begin with
3
 
8:24 AM
late start trains delayed cabbage, all, bugrit
[late start AND trains delayed, not late start BECAUSE trains delayed]
@JRichardSnape I love the thought of illicit hash corned beef
 
@holdenweb :D indeed!
 
8:44 AM
I am listening to metal today whole day, I don't know why
 
You're showing your iron will.
 
PDEs are ugly and beautiful at the same time
 
pde?
 
9:02 AM
Partial differential equations I'm gonna guess
 
I thought it was a metal band -_-
 
Cabbage
 
\o
 
@khajvah PDEs are beautiful because they can be used to succinctly describe a huge range of relationships; they're ugly because there's no general procedure for solving them, unless they're fairly simple.
 
@PM2Ring I read “PDF” instead of “PDE” and that sentence still made somewhat sense to me.
 
9:11 AM
@poke Yeah. :) To be fair, PDF was designed to have a degree of security through obscurity.
 
heh
 
@PM2Ring simple ones spit ugly solutions too
 
@khajvah You might be interested in this SE.maths question I answered last year: How do I get geographic coordinates of a point if I know the distance from two other points?; it does a little bit of numerical work with partial derivatives. "We can solve the geodesic distance triangulation problem on the WGS84 ellipsoid by using Newton's method as applied to the partial derivatives of a pair of simultaneous equations."
 
I will read after work, as it's not simple to understand
:D
 
@khajvah Fair enough! I've probably forgotten half that stuff since I wrote that answer. :) OTOH, you should be able to understand the section "Newton's method for solving simultaneous equations" - it's a general technique, so you can understand it without needing to understand the other stuff in that answer about ellipsoid geodesics.
 
9:21 AM
yeah I am kind of familiar with Newton's method
 
user6568562
Cbg everyone
 
\o
 
user6568562
Ey Andy [ :
 
Hi, random.
 
user6568562
Hey PM [ :
 
10:03 AM
cabbage
 
cbg @BhargavRao
 
cbg
@PM2Ring upvoted :P
 
Thanks, Antti!
 
@PM2Ring now I read: "the Python 2 program" and I got this urge to cancel my upvote :P
 
10:20 AM
:) IIRC, it wouldn't be hard to convert it to Python 3: just change the print statements to functions and change xrange to range.
 
please :P ;)
 
I'll think about it, but it's not a high priority for me since the code is not actually on a Stack Exchange site. But I'll see if GeographicLib is available for Python 3...
 
cabbage
 
cabbage
 
10:36 AM
Ok, GeographicLib works with Python 3.
 
The amount of PHP and JS on backends make me go away from web development
 
the safe part isn't correct I think
 
which part?
there were many
 
Georgia and Armenia
safe to travel, 2nd paragraph
 
10:49 AM
wow so many scripts on that page
 
Finland seems to be the best: high alcohol consumption, safe
 
the railway map is bollocks
it doesn't compare to number of people or anything such...
or area...
just total number of km
 
I wonder how France has lower chance for natural disasters than us
Godzilla will clearly devastate the shore first
maybe flooding?
 
@khajvah read the description
"This map shows those countries the Foreign Office believes is safe for British travellers to visit (in green), and those it doesn't (red). The Foreign Office advises against travel to parts of those countries shown in yellow. "
it says: British
 
I wonder what parts of my country are they advised against visiting
 
10:54 AM
@khajvah wonder not, read online
 
The parts where that dude lives who was taken into custody for a night after some riots in the streets
4
 
@khajvah c.f. for example Vietnam
 
@AndrasDeak lol
 
@khajvah and that was last updated 8 days ago
@khajvah I went to downtown Bangkok 2 years ago when returning from VN, in the evening/at night...
it looked like a warzone...
 
I just had to name a property StartDateDate
 
10:57 AM
I was walking around and suddenly I come across a zone full of sandbags and green cars and persons with assault rifles
I was like "oh, hi guys"
 
@AnttiHaapala fair enough, although military emplacements don't happen in the border of Armenia, they only happen on the Karabakh land(the land for which the war is for)
 
@khajvah also you need to remember that this is advisory, and it is for reading beforehand, that there is a possibility of border skirmishes cannot be ruled out.
 
yea
understandable
 
@poke I'm SorryToHearThatHearThat
Any government foreign advice should err on the side of caution
 
I couldn’t name it just StartDate because StartDate already is a complex object that has the date encoded as a string. So StartDateDate is the date object of that string representation…
 
11:01 AM
such as "don't go anywhere, the world is full of foreigners and they might hurt you"
 
in Vietnam for example there is no place that I wouldn't feel safe visiting, other than because traffic accidents...
 
@poke StartDateAsDate?:D
 
kind of, yeah xD
StartDateThisTimeItsReallyADateObjectIPromise
 
@poke wouldn't it be cool to overload a name by return value :P
 
It’s actually mapped to a database field… >_<
 
11:05 AM
@poke I envy your German passport now, better than the Finnish :D
 
huh?
 
@poke StartDateAsDate?
 
Did you get a new one, or should I have gotten a new one?
 
@holdenweb high five ;)
 
@poke nooo :d
just in news that German passport gets visa-free entry to 177 countries, Finland is 175 :(:(
@AndrasDeak Hungarian passport to 167 countries, not bad.
 
11:13 AM
And counting (down)....I'm afraid:P
 
user6568562
Tunisian passport grants you free entry to Tunisia (under some conditions)
 
@randomhopeful it's something
 
user6568562
@AndrasDeak True : D
 
@randomhopeful tunisian passport is better than armenian...
 
11:16 AM
@AnttiHaapala lol…
 
It's not just the visa requirement, the worst thing is that most people get refused from US or Western Europe embassies
US is the worst, probably only 1 in 10 gets visa
 
@khajvah Security through unfriendly and useless selection.
 
and the embassy staff is annoying too.
 
user6568562
None of this will matter once water will be depleted. Then fat people's sweat will make us rich. Rich I tell you !
 
11:46 AM
Whoever wrote the Python 3 sockets docs is a genius: "In the interests of space, building your character, (and preserving my competitive position), these enhancements are left as an exercise for the reader."
 
lol:D
Dammit, @Kevin! ------^
 
12:08 PM
~o~ \o/ ~o~ \o/
 
> Author: Gordon McMillan
 
I admire his competitive advantage
 
@AnttiHaapala: Ok, I've updated GeodesicTriangulate.py so that it runs on both Python 2 & 3. I used 2to3-3.6 to do the conversion, but I had to fix a few sets of double parentheses around some print calls (I'd used parentheses so I could continue long format strings over multiple lines).
I also had to change some of the geographiclib stuff: my old code accessed a couple of WGS84 ellipsoid constants via private attributes, but one of those attributes (the semimajor axis) is now a public attribute in the new geographiclib interface. :oops: I've fixed that stuff so that now I'm only using public constants.
 
@PM2Ring +1
 
Thanks. Frankly, I can't even remember why I used those private attributes. I think they may have been in some example code in the old geographiclib docs; the new docs don't even mention the e2
 
12:21 PM
1. To improve things, things must change
2. We are changing things
3. Therefore, we are improving things.
 
Well, I ought to know better than to access private attributes in a module I have no control over. :) It would be nice if they made all the handy constants accessible in a uniform way... but I really can't complain: geographiclib isn't just a Python package, it supports a fairly large number of languages, and the author Charles Karney isn't a Python programmer, so I guess he has to rely on the Python skills of others.
 
my canon is used again \o/
boom boom
 
@idjaw Hammered
 
\o/ ta
 
12:34 PM
@PM2Ring isn't it a bit too early to be doing that? Oh wait, time zones.
 
IMHO, geographiclib deserves to be better known. Karney really knows his stuff: he's the major contributor to the Wikipedia articles relating to ellipsoid geodesics, and his algorithms are vastly superior to the more well-known Vincenty's formulae.
Vincenty developed his algorithms back in the 1970s, when desktop computers were just beginning to be available, so he needed something that would work given such limited computing power and RAM. So it's not surprising that distances calculated using his algorithms can be out by several metres, or fail to converge. In contrast, Karney's algorithms always converge, and are accurate (on the reference ellipsoid) to within a few nanometres.
@Programmer What do you mean? It's never to early to hammer a dupe, as long as you've got an appropriate dupe target.
 
@MartijnPieters I finally edited my answer here. Should I just remove the mention of the pycache altogether or is my additional sentence OK?
 
I was only kidding, I meant in the sense "getting hammered". :P
 
@Programmer Ah, ok. Yes, it's 10:38PM here. OTOH, I'm not intoxicated in any fashion. :)
@idjaw The OP just self-deleted. Which I guess is a good thing. :)
 
sweep sweep
 
12:40 PM
@PM2Ring yet
 
@idjaw
import:

Your script. Notice the name you used:
^the formatting above is a bit strange; additionally you could word it that "this is an example of a problem that can often be easily diagnosed if full traceback is provided."
e.g. generalize it a bit and show it in the answer itself
 
@AnttiHaapala thanks for the feedback. So, are you suggesting that the answer should be started off by explaining that the diagnosis is easier if full traceback is provided?
 
yes, and the answer should be self-contained, in that you can tl;dr ImportError, and skip to the answer
well, it is there... but
wait, I reread the answer again
"installed requests package", your module shadows the installed package;
you could even do
.../requests.py
    ~~~~~~~~~~~
but it is not always identifiable such...
there will be cases where it imports another module.
that is why one should say "often"
 
user559633
I'd instead just give examples of a requests in pwd vs requests in the lib dir and then call it out specifically in an example traceback
 
nope...
 
user559633
12:52 PM
No, I wouldn't?
 
you would
but I wouldn't :D
sometimes there has been some ppl who have had another module named requests.py lying there, and they do not notice it shadowing something.
 
user559633
Oh, just read the question.
 
user559633
I'd use jquery.
 
:P
jquery is the best
 
Hey guys. Let's create a SOD for this!
~o~
 
12:55 PM
[michaelscott.gif]
 
user559633
NASA is hiring near me and they've found a way to make working for an amazing goal sound like bureaucratic drudgery.
 

« first day (2175 days earlier)      last day (2777 days later) »