« first day (2714 days earlier)      last day (2249 days later) » 

6:00 PM
When there's that many answers by the time you notice your mistake, usually either one of the other answers is good enough (maybe with an edit or a comment) that you should scrap yours, or they're all so far off that things are less obvious than they appear and you probably need to write a more detailed explanation.
 
Usually when a question garners that many answers, it's basic enough to probably not be worth your time anyway
 
So best practice for the site should just be to just let it be and suck it up?
I'll do that, it's not like anyone will die of not finding a nested minimum in one line
 
@cᴏʟᴅsᴘᴇᴇᴅ: I don't think the NumPy NaT question is a good dupe for the Pandas NaT question. pandas.NaT isn't actually a NumPy NaT, and it behaves differently from a NumPy NaT.
 
Best practice is probably to stop being sloppy and committing answers before you've re-thought them… but I never trained myself to do that well, so I just suck it up sometimes. :)
 
@abarnert Yes... definitely would be the best practice.
 
6:04 PM
@cᴏʟᴅsᴘᴇᴇᴅ Yeah, in which case you can just scrap your answer.
I mean, if you're smart, you'll take a few seconds to realize that's going to be the result and not write one in the first place, but apparently Olivier is no smarter than me in that regard. :)
 
Thx Aran -- that worked and I can now get ride of 3 lines :)
 
@abarnert does not look like it for you though. You really produce high quality answer. Wow, was I amazed by that answer about the print function the other day
 
@user2357112 The second answer to that dupe uses pd.isnull, which is what I would've answered with...
 
wim
how do you skip running the test suite when building CPython from source?
 
One of the nice things about the SO model is that it makes it a lot easier to find my good answers than my bad ones. :)
 
6:05 PM
Hey, can anyone help me in celery?
 
@abarnert Well, smarts doesn't play as much into it as just having seen enough questions to gauge that sort of thing accurately :D
 
@itzMEonTV Someone might be able to but check out the room rules. Dont ask to ask. Just ask :)
 
Yes, definitely. But I think at this point I've seen enough questions that anything I get wrong, I can blame on myself.
 
It is about prefetch in celery. I started two workers with default concurrency and prefetch. Started adding tasks, but it is like round robin. Not prefetching..why? status showing prefetch as 32
 
@abarnert I'm looking at your negative score question right now, hehehe
 
