« first day (2887 days earlier)      last day (2286 days later) » 
00:00 - 22:0022:00 - 00:00

00:41
@user3483203 Finally got the pd.merge() approach working. Splitting the compound column 'FILM' into title (year). Too much work.
 
3 hours later…
03:29
could we check a sourcecode for obsolete code. i.e. python 2.x code?
i mean obviously via a function/script
04:39
Stupid question here, but is there a specific name for the variable generated from a loop? As in the i in for i in range(10), do we just call that a variable?
04:49
0
Q: What is the counter variable in a Python loop called?

LondonRobIn languages where for loops are constructed similarly to this: for (int i = 0; i < max; i++) {} the variable i in this example seems generally to be referred to as a "counter variable". What is the equivalent technical name for the loop variable in Python, where for loops are more like for e...

Thanks
@user3483203 Hey where do you think LondonRob is from?
We may never know
05:11
That answer really sent me down a rabbit hole becuase now I'm wondering if you can define the target list in a way that would make the loop variable change everytime, which would be completely useless in any real sense... I think target list is a misleading term
05:58
cabbage
This should come as a context manager: stackoverflow.com/questions/52269334/python-trap-routine
with trap(event): ...
06:37
@W.Dodge no...
the target_list is a non-terminal in the Python grammar
well, strictly, it is a exprlist
exprlist: (expr|star_expr) (',' (expr|star_expr))* [',']
what it refers to is that you can have several variables there...
for a, b, *c in zip(*[range(i, i + 10) for i in range(0, 40, 10)]):
     print(a, b, c)
a, b, *c is the target list, i.e. list of assignment targets.
for i in foo - here i is a list of one target.
07:22
cbg-ning
07:37
@Aran-Fey I had to close your super() question. While I applaud your efforts, that's way too broad a question, certainly the way you worded it.
sadface.jpg
Well, it lasted longer than I dared hope when I decided to post it
Any opinions on what I should do with the question? On one hand I'd like to keep to keep it because some people might find the answer I posted useful or because I might get some feedback from people who disagree and learn something from it. On the other hand, it's unfair that I'm the only one with an answer on the question
07:52
cabbage
 
1 hour later…
09:06
@Aran-Fey that's the nature of the beast; answers that were posted before a question is closed won't be joined by others.
@Aran-Fey you are welcome to just leave it be, or delete it. It's your call, you self-answered so you can do what you want with it at this point.
Ok. I'll leave it be, then. The chances are slim, but I still hope to get some sort of feedback on my answer
@Aran-Fey: here's one remark: When your class inherits directly from object: classes without bases inherit from object, always, in Python 3.
That sentence implies that you shouldn't use super() on Python 3..
That's why it says "inherits directly from object" :)
I'd use explicitly inherits then.
because class Foo: inherits directly too.
Cbg
09:10
Yeah, I know. There's no difference between class Foo: and class Foo(object):, so I think "directly" is more accurate
The point is that object can cause unforeseen diamond inheritance. Whether you inherit from it explicitly or implicitly isn't relevant
I think constructor doesn't exist in object class
It does exist. It just doesn't do anything.
Assuming "constructor" means "__init__ method".
Can you tell me if it has an argument ?
Well... that's a tough question... it depends on context, kind of
Check this out:
class WithNew:
    def __new__(cls, *args):
        return super().__new__(cls)

class WithoutNew:
    pass

