« first day (3727 days earlier)      last day (1220 days later) » 

5:28 AM
@python_learner Did you implement your trie? The existing packages cited should be what you need. But if you want a tutorial on coding your own, Albert Au Yeung's from 2020 is educational.
 
hey smci, I am following github.com/bdimmick/python-trie/blob/master/trie.py from the links you gave, I have not fully understood all the dunder methods there though
I can get away with not using those but still
 
 
1 hour later…
6:47 AM
cbg
 
7:06 AM
@python_learner I wouldn't use the pure Python implementations since you said prefix-lookup performance was an issue. As to the dunder methods, they're pretty standard, just google for a tutorial.
 
8:04 AM
 
8:48 AM
Hello guys, is there a standart way to do a sklearn operation? In particular a logistic regression?

What I mean is, that there are f.e. some standarts for a literature review... And I wanted to know if these statistical approaches also have a standartised way, because I need this for a paper.
@smci Hi dude, thanks for the edit of my questions btw!!
 
9:14 AM
I don't follow. Do you mean you'd like to see good examples of logistic usage?
If that's the case, the scikit docs (which are quite good, in case you haven't checked them out yet) have a section on logistic regression which also features a number of examples.
 
9:57 AM
@Arne Thanks for your answer. So I mean like a standartized procedure according to someone who wrote a paper. For example: For literature reviews its Transfield et al. 2003 or something. So its a standart after which you orientate and do this process.

Do you follow?
 
ah, yes. No, I don't know of such a paper for logistic regression specifically, I haven't used it very much myself.
 
 
3 hours later…
12:44 PM
my sqlafu fails me :(
got installation*--*company*--*user where *--* = many to many
and now... how do i write the cleanest code for query(installation).... where current user belongs to a company that has a relationship to the installation :D
all are 2-way navigable relationships (non-lazy)
i.e. I could use a join, but I need not
because the company_user association table has the user ids
ah
filter(Company.users.contains(current_user))
 
1:01 PM
Hi
 
hi
 
why is try ... else not allowed
 
1:19 PM
I mean... what would the point of that be? What would even happen if an exception was raised?
 
AAB
Hi
when using something like sqlite3 or any other rdbms is it fine to include repeating fields in the same table instead of a separate one?
 
Don't tell me you want it to act like an except: pass? I'm gonna scream
 
@Aran-Fey of course not.
 
AAB
for eg t1(vid,vname) t2(pid,pname,vid) => t2(pid,pname,vname)
 
if I do not have except block then exceptions are not handle.
 
AAB
1:24 PM
instead of doing joins just include the value in the table?
 
@Aran-Fey hint: what happens if you do try: finally:?
 
So how is a try...else different from... literally no control structure at all?
 
Hi guys I have a question regarding how I should aggregate the count of users for a certain dataset that I have to handle.
 
does it do except: pass
@Aran-Fey it is indented. In case I want to add something else :D
 
Here is how it looks: pastebin.com/9UjYhhfd
 
1:26 PM
@AnttiHaapala ಠ_ಠ
 
The question from my side is not how to do the aggregation in Python, its more of what approach should I use
 
@Aran-Fey so explain to me why there is else block anyway :D
 
Are you aware that the else block is only executed if no exception was thrown inside the try? :P
 
1:29 PM
In case someone suggests why I can't export the data in that way, its because there are more than 14 million records and its not feasible without aggregations
 
Then I'm not sure what more I need to explain ._.
 
but it is like equivalent to executing the code after the end of try, excepting the finally.
and hence we come back to: why is try: else: not allowed.
or try: else: finally:
 
Ah. True, but it lets you keep the code inside the try to a minimum. That way you're less likely to accidentally catch an exception that was thrown somewhere you didn't expect
 
hmm though, finally always runs after the else block.
 
try:
    i_know_this_can_throw_an_exception()
except:
    print('oops')
else:
    this_can_also_throw_an_exception_but_i_dont_wanna_catch_it()
In a try...else...finally, what would happen if an exception is raised in the else block?
hmm, the same thing as in a try...except...else...finally I guess
which is... I have no idea
Ah, it runs the finally block and then re-raises the exception
Alright, try..else..finally would actually have a use, unlike try..else
 
 
2 hours later…
3:15 PM
Hi
 
3:39 PM
Hi guys.. has anyone solved this (projecteuler.net/problem=254) without brute-forcing ?
 
can some tell me why r.search function with .group in the syntax can't return none as well?
 
@arielma Not sure what you mean. Both re.search and match.group can return None
oof, sorry for the triple ping
 
when I'm using ,group it throws exceoption
 
That's because you didn't find any matches
 
correct, so it can't return none as well?
 
3:49 PM
Huh? You're getting an error because it can and does return None
"it" being re.search in this case
If you're asking why None.group can't return None, that's because no None.group method exists
 
ok tnx
and one more question
can I use None value for max function?
 
Use it how? max(None)? Obviously not
 
I mean: max(None,1)
per this thread, it was possible in python 2, but not in 3
12
Q: Python min/max on None type

mclafeeI noticed that while the 'max' function do well on None type: In [1]: max(None, 1) Out[1]: 1 'min' function doesn't return anything: In [2]: min(None, 1) In [3]: Maybe it's because there is no definition for min(None, 1)? So why in max case, it return the number? Is None treated like '-inf...

 
What would you expect to get as a result from max(None, 1)?
 
I was hoping to get 1 :)
 
4:05 PM
That makes sense I guess. But no, that doesn't work because you can't compare None to ints. None < 1 will crash, and so max(None, 1) will also crash
 
ok tnx
 
4:21 PM
@arielma scientific libraries have nanmax but that only makes sense if you're using those libraries anyway
 
 
3 hours later…
6:54 PM
if you're not using those then something like max(val for val in vals if val is not None) would make more sense
 
@AndrasDeak - need to guard against all values being None, in which case you get an error for calling max() with an empty sequence (probably unlikely, but still an edge case).
Ah, I see that in Py3.4, an optional default argument was added to min and max, to be used in case the sequence is empty. Could have used that in my last job...
 
7:27 PM
@PaulMcG yes, that should raise anyway :P
 
 
4 hours later…
11:51 PM
HNQ has outdone itself. How to prevent the water from hitting me while sitting on toilet?. If this constitutes a "life hack".... my word
 

« first day (3727 days earlier)      last day (1220 days later) »