6:08 PM
@wim Doesn't it require a separate make test step to run the tests, so you just skip that step?
(You're not on Windows, or cross-compiling, just building natively for either linux or Mac, right?)
@OlivierMelançon I have a bunch of answers around -1. Some of them are because of the exact same thing you were talking about. Others are because of answering a question from a help vampire before I realized it and deciding the answer might help someone else one day even if someone else disagreed. Some are presumably actual (at least mildly) bad answers.
 
wim
I get downvoted all the time, even on answers I know are good
think I've got some stalker out there with nothing better to do with their life
 
@wim I just tested it out: Fresh clone, configure, make, ./python.exe, everything works, and I never ran the test suite.
 
well you are quite abrasive, so you have a high chance of gathering malevolent stalkers
 
@wim That is a nice way to rationalise votes on bad answers in general
 
@abarnert Yea, even those are really not that bad
 
6:13 PM
@cᴏʟᴅsᴘᴇᴇᴅ: It's still the second answer, and none of the answers actually use pandas.NaT or say anything about the differences between Pandas and NumPy NaTs. I think the Pandas question warrants more than a dupe-link to that.
 
@user2357112 Okay, I'll reopen it. Are you planning to answer it?
 
wim
@cᴏʟᴅsᴘᴇᴇᴅ do you think I'm rationalising bad answers?
 
@wim Whenever you write a less-than-glowing comment on an idiot's answer, there's a good chance they'll get stalkery. If you're lucky they'll serially downvote your last 100 answers, which SO easily detects and reverts. But if they're so lazy they stop after 2 or 3 answers, you're stuck with the downvotes.
 
Oh, I did not realise the question did not have any tags you have a gold badge for
@wim Not you, specifically, but it would be a great argument for anyone to use :p
 
wim
yep, I know. doesn't bother me anymore, got used to it :)
 
6:16 PM
I don't particularly think you write bad answers. Any downvotes you get are likely revenge votes
 
@cᴏʟᴅsᴘᴇᴇᴅ: Probably, unless someone with more Pandas experience handles it. I'm more of a NumPy guy; I'm having to research and verify this on the spot. I wasn't aware of the Pandas/NumPy NaT differences until I tested pandas.NaT.
 
I'd imagine not many users in this tag are qualified enough to answer that question with the level of depth that you plan to, so I'd say go for it.
 
Everyone who's written a lot of answers has written a few that need some clarification to not be misleading. The only problem with the stalkers is that it makes it harder to see the real downvotes that should be a signal that you need to clarify something. Fortunately, most people who are likely to be able to correct me are "abrasive" like wim and tell me exactly what I did wrong, but not everyone is.
 
I can only think of a handful of users... Wes, Andy, and Jeff (all of who are core pd devs), and (probably) piRSquared.
 
wim
@abarnert thanks, that helps (it was a wrapper script running them)
> The only problem with the stalkers is that it makes it harder to see the real downvotes that should be a signal that you need to clarify something.
^ yes
decreases the signal to noise ratio
the rep cost doesn't even matter because we usually hit the rep cap anyway
 
6:21 PM
Now begins the humblebrag :P
 
I don't think that qualifies :P
 
Does the rep cost matters once at 126k anyway?
 
It always matters, it hurts egos
 
I think you get a second bit of swag at 200k, like a mug or t-shirt or something, but I can't remember.
 
DSM
@cᴏʟᴅsᴘᴇᴇᴅ: ahem.
 
wim
6:22 PM
hm I got a mug and t-shirt at 100k so I hope it's not another mug and t-shirt
 
@abarnert Ahah, says the guy who crossed it probably a few days ago
 
@abarnert Oh, right. You hit 200K recently. Pineapples to you :)
@DSM Yes, sorry, forgot about you, because you don't even answer :P
 
wim
@OlivierMelançon No what I mean is, you start losing "opportunity rep" because you're still collecting upvotes.
 
No, I crossed it a few years ago, but lost some rep while I was away (presumably people closing questions that I had positive-scored answers on) and had to cross it again.
 
wim
So if you got downvoted 2 times, the last upvote will give you +6 rep instead of +10
it's hard to explain, and the system they use to cap it is pretty stupid
 
6:24 PM
Hum... I thought it would just sum rep and take max of that against 200
 
wim
nope
the way they do it means that the order in which the votes come in matters
 
and unupvotes mess with it too somehow
 
I remember looking into the scoring system when I was trying to see if I could try to choose which answer put me over 100k, but I don't remember any of what I learned. Or which answer I chose. Or even whether I was successful.
 
wim
yeah like if you got 60 upvotes and then one unupvote, that's worse than one upvote and then 21 upvotes.
 
I guess making addition non-abelian can be an exciting idea to some
 
wim
6:27 PM
What's purple and commutes?
 
No idea
 
wim
An abelian grape ..
 
I think I'm missing something subtle
 
Ahahah! Didn't even know that one.
 
because it's commutative... o.o
 
6:29 PM
@AndrasDeak Do you know that "abelian group" is a group that's commutative? If not, it's not going to be funny.
 
I understand abelian vs commutation, I don't get the grape part...
 
wim
What's yellow, normed, and complete?
 
is it because grape almost rhymes with group?
 
Oh, well, grapes can be purple
 
Yes, they're consonant. It works better if you say it out loud rather than typed.
 
6:29 PM
sorry, I'm being dumb on purpose
 
@AndrasDeak english pronunciation :/
 
@abarnert not in my accent :D
but thanks, then I get what I don't get
 
@wim Hum..?
 
wim
come on this is an easy one ..
 
