« first day (2389 days earlier)      last day (2560 days later) » 
00:00 - 18:0018:00 - 00:00

6:04 PM
Will check em out when I get home. Thanks.
 
I tried to encourage this user to submit a PR, but they were too nervous. :-/ github.com/pallets/jinja/issues/709
Anyone else want to make a PR?
 
I've been listening to My Brother My Brother And Me lately and it's pretty funny but there was one question they had where I thought "hmm, this is something I could picture myself asking in slightly different circumstances" and they spent the next thirty minutes implying the asker was a deranged potential serial killer, which hurt my feelings for a while
 
@PM2Ring I got you now. One more question, For myList = [1,2,3,4], if myList[2:-1:-1] is equivalent to myList[2:4-1:-1] then what does myList[::-1] equivalent to?
 
@overexchange,
> Slice indices have useful defaults; an omitted first index defaults to zero, an omitted second index defaults to the size of the string being sliced.
 
@Kevin: Not true for this case.
 
6:12 PM
Hmm.
>>> range(4)[0:4:-1]
[]
>>> range(4)[::-1]
[3, 2, 1, 0]
So it isn't.
 
do any of you work for stack overflow?
 
I guess we can't expect "An informal introduction to Python" to get into corner case behavior. Let's see, what does the actual documentation say...
@J.Stahl Unlikely.
 
I do secretly.
 
