« first day (2044 days earlier)      last day (2920 days later) » 
00:00 - 20:0020:00 - 23:00

12:05 AM
Okay, how do I make pycharm break on every error rather than just throw an error and die? Like dbstop if error in MATLAB
 
 
3 hours later…
3:21 AM
it should just work ... click on the breakpoint thing and make sure you check "stop on exceptions" (but really thats typically the default)
 
 
2 hours later…
6:12 AM
cbg all!
I can't understand the last example here: docs.python.org/3/tutorial/…
In this example, the echo and surround modules are imported in the current namespace because they are defined in the sound.effects package when the from...import statement is executed. (This also works when __all__ is defined.)
I don't get This also works when __all__ is defined. It should only work when __all__ is defined.
I am referring to the last example here.
 
6:37 AM
Is there any way that I can parse timezone from my datetime string?
With using datetime module
 
@fredpedro no.
datetime absolutely sucks.
@fredpedro what be the format of your timestamp?
@AbhishekBhatia no.
@AbhishekBhatia read about __all__ again. In absence of __all__ python behaves as if all names that do not start with _ were added in __all__.
that is no __all__ is different from __all__ = []
@AbhishekBhatia in that specific example the first 2 imports import the submodule into sound.effects; they exist as names in there (attributes of the module sound.effects)
finally from sound.effects import * imports all attributes present in that module into the current namespace
@fredpedro you can try to "parse" the timezone string by first modifying it to something parseable by datetime, it does parse certain formats of timezones.
e.g. fixed offset in very strict formats. Most of the time it just sucks.
@idjaw @idjaw certainly 4 hours wasn't enough when upbringing the current team Canada :D
 
6:57 AM
@AnttiHaapala thanks for the reply! i think no __all__ is same as __all__=[]. I tried a quick example here bpaste.net/show/69fb181b3500
The tutorial says If __all__ is not defined, the statement from sound.effects import * does not import all submodules from the package sound.effects into the current namespace; it only ensures that the package sound.effects has been imported (possibly running any initialization code in __init__.py) and then imports whatever names are defined in the package.
@AnttiHaapala I am referring to Python 3.5, unsure if this was different in Python 2.
 
7:14 AM
@AbhishekBhatia check our rep ratio again.
it imports whatever names are "defined" = present in the package
the previous 2 import statements from that example just imported the 2 submodule names into there
note that the submodule does not exist in the parent module as an attribute (i.e. the package), unless it is imported there first!
 
@AnttiHaapala By present in the package, you mean present in __init__.py?
 
no
by present I mean: hasattr(package, 'submodulename')
but the tutorial is right, though perhaps confusingly worded (and I just woke up so I am confusing as well)
ah there is a mistake
__all__ does not need to mean "names of modules"
it just means "these are the names to import with * - if the name is not present, please try to import it"
hmm perhaps I should make a bug about that
 
@AnttiHaapala which line are you referring to ?
 
if a package’s __init__.py code defines a list named __all__, it is taken to be the list of module names that should be imported when from package import * is encountered.
this
they need not be names of modules.
all in all, you shouldn't perhaps use __all__ at all...
it is not a good practice to support it.
only in some very rare cases.
 
What else can they be?
 
7:25 AM
they can be any names
% cat foo/__init__.py
__all__ = ['barf']
def barf():
    pass
if the name already exists, it is not imported as a module.
even though
% cat foo/barf.py
print("barf imported")
python3.5 -c 'from foo import *; barf()'
doesn't print "barf imported"
so the statement is not very right
 
Oh!
I don't know how import works. But byif the name already exists, it is not imported as a module. you mean the names defined in __all__ are imported at the end?
Otherwise, how does it know that the name already exists?
 
it goes like this: from package import * first checks sys.modules. If package wasn't ever imported, it is loaded now. Its body is executed once.
 