Let me think
 
6:30 PM
I still don't understand what commutativity has to do with global regular expression and print.
 
(it's probably rare that someone knows about abelian groups and still doesn't get that pun...)
 
I did a lot of my math in French... So I don't immediately see those
 
Banachna?
 
DSM
@wim: that's terrible. :-P
 
Something like bananach?
 
6:31 PM
Oh yeah, Banana Space
 
better -----------------------^
 
Oops, Andras beat me to it. And Olivier got the funny version.
 
wim
close enough ... bananach space :D
 
I love math puns
 
Wait, I got it right, even though mine was the least funny?
 
6:32 PM
They are the best part of math
 
math jokes are just like math on its own for me: I don't get most of it
 
wim
@DSM the french meaning of "terrible" or the english meaning?
 
You don't get math. You get used to it.
 
Kevin, you could at least appreciate the group/grape/grep pun, though? Even if you had the overwhelming urge to explain why you don't need to subprocess grep when you can use a genexpr to filter natively.
 
@abarnert I thought yours is better
 
6:33 PM
I don't even get the follow-up questions to the jokes, yikes
 
wim
TIL what grep stands for
 
DSM
@wim: both.
 
care to share with the rest of the class?
 
DSM
@AndrasDeak: read up a few lines..
 
ohboy, what a long day
 
6:34 PM
It's an expanded version of the ed/sed/vi command to globally search by regex and print results.
 
thanks
 
It amazes me that half my coworkers use vim and don't know any ed-ness.
 
wim
where is the part in cpython sources where it tries to find devel packages on the system
 
it's certainly useful when you get stuck in ex mode and just accept your fate
 
wim
(speaking of grep)
I thought I would find it by grepping for some obvious suspects like zlib-devel, but no dice
 
6:36 PM
I know enough ed to abandon, quit back to the shell, and try again in a proper editor. And it works in vim too, so that's all the vim I need.
 
wim
fun fact .. vim is how dutch people say my name
 
Germans too
 
wim
you german?
 
and Hungarians if they don't pay attention :P
 
yeah
 
wim
6:37 PM
 
And ancient Romans. It's really only a few recent languages that do w that way, even if one of them is the international language of the modern world.
 
slow clap
 
actually, the label on Nutella says "guten tag" which I regularly misread as "gluten tag" in the morning
 
My Machine Learning professor makes a lot of weird puns like this
 
chemistry slash machine learning
 
6:39 PM
Time to put out the dumpster fire of pjs now
 
@wim For your serious question, I don't remember, but it has to build up the distutils config out of the same info, right? So that might help the search.
 
@wim wait, how else would you say it? ._.
 
23rd century Russians will say vim as your name, while searching for the nuclear wessels.
 
wim
Just say it how it's written, except upside-down and flipped horizontally.
 
that's a tongue twister
 
6:41 PM
So we have to round the w and sharpen the m?
 
@Aran-Fey with a Polish ł letter
 
wim-approved fonts are such that "wim" has C2 symmetry in it
 
wim
ł sounds like ee ?
 
no, ł sounds like w as far as I know
 
6:45 PM
@wim Maybe I'm slow, but I literally only just got the thing and I actually facepalmed. Well played, I guess.
 
I thought your point was the w-v deal, not the i-ee deal
 
wim
originally was
oh right
 
DSM
When I was in school we used "Dummit & Foote" as a curseword when a math problem wasn't going well.
5
 
wim
yeah I worked with a guy called Łukasz or something
 
