« first day (1717 days earlier)      last day (3225 days later) » 

7:00 PM
yes, I assumed that the library was in python
 
It is in Python.
 
Oops, overdid it on the caffeine. My eyes are vibrating again.
 
Pfft, amateur.
 
@Kevin I just got a french press and good coffee. It's a struggle to not overdose on coffee.
 
I know. I'll drink more caffeine, so the vibration aligns with the fps rate of my visual cortex, canceling out the effect.
 
7:01 PM
It's not classed as a caffeine overdose until you can hear the colour three.
 
@JoranBeasley why does os.path.join work like this? I mean, I can imagine reasons, but canonically, what's the explanation?:
>>> os.path.join('C:\\blah', '/foo')
'/foo'
it used to catch me up, but I learned my lesson a long time ago. A while back, I was able to fix someone else's code that unexpectedly (to him) did that.
 
If I overshoot I can just aim for the next multiple of the wavelength, up until I hit the resonant frequency of my bones and disintegrate.
 
But the "Why" is not spelled out.
 
Also, I really need a third monitor.
 
@AaronHall A leading / means the “root” of whatever context you’re currently in. For URLs, it’s the root of the path (i.e. just the host), and for drives in your local file system, it’s the root of the drive.
 
7:05 PM
@poke but if that's the intent, why is it being passed to a join function?
I can see why I'd want this in the behavior of e.g. a gui
 
Joining paths generally means “interpret the second argument, based from the first argument”
e.g. “I’m currently here, and now I want to interpret the following relative path”
 
source?
 
I can’t really give you a source for that, as it’s just how most programming languages, frameworks, or environments handle it.
The documentation describes the behavior very precisely though.
 
Yes it does.
Woe betide any who fails to read the docs.
 
this kind of sort of looks like it may have path joining logic in it somewhere.
 
7:19 PM
If you follow that, you'll see the logic is in the nt or posixpath, likely.
 
heh I dont know why ... but to me its essentially expected behaviour :P
it could still be painful to get to the bottom of that type of bug though
 
Follow the path of Wen the Eternally Surprised, and abandon the notion of "expected" behavior.
 
well if you just read the docs...
 
Take delight that your programs produce any kind of output, even stack traces.
 
… Actually, now that I think about it, the behavior might not be that consistent with other environment after all…
 
7:27 PM
Windows path.join function
I think it's consistent external behavior
Even if there are two platform dependent implementations.
 
@Hi, Is there any way to set a js variable through jinja without re-rendering the entire page?
 
$.getJSON
oh i guess thats via json not jinja
 
no, that's via jQuery ;-)
 
(no jinja only executes on page render)
 
Anything dynamic you want on the page is done client side with JavaScript
 
7:41 PM
ergo the only time jinja can do anything is when rendering the page
 
I'm trying to pull facebook user data from a popup to the main window, but when I try I get a Uncaught SecurityError: Blocked a frame with origin.
 
If any of my assumptions are wrong, I would love to be corrected.
 
my colleague implemented (without asking anyone, of course),
dict unpacking in cpython 3
so you can do
{'foo': a, 42: b, **c} = dct
 
user559633
@AnttiHaapala lol. кбг as a kind of nonsensical version
 
@AnttiHaapala are you talking about PEP 448?
And by implemented you mean "used?"
is he on Python 3.5?
 
7:45 PM
@AaronHall this is "844 PEP"
python 3.6 :P
@tristan yeah, maybe кбг is better, just was thinking how they're pronounced when you read ce be ge
 
I like the dict unpacking ... its part of a pep ... did your colleague actually implement it for python? or he just used it??
 
Yeah, I guess that would be using PEP 448
 
yeah thats what I was thinking of
 
no, it is not
he implemented the dict version of pep 3132
 
@AnttiHaapala that looks cool, but I can imagine it causing a ton of confusion
It means "value of 'foo' key in dct is assigned to name a", right?
 
7:49 PM
yes
 
it is the natural progression of the current peps though
 
3132 doesnt mention anything about dicts
Im confused how thats 3132 and not 448 ?
 
right, because he implemented something new, there's no pep yet, only similar peps
 
@AnttiHaapala so he implemented it? Like, he wrote the C that parses that?
 
no need to write C to parse that:P
the parser already supports that syntax, but the byte code generator rejects it
 
7:51 PM
Oh it just clicked
I see now
 
and he... modified it to accept it?
 
lol ok I get it now
 
yes sort of
 
I have 3.6 compiled on my machine, I'll try it....
 
although I too have a very hard time thinking of a place I would want to use that
the idea is not to turn python into unreadable perl :P
 
7:52 PM
haha :D
 
(not that that method has anything in common with perl other than being unreadable :P)
 
yeah it is a bit dubious
 
that seems really gross ... it was probably a fun learning experiment though :P
 
I guess so
 
rather than unpacking **kwargs to self. in __init__, you could do {key: self.key for key in kwargs} = kwargs or something
although the syntax isn't quite the same
 