@AnttiHaapala I am still confused by your statement: it imports whatever names are "defined" = present in the package. In this example I tried, bpaste.net/show/69fb181b3500 b in present in A package but does that mean it is defined in A?
 
lol, this python packaging mess is so confusing.
 
yeah. :)
 
7:36 AM
packages are special case of modules that can have subpackages and or modules
but they're still modules.
we're talking about what attributes are present in the module scope at the time of execution of from package import *
exactly which attributes are present when the package was properly loaded, its body was executed once already, and if it was loaded before that statement, whatever changes had happened in its module scope prior to that from package import *
now at that point, from package import * will always check if __all__ is present in that package.
if it does, it is a sequence of names to import from that package.
so the importing code tries to getattr(package, name) each and every name from that list of names.
if an attribute access raises AttributeError, only then the importing code tries to import package.__name__ + '.' + name as a module, and then repeat.
 
thanks that makes sense!!
If you could give an example of __all__ not defined != __all__=[] that would be great.
 
% cat foo/__init__.py
__all__ = []
def barf():
    print("Barf barf")
% python3 -c 'import foo; foo.barf(); from foo import *; barf()'
Barf barf
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'barf' is not defined
now try with __all__ removed
 
7:54 AM
Cabbage
 
@PM2Ring switched back yet?
 
@AnttiHaapala :) I haven't been doing much coding lately, and I suppose I'm still mostly using 2.6, but for stuff I post to SO I check that it works on 3.6 too.
 
@PM2Ring "external source" and then guy is showing they pasted it
so why not swithc your code to python 3 :d
it isn't that hard.
 
@AnttiHaapala I try to write stuff that works on both, unless the resulting code would be too inefficient.
@AnttiHaapala I have almost no motivation to convert my old code to Python 3. I'll do that when (if) I need to on a case by case basis.
@AnttiHaapala Yeah. The original version of the question didn't mention that they'd pasted it. And I'm still not sure if they actually did paste it in by hand. :)
 
not sure about that eithre, but someone pasted something somewhere or something
either that guy made the error of using \2 in a file path, or the external code did that
 
8:11 AM
@AnttiHaapala wow, I didn't expect that.
 
@AbhishekBhatia Why not? \2 is an octal escape code in Python.
 
@PM2Ring I was referring to the previous example he mentioned about importing.
 
@AbhishekBhatia Oh. So maybe you should've linked your reply to that post...
 
oh yes. Will do in future.
 
@AbhishekBhatia so clearly as the output is not the same, not defining __all__ at all is not the same thing as __all__ = [].
stackoverflow.com/q/36808260/918959 why does this question need copies?
 
8:42 AM
@Ffisegydd 1.80775 lol.
Testing how to get suitable output from vowpal :D
 
9:15 AM
it only outputs some log-confidences for OAA and I am trying to map it to probabilities
 
10:12 AM
cabbage
 
10:54 AM
@Antti nice :P
Got a slight improvement from using xgboost.
Up to 74th place.
Need to start doing some hyperparam searching.
Also considering some ensemble methods.
 
@AnttiHaapala We will consider the exile of the current team Canada based on today's game.
 
@idjaw did you lose at iceball?
 
11:16 AM
@Ffisegydd Finland beat Canada 4-0 a few days ago. But today is an elimination match against the USA.
 
20 hours ago, by Bhargav Rao
@AnttiHaapala Suomi 4!!!
 
Finland vs Russia today
as well
 
9gag was filled with Finland posts on that day. :D
 
I'm trying to be optimistic for today
they better beat the US
and on that note....time to rbrb. cheers all
 
Best of luck for your team. :-)
rbrb
 
 
3 hours later…
2:05 PM
finland vs russia atm
and russia in the lead...
@Ffisegydd I think vowpal/simple gradient descent is not a good match for this :D
not enough data...
hmm
 
@AnttiHaapala 1 1
 
yeah
@BhargavRao hope that there will be an epic Fin-Can tomorrow
 