yup, "wukash" (well, wookush I guess but let's not get carried away into English phonetics)
 
wim
6:46 PM
the other hungarian guys called him ... ^ that
 
that's nice, it's not universally known among my people how to pronounce Polish stuff. The "sz"-"s" is infamously the opposite of the Hungarian convention, so that is usually known
 
wim
I always used his name in unit tests because it caused unicode bugs to bubble to the surface
 
Speaking of textbook pairs, Hennesey & Patterson finally got a turing award
 
wim
that's good, cognac improves my programming significantly
@abarnert found it, in setup.py
cpython's setup.py is 2000+ lines :-|
 
I always liked Chinese names with one unusual-enough-to-be-astral character in them. You need astrals to break UTF-16, and you need somewhere that your brain won't recognize and process, but that you can partially recognize as being in the right general set of things.
@wim So we can no longer make fun of perl for inventing its own autoconf/automake replacement in an attempt to simplify things and then ending up with a metaconf even longer than the original autoconf/automake?
 
6:57 PM
How is "python" pronounced? "pyth-awn", or "pyth-un"?
 
pythn ;)
probably depends on whom you ask
 
wim
making fun of perl is always fair game
 
Wait, how are you pronouncing the "y"? If you're not an English-native, that's more likely to be off than then unstressed vowel.
 
wim
I say it like "pythn" and the americans around me all say "pyTHON"
 
I say "py" as I would, "pi"
 
6:58 PM
They stress the second syllable? That's bizarre.
Are you sure they're really Americans?
 
wim
yeah, and annoying
yep chicagoans
 
"pythn" is what I (and literally every other Indian ever) say, but everybody here stresses on the "thon', as wim said
 
It's pit-on
pee-t-on
 
sneklang
 
wim
could also be the whiney chicago accent. it's a long "a" like in "blah" ... pythAAAn
 
6:59 PM
"aigh-thon", the P is silent like in pterodactyl
 
The p is silent in pterodactyl?
I have to go apologize to some people...
 
Ask them to say “shibboleth”. If they say it as “Screw you, I ain’t saying no foreign Go bears!” they’re authentic.
 
@OlivierMelançon in English, yes
 
in openpyxl library how can I know what is my actual index when doing iter_rows?
 
wim
well I never heard a pterodactyl pee
 
we're more than capable of saying "pterodactylus"
 
"Petterodactil"
 
while we're on the subject: the word helicopter is not heli+copter but rather helico+pter: helical+wing
 
wim
is CPython pronounced like "kehpython" or like "spython" ?
 
Who's Peter O'Dactil?
 
7:02 PM
@wim I just had that thought, as a challenge. Remember that question about deleting builtins? Suppose you are in a shell that does not exit on CTRL D and that you delete builtins. How would you proceed to exit, only via Python?
 
I was sure it was abbreviated to "Monty," historically speaking, or "Cleese and co.", and users parselmouths..
 
@wim see pee why thon
 
wim
iirc thon is tuna in french
so i'm gonna say "sea pie tuna"
 
python is pronounced poisson, got it
 
wim
mmmm ... sea pie tuna
 
7:05 PM
What has a name that makes you hungry, but is actually bad for your production environment? Spaghetti Code...
 
@QuicoLlinaresLlorens Perhaps enumerate the thing you're looking for?
 
(makes me hungry, at least)
 
@cᴏʟᴅsᴘᴇᴇᴅ Apple Servers?
@cᴏʟᴅsᴘᴇᴇᴅ Pear Programming
 
@OlivierMelançon (lambda __builtins__=''.__class__.__class__.__subclasses__(type)[0].register.__globals__['__loader__‌​'].get_data.__globals__['sys'].modules['builtins']: [__builtins__.__spec__.loader.create_module(__builtins__.__spec__), __builtins__.exit()])()
 
Those aren't bad, per se. Anyway, the punchline was foolishly in the riddle
 
7:07 PM
@Aran-Fey You cannot, type is not defined
 
@OlivierMelançon Huh, you're right. Not sure when I broke that. I'll have to update my gist...
 
@Aran-Fey You can access it by calling .__class__.__class__ on any object though
I just deleted builtins in my shell and I'm trying to get out
 
Give me a minute :P
 
But yes, doing this worked.

type = [].__class__.__class__
(lambda __builtins__=''.__class__.__class__.__subclasses__(type)[0].register.__globals__['__loader__‌​'].get_data.__globals__['sys'].modules['builtins']: [__builtins__.__spec__.loader.create_module(__builtins__.__spec__), __builtins__.exit()])()
 