@J.Stahl We all do voluntary work for SO but with no pay :(.
 
I'm a spy, sent to infiltrate room 6 and drive Tristan to leave.
 
6:18 PM
@MoinuddinQuadri no monetary pay, we get paid in other means :D
@Ffisegydd I wonder who's next on your hit list
 
Not you.
 
int
PySlice_GetIndices(PyObject *_r, Py_ssize_t length,
                   Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
{
    PySliceObject *r = (PySliceObject*)_r;
    /* XXX support long ints */
    if (r->step == Py_None) {
        *step = 1;
    } else {
        if (!PyLong_Check(r->step)) return -1;
        *step = PyLong_AsSsize_t(r->step);
    }
    if (r->start == Py_None) {
        *start = *step < 0 ? length-1 : 0;
    } else {
        if (!PyLong_Check(r->start)) return -1;
 
Oh... so I'm not good enough to be on a list? :D well I didn't want to be on a list anyways.... or do I.. maybe.... some lists?
 
Think of it like LOST. I only take the good people.
 
Ah ha, so myList[::-1] is equivalent to slice(None, None, -1), which is equivalent to slice(length-1, -1, -1)
 
6:19 PM
I'll be taking Kevin, DSM, and Martijn next.
 
@MooingRawr Is there a way to in cash the other means? :P
 
I'll be leaving the rest of you to be eaten by a smoke monster.
 
The easiest way to take Kevin is to deprive him of stars :D
 
Or, hmm, stop being -1 in that context may be different than passing in -1 as the parameter for stop, since this might occur after the preparatory step of turning negative parameters into positive ones
 
6:21 PM
what is the easiest way to get my reputation up when I am just learning this language?
 
ask well received [MCVE] questions, learn the language well enough to answer questions.
 
Don't worry about reputation (a meaningless number on a website) and instead focus on learning the actual language.
 
Yeah I'm fairly certain you can't replicate the behavior of [::-1] using slice without using None
 
@J.Stahl Keep tracking the latest question, and try to answer the questions to the best of your knowledge. Also read the answers of others which will help you gain more knowledge of the subject. With time you'll gain knowledge and reputation comes along with it (when you start answering the question)
 
i want to be able to send personal messages, but i don't think i can yet
 
6:24 PM
There's no such thing as PMs on the site.
 
>>> range(10)[slice(None, None, -1)]
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> range(10)[slice(9, -1, -1)]
[]
>>> range(10)[slice(9, 0, -1)]
[9, 8, 7, 6, 5, 4, 3, 2, 1]
 
oh, guess i would be working for a long time for that one
 
@Ffisegydd Only 2Ring :D
 
^ it's the killer :D
 
@Ffisegydd As long as there's wifi.
 
6:26 PM
@Kevin Ok thank you
 
My jimmies are moderately rustled that I couldn't find this information in the documentation.
You can infer what the behavior is from the tutorial but if you're reading it strictly as written, behavior of negative strides is not explicitly described
Not that I think the tutorial ought to be muddled with information that's incidental to the main topic, but it ought to show up somewhere
Actually I've only been looking in the 2.7 docs. It'll be funny if it turns out the 3.X version is perfectly descriptive.
It takes a special kind of laziness to dive into the source code to avoid clicking on a dropdown box in the browser
Update: the 3.X version is not perfectly descriptive.
 
I am shocked :)
 
@Kevin Not lazy, just no faith :D you believe that the docs in the latest versions will not have the information so you skipped it and went straight into the source where you know it's guarantee there. Not lazy at all.
 
If I had more gumption I would submit a bug report on this technically incorrect documentation.
 
wim
6:47 PM
you have to be careful with these slicing things on 2.7
 
Why 2.7 specifically? Has the behavior changed?
 
wim
yeah
although foo[start:stop:step] is equivalent to foo[slice(start, stop, step)]
it is not true that foo[start:stop] is equivalent to foo[slice(start, stop, None)]
 
I'm trying to think of a counterexample but they all involve overriding getitem in a silly way
 
Is slicing of a string nothing but assigning one more name to string type object?
>>> str1 = "acdefg"
>>> str2 = str1[:]
>>> id(str2)
139743628599488
>>> id(str1)
139743628599488
>>> str3 = str1[1:3]
>>> id(str3)
139743628055216
>>> id(str1[1])
139743659658456
>>>
How to find the location of str1[1]? Is it not id(str1[1])?
 
Why do you care?
 
6:58 PM
The address of the object that someString[x] evaluates to is typically not the address of the xth character of the someString object, because string objects require more data than just a pointer into a char array.
And by "typically" I want to say "never" but I'm not familiar enough with the memory model to say that for sure. But that's what I'd bet on
Ffisegydd is right that you almost never need to actually care about this distinction.
The mystery of CPython's string interning algorithm is not meant for us mere mortals.
Whoops, three messages up, I meant 'And by "typically not" I want to say "never"'. Leaving out the negative there rather changes the sentence, doesn't it.
 
You could have stopped your sentence with just "Ffisegydd is right". It's a good response in all situations.
 
Right now only Davidism is on my Platinum-level automatic agreement plan, and only for Flask questions.
This, too, could be yours, for a just-short-of-extortionate resubscription fee.
I wonder if s is s[:] evaluates to True for all strings, even ones that are too long to intern.
 
I'm not 100% sure how the slice object class interfaces with the string and/or unicode object class, so returning the same instance could either be trivial or fiendish
    if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) {
        /* It's the same as a */
        Py_INCREF(a);
        return (PyObject *)a;
It's trivial.
 
Just watched ep1 of American Gods. Really good. I can see why reviewers have been saying "Looks awesome but hella confusing" though
 
DSM
7:10 PM
Is it planning to cover the same story as the books or is it just set in the same AG/AB universe?
 
Like Legion
Legion requires full attention. It's confusing AF
But really really good
 
DSM
I loved the first episode of Legion so much I've been waiting on watching the others.
 
I still have the final episode of the season to watch.
 
@DSM It's the exact American Gods novel I believe.
 
DSM
@Ffisegydd: cool.
 
7:11 PM
Been a while since I read AG but I seem to recall them introducing a number of secondary characters without revealing their true identities until later. Not surprised that ep. 1 could leave people with quesstions.
 
Yeah exactly. They didn't actually explain who anyone was. I'm glad they're keeping to source, even if it might confuse people.
The reveal when you realise it was all a dream and he's still in prison is too important to remove.
 
DSM
TWF you have to order your minions (and I quote) "AND UNDER NO CIRCUMSTANCES SHOULD YOU WORK ON WEEKENDS TO MEET AN EXPLICITLY UNDERESTIMATED TIMELINE"
 
That doubleplus ungood whenfeel
 
That Wheeling Fen would be a good name for a Scottish folk rock band.
 
In this day and age of binge watching, perhaps shows feel more comfortable leaving the watcher in the dark, since the majority of them can just click "next episode" right away rather than feel puzzled for seven days
 
7:15 PM
I just read about AG. Looks interesting.
 
@Kevin that's actually a documented thing with changing styles now.
 
The article I read was about the one sex scene
 
Some older shows don't work well for bingeing because of their structure.
 
Bad news for us who are stuck in the lame present, good news for everyone living between 13 episodes from now and the end of civilization
 
@DSM Can I be one of your minions :D
 
DSM
7:18 PM
@MooingRawr: who knows what the future will bring? But I'm this (holds fingers together, almost touching) close to getting their VPN access disabled on the weekend, I don't want to see weekend commits. They should go outside and play.
 
outside ... and play... that reminds me I have to pick a summer event that my company is hosting/providing: Jays game, Canada Wonderland, hiking/zip lining, arts and craft, gofting, or watching horse races... :( I didn't realize how much of an anti social person I am when none of these interest me, but I have to pick one....
 
hiking/zip-lining
 
Folks, I'm very new to Python (although not all that new to coding).
I need to read a CSV file, then do an Fourier transform (FFT). I've figured out the FFT part (thanks in no small part to this thread).
But what would be a good way to read the CSV? Do I need to do it th hard was and read line-by line? Is there an function for importin CSV (I know Matlab has got one)?
(If it matters, this is a quick&dirty computation job I'm doing. This ain't production code.)
 
@MooingRawr It's typically easy to get alone on the trail
@NickAlexeev import csv :)
 
@WayneWerner bugs, heat, climbing, lack of washroom, lack of electronic :( eh no thanks
@NickAlexeev docs.python.org/3/library/csv.html just read and follow the tutorial, one of the easiest thing to do...
 
7:24 PM
@MooingRawr Will do. Cheers!
 
@MooingRawr pssssh, there's no reason to not bring your electronics. Unless it's just a really really out of the way place then you probably have totally fine cell coverage.
I just download a boatload of podcasts, though
 
@NickAlexeev hang on a second.
If you're doing FFT then you're probably using numpy or scipy.
 
@WayneWerner I think ima just end up picking a random one finding a place to sit that's away from people and napping.
 
In that case you should look into the numpy or scipy methods, rather than using "raw" Python as @MooingRawr has suggested.
It'll get the data into the correct format quicker and easier.
 
DSM
^^ this is good advice.
 
@NickAlexeev Do what @Ffisegydd tells you, I'm just giving you the quick dirty way of doing things, not the truest way :D
 
@MooingRawr I know you're trying to help, but if you don't know the correct way then consider waiting to see if someone else will answer first.
Otherwise you could accidentally give someone poor advice D:
If no one else answers, then you can always pitch in with the best you know.
 
Hmm fair enough. :D Just CSV reader came to mind first, didn't really think of the application past reading a CSV file, which is my fault again.
 
I got rep on Cross Validated SE today. Truly I have finally arrived as a Data Scientist.
 
Maybe it was only a misclick
 
7:29 PM
@Ffisegydd Yes, I'm using scipy (from the Anaconda bundle).
 
I still don't know what a data scientist is, wiki tells me all these fancy things about them, but what do they do in an everyday life?
 
@NickAlexeev in that case you'll probably be using numpy arrays as your data structure (that's what scipy will probably expect) so look into numpy methods for reading csvs. That link I posted will be a good place to start.
 
they write graphical user interfaces in visual basic
 
@Ffisegydd Got it. Thank you.
 
No worries.
 
7:30 PM
I used to know only Python and I was in love with this language. Now I am exploring more language, and my love for Python is increasing more.
 
Well that's my "help someone" quota done for this quarter. I'll be back on June 9th. Peace out.
 
take care
 
@MoinuddinQuadri go play with Cobol and bank money with bank money with your bank
rbrb \o ffisegydd.
one of my fear when thinking about joining a different company : xkcd.com/1831
 
@MooingRawr I think I have to wait a bit in order to achieve that. My new project is mainly on JS, PHP, JQuery (with HTML, CSS as add-ons) and I was knowing nothing about these until last week. Now when I started exploring about these technologies, I miss Python even more. But I don't see much of Python work coming at least for next 2 months.. SAD :(
 
My friend, over the weekend, was trying to convince me that Python is a dying language in the professional field and will be replaced with something newer like GoLang or something...
 
7:37 PM
@Ffisegydd I just thought to care, as we try telling whether slicing is shallow copy or a deep copy?
We have many queries on SO who gets into details on list slicing. On same lines, I was thinking about slicing on strings
 
@overexchange on a numpy array it might not even be a copy but a view, on python lists it's shallow
 
@MooingRawr And I am sure that you were able to convince him that it is not True. Specially when machine learning and data prediction are the emerging technologies, and Python is master in those fields.
 
you can think of strings as a 1d array of characters - they're immutable so it's always a copy
@MoinuddinQuadri I see what you did with the True there :p
 
not always, as Kevin noted (trivial full slice case)
 
@JonClements Should I say deep copy because string type object is more than a string of characters?
 
7:40 PM
there's nothing to "deep" copy - it's just a copy
 
@MoinuddinQuadri I gave up trying to change his mind :D Wasn't worth the effort imo...
 
id() shows same location but not a copy
>>> str1 = "acdefg"
>>> str2 = str1[:]
>>> id(str2)
139743628599488
>>> id(str1)
139743628599488
 
It's technically not even a string of characters, it's a string of len-1 strings ;)
@overexchange I'm not sure if that's accidental or guaranteed by slice
I'm pretty sure that's just an implementation detail
 
@overexchange since they're immutable - it's fine to just increment a reference counter - as one can't affect the other through mutable operations...
 
as Kevin noted, it's guaranteed (but definitely implementation detail)
33 mins ago, by Kevin
    if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) {
        /* It's the same as a */
        Py_INCREF(a);
        return (PyObject *)a;
 
7:43 PM
@davidism: someone's looking for you in #pocoo
> <jtanner> anyone know the irc nick for davidism from github?
 
In [1]: x = 42

In [2]: y = 42

In [3]: id(x)
Out[3]: 4297625248

In [4]: id(y)
Out[4]: 4297625248

In [5]: x = 420

In [6]: y = 420

In [7]: id(x)
Out[7]: 4378903472

In [8]: id(y)
Out[8]: 4378903856
I suspect that slicing is the same ^
 
user6845426
cbg o/
 
Pretty much
>>> s = "This is a very long string and so it is not likely that it will be interned, because it is very long and cpython does not intern very long strings."
>>> s is s[:]
True
>>> s[0:len(s)+1] is s
True
>>> a = s[:-1]
>>> b = s[:-1]
>>> a is b
False
 
user6845426
Anyone watch the Anthony Joshua fight on the weekend
 
Incidentally,
>>> seq = [1,2,3,4]
>>> seq is seq[:]
False
 
7:45 PM
Interesting!
TIL
 
This is necessary if you want seq[:].append(23) to not mutate the original seq
As Jon indicates, that's not a problem for strings since you can't mutate them at all
 
>>> x = "YoullFindThatCPythonReallyDoesntCareAboutTheLengthWhenDecidingWhatToInternAndTheDecisionIsActuallyMadeBasedOnWhatKindOfCharactersTheStringIncludes"
>>> x is intern(x)
True
 
@user2357112 that's just cheeky :p
 
DSM
"Someday someone will explain to me why people find the implementation details about when immutable objects are reused so fascinating. (And many people seem to.)" (DSM, 28 Aug 2015)
 
51 mins ago, by Kevin
The mystery of CPython's string interning algorithm is not meant for us mere mortals.
We're going to get smited by the mighty Odin if we keep it up
 
DSM
7:52 PM
I'll get smited by the Canadian Odin. He's quite mild-mannered. #callback
 
TIL intern() got moved to sys.intern() from Py2 to Py3...
 
wim
@DSM I think it's because understanding how the interning works often arrives at the same time as understanding other things about how the object model works in general. And why pass by reference / pass by value is not a useful analogy in Python. It's an "aha!" moment
 
interns always get shuffled to the least desirable real estate during a reorg, natch...
 
wait... that wasn't a correct test for interning
 
DSM
7:55 PM
@Kevin: you're on fire today.
 
It's the mescaline.
Nope, misread the ingredients on this energy drink. It's the caffeine. I was close, though.
id() is the mouse-on-a-spring-on-a-scratching-post of programmers.
 
>>> x = "ThisShouldBeACorrectTest"
>>> x += "LengthPaddingLengthPaddingLengthPadding"
>>> intern(x)
'ThisShouldBeACorrectTestLengthPaddingLengthPaddingLengthPadding'
>>> "ThisShouldBeACorrectTestLengthPaddingLengthPaddingLengthPadding" is x
True
Okay, that one actually shows Python reusing the interned string. The previous one would have shown True even if Python didn't originally intern the string, because without an existing interned version of the string, intern would have just interned and returned the string it was given.
 
wim
if you're overriding sys.excepthook, are you supposed to save the old function and call it and the end of your handler?
 
@wim: If you actually want the default excepthook to run at the end of your custom hook, then yes.
 
but you don't need to save it because you can use sys.__excepthook__
 
wim
8:02 PM
ahhh, handy
the day I learned you could always get sys.__stdout__ was a lifesaver
 
oh nice
 
wim
hmm, wat
 
but then you could use contextlib.redirect_stdout in most cases, I think
 
wim
>>> inspect.getsource(sys.__excepthook__)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/inspect.py", line 938, in getsource
    lines, lnum = getsourcelines(object)
  File "/usr/lib64/python3.6/inspect.py", line 925, in getsourcelines
    lines, lnum = findsource(object)
  File "/usr/lib64/python3.6/inspect.py", line 738, in findsource
    file = getsourcefile(object)
  File "/usr/lib64/python3.6/inspect.py", line 654, in getsourcefile
    filename = getfile(object)
 
Yeah, that's what happens when you try to inspect.getsource a C function.
 
wim
8:05 PM
>>> inspect.isfunction(sys.__excepthook__)
False
>>> sys.__excepthook__
<function sys.excepthook>
 
DSM
CPython details leaking again. :-/
 
Wait, it just says function in the repr?
 
wim
yeah
that's probably ipython's pretty printer doing that
>>> sys.__excepthook__
<function sys.excepthook>
>>> repr(sys.__excepthook__)
'<built-in function excepthook>'
 
why does your ipython say >>>?
 
DSM
--classic?
 
wim
8:07 PM
^ that
 
ooooh, weird
 
wim
I like it to look just like vanilla repl, so I can copy and paste stuff directly to/from SO without that In[1]: bs
 
yeah, that's the one use case I could think of right now
 
DSM
I used to use --classic all the time when I didn't want to explain what the In/Out meant. These days I'm too lazy.
 
I sometimes rewrite it to >>> manually #sucker
 
DSM
8:08 PM
Transcript altering is a dark path..
 
wim
i've got all kinds of aliases and stuff set up
 
I much prefer an IPython that's visibly IPython.
 
wim
it's visibly an ipython because it's coloured
 
DSM
I think there was once or twice I was able to figure out what a problem was a lot faster because I saw the OP was using IPython and so might have been using pylab mode.
 
wim
there is not the syntax highlighting in the vanilla repl
 
8:09 PM
I don't see any highlighting in your message either
 
wim
pylab and it's all / any rewrite :(
 
DSM
Yeah, that was a bad play.
 
TFW you discover a bug in your process but it's also in the existing process so maybe you're not that bad?
 
DSM
Points for discovery still count..
 
DSM
8:27 PM
Time to enter the mist. Monday rhubarb for all!
 
rhubarb for DSM
 
have a nice one DSM
 
8:42 PM
We have a canonical dupe for "list multiplication makes multiple references to the same list" right?
 
Anyone know if its possible to bind/configure text in a pyqt Qplaintextedit like you can in tkinter.Text widget ? Not finding answers on google. Maybe im searching for the wrong stuff.
 
 
1 hour later…
10:05 PM
Recbg
 
de-cbg'd
 
 
1 hour later…
11:07 PM
OIC, the snobby academics have to have their own stackexchange
 
with blackjack and hookers
 
that sounds like a good combination to me
I'm not much of a gambler, though.
 
and forget the blackjack
 
11:53 PM
talking about hookers...I need to take a trip to Nevada
Does python on Windows have problems with case-insensitivity in package names?
 
00:00 - 18:0018:00 - 00:00

« first day (2389 days earlier)      last day (2560 days later) »