@AnttiHaapala Yeah
Wanna see another 4-0 :P
(cc @idjaw)
 
:P
though this tournament already sucks a bit.
Finland didn't defeat sweden
 
I've been watching only the scores.
 
haha the first free english stream there is 10 seconds ahead of my tv :d
 
@AnttiHaapala :)
 
@JohanLarsson you've got some sort of automatic ping for string sweden eh? :d
 
no, just happened to skim the screen
Stuck with a unit test :)
 
2:23 PM
:D every time I mention sweden :D
 
2:36 PM
3-1
 
3:28 PM
36 seconds left...
3-1 :D
 
@AnttiHaapala Thank you for the response. I used dateutil instead to parse the timezone in my string and create my datetime object
 
good
but which format was it?
3-1, Finland = Final'd
 
It was this "Tue, 26 Apr 2016 02:40:16 +0000", tried to use strptime prior to dateutil, but I encountered an issue with parsing the timezone. dateutil made everything easier
 
DSM
Here's hoping for a Canada/Suomi final!
Waiting-for-phone-to-charge cabbage for all.
 
:D:D:D
if Finland wins, it'd be a record U18, U20 and seniors for the same country same year
 
DSM
3:39 PM
Can't have that. Nothing personal, you understand.
 
@fredpedro That timezone can't be parsed by Python 2 stptime, but Python 3 can handle it.
>>> from datetime import datetime
>>> s = "Tue, 26 Apr 2016 02:40:16 +0000"
>>> d = datetime.strptime(s, "%a, %d %b %Y %H:%M:%S %z")
>>> print(d)
2016-04-26 02:40:16+00:00
 
hmm
@fredpedro yeah, but in general case you'd want to use dateutil anyhow :D
or if they're strictly iso 8601, then the iso8601 single file package is ok.
 
DSM
If you're installing an extra package anyhow, might as well be one which is more robust.
 
I just noticed that the weekday name is ignored: if you change "Tue" to another day it makes no difference. It'd be nice if it at least issued a warning that the date string is inconsistent.
 
@DSM but iso8601 really does not need install, just throw the 1 file in
@PM2Ring it is just how the C standard library works...
(f*cked up)
 
3:50 PM
@AnttiHaapala Ah, of course.
 
DSM
Not sure what I think about the just-throw-one-file-in install policy.
 
the parsed data is filled in struct tm
@DSM not "in install" but you can throw it in your package...
sometimes there have been people who said "I cannot install any extra packages"
 
DSM
True enough, although I often wonder what circumstances they're operating under.
 
Indeed. Eg, if it's for a school project they may not be allowed to use 3rd-party modules. The other side of the coin is people who ask "how do I make my Python script automatically install stuff that's not already installed?".
 
DSM
4:07 PM
@davidism: you're making me look bad, I have pandas tickets I should be working on..
 
4:35 PM
@AnttiHaapala it seems that f"" strings are even slower that .format: stackoverflow.com/questions/37365311/…
 
4:47 PM
Is 15% really that much slower?
I suspect that with larger examples, the parse time for str.format() may start to play a role too.
Still, a little surprised at the use of BUILD_LIST, I wonder if bytecode using a constant string format could be used instead. Positional arguments in the constant string, pass in the expression results as positional arguments to a str.format() call...
@PM2Ring: your comment doesn't make much sense. Why wouldn't the expression be compiled at compile time?
 
@MartijnPieters I thought that maybe it was doing something like calling eval every time the f-string is evaluated.
But on reflection I guess I should delete that comment. :)
 
I wasn't sure what you were asking since I just showed the disassembly in my answer (where the string was converted to bytecode, including the x expression).
 
@MartijnPieters I hadn't seen the disassembly; in fact I hadn't even seen your answer, just your comments.
And I didn't think to run dis myself...
 
5:19 PM
yeah
I don't believe a single second that a complex f-string will be faster
notice that they didn't even use kwargs there
CAN-USA 0-0
those USA amateurs are playing pretty well
 