Ooooh, I'm a potato. I set the globals to an empty dict instead of {'__builtins__': None}
 
7:11 PM
Or shorter:

type = ''.__class__.__class__
(lambda __builtins__= type.__subclasses__(type)[0].register.__globals__['__loader__‌​'].get_data.__globals__['sys'].modules['builtins']: [__builtins__.__spec__.loader.create_module(__builtins__.__spec__), __builtins__.exit()])()
 
wim
potato, lol
such a funny word, for no reason
 
Or even shorter:

ˋ''.__class__.__class__.__subclasses__(type)[0].register.__globals__['__builtins__']['exit']()ˋ
 
Stop typing

On two lines.
 
Sorry
I'll stop, I'm done anyway
 
"Even shorter, here's another long mess."
 
7:16 PM
I just do that on two lines because I never figure out how to type the ˋ character on my keyboard
 
@wim Especially if you say it real slow. lol
 
Huh. Assigning the builtins module to the name __builtins__ isn't enough to be able to use builtins again? That's weird.
>>> scope = {'__builtins__': {}, 'builtins': __builtins__}
>>> exec('__builtins__ = builtins; print(5)', scope)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
NameError: name 'print' is not defined
 
It worked for me in 3.6.2, what version are you using?
 
3.6.4
 
You are right, it does not work within exec
Oh, I got it you are passing builtins as locals, not globals, try exec('__builtins__ = builtins; print(5)', {}, scope)
 
7:26 PM
I am getting a problem again and again
 
welcome to being a programmer.
 
:D
 
this statement
 
If you keep at it, who knows maybe you will get other people's problems too
 
for cl in range(1,6):
 
7:28 PM
@OlivierMelançon You're right, that works. Not sure why though. The documentation says " If only globals is provided, it must be a dictionary, which will be used for both the global and the local variables." So why does {}, scope work and scope, scope work, but just scope doesn't?
 
    mean_vectors.append(np. mean(X[y==cl], axis=0))
It gives typeerror unsupported operand types for int and str
The last line
 
@Aran-Fey Actually what I suggested is cheating. I provided an empty global dict, so exec filled the builtins.
 
Any solutions?
 
wim
@Aran-Fey I have an answer about that
 
user9107868
@davidism I am ready to come back. Are you ready for me or should I wait?
 
7:32 PM
You should wait much, much longer.
 
@wim As in, an existing answer on SO? Or one that has yet to be typed out?
 
I count at least 3 variables in your question that haven't been defined
 
user9107868
Will do.
 
4, if you're counting the lacking imports
 
wim
@Aran-Fey existing
 
7:33 PM
@excaza you are referring to me?
Actually I am writing this using mobile so was not able to write whole code.
 
wim
came in handy in q08_crazy.py (advent-of-code)
 
for row in ws.iter_rows(min_row=3, max_col=141, max_row=84):
        zone = ws.cell(row=i, column=1).value
        subZone = ws.cell(row=i, column=2).value
        print(zone)
        rowToInsert = [[zone,subZone,2008],[zone,subZone,2009],[zone,subZone,2010]
        [zone,subZone,2011],[zone,subZone,2012],[zone,subZone,2013],[zone,subZone,2014]]
        #for cell in row:
            #print(cell.value)
        i = i+1
Why it says list indices must be integers or slices, not tuples when reassigning in 2nd iteration?
 
Turns out I must've seen that question and answers in the past, 'cause they're already upvoted. Maybe I can remember this tiny fragment of knowledge this time around.
 
@AmmarSabirCheema yes
I'd suggest reading MCVE
 
7:50 PM
Speaking of code on mobile, is there anything like Pythonista for Android?
 
@QuicoLlinaresLlorens Which line? Can you give us a repro with actual inputs instead of some iterator we can't see?
 