object.__init__(WithNew(), 'foobar')  # works
object.__init__(WithoutNew(), 'foobar')  # throws exception
09:26
I never checked but i think the concept constructor allow to do something liké this super().__init__()
Morever object is a Fake class, WE cannot Say if interface, abstract or simple class. It closests metaclass
Not sure what you mean. There are no interfaces in python, and it's easy to prove that object is not abstract or a metaclass
>>> object()  # not abstract
<object object at 0x7f13bb9bb0d0>
>>> class Foo(metaclass=object): pass  # not a metaclass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object() takes no arguments
As same instance = object()
^ wonder if that'll count towards the Legendary badge
Check stackoverflow.com/reputation
it doesn't count :(
09:36
:(
Interresting
hey guys, what'sup? Any help with this question? stackoverflow.com/questions/52273047/…
basically it's the pickling on networkx objects that's screwing my life
help please!
i'm desperate, being working on that bug for so much time
09:51
Have you googled "can't pickle lambda" yet?
And when you return from google, please read our room rules
o.m.g. dude
of course I cannot pickle lambda
but this is a library
and I cannot find that lambda in the implementation of networkx
clear
?
You're telling me SubDiGraph is a class implemented by networkx?
yes
That's interesting, because I can't find any results for "SubDiGraph" in the networkx documentation
it's in the implementation of networkx.
have you googled "subdigraph" "networkx" yet?
09:59
Hi. Do you see any problem with this code?

def write_response_to_file(generator):
for iter in generator:
total_pages, page_counter, scroll_size, page = iter()
print(total_pages)
I get the exception tuple object is not callable. I make the generator by

yield total_pages, page_counter, scroll_size, page
@fstab Yes, and the closest thing I found was a class named "digraph". Now if you'll excuse me, I'll spend my time on more productive things.
@Phil Try total_pages, page_counter, scroll_size, page = iter. Also, iter isn't the best variable name of all times because it shadows the builtin iter.
@Aran-Fey thank you, works now!
@fstab Okay, I guess you're right. But please include a Minimal, Complete, and Verifiable Example in your question next time; that could've avoided this unproductive discussion
10:16
morning world
i'm wondering if there exists a better way for this question yet: stackoverflow.com/questions/3194516/…
way as in answer / different method?
either or...
let me take a look at that
i was originally having issues with it not "normalising" ø
In [34]: unidecode.unidecode('ø')
Out[34]: 'o'
@fstab You got me! Took me a while to realize that the SubDiGraph defined by networkx is a function, not a class.
hmm i'm using normalize that's why
unicodedata.normalize('NFD', s)
10:31
That's a perfectly normal letter, ask any Norwegian
hey guys I am debugging some python code in eclipse with PyDev plugin. I get a lot of PyDev plugin debug logs in eclipse console of the form pydev debugger: warning:. How do I prevent them from appearing in the eclipse console?
Hey guys, is anyone here to help me with pypython?
Never heard of it, sorry
I seem to have trouble communicating my super woes to other people, so if anyone can be bothered to read a wall of text I'd appreciate some feedback on my new question about super. What can I do to make it clearer? What's making it confusing?
"Wall of text"? :P
10:37
It's no great wall of china, but it's bigger than your average garden fence :P
I mean that would be my first guess for unclarity :D
Tl;dr is unclear
i mean pyparsing in python =)
But I won't be able to read it for hours
10:48
what's currently the most precise platform independent way to measure performance? In this thread stackoverflow.com/questions/7370801/… they introduce native time.time(), time.clock() and 3rd party timeit and datetime
Both timeit and datetime are part of the standard library, they're not 3rd party
oh ok. but which one is more suited?
> platform independent way to measure performance
that one sounds impossible
Definitely something from the timeit module, but I don't know which one of the functions there has the most accuracy
that being said, timeit, called from the command line as a module
10:53
@Arne well its supposed to run on my OSX for testing and later in a docker container
ok then timeit it is, I will look into it
thank you
 $ python -m timeit -s 'vals = range(100)' 'list(vals)'
500000 loops, best of 5: 612 nsec per loop
 $ python -m timeit -s 'vals = range(100)' '[*vals]'