7:53 PM
tbh Im not sure what that code even does
what if dct has 42 in it?
its like a reverse dict.update() ?
 
@AnttiHaapala so why did he do that?
 
why not?
 
I get a SyntaxError: can't assign to literal
 
to lrearn cpython
 
I agree with @davidism :P
and learning is one of the best motivations there is imho :P
 
7:54 PM
it sounds like it's literally on this one person's machine, I'm not sure why everyone thinks it's already available.
 
I wish I had more time for learning these days
I feel like I spend alot of time turning cranks
 
@davidism bingo
 
no I understand its only in his version
 
Do you Joran? Do you?
 
I figured he didn't have it in, I just wondered what the error would be.
 
7:55 PM
I do indeed :P
ok food in my belly time ... laters
alligators
 
Odd, I thought kwarg unpacking was already in the most recent development build. Mandela Effect in action??? (probably not)
 
it is
your missing the same key info I was
re-look at the example code
 
It should be in 3.5
 
{'foo': a, 42: b, **c} = dct
is not the same as dct = {foo:a,42:b,**c}
 
ah, it's novel because dct is on the right hand side. Got it.
 
7:57 PM
which afaik is indeed possible in 3.5
 
I think the intent of that code would be a gets the value of 'foo', b, 42, and c gets the remaining key-value pairs.
 
I didn't notice at first because this energy drink has given me Sight Beyond Sight, which has the irritating side effect of reflecting things on the Y axis without warning
 
maybe should ask my colleague to post this to python ideas :D
 
maybe so
 
On the plus side, I see the interconnectedness of all things. So at least I got that going for me.
 
7:59 PM
when will they update the what's new in 3.5 doc?
 
@AnttiHaapala ugh. Please BDFL, never make this come true.
 
although I would be very suprised if that code ever made it into a pep ... its really not clear to me at least what the intended behaviour would be in several cases
 
if they accept it the implementation is there already, and even better if it is rejected :d
 
I'd like to update my answer regarding that.
 
7:59 PM
@Kevin you're drinking the "Sword of Thundera!"? wow
 
@poke I agree
ok food time really ...
 
It would need a lot of work to make it less confusing before I'd want it in the language, but it is cool.
 
@JoranBeasley the behaviour is very clear, it does __getitems__ in order, popping items, left-to-right, then stores the remainder to the **arg name...
 
I agree with @poke I don't see much value, even though the intent it clear, the syntax is cluttered.
 
8:01 PM
@JonClements Yeah man, goes down smooth.
 
works atomically, nothing gets changed if an exception is raised :D
 
I can also punch mummies into dust, although it has little day-to-day relevancy.
 
nice, __getitems__ in order.
 
@AaronHall 448 also has ordering
 
The syntax makes some sense in JavaScript where you actually declare new variables that way, but in Python, it’s just super ugly.
 
8:02 PM
Yeah, in terms of precedence.
 
448 is already borderline clear
 
hhooohoho at my colleague
said: "oops, this works by accident"
>>> {'a': {'b': c}} = {'a': {'b': 42}}
>>> a
42
LOL
now he's really confused about how that actually could possibly work.
 
What even.
 
@Kevin he wrote top level dict unpacking but it works for nested dicts too
 
Not sure if I want to go the route of trying to understand that.
 
8:06 PM
maybe python will soon become haskell
and then sentient
 
hoho
it works because the parser already supports left-hand nesting
[[a, b, *c], [*e, f]] = [range(5), range(5, 10)]
that works in any python 3
 
I recently explained to a haskellyte who was marginally type-safety trolling #python on freenode that he really didn't want haskell, what he really wanted was to work with mature intelligent programmers.
 
>>> [*[*e, f]] = [range(5), range(5, 10)]
 
which returns?
You can remove brackets on the right hand side and still get identical behavior...
This is cool - it works in 2 also:
>>> l = []
>>> l += xrange(5)
>>> l
[0, 1, 2, 3, 4]
 
8:19 PM
eh
how is that related?
 
list and range/xrange objects, otherwise not... :D
 
Well, girlfriend's home, so rb, everyone.
 
bai
 
I have Python 2.7.8 and I tried @AnttiHaapala's code there, but it didn't work, I assumed he was using Python 3 then, so I assumed those were range objects. But in 3, e becomes [range(0, 5)] and f is range(5, 10)
Is it possible it works in the latest 2.7?
built Jul 28 2014...
 
No, it’s covered by PEP 3132 which is Python 3.0+
 
8:31 PM
*[*e, [f, *g]] = range(5), range(5, 10)
 
hi guys i have a small error, not worth to open a question for, i hope you can help me with, all details are here pastebin.com/AgDQukWt
 
@Fischer the csv values are strings, you cannot do '1' + 1
try int(row[0]) + 1 == row[1]
 
@AnttiHaapala thanks
i should frequent the chat rooms more often
 
:)
 