rowToInsert = [[zone,subZone,2008],[zone,subZone,2009],[zone,subZone,2010]
        [zone,subZone,2011],[zone,subZone,2012],[zone,subZone,2013],[zone,subZone,2014]]
That line @abarnert
 
Really? I don't see any indexing in that statement at all.
 
@QuicoLlinaresLlorens welcome, please read our room rules: sopython.com/chatroom. In particular, you need to give us enough information to actually help you with the problem. If it's more than a couple lines, either use a site like dpaste.com or post a question on SO.
 
7:56 PM
There is indexing, you missed the comma at the end of the first line
 
Nice catch.
 
So it sees [zone,subZone,2011] as an index
 
@QuicoLlinaresLlorens now I suggest you really read the rules
 
@davidism sorry
 
wim
@abarnert it's like where's waldo for subscripting
 
8:02 PM
@wim I get enough Waldo from missing close parens on an earlier line.
 
wim
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit                pwd                   time
is that any cause for concern (building CPython from source) ?
not sure if it's telling me there's a devel header missing, or it sorted everything out by itself
 
stackoverflow.com/questions/49435233/… – Redupe this, maybe? I don’t agree that this is worth being open. chepner’s answer of using “Ctrl+P” is not really a usable alternative, and I don’t believe that OP was even remotely meaning that.
 
zone = ws.cell(row=i, column=1).value if ws.cell(row=i, column=1).value != None else zone = zone
Why this is not valid?
I get this error: SyntaxError: can't assign to conditional expression
 
Change else zone = zone to zone for a start. You don't need any assignment in there
 
@QuicoLlinaresLlorens what happened when you googled that error?
 
8:08 PM
Not sure what that means; you may have to grep for that string. My guess would be that it means something like "we used our internal compatibility library because we couldn't find any platform-specific header, so you won't have access to platform-specific features beyond the lowest common denominator", but that's just a guess.
 
@poke given that the op commented on an answer that is the exact dupe, I'm inclined to agree
 
wim
>>> datetime.strptime('8082018',"%m%d%Y")
datetime.datetime(2018, 8, 8, 0, 0)
@abarnert ^ that kinda looks like a bug, don't you think?
well, surprised me.
 
@QuicoLlinaresLlorens When you have a complicated expression that's giving you a syntax error you can't understand, either (a) break it into separate subexpressions on separate lines, (b) add parentheses everywhere you think the precedence goes, or (c) both. Usually you'll figure it out faster.
 
wim
I want ValueError there
 
eh... I don't like that at all.
 
8:10 PM
Although then again, that's not how the question's worded. I'll leave it for someone else.
 
As I said in a comment to the OP, I'm pretty sure that it's intentionally reproducing the behavior of SysV strptime, not unintentionally doing something wrong.
And I wouldn't be surprised if that behavior is enshrined in POSIX and/or C standards.
 
wim
sadbadger.jpg
 
@excaza here is the code for program
 
If you were designing it from scratch you'd make that an error. But if you were designing it from scratch, would you use the strptime design in the first place?
 
wim
reproducing a well-known bug is still a bug
 
wim
if they literally use the system strptime and inherit the bug, that's more defensible ..
 
pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html says that both leading zeros are "permitted but not required".
 
They used to use system strptime on all platforms but Windows, but as of 3.3 or so they no longer do.
 
wim
ah, yuck
 
8:13 PM
@vaultah ok
 
time.strptime might still use the system call, but that's more understandable. If you're using time instead of datetime.datetime you probably want your father's C behavior.
Worse, POSIX seems to have taken the BSD improvement where %e means definitely 0-prefixed day and %d means sloppy on board by making %e an exactly synonym of %d, meaning any code you wrote that takes advantage of BSD not sucking as bad as SysV is now required to suck as bad as SysV.
 
On Windows:
time.strptime('8082018',"%m%d%Y")
Out[4]: time.struct_time(tm_year=2018, tm_mon=8, tm_mday=8, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=2, tm_yday=220, tm_isdst=-1)
 