500000 loops, best of 5: 511 nsec per loop
just a snipped to get you going
I don't know if the top google reuslts for timeit usage are any good
haha :-p
IMO the question seems okay and to the point.
Even though I might need to expend more brain cells on it to understand it completely.
Alright, thanks
I'm not sure if they're saying I need to study that tutorial. I hope not.
11:11
@Aran-Fey I think that's the case, and it doesn't seem sarcastic. That's why I felt it was funny. The question is more complex than a basic inheritance tutorial.
You should see the answer that person posted. One version didn't call the Foo constructor, and the other version didn't call either one of the two parent constructors
 
2 hours later…
12:45
@AnttiHaapala Thank you for that explanation last night, I fell asleep before I had the chance to read
I sure hope str.ljust existed in 2.6 or else my answer is going to look dumb
I would test it myself, but I don't have it installed. Are there any online interpreters that support 2.6?
I think Andras / PM2Ring had 2.6 somewhere on their computer, no idea about online interpreters, but likely think that they won't exist. Unless you get hang of some ancient servers.
@Kevin It certainly did.
Phew
Python devs, please implement a companion function to help() named blame(), which tells me in which version a function first existed
also being able to do blame("separate scope for list comprehensions") would be nice but I'll take what I can get
I don't know when str.ljust first appeared, but the fillchar arg was added in 2.4
@Kevin I'm pretty sure that list comp creates a new scope in all versions of Python 3.
12:55
All the ones I've ever used, at least.
Py3 list comp works by creating a temporary function object.
@shad0w_wa1k3r not on Andras' computer but some yamming lab eq.
wouldn't it be nice to have an automatic reference about the certain functions in all python versions ...
@AnttiHaapala I think it was PM2Ring who had 2.6 installed
yes
I had even python 1.0
it was ... "interesting"
@AnttiHaapala yeah, backporting seamlessly would be quite nice, but well...
12:59
kept crashing with sigsegv after 3 lines into the interpreter...
that's when you let Guido write :D
The latest version of Py2 on my machine is 2.6.6. I also have some version of 2.5, but I'm on my phone, so I can't check. I also have 3.1 & 3.6.0
time to compile 3.7 :D
@AnttiHaapala that would be really interesting today
Historically PM has been very helpful in answering my 2.6 related queries but all programmers know that the best workflow is one that doesn't involve any other humans
@shad0w_wa1k3r I mean I compiled it
13:00
So I'm still keen to find a 2.6 environment I can run without, er, installing 2.6
I've started with Python 2.0 with a python 1.5.2 in nutshell as my reference or so...
@Kevin And the fact that you should update software specially when it's 1.1 version higher or about (stupid math) 50% :-p better
lower* but you get the gist :D
I guess so. But I might have problems with OpenSSL. I might have to compile that as well, or at least manually download the .deb. I can't upgrade it with apt-get
@AnttiHaapala ah nice, compiling ancient softwares would also be quite a challenge, specially with updated backward-incompatible dependencies
it is not about the dependencies
but that the code was garbage
13:03
hehe, debugging installation errors would be a headache
I might have Python 1.4 somewhere. I've still got a handful of scripts I wrote for it.
@AnttiHaapala I wouldn't know, I haven't faced much trouble lately (~2 years). Python with docker is bliss.
(and virtualenv wherever required)
Python 1.0.1 (Sep 11 2018)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> exec('print "hello", a, b', {'a': 42}, {'b': 53})
hello 42 53
>>> import regex
>>> help(regex)
Traceback (innermost last):
  File "<stdin>", line 1
NameError: help
argh
>>> regex.compile.__doc__
Traceback (innermost last):
  File "<stdin>", line 1