@AnttiHaapala int(row[1])
 
8:38 PM
aaa :D
@Fischer ^and @davidism
otherwise it would still never print "pizza"
 
That would be a terrible fate… we can’t live without pizza
 
so far I have never eaten printed pizza in my life
not a terrible fate
 
For some incomprehensible reasons, my mouse is able to flash its LED a few times before the battery dies completely.
Not sure why it thinks that spending the last amount of energy on that is a good idea…
… or why it thinks that the little bit of flashing is making me more aware of the dead battery than it not responding the second after.
 
it is like those smoke alarms
lol, firemen actually came to my apartment to remove the battery once :d
 
Hey all, I need some help with something I can't even workaround.
Before that, is there any problem with the cmd in Windows? Does Python have any trouble with it?
 
8:48 PM
Not really.
 
DSM
After waaaay longer than it should have taken, I've resolved the gamma matrix. (Which sounds like the kind of technobabble you'd expect on some B scifi tv show, but is actually a good description..)
 
cbg @Waffle'sCrazyPeanut
 
like, a KeyboardInterrupt doesn't show any response?
 
DSM
Late afternoon cabbage for all.
 
cabbage
 
8:48 PM
Hey up DSM
 
@AnttiHaapala huh?
 
Wotcha @deezy :-)
 
@Ffisegydd Then, I think I experience one (my script runs perfectly on IDLE, Ubuntu terminal, but not Windows cmd!) o_O
 
What's the script? Share your woes.
 
KeyboardInterrupt doesn't show any response
For sure, I've made a similar script just to show you all :)
 
8:51 PM
os.popen can be used as a context manager...
 
Try using PowerShell instead.
 
cbg @DSM
 
def bing():
    try:
        line = raw_input()
    except KeyboardInterrupt:
        print 'Ahh!!! Nothing happens!'

try:
    bing()
except KeyboardInterrupt:
    print 'Nothing happens here too!'
@Ffisegydd ^^^ That annoys me! :/
 
Unfortunately I've booted down for the evening so can't test it
 
how are you entering a KeyboardInterrupt?
 
8:52 PM
ah, damn... Anyone else?
@davidism I don't understand?
 
What keys are you pressing?
 
As the script starts, I just press Ctrl-C
 
@Waffle'sCrazyPeanut I see "Ahh!! Nothing happens" under 2.7.2
 
It's Ctrl+Z in Windows, unlike everything else
 
@holdenweb In Windows command prompt?
@davidism Oh, crap... it was Ctrl-C everywhere... -_-
 
8:54 PM
That’s because raw_input() blocks the input in a different way. If you Ctrl+C it, it raises a EOFError
 
Ah, sorry, stopped using Windows about five years agoy
 
@davidism Uhm, no?
 
@holdenweb No problem :)
 
@poke pretty sure that Ctrl-C on Linux is Ctrl-Z on Windows
 
Isn't it CTRL+Z then [ENTER] on Windows or some such craziness (maybe only in some circumstances)?
 
DSM
8:55 PM
Man, step away from the keyboard and miss all the fun. I seem to be able to catch a control-C KeyboardInterrupt in powershell.
 
@poke Really? It raises the KeyboardInterrupt in terminal & IDLE
 
@davidism As a main Windows dev, I disagree :P
 
Whatever it is, it's dumb. Solution: use Linux.
 
Woteva.
 
@davidism What's CTRL-Z in Windows? THat's EOF, equivalent to a Unix CTRL-D, right?
 
8:55 PM
@davidism ctrl+c means the same, the difference is between ctrl-z and ctrl-d
 
Ah, that's the one.
 
def bing():
    try:
        raw_input()
    except KeyboardInterrupt:
        print 'Ahh!!! Nothing happens!'
    except EOFError:
        print 'This is what actually happened here!'

try:
    bing()
except KeyboardInterrupt:
    print 'Nothing happens here too!'
^ Try that.
And then Ctrl+C it.
 
Yep. I can't keep track of silly Windows.
 
Cabbage all :D And I'm going to pretend I don't pay attention to Windows...
 
Use OS X. Buy a Mac, be cool.
 
8:57 PM
wb @Alexander
 
You know what's cooler than a Mac: having money, which you will if you don't buy a Mac and use Linux instead.
10
 
@AnttiHaapala if int(row[0]) + 1 == int(row[1]): worked... but is there a way to treat row[] always as int? coz im too lazy to keep typing int (row[]) :p
 
@Fischer You can convert all list items to ints first: row = [int(c) for c in row]
 
You know what's even cooler than a Mac: having a system where you don't have to disable transparency (because you cannot disable the compositor) to open a file manager in under 30 minutes.

Ok, maybe like 2 minutes, but still. I had 8 gig of RAM on my old Mac, fresh install, and could not open the file manager to save my life until I used dotfiles to make the system not awful. Switched to Linux within the month.
 
DSM
intify all the items!
 

« first day (1717 days earlier)      last day (3225 days later) »