here is the code dpaste.com/37B4F3C and when I executes it gives following error
Traceback (most recent call last):
File "iris2.py", line 30, in <module>
mean_vectors.append(np.mean(X[y==cl], axis=0))
File "/home/ammar/anaconda3/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 2878, in mean
out=out, keepdims=keepdims)
File "/home/ammar/anaconda3/lib/python3.5/site-packages/numpy/core/_methods.py", line 65, in _mean
ret = umr_sum(arr, axis, dtype, out, keepdims)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
 
It looks like in 3.6, both datetime and time defer to a _strptime extension module when present, but I'm not sure where that comes from.
But it has functions named _strptime, _strptime_time, and _strptime_datetime, and the latter two seem to call the first one.
No C accelerator or C interface; it's just always calling the same pure Python code on every platform.
For both functions. And deliberately emulating POSIX.
In [198]: datetime.datetime.strptime('1382018',"%m%d%Y") is especially fun. It parses the month as 1, the day as 3, the year as 8201, and then complains about a leftover 8 at the end.
Not that it shouldn't be an error, but that's probably not the error you expected from month 13.
 
wim
bahaha
>>> datetime.strptime('1282018',"%m%d%Y")
datetime.datetime(2018, 12, 8, 0, 0)
can also be datetime.datetime(2018, 1, 28, 0, 0) , right?
 
8:31 PM
Well, it could to a human reader, but not to the algorithm used by SysV, POSIX C, or Python 3.6 time and datetime. Even if I can't find where that algorithm is every documented explicitly, it's pretty obvious where the greediness goes.
 
I'm getting a warning from pylint in spyder telling me that "id" is an invalid class instance attribute name. "idn" doesn't throw this - is there something in PEP8 or some other convention I haven't come across here?
 
Anyway, in my experience, the only time I've ever had to parse a format like this, it was the first component that was truncated, because some idiot wrote DDMMYYYY dates into an INTEGER field in a database, so the strptime rules were wrong. As I mentioned on the answer, I just left it as an int and used… ldiv, or whatever the right POSIX function is for divmod.
 
DSM
@toonarmycaptain: didn't it spit out the regex which failed it?
 
@toonarmycaptain PyLint gives you an error number that you can look up on the pylint wiki for more explanation. Have you tried that yet?
 
BeautifulSoup makes me hungry when ever i import it
 
8:36 PM
IIRC, pylint's rules are that all attributes should have at least 3 letters, and everyone who uses Django disables that rule because of exactly this issue.
@Teomanshipahi Because the soup is too beautiful to eat?
 
DSM
At the console I get '([A-Za-z_][A-Za-z0-9_]{2,30}|(.*))$' as the controlling regex.
 
@DSM Yes.
@DSM No but I found it in the docs.
 
@abarnert yeah, especially mushroom one
 
@toonarmycaptain This is why when you have an error you want help with, you should paste the whole error, instead of making people guess.
 
I just wondered if there was a convention I didn't know about that limited names to >2 characters
 
8:38 PM
id is a reserved keyword in Python
 
It's just a function (= name)
 
@roganjosh No it isn't.
 
No, you're right
Sorry, it's a builtin
 
Sam
Just been reading up about branching and merging in Git (Shamefully not a Git user but trying).. I have a question about branching..
If I have a file somefile.txt which on my main branch has the content 'hello world'
If I create a new branch and edit the file to read 'hello world!' (and commit the changes).. I'm a little confused how I can switch between the two versions easily in my IDE. Am I to assume I must commit the changes to my github branch and then perform a pull request on my master branch to obtain the 'hello world' version of my file?
Evening all btw :)
 
Actually, I'm pretty sure PEP 8 goes out of its way to explain why attribute names don't have to be as long or as unique as variable names because they're always going to appear together with an object. But pylint is enforcing pylint conventions, not PEP 8 conventions, which aren't identical.
@Sam You shouldn't need any pull requests. Just commit different code into different branches, and git checkout master and git checkout mybranch will switch back and forth.
 