TypeError: attribute-less object
this was a bad language :d
>>> lambda x: 42
<anonymous function at 5571c4f597b0>
>>> lambda x:
zsh: segmentation fault (core dumped)  ./python
that copyright though....
haha, breaking things is fun (if you intentionally wanted to)
Hi! does anyone here know about a good list of standardized log parses for different systems in python (nginx,apache,linux logs, squid,postfix etc...) ?
* = something like this: https://github.com/etsy/logster/blob/master/docs/parsers.md
But with more parsers, specifically in python.
13:16
Can't say I've seen any resource that aggregates log parsers, no
Other than the one you just linked I guess
Hmm, I'll have to check some more. But I was thinking of creating a directory for some.
\o cbg
@shad0w_wa1k3r thanks to the wonders of academia I even have access to 2.4 \o/
I'm a... happy(?) for you :-p
incidentally that's where I compiled 3.6 myself...
13:39
cabbage
word
I don't understand the additional answer that was added here -> stackoverflow.com/a/52271581/1832539
their example in effect is the answer I provided.
Am I wrong in understanding that they started their answer saying that there is another scenario the accepted answer illustrates, which they try to portray, but in the end showcase the exact scenario that they were not trying to show?
I'm confused...
the only thing I can figure out is them saying users might have to delete bytecode.pyc along with your solution....
perhaps the new answer is just not understanding the second half of your answer?
13:55
maybe?
I mean, if it helps add another explanation, I'm all for it. If ultimately their scenario complements it well, it probably needs to just be edited to provide an additional scenario rather than make it look like it is contrary to my example
too many people on SO are enigmas, best not to try and figure them out...
I think he's saying "the problem might not be evident just by looking through the code of the main source file of your project".
Consider a file myproject.py which has import mydecimal, and mydecimal.py which has import decimal, and a local decimal.py file. Running myproject.py will cause an AttributeError, but just looking at the contents of myproject.py will not tell you that decimal is being overshadowed
I think this is effectively what that user is saying, but they didn't explicitly mention that you're not running mydecimal.py directly
On my third read, no, that's not it
He's saying "import decimal can fail even if you don't have any local files named decimal.py. You can get an AttributeError by overshadowing a module that never appears in any import statement in your project"
The accepted answer advises checking the traceback, but this advice is not globally applicable. Dave Rose's traceback contains no hints that numbers.py is the file that's causing the overshadowing. (although maybe you can guess since it mentions Number, and where else but numbers.py would such a thing be defined)
Although I notice on my machine, the error message is AttributeError: module 'numbers' has no attribute 'Number', which does give you a hint to what file is being overshadowed. So maybe this is less of a problem on a modern install
14:16
@Aran-Fey it's a period not a comma o.o (in regard to your comment stackoverflow.com/questions/52277960/…)
Oops. Being multilingual is hard
not to be picky but yeah :D sorry
(For those who don't know, in german the decimal separator is a comma)
No need to apologize by the way. I appreciate being corrected
I notice that about some notation about . being used to break up a number, but my question is what is the notation to denote decimal if it's not a .?
Related reading:
A decimal separator is a symbol used to separate the integer part from the fractional part of a number written in decimal form. Different countries officially designate different symbols for the decimal separator. The choice of symbol for the decimal separator also affects the choice of symbol for the thousands separator used in digit grouping, so the latter is also treated in this article. Any such symbol can be called a decimal mark, decimal marker or decimal sign. But symbol-specific names are also used; decimal point and decimal comma refer to an (either baseline or middle) dot and comm...
TLDR: If you use a period as a thousands separator, then you use a comma as a decimal separator.
14:23
or you use the bar notation..
> In the Middle Ages, before printing, a bar ( ¯ ) over the units digit was used to separate the integral part of a number from its fractional part, e.g. 9995 (meaning, 99.95 in decimal point format)
If that system had still been in use in modern times, 0̅, 1̅, 2̅, 3̅, 4̅, 5̅, 6̅, 7̅, 8̅ and 9̅ would probably be ascii characters today
Heh, those render funny
i just realized my bar in my quote is missing!
14:38
I can see it on my machine.
I can't see the bar above 9995 either. Is this a Windows/linux thing?
I dont see it on Windows 10, Chrome, FF, IE :\
My bar is missing on the 9995 not the one in the brackets... (sorry for confusion if you meant that bar)
Yes, that's the one I meant. I don't see any bars above the 9995.
I suspect Wikipedia is using markup trickery to render that bar, and it's not present "inline" like the one in the parens is. The markup for the page shows that the number is 9{{overline|9}}95
Whereas the one in the parens is simply ( ¯ )
The page source for that number is <span style="text-decoration:overline;">9</span>
kevin'd :\
New topic. Today I have been tasked with implementing unit tests for the SplineReticulator web site. In order to do this, I must import code from the web site project into the unit test project. But web site project can't be imported. Therefore, I am doomed.
14:48
wait why can't it be imported ?
That's just how C# be sometimes
"You have several other web projects, right? Surely you can just look at existing unit test suites for those other projects and see how they work around this", you say hypothetically. Oh you sweet summer child.
You just need to copy/paste the web site code. Problem solved.
"A well-designed solution would ensure that the web site project contains only the absolute minimum amount of executable code. If there is a substantial amount of business logic in a web site project, something has gone horribly wrong", you say. Dear reader, you are correct on all points.
I'm really curious why C# won't let you import the code. Is there a short explanation that doesn't require much C# knowledge?
rb folks
14:53
my guess is they have dependency / conflicting source for importing a solution into another.
rbrb \o andy
web site projects should contain, primarily, resources that are not directly compiled. template files, resources such as images, etc. The actual source code should be written in a separate project, which is then imported by the web site project.
I feel bad for that question asking how to find all their API since their lead dev left, But then I guess this is why you should document all your End points.
You can jam all your source code into the web site project, and this works just fine, except that code is inaccessible by any other project. This is almost never a problem because almost no other projects would be interested in the code designed specifically for one web site.
But, oops, the unit testing project is interested in that code.
So basically you'd have to refactor the entire code base in order to make it testable? Ouch.
I think for our company, we use Automated regression test with selenium for our web site testing
Our Unit test are generally only for our API testing and what not...
15:02
Or maybe it's wrong to say that a web site project should contain no code. .aspx files always have an accompanying source file, and you can't(?) cleanly place those into a separate project. Maybe the ideal is that the web site project should contain only code that you don't want to unit test
You would prefer selenium-style testing for code whose only visible effect is changing how a web page is rendered. So if your web site project contains all and only that kind of code, you can happily ignore it in your unit tests.
The upside is that the code that needs to be unit tested is the easiest to refactor into a separate project
wim
wim
15:26
Spent ten minutes composing an answer in Notepad++, and came back to see the question was deleted... Sigh
The comments hint that the OP figured it out on his own, so at least he's in a better place now
I've been seeing a lot of "how do I print my 2d data structure in a nice aligned grid?" questions lately.
15:41
oh i do like the git range-diff
wim
wim
@Aran-Fey my opinion: delete it
If you don't delete the question, at least delete the answer. Some of the recommendations made in the answer are really bad/wrong.
I think the OP's assumption (that the accumulator value from cv2.HoughLines() can be returned) in this post may be wrong. Can't find anything supporting except a vague reference in the docstring.
3
Q: OpenCV+python: HoughLines accumulator access since 3.4.2

user2246166In OpenCV 3.4.2 the option to return the number of votes (accumulator value) for each line returned by HoughLines() was added. In python this seems to be supported as well as read in the python docstring of my OpenCV installation: "Each line is represented by a 2 or 3 element vector (ρ, θ) o...

15:57
rb guys
NM, answer just posted
@wim Noted, but could you elaborate a bit about what's wrong with it?
16:16
it took me like 20 minutes to understand "mylist.append(x)"!="mylist=mylist.append(x)"
now hating: everything related to python packaging
@Null Read the documentation for append(). What does it return?
NOTHING
oh wait...I misread that you still don't understand...my bad.
well, it returns None
16:28
yah, which in python-speak is basically the same as NOTHING
wim
wim
16:44
@AnttiHaapala packaging is not 100% awful currently
Sam
Sam
Evening all.. does anybody recommend any tools for testing API modules? I find it a little tedious using curl and checking response codes
wim
wim
@Sam within which framework?
Sam
Sam
Flask
wim
wim
I'm not a flask expert but presumably they have a test client you should be using.
Sam
Sam
Not for writing unit tests.. more for just playing with the API
wim
wim
16:47
ah
check out postman getpostman.com
Sam
Sam
Sweet i'll have a look. Thanks :D
@Sam there is webtest
it is from pyramid-world though, but would work with any WSGI
presumably there is similar with more flaskish interface..?
Sam
Sam
getpostman looks ideal for me
or perhaps Ididn't understand the question :D
Sam
Sam
That is useful for writing unit tests though so thanks
Yup that app is awesome
17:48
I love finding a question that has already been answered and forgotten then spending too much time writing another answer that no one else will care about but me.
wim
wim
so glad that cpython dev has moved to github now
they have a process and an army of bots for creating backports etc
time from diff to merge: 5 days github.com/python/cpython/pull/9086
18:01
Poll: When implementing a file-like object, how important is it to correctly implement the read(maxsize) method? Would anyone care if I my file object returned more than maxsize bytes?
wim
wim
compulsory
you may return less than maxsize, not more.
this is about the callers available buffer size, which you can't know about
Huh. I didn't think anyone had to worry about buffer sizes in python
wim
wim
they do.
Alright, I guess I'll write a mixin that buffers the excess data
make read(maxsize) always return the empty string, thus satisfying the requirements
18:15
The problem is that the empty string signalizes the end of the file, so that would still be incorrect :(
Sam
Sam
Any Flask wizards about? I'm having difficulty wrapping my head around making modular components.. I'm trying to create an authentication module which contains a User model.. I'm not really sure how I add this model into my migrate
I register the blueprint but I'm a little unsure how I link the models
wim
wim
@Aran-Fey related Guido considering EOF vs empty string
Answered a question but a comment from the OP five minutes before my submission implies that he's stepped away from the computer to think about the problem in quiet seclusion. Bad timing.
In a month's time he'll emerge from his contemplation zone (most likely a cabin deep in the forest) and come back to my post and say "well, yeah, I figured that much out". It would save him a lot of time if he skipped all that and just gave me an accept
@Kevin hehe
DSM
DSM
Okay, this "let's throw numpy and pandas at everything" habit has, like the phrase itself, jumped the shark.
18:28
I voted to close for too broad and now I kinda wanna change it to a dup for stackoverflow.com/questions/29066207/…
oh btw DSM/Idjaw, did you guys hear the Habs' GM wants to win the cup this year? not even trying to rebuild or what not, just straight up win it with the current team. I found it kinda amusing
DSM
DSM
I'd laugh except the karmic consequences of that could be dire. So instead, I'm going to say that I admire the commitment to victory.
@user2357112: that mod Q is weird. I figured it would be a lot easier to track down than it seems to be.
@DSM: I think it's just fmod being slow.
I would have said "as simple as fmod being slow", but fmod being slow is probably a big can of worms.
could this pseudocode be implemented? if so, would there be a use for it, i mean when do we need a bunch of variables be created? pastebin.com/zyjm4nX1
DSM
DSM
The use would be anytime you needed something like a dictionary, so there are lots of use cases. But we just use a dictionary instead rather than cluttering up the namespace directly.
I mean, after you create the variables you need some way to treat them as a group again anyway.
@Null The conventional wisdom is that you virtually never need a variable number of variables. That's what lists and dicts are for.
You are basically doing this, but with less pleasant syntax:
def variablenames(n):
    a = {}
    for x in range(n):
        a[n] = 42
    return a

print(variablenames(3))
"But now you can't access those variables by referring to a_1, a_2, etc. You need those unsightly square brackets. Doesn't that make it worse?" you ask. Maybe. But I struggle to think of a situation where you would create a variable number of variables, but then only refer to them by literal name.
If you know you're only ever going to refer to a_1 and a_2 and a_3 and that's it, you may as well create them normally. If you don't know how many variables you need at compile time, you're going to have to do a_(n) anyway, so your code will be just as unsightly as if you had used a dictionary, if not more so
This is a rather long-winded way of saying "I agree with DSM"
18:48
Why say few word when many word do trick?
Whenever I write something that contains no new information over what someone else already posted, I console myself by imagining that the intended audience still finds it illuminating thanks to the slightly different wording
Consider: a floodlight in the darkness casts many impenetrable shadows, but two floodlights may cover one another's blind spots
inb4 "bold of you to compare yourself to anything more incandescent than a glowstick"
the real problem is when you need to access anything programmatically, and your only choice is eval(f'variable_number_{k:02d}')
(I know locals() and whatnot :P)
also recbg
With lists and dicts I fail to see why many people are drawn to dynamic variable names in python. At least in MATLAB there's neither (sort of), so the replacement is non-trivial
I want to see a play written in the style of a Socratic dialogue between Simplicio, who has just come up with this great idea for variable variables, and Sophisticus, who praises the idea yet probes for technical details until Simplicio realizes that his new feature is no more powerful or concise than a dictionary
19:22
Hmm. What would you say to a proponent of variable variables who puts forth this use case: "I have a dictionary of constant values, {"inches_per_foot": 12, "feet_per_mile": 5280, "pints_per_gallon": 8, ...}. I wish to use these values in my code, but I would prefer to access them like x = y * inches_per_foot rather than x = y * constants["inches_per_foot"]."
"I never need to access the values dynamically, so I won't have to touch globals() or locals() once the names are initially injected into my scope."
What advice would you give this person? "Using a dict is so much more consise" is not as objectively true in this scenario as it is in the typical use case. If these values are used enough times, then the variable variable approach will require fewer keystrokes than the dictionary approach. And all the ugliness of the variable variables approach is concentrated in the one bit of code that injects the names, which is more easily ignored than sprinkling dict indexing everywhere
Perhaps the proper retort is "if the dict is constant, delete it entirely and manually create those variables instead. Then you save keystrokes because inches_per_foot = 12 is two fewer keystrokes than "inches_per_foot: 12", and we're not even counting the length of the name injection code"
@Kevin "you can never be sure"
"If the dict isn't constant, I question your assertion that you'll never need to access the values dynamically"
19:51
My genius solution pastebin.com/fqm1Xz4E to a question that @DSM answers with a one-liner :\ Glad he posted before I did. LOL
4
A: Pandas: Forward Fill without Filling trailing NaNs

DSMOne way would be to bfill, which makes everything before the last non-NaN value non-NaN, and then use where to select the ffill() results: In [45]: df.ffill().where(df.bfill().notnull()) Out[45]: date ERICB SS Equity DCI US Equity FLEX US Equity 0 2008-02-14 8.026 ...

else: pass is a no-op, incidentally
Did you mean to use continue?
Yeah that's totally unnecessary isn't it. The if statement alone is enough ya?
#Likewise,

if thing:
    pass
else:
    f()

#is more concisely written as

if not thing:
    f()
Umm hmm, yup that's pretty obvious now that you mention it
Update: The OP from before said my answer was interesting and he would think about it. I guess he'll need to spend a month in the contemplation cabin anyway. I get that.
19:58
@Code-Apprentice neat
@AndrasDeak To be fair, I found that because @wim linked the entire page earlier
20:52
TIL you can use an empty Tuple as a key, guess that make sense since tuples are immutable and hashable. I guess I just never thought of using tuples as keys...
Actually digging back to my high school days, past me did use tuples as keys for my text based adventure game.... guess present me needs to remember/learn from past me...
cabbage
cbg coldspeed
been a while and new picture ?
I've been here on and off. New picture indeed. I became bored staring at my identicon :P
"(Ex) Software Engineer"?
21:08
I just read coldspeed's profile, same age but worked at google.... :\ some people are more talented/dedicated than others
@user2357112 Yeah, I'm returning next June for full time. Will update it then
similar to when i hear a 17 year old is being scouted for professional sport... makes me wonder what we've done in our lives lol
Actually I'm not sure what one puts when in limbo. Maybe I'll just remove it altogether for now
Thanks mooing, but I've a long way to go :)
google space limbo :D
wim
wim
@MooingRawr tuples as keys of a dict is often a better pattern for a "2D hash" than using a dict of dicts.
numpy gets the WTF award for weirdest use of an empty tuple (it can be used to index an 0-d array)
21:14
what do you mean by "2D hash" do you mean hashing both objects together or something else ?
I think he meant hashing of depth 2 or more
abc
abc
@wim interesting, could you expand a bit more? You mean that it's better to have d[(0,1)] with d = {(0,1):1,...} than having to access d[0][1] with d={0:{1:1},...} right?
wim
wim
@abc sometimes better, yes.
thats 1 getitem call, not 2.
@Aran-Fey did you get your 500 pts bounty refunded when the too broad question was closed?
yeah
wim
wim
21:27
Are you gonna put it on the new question? If so, I will write out a thorough answer for it.
I wasn't planning to, but if it nets me a good answer...
Though it's currently sitting at a score of -1, so I should probably try to improve it before I post a bounty (though I don't really know what's wrong with it)
wim
wim
Yeah. The thing I saw that was wrong with it you already fixed
That was just a typo anyway. I hope nobody downvoted because of that
wim
wim
+2/-2 is still +16 :)
Oh, someone undid their downvote. Nice. Two to go
Alright, time to haggle. I don't think that question is worth a 500 rep bounty. Unless it's more broad than I realize, 200-300 should be plenty. How does that sound?
DSM
DSM
21:36
What Q are we talking about?
@Aran-Fey you can always start from 100 and see what happens
DSM
DSM
I remember once being on an overbooked flight where nobody wanted to take a later one and by the end it was a free flight + 500$ or so.
The same day?
DSM
DSM
This was years and years ago, so don't trust my memory, but I think so -- my flight would have been late afternoon. I remember telling my father (who would have been picking me up in Calgary) about the story and why I didn't volunteer because of the inconvenience to him, and he was like "for that amount of money I'd have gotten over waiting a few hours, you should have done it". But this was pre-cellphone, so it was harder to arrange things like this..
21:46
hehe :) "now you tell me!"
wim
wim
@Aran-Fey sound good
200 it is! :p
DSM
DSM
200 OK, as they say. ;-)
I ACK that reference
DSM
DSM
I'm not going to beat that today, so I'll rhubarb out. Later!
21:49
rhubarb
100 Continue the HTTP status jokes
wim's current http status is 402 Payment Required :D
Aran would you object to making SuperCls take optional args to not have to worry about it's "parents" or does that defeat the purpose
I don't object to anything. I'm basically asking what the correct way to do it is. If your answer says "Use **kwargs in your classes because <insert explanation here>", that's a perfectly good answer
Just be prepared to answer some follow-up questions, like "Since 99% of classes I've seen don't use **kwargs in their constructor, does that mean 99% of python classes are implemented incorrectly?"
well my suggestion would be not to call super in a superCls that has a diamond shape dependency , but i understand this might be for educational purposes or your hands might be tied on this matter
im not saying don't use **args, I'm just simply saying that if you have a class that is dependent on it's super / mro might as well have a **arg so it can handle these scenario
similar example could be like I tell you to find someone to paint my room but I don't give you the price of the cost. and you don't pass that along to the next person, would be unreasonable
@Aran-Fey if blaming other people is a way out then I don't see the problem :P
21:59
Frankly it's ping pong time, if an answer isn't written to your satisfaction by the time I come into work tomorrow, I'll write one up
00:00 - 22:0022:00 - 00:00

« first day (2887 days earlier)      last day (2286 days later) »