@AnttiHaapala I saw your comment, but f-strings are still slower even when format is used like this: "X is {x}".format(x=x)
 
>>> timeit.timeit('"X is {x}".format(x=42)')
0.4481568639894249
>>> timeit.timeit('f"X is {x}"', 'x=42')
0.4283783929859055
they're pretty even :P
@MartijnPieters I tried a more complex one, and it seems that it is still slightly slower on average to use f''
I am starting to think that the solution would be to have a BUILD_STRING opcode
 
@AnttiHaapala On my admittedly poor AMD Windows machine, the difference is more significant:
>>> timeit.timeit('"X is {x}".format(x=42)')
0.5764463916093128
>>> timeit.timeit('f"X is {x}"', 'x=42')
0.6460788601771448
 
yeah
CAN-USA 1-0
seems that it is Canada who's going to be Finnished tomorrow.
And USA shall meet Crushians
 
@AnttiHaapala torilla tavataan
 
5:45 PM
2-0
@DSM @idjaw @IljaEverilä
 
For those who have no idea of what Antti said tsn.ca/hockey-canada/mens-worlds/game/…
 
and the question is about which of these teams Finland is going to decimate
 
6:15 PM
LOL USA scored 2-2
but ref didn't even see :D
mmmm...
 
omg USA in the lead
@DSM @idjaw this is getting exciting
 
6:32 PM
@AnttiHaapala 3-2 argh yam yam yam
 
user559633
is there a website where i can watch this stickball on ice match?
 
user559633
thank you sir :)
 
Oops wrong match.
 
I'm actually looking for a stream as well. I'm at my brother in laws and the kids took over the tv
 
6:35 PM
yeah that one works
 
user559633
the uploader didn't make it available in my country :( seriously crushing my freedoms right now
 
It's getting tense
@tristan This works?
 
lol 3-3
 
Yay!
 
user559633
6:40 PM
@BhargavRao not available in my country, it's okay, thank you for trying
 
Damn, Can't help. :/
 
@tristan did you try all those from batmanstream?
surely one of them works
 
user559633
it's okay, i know USA is #1
 
user559633
haha, amusingly, no
 
6:41 PM
Hehe @antti you made me ice hockey addict too :D
 
Not available in north-land
3-3!!!!!
maple power!
 
user559633
just tell me if america wins so i can gloat about something i don't really care about
 
in Finland the gov has made it into law that whoever happens to have the broadcasting rights to "important international sporting events" must broadcast Finland's games free of charge to at least 98 % of population
@BhargavRao ice hockey is so much faster sport than suck.. soccer
 
I don't like soccer/football :D
 
it is like in soccer someone scores and only 10 minutes left, then they've basically won
 
6:45 PM
I watched that Fin-Can match. The first Ice hockey match that I've even seen
 
in ice hockey, Finland was leading Russia by 2 goals, my pulse was 150 when there were only 60 seconds left... because scoring twice in 60 seconds is not unheard of
@BhargavRao once fin-swe, 5-1 before the 3rd period. Finland lost 5-6 :D
 
Wow, That's strange. I've to read up more and see some iconic clashes. :/
 
that happened in an nhl game once. Montreal down 5-1 . They won in overtime 6-5
 
sorry it was in the middle of 2nd period :D
 
How did your's get cut off? o_O
 
6:58 PM
Oh it was 5-0. Biggest comeback on their franchise history: m.youtube.com/watch?v=zACGht3qfXA
I remember watching that game
 
Apr 13 at 18:31, by Bhargav Rao
@AnttiHaapala Apparently India has a Ice Hockey team.
 
yeah I remember :D
First international
Thailand 14 – 0 India
:D
 
Well in India, Cricket is given a lot of prominence and after that it's shooting and wrestling.
 
@AnttiHaapala saku koivu was the captain of that team for a long time:)
 
7:06 PM
@idjaw his bro is now the captain of finland, so watch out
 