Sam
8:41 PM
So effectively by changing the branch this should change my current version of a file?
 
Yes.
As for how to do it in your IDE… depends on the IDE, but I usually only use IDE git support for things in a narrow range of mid-level complexity—anything easy is faster to type at the shell, and anything hard, I want to know exactly what I'm executing.
 
Sam
When you say 'Just commit different code into different branches' what if I'm making a branch to edit some existing code? I'm using PyCharm BTW
 
wim
if you're learning git, stay the hell away from IDE git stuff until you know the cmd line reasonably well
 
Sam
Ohhhh I see what you're saying. Damn this is neat
 
Start with the existing code's branch (whether that's master or not). Make a new branch from there and check it out. Do your new code there. When you want to switch back and forth, commit (or stash) and checkout the other branch.
 
Sam
8:43 PM
@wim I've been using the console within PyCharm, none of its GUI features
 
wim
@Sam ah, that's fine
 
Sam
I found this great tutorial which pretty much explained great: git-scm.com/book/en/v2/…. My previous attempts at Git were to delete and remake a repo each time it broke :p and commit everything to the master branch
 
If you're used to a traditional VCS, "committed to a branch" is more like what you think of as "staged but not committed" than "committed". Although that can be just as misleading, so don't take it too far.
 
Sam
I'm coming from no version control
 
@abarnert Ah I see. Cheers.
 
wim
8:45 PM
I posted a fantastic tutorial a while back, let me dig up the link again
 
That's actually better—no bad habits (or good habits that are misleading with git) to unlearn.
 
Sam
That's a lie. I'm coming from a 'file_v1' 'file_v2' 'file_v3' version control
 
Sam thank you for that link. You've basically described my current situation so I'll be sure to read :)
 
^ good stuff
 
Sam
8:46 PM
@roganjosh I found it most useful. Let me know what you think. Thanks @wim I'll be sure to take a look!
@wim You made that site?
 
wim
No!
my javascript is garbage
 
Sam
Ahh - I got confused when you said "I posted a fantastic tutorial a while back". You must have meant posted the link
 
What's funny is that I can go back to svn or even Perforce if necessary, but I can no longer go back to hg—any DVCS or short-lived-branch functionality in my head only exists in git syntax/naming, and I can no longer map it back to traditional language.
 
wim
yep, sorry
 
@wim You don't need the "my" in "my javascript is garbage"; it's redundant in English. :)
 
Sam
8:48 PM
My JavaScript knowledge is I can add event handlers...
@abarnert There's probably a js Framework to automatically remove the 'my' ;)
 
Isn't removing the my how you autoconvert from perl to tcl?
 
My aversion to JS has been a bit like how I judge spaghetti before cooking. I kinda think I can just throw enough SO pre-built answers, with little tweaks, at the wall and something will stick. Then the spaghetti grows and grows and I have to seriously consider learning properly what I'm doing :(
 
Sam
You throw spaghetti at the wall?!
Are you Gordan Ramsey?
 
*Gordon *Ramsay
 
After working on fork of the Spidermonkey interpreter, I learned that JavaScript (actually ActionScript) is actually kind of a fun language from the inside… it's just using it as a language to program in that sucks.
 
8:53 PM
In the off-chance it's an idiom in England that you're not aware of: english-for-students.com/Spaghetti.html
 
Sam
@AndrasDeak It didn't feel right
 
say that to his face
 
Sam
As long as he doesn't have spaghetti in his hands
 
wim
some of the stuff that node.js is capable of is pretty amazing
 
From the outside it just seems too omnipotent to me. Like I can't, on the surface reading through the code bases, understand the restrictions of its namespace and what things it can magically act on. <shrug> maybe it's just unfamiliarity
 
8:58 PM
Well, it is a turing complete language. :)
 
wim
 
Sam
Yup, love d3
WebGL amazes me also
 

« first day (2714 days earlier)      last day (2249 days later) »