« first day (2809 days earlier)      last day (2122 days later) » 

2:01 AM
cbg
 
 
2 hours later…
3:32 AM
recabbage
 
cbg
@CallCenterExecutive is that your "real" identicon
 
this is my final form, yes
Unfortunately, there's a typo in "center"
 
@piRSquared That's the result of you constantly applying yourself. Well done!
 
Well stated (-:
 
cbg
 
cbg
 
5:22 AM
wt-yam with the new name @CCE
 
It's a temporary minor meme.
Cuz... you know... I hail from the land of call centres... etc etc
 
Nice
 
5:43 AM
falling asleep at keyboard... its rbrb time!
 
6:26 AM
plus the fact that I sometimes feel like call centre support, with the kind of questions that come into the site these days...
 
7:04 AM
cbg
@CallCentreExecutive Now you are going to confuse everyone
 
@Code-Apprentice why is that?
 
because of your sudden name change
fortunately it isn't difficult to find out who you really are by checking your profile
 
Indeed, but this is my real identicon
 
cbg
call centre exec ?
big boss?
 
rbrb...time for bed
gnite
 
7:21 AM
@Code-Apprentice see ya
 
7:33 AM
cbg
 
8:05 AM
cbg
 
 
1 hour later…
9:32 AM
Someone would know where find doc in deeplearning (theories, informatics...). I didn't find internet
 
10:05 AM
@bereal thanks
 
10:24 AM
cbg
 
What does it mean cbg... I often see @AndrasDeak
 
sopython.com/salad, also mentioned in our rules page sopython.com/chatroom
 
Interesting
 
10:52 AM
airport lounge cbg
 
cbg
 
 
2 hours later…
Hmm, why?
 
against piling on downvotes, probably
 
12:49 PM
I've seen someone import np as _np etc, claiming that he signals that thes modules are not their own. While I sort of see where they're coming from, It seems pointlessly cumbersome to keep doing that with third-party modules in your code. Am I right that using a well-documented API and maybe __all__ make it fine to keep using modules without underscored names? Now that I think about it underscores are usually reserved for internal modules, so exactly the other way around.
 
It's not clear to me why it would be useful to signal that kind of thing
 
I think the motivation is that someone might see yourmodule.othermodule and think that it belongs there, when it was merely imported. Similar surprises are numpy.int which is really just int and not to be used for anything.
 
I don't typically do dir(third_party_module) and see another unrelated third party module and assume "oh, these must be made by the same company" and then make incorrect technical decisions based on that. Who's he trying to protect?
Indeed, what kinds of incorrect technical decisions could I make? What's the danger even if I'm maximally dumb?
 
in the numpy case you may expect numpy.int(3) to give you a numpy int, whereas it's a regular int
But if you look at the relevant documenation it's obvious that numpy.int is not a thing, and looking at the implementation reveals that it's just int. But for this you need to suspect that your naive jumping to conclusions was wrong.
 
1:08 PM
In the specific case of a module overshadowing a builtin, I would hope the average user would approach using it with due caution
Concluding one of:
- the developers of this module must have a very good reason to ignore the common rule of "don't overshadow builtins", possibly because of a difficult situation with many corner cases, and I should be on my guard
- the developers are kind of dumb and I should be careful using their code at all
Which doesn't prevent them from eventually wrongly concluding "I guess numpy.int is a custom type they defined and which I may use" but it becomes harder for them to do that
The case I think that has the most merit is: if third party module A imports third party module B, and module B has a sufficiently generic name that you're not sure what its affiliation is WRT A.
If pygame imports requests, that might be ambiguous because maybe they wrote their own requests module that doesn't have anything to do with the popular HTTP request module. If scipy imports BeautifulSoup, you can probably reasonably assume that it's actually importing the real BeautifulSoup because it's not too likely that scipy would independently choose the name "BeautifulSoup" for a module they invented
Ideally, nobody would name their module after an already existing popular third party module, but that would be pretty hard to enforce unless everyone is intimately familiar with the third party library ecosystem
 
DSM
1:45 PM
Monday morning shoulda-stayed-in-bed cabbage for all!
 
cabbage
thanks, @Kevin, that's kind of what I had in mind
the tricky thing about the numpy example is that numpy.int8 and numpy.int64 and the like do exist
 
To maintain the pattern of the "int" + "number of bits" naming system, long ints should be referred to as numpy.int∞
 
monday cabbage all
 
2:03 PM
@MoxieBall afternoon
 
3:01 PM
If anyone remembers the "what if we allowed a:b:c to represent a slice literal in any context, not just inside square brackets?" conversation from last week, I just now noticed that we already use ":" as a token in a non-slice context: in the format specifier of f-strings. So it would be ambiguous whether f"{1:2}" should evaluate to " 1" or "slice(1, 2, None)"
 
yup
 
We can quietly ignore the ambiguity of dict literals because {1:2} shouldn't reasonably be interpreted as "a set containing slice(1,2)" since slices are unhashable
... Which is kind of weird since slices are basically just highfalutin tuples, so why shouldn't they be hashable?
 
inb4 "dict views"
yeah, slices also seem pretty immutable
 
Tentatively file under "because not enough people have asked for it"
 
>>> x = [1,2,3]
>>> y = [4,5,6]
>>> s = slice(x,y)
>>> x[0] = 0
>>> s
slice([0, 2, 3], [4, 5, 6], None)
 
3:07 PM
Anyone interested in aiosmtpd, asyncio, and debugging intermittent issues? github.com/aio-libs/aiosmtpd/issues/133#issuecomment-399943405
also, morning cabbage all
 
cbg
 
Ok, so slices are mutable by proxy. But this is also true for tuples. So ideally, slices should be hashable iff their arguments are hashable. Just like how tuples are now.
 
is there a purpose to defining a slice using lists like that?
 
I didn't know it existed
what does that even mean?
 
I can't imagine any built-in types accepting a slice whose arguments are lists, but theoretically you could write your own class that can do whatever it wants
 
3:09 PM
oh, right, numpy does some neat things with weird slices
 
Some wacky 7 dimensional matrix that you want to be able to slice every which way
 
hmm, then again those are not array-valued slices
I got confused, those are actually getitem tricks
pandas on the other hand uses string:string slices
 
I think you can slice(start,end) however you want
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> slice(3, 'elephant')
slice(3, 'elephant', None)
answer: yes
 
DSM
Hmmph. My ipython console is querying an object for attributes, breaking the attempted lazification of my object. :-/
 
This lets you define __index__ on your custom types so it does sensible things when passed into a slice. Neither list nor str have defined it.
 
3:15 PM
straight from guido
I think I agree that it would make some syntax especially confusing for no huge benefit
 
so, TLDR: because we want some_dict[:] to crash instead of doing something weird
Good enough for me.
 
And in the event that you really need hashable slices, the workaround is quick
 
I'd agree with that
 
3:31 PM
morning cabbage
 
cbg @Code-Apprentice
 
cbg
 
@vaultah so that you can concentrate on doing something else :d
airplane-cabbage-with-current-continuation
 
@AnttiHaapala where you headed?
 
Gibraltar
or plane is headed for malaga
landing now :d
 
4:14 PM
Random thought: sin(pi/2) is rational. sin(pi/4) is irrational. Is there a generalized way of determining whether sin(x) is rational for any x?
Are... Are triangles involved
 
@Kevin /gasp Triangles in trigonometry! The horror!
 
I ask because a commenter in php and python result difference for same function writes, "Neither PHP nor Python are actually returning the real value [of sin(45 degrees)]. They both approximate." and I thought "well yeah, because you can't store an irrational number precisely in a float. But, hmm, how often is the result irrational?"
 
@Kevin my intuitive guess is "almost always"
 
I'd say it usually is, considering that irrationals are uncountably many
 
In general, there are by far many more irrational numbers than there are rationals
 
4:18 PM
oh, and pi is irrational so a given rational input will probably give you an irrational result
I'd wager that 0->0 is the only rational example
 
6-1 cabbage
 
Cbg.
 
Oh yeah well my country hasn't lost a game in the world cup yet
And I would bet they're not going to
go USA!
 
All of those ideas in the picture are good aside from \if
You're gonna get types and you're gonna like it 👿
 
@AndrasDeak Apparently "if x is rational and not zero, then tan(x) is irrational" has been proven, and was used in an early proof that pi is irrational.
The math is one million miles over my head but I wouldn't be surprised if a similar argument could be applied to sin
 
4:25 PM
@MoxieBall ...you mean since the start of June? :p
 
@toonarmycaptain you can't hurt me I don't even like fake football
 
@Kevin neat
tan(x) = sin(x)/cos(x) = sin(x)/sqrt(1-sin^2(x)) roughly, so something something it's probably similarly true
 
@MoxieBall That last phrase has started many fist fights. Best not go there.
 
Speaking of new python features, how do you think proposing dict unpacking would go? I'd be surprised if it hasn't already been proposed
 
@toonarmycaptain all jokes aside, I like football way better than american football, where 95% of the game is waiting for the game to happen
 
4:32 PM
Anyone have any experience producing pdfs/documents with equations in them eg x^3 - 4 x^2 + 6 x - 24 = 0 formatted with superscripts etc? I'm trying to find a solution that doesn't include packaging a half gig or so of LaTex with my several meg package.
@MoxieBall Yah. I prefer rugby to NFL.
 
@KevinMGranger have you seen PEP 448?
 
@toonarmycaptain I find that google docs has a surprisingly good equation formatter
 
Not what I mean by unpacking-- maybe destructuring would be a better term
 
cbg CCE
 
4:36 PM
I can do x = dict(foo=1, bar=2), so I'd like to be able to do {foo, bar} = x
 
I'm going to quit being a call centre executive. I don't much like it :(
 
I want symmetry between being able to create/modify a dict with keywords, and being able to extract from a dict with keywords
 
What would {foo, bar} = x do?
 
it would be equivalent to foo = x['foo']; bar = x['bar']
 
cleaned_addr = [item.split(" Tel")[0].split("For more")[0].strip() for item in [address1,address2,city,state] if item]
address1, address2, city, state = cleaned_addr
My problem is that if there is a None value in the list there will be only 3 values in cleaned_addr how can I fix this??
 
4:41 PM
oh, I see what you mean
 
@KevinMGranger what about keys that aren't valid names?
that seems like a strong counterargument
and why would you tie the name of the new variable to the name of the key?
@Self hello
 
@MoxieBall I see that. You're suggesting I use google docs online to format then pull the doc back and convert to PDF (or just use google doc)?
 
@Self leave the None or check for the number of items?
 
If they're not valid names, then you can't do it, and the answer is "tough, deal with it". Unless that backslash proposal gets accepted.
 
either unpacking makes sense and then you can have a placeholder (even None) in there, or unpacking doesn't make sense and you shouldn't be unpacking anyway
 
4:44 PM
@toonarmycaptain not sure what your restrictions on the end format are so I can't make a recommendation as to how to use it, I just like what it can do
 
@KevinMGranger that would be very asymmetric: you could unpack {'foo':1} but not {1:2}
 
The main use case is for keys that are valid names, which I believe represents enough of a majority of dict usage to be worth it
 
"Display name may only be changed once every 30 days; you may change again on Jul 25 at 3:28"
uh oh, I'm stuck now
 
How to handle n amount of missing keys remains an open question, or other exceptions that occur with __getitem__
 
and why should there be a set on the left-hand-side?
 
4:47 PM
I'm sure you can use your imagination ;)
 
This kind of unpacking ("destructuring") has already made its way into JS
I guess Python developers could figure it out, too
 
Long story short I don't like having to use 4 characters of symbols to extract a dict member, when getting an attribute only uses 1 character
 
@KevinMGranger I definitely make dictionaries with keys that are invalid names more often than valid ones
 
@MoxieBall Fair enough. I'm trying to output randomised math worksheets/tests. Seems like there should be a library/ies that can format my x^2 to x superscript 2, and fractions without the function/other_function slash styling, that doesn't involve package sizes expressed in GB
 
@toonarmycaptain you could do some fancy PIL work to draw a page yourself :P
 
4:56 PM
@MoxieBall Yeah, a bespoke parser and formatter is what I'd like to avoid lol
 
@toonarmycaptain how about this?
 
@MoxieBall I mean, I've seen matplotlib can be (ab)used to produce text with blank plots, but that seems like grabbing a library purely for a side effect of it's main purpose.
 
@toonarmycaptain or SymPy?
 
Man, ThinkGeek has a The Last Unicorn statue. Shiny!
 
Hmm, is there no module for getting image data out of the Windows copy/paste buffer? pyperclip apparently only does text.
I have a 30 minute task that could become a 10 minute task if I had this power, but I don't want to futz around with the win32 API for 20+ minutes, that'd be a net loss
 
5:12 PM
not if you ever have to use it again...
 
@MoxieBall I'm actually looking at that right now.
 
Also the win32 API is an excruciating experience so every minute I spend with it, I'd rather spend ten minutes watching paint dry
Oh, PIL of all things has clipboard reading ability.
But oops I already gave up and started doing the task manually and undoing my work is more work than finishing at this point
 
Sunk cost fallacy
 
I don't think that applies here
 
5:24 PM
googles topic for 5 minutes Yes I totally understood that
 
me any time someone links to a proof from the 18th century
 
:43036031 Unless I'm reading wrong, SymPy will format my equation into LaTex syntax, but then I'd still need to bundle with a LaTex distro, right?
 
@toonarmycaptain I was reading this, looks like you don't have to use LaTeX but idk if the others will do what you want
 
@MoxieBall I guess I'm pretty much looking for the python equivalent of MS Equation editor (or whatever exists now, I last used it circa 2003), that will take some sort of syntax and give me either formatted text or an image that I can then insert into a pdf or other document.
 
Ok, it may or may not apply here depending on whether I can complete writing the program in less than five minutes, given that I only have 15 minutes of manual process left
 
5:34 PM
@toonarmycaptain well some combination of the previously discussed options should be good enough I imagine
I'm a fan of the google charts api
 
though I don't understand why you wouldn't want latex on your computer, there are online services such as sharelatex :P
odds are they don't have an API though
 
@AndrasDeak Really because I'm wanting to distribute something that's less than half a GB, otherwise I'd be using it and done.
 
5:51 PM
Cabbage
@toonarmycaptain Is this Open Source or commercial? If it's free, I think you could use CodeCogs for free, for commercial use there's a charge. codecogs.com/latex/about.php
 
DSM
@toonarmycaptain: I, can, sympathize.
(Apparently it's easier to remember things you complained about years ago if you write them down, even virtually..)
 
How complicated are these equations? If they're just say, simple polynomials, you could write a simple parser that outputs Postscript, and PostScript to PDF is easy on any Linux system, since it's bound to have Ghostscript. And many popular PDF viewers will show Postscript.
 
@PM2Ring At the moment, simple polynomials and rationals (eg x^2 + 4x -17 / x -7 )
@PM2Ring heh "simple parser" - yeah I'm sure I could, I now feel crazy for thinking that there's some simple package for this. Y'know, because polynomials are fine, but when I want to extend to trig, limits, etc, that's another matter.
 
6:09 PM
@toonarmycaptain Or just cheat and use Unicode, which will give you superscript, and simple fractions, although it can look cheap, depending on the font. E = mc², 10⁵, ⅔
@toonarmycaptain Simple is simple. But you definitely don't want to reinvent LaTeX.
 
hey guys, opinion on from . import x vs. import x? i.e. relative vs. absolute imports. I haven't seen enough debate to have an opinion
 
From these two definitely the former
 
And they aren't equivalent
 
not my original idea, but
import matplotlib.pyplot as plt
fig = plt.figure()
fig.text(.5,.5,r'$\frac{x^2 + 4x -17}{x-7}$', size=100, horizontalalignment='center', verticalalignment='center')
plt.show()
without setting text.usetex = True in any rc files you'll probably get the native pyplot renderer
you can savefig to pdf; perhaps the only thing you need is an autocrop
which, ironically, I usually do with pdfjam which I'm pretty sure is latex
> pdfjam is a shell-script front end to the LaTeX 'pdfpages' package (for which, see ctan.org/tex-archive/macros/latex/contrib/pdfpages).
 
6:19 PM
@vaultah could you elaborate?
 
Sigh, mobile site
 
ugh, seeing 2 spaces for indent instead of 4, and function names beginning with a capital letter in the codebase is maddening
 
@CallCentreExecutive sorry to hear that
 
@AndrasDeak THanks. That's probably what I'll have to go with, although I still feel like using the matplotlib to generate text is like using an ER to put a bandaid on a papercut.
Thanks all, rhubarb for now.
 
yes, but you don't want to use the bandaid because it's too heavy
rbrb
 
6:32 PM
This is from CodeCogs. I'm not used to doing stuff like this on my phone. :)
 
looks good
 
It's a little blurry, but I just chose fairly simple options, CodeCogs can do better. The 1st version I tried had a transparent background, but when I viewed the downloaded version the Android Gallery app decided to display it on a black background. :) There's probably some way to change that, but I'm still getting used to this phone.
 
It should export to pdf in which case it'd be vector graphic
 
6:54 PM
@AndrasDeak Yes, it does PDF & SVG, as well as a few other formats. But none of those will display here in chat. Here's a slightly higher res transparent version.
 
7:17 PM
This is useful. I don't know when I'll use it. But I have faith that I will
 
7:49 PM
Cbg
 
cbg
 
Can I get some formatting help? I'm on my phone and un able to fix that answer ' hyperlink: stackoverflow.com/a/51030296/5079316
 
Cbg
 
@OlivierMelançon done
 
Thank you!
 
7:51 PM
2fast4me
 
Oh, was there a space just after the (?
 
yup
 
8:55 PM
I'm creating a modified notebook app, and I don't want to actually import the dependencies for testing. So I'm importing them in a separate module that I'll mock for tests. What do I call that module? I'm leaning towards jupyter_libs.py...
 
9:07 PM
jupyter_libs.py it is...
@CallCentreExecutive what's with the name change?
 
9:52 PM
@PM2Ring matplotlib can render without LaTex. Have to juggle to crop within matplotlib, but it's functional. I see options to achieve perfect cropping with PIL but suspect that may be slower than it's worth. This'll do me for now though :)
 
10:10 PM
17 hours ago, by Call Centre Executive
Cuz... you know... I hail from the land of call centres... etc etc
and also
16 hours ago, by Call Centre Executive
plus the fact that I sometimes feel like call centre support, with the kind of questions that come into the site these days...
But I tried changing back today, and found I have to wait 30 days to do so.
 
@CallCentreExecutive lol @CCE
 
guess they don't like users making UPDATE queries to their User tables too often
 
I imagine that's true. But I think they'd also prefer ppl not obscuring their identities.
 
also trolls
 
afternoon cabbage
 
10:18 PM
Cabbage @Code-Apprentice
 
Hello Guys. I hope you have a nice evening.
How can I use the xmbd variable, as a search variable in the re.findall? Since I'm already in for-loops, I unfortunately have several iterations and have therefore lost the overview.
 
@CallCentreExecutive there's a workaround
@madik_atma Welcome to Room 6. Please take a moment to read the rules.
Did you try putting xmdb in place of "HERE"?
 
@Code-Apprentice I'm all ears!
 
Hi @Code-Apprentice, ty
yes @Code-Apprentice
 
@CallCentreExecutive as long as you didn't check "change profile on all sites", you can go to another SE site and change your name there and select the option to change on all sites.
oh...it's two different buttons, not a checkbox
 
10:22 PM
Thank goodness, I didn't
 
I went through a name-changing phase early on in my SO career and learned these tricks.
 
interesting. It didn't work.
No, wait. It did
 
I see you as coldspeed on main
 
@CallCentreExecutive it will take a little time to propagate to chat
 
yup, I realised it takes a while to update here
@Code-Apprentice thanks, you're a lifesaver
 
10:26 PM
Relish your executive title while it lasts
 
awww you had to tell him about the loophole :P
 
aww, you liked my new nickname
 
yeah, despite the weird spelling
 
Funnily enough, Centre is the right spelling for something that is not a physical center
Example: Shopping Centre
 
@Code-Apprentice why did you say that? They've been around enough
@CallCentreExecutive I always thought it was a regional thing rather than a semantic distinction
 
10:28 PM
@AndrasDeak were you keeping it secret? You should have message'd me with the memo
 
too late for that!
 
@AndrasDeak because I'm trying to be friendly and too lazy to check history
 
@CallCentreExecutive pro-tip
 
wim
centre from french
center from american
 
10:30 PM
90
A: What's the difference between "center" and "centre"?

snailboatOriginally, everyone spelled it centre, but because of Noah Webster's spelling reforms, people in the US started spelling it center, particularly in the last century. Although the revised spelling center has been adopted internationally to varying extents, centre is still more popular in most re...

unsurprisingly there's a SE post about this...
 
They changed to center because English started to adapt its spelling to the pronunciation. Something something laugh
 
which seems to agree with @AndrasDeak that it's a regional difference
 
Ah, so it is a british thing
 
wim
No
centre is a french word
 
@AndrasDeak in the early 20th century there was a movement to pass legislation about spelling of words...it never caught on, though.
 
10:31 PM
yes but it's used in British english
and India is a British colony
 
@wim yes although we spell it like that here.
As the Call Centre Executive said.
 
wim
US was arguably an english colony too
They were just better at rejecting the monarchy than India was
 
bowed out early on this one stackoverflow.com/q/51032504/2336654
 
you mean better at using systems no one else wants to use
 
10:34 PM
@wim or quicker to do so at least...
 
wim
Yes, and it shows in the language too
 
We have over 100 regional languages, it kinda makes sense that not everyone wants to master a foreign language (English)
of course, not saying that's a good thing
but eh
@piRSquared Unclear, arguably no mcve question with an upvote? Doesn't look right...
 
wim
Once you realise that so many English words are/were just misspellings from French, you realize (sic) that it's pointless to talk about the "correct" English spelling
 
whoops, was my upvote >.< gone now
rbrb all. might be on later
@wim where is the mic drop?
and rbrb seriously now
 
wim
e.g. couleur (french) colour (english) color (us)
 
10:39 PM
buh bye
You could say the US "dumbed down" the spelling. A lot of "oea" words lost the "o"
etc etc. I can't remember more examples.
There's also a dichotomy when it comes to 'ize' or 'ise'.
 
@wim Which is handy when you write both, and use the other for coding.
 
Hi Guys. I would be reluctant to interrupt your conversation, but nevertheless I would be happy about possible help:

Unfortunately I have a bug here. Everything on my output is written twice in JSON. But I think it's a problem with the for-loops. Do you have an idea?

http://dpaste.com/31EMTXM
 
wim
if you don't like it, you could call it "dumbed down". if you do like it, you could call it simplifying, incremental improvements.
 
@madik_atma always feel free to interrupt off-topic chatter with python questions :)
I mean, multiple conversations can easily be maintained in parallel
 
@AndrasDeak ok ty :)
 
10:49 PM
@madik_atma it's not your first example like that, so: it would help a lot (at least it would help me) if you had some reasonable (English) words in your example. I find it hard to comprehend foreign-language stuff
(foreign with respect to English, I mean)
You should probably also simplify your snippet to cut down to the most essential parts, with an example input that can be run by others.
 
@wim Meh. I wouldn't necessarily consider random permutations of characters and swapping out one letter for another as a simplification or improvement. Only confusion.
 
also I'm not sure what you mean by "output is written twice"
you have multiple dicts/lists going on
and with that good night and good luck :P
also make sure you don't have to set speeches to be a new empty list after you insert it into speaker['GERMANISCH']
 
@wim The American spellings don't necessarily simplify things, though. They can make things more complicated, e.g. centre -> central is simpler than center -> central. Or analyse -> analysis vs analyze -> analysis. I guess you can say that "analyze" makes more sense phonetically, but if American English were serious about doing that then plurals of nouns that end in a voiced consonant should take a z, e.g. dogz.
Aug 7 '16 at 12:42, by PM 2Ring
@AnttiHaapala "The problem with defending the purity of the English language is that English is about as pure as a cribhouse whore. We don't just borrow words; on occasion, English has pursued other languages down alleyways to beat them unconscious and rifle their pockets for new vocabulary." — James Nicoll
 
11:07 PM
Hello @AndrasDeak yes you are right with the foreign words, but since I like to work in German, my variable names are therefore also in German. Sry for that

I was able to stop the bug with a break. Can you tell me with this snippet, what I'm doing wrong, that I have to go through the loop once with a break?

My JSON agrees after using Break.

Many Thanks !

http://dpaste.com/0T0Z73K
 

« first day (2809 days earlier)      last day (2122 days later) »