Wow, There was an Al Jazeera documentary on Indian Ice Hockey team aljazeera.com/indepth/inpictures/2016/02/…
 
it'd be quite epic, FIN-IND final :D
 
Perhaps after some decades.
 
@AnttiHaapala I found his brother to be better all around
Great hockey player
 
4-3 atm, I want Canada to win, so that the starred message comes true -->
there's an "Antti Pihlström" :D
 
7:14 PM
@idjaw saku was legendary in 1995
he was chosen as the best forward in championships in 1995
 
ye I remember that and then how excited we were when we heard he would play for montreal
 
and in Finland we're not so excited when we find out that the best players would be moving abroad :D
 
oh yeah I can understand that Heheheh. but the money is just too tempting
 
@AnttiHaapala What does "@ElmeriKuronen Suomi RillaA Huomenna 6-0" mean?
 
especially back then when there wasn't really a cap
 
7:18 PM
@BhargavRao rillaa = grillaa = going to grill; huomenna = tomorrow
so usa/canada is getting roasted
 
The comments section on youtube live is funny. I wish I could upvote them :D
 
@MartijnPieters let's see what happens: bugs.python.org/issue27078
 
It's getting more unsettling the less time there is
 
DSM
Take the icing!
 
@BhargavRao do you like cricket?
 
7:28 PM
Yep.
 
DSM
On the bright side, I've been impressed by this Matthews kid.
 
I've never watched it :D not even in films...
@DSM @idjaw so what are your fav NHL teams?
 
@AnttiHaapala Watch Lagaan en.wikipedia.org/wiki/Lagaan
 
DSM
For my sins I'm a Leafs fan.
 
lol wife.. "whyy there is gangnam style"
 
7:30 PM
well my favourite player growing up was Pavel Bure. So I loved the Canucks. Always had a soft spot for the Canadiens.
 
she hates psy :D
 
but I've been so annoyed with both organizations that I've just watched hockey for the enjoyment of the sport
 
@AnttiHaapala Cool!
 
so leafs will pick matthews?
 
I really think they should
 
DSM
7:32 PM
Probably. There's been some discussion that we should trade the pick to get more, but I don't think it's going to happen.
 
our wonderboy Laine going to Winnipeg
 
@AnttiHaapala do you have a favourite nhl team
 
not really, I've not watched NHL except just passingly :D
 
:O
lol
 
7:35 PM
From Youtube :D
 
DSM
The town my father grew up in has a lot of Finns. He wound up speaking a bit, though I think it's mostly gone now.
 
@MartijnPieters probably someone's going to complain that such micro-optimizations are useless...
 
DSM
Canada vs. Finland it is!
 
Congrats guys!
 
7:39 PM
tomorrow then :D
 
HYVÄ TANKSA!!
@Antti Ping me when the match starts. Please :)
 
@BhargavRao Tanska = Denmark :D
@BhargavRao ok, same time
 
oh so happy
 
@AnttiHaapala Some 4 to 5 people commented that in Youtube D:
 
DSM
7:42 PM
I much prefer sopython-hockey to sopython-MtG or whatever nonsense the kids get up to these days.
 
@BhargavRao I can't even see the comments :d
 
@AnttiHaapala soooooooooooooon :p
 
@BhargavRao I cannot view that YT stream but seems that they've blocked the comments as well
I am pretty sure someone will be disappointed tomorrow :D
 
@AnttiHaapala Hmm, That's sad.
Anyway, Job done for the day.
Rhubarb all.
 
7:51 PM
guys
I have an algorithm that computes a GIGANTIC number
Python just stays there for about 1 min then shows an empty line
any ideas on how to make it better?
 
@AswinG no, but I've got many ideas on how to make your question better
 
DSM
We need a standard routine for when someone asks for psychic debugging.
 
00:00 - 20:0020:00 - 23:00

« first day (2044 days earlier)      last day (2920 days later) »