« first day (2474 days earlier)      last day (2474 days later) » 

4:00 PM
Found this channel with cool sountracks on vinyl.
 
Decided to give Lana Del Rey's new album a listen. It's pretty good.
 
Now I'm listening to Myst Uru soundtracks and want to go play it again.
 
Been trying to find some half decent questions to go for to get those last few upvotes for the hammer
and the last two days have been dryyyy
 
I'm only answering around 2 questions per week now. :-(
There are week+ stretches with no answers. And yet I'm still on the site every day.
 
haha yeah same here
I've had to even answer some really meh questions that met some criteria
 
4:07 PM
It's interesting that min and max are O(N) on range objects when it would be fairly easy to do in O(1)
 
At one point I was the top 30 day answerer for an entire year, with few exceptions, for .
Then I just sort of dropped off to only voting and hammering.
 
I guess they don't want to add an if isinstance(obj, range): conditional to the implementation and bog down the base case
 
@davidism Yeah I had a few stretches where I was always in the top rankings for answering in the given week/month
 
I find myself interested in SO but I can't stomach looking through questions to find some of interest to answer
 
4:10 PM
research.googleblog.com/2017/07/… oh google, so much money to burn
 
They could have flagged for a dupe instead here
that's very high rep to do something so .... funny.
 
@idjaw so.... common*
 
hehe
Maybe you can use that shiny gold hammer to dupe this question. :) — idjaw 13 secs ago
a nice dash of passive Canadianess
 
I used my hammer, but it's not very shiny.
 
@idjaw You get your gold yet?
 
4:17 PM
@Marcus 8 upvotes away
I can smell the blood
 
@enderland I'm back with some code updates :)
my code is on pastebin.com/c41C1rq9
 
@Kevin I wonder why because in operator works with O(1)
 
and my problem is that I want to update the values in 'ports' each time I calculate a value in one of the Func or Mixer classes
 
so they have some mechanism already in place that prevents range evaluation
*in python 3 only
 
1 hour ago, by davidism
Sounds like poor design, but yes, just tell the children about the parent.
 
4:21 PM
and for example in the Mixer class I need to get the values from the ports dict by using a pointer or something to them defined in the method 'connect_ports', which automatically updates the values if one gets updated
 
Are you even reading what we post?
 
@davidism yeah ok, so how do I tell the children about the parent and how could I avoid that poor design?
I'm quite new to OOP and thus not really experienced
yes, I do. but looks like I didn't understand all of it
 
Add an argument to the child's init and pass the parent instance to it? Set an attribute? Did you try anything? Also, you seem to have picked a crazy example to learn about a nebulous and not very useful in this instance concept like "oop".
 
yea, might look like a crazy example but that's just what I have to deal with at work right now...
 
If you're at work, why not ask your coworkers for help.
Unfortunately, chat isn't the right place to get the help you're looking for. You need to read tutorials and try things yourself, and have a common basic understanding for us to work with. Throwing a ton of code at us is not the right way.
 
4:24 PM
I've tried tons of stuff, but perhaps in some cases there might have been something else which made me do some errors. I don't know why, that's why I'm asking
yeye, I got it...
 
chat is a good place for clarification types of questions, but not really for... teaching I guess
 
sounds stupid, but none of my coworkers is as far with programming as I am. we are thermodynamic engineers and not programmers... -.-
 
if you gonna create a mutable object like dict in parent, and pass it down to child for example in constructor, its gonna be the same object for all of them
and changes made in child will be visible for parent and other way around
 
I know this is going to sound like I/we are brushing you off, but the chat is not intended to be used as a tutorial service. I understand where you are coming from. But, it seems like there are some core fundamentals in OOP that need to be learned and played around with.
 
@marxin Probably because __contains__ is an overloadable dunder method but there's no equivalent for max or min
 
4:28 PM
ok. I already got that with the dict in parent, or am I wrong? the 'ports' dict is mutable afaik and I can access it from everywhere
@idjaw yeah, I understand that, I just got stuck at a certain point and thought asking for help could help
 
@Kevin yeah you're right, it would have to be implemented in min / max funcs
 
@marxin so when I access the 'ports' dict from the parent class it seems to be accessible by every child class. but now I just need to connect certain dict values of the ports dict with certain other dict values of it, so both are updated if one is updated. as defined in the method call at the bottom. but I can't get that to work...
 
@Scotty1- let me have a look
 
I suggest if you guys want to work on this together to jump on a separate chat
 
ok, thanks alot
 
4:47 PM
unclear/ no mcve stackoverflow.com/questions/45308238/… I was looking forward to answering this, but the OP hasn't clarified, and it's attracting silly answers.
 
@Sarah so it means that there is nothing wrong with your Flask code, and the fault is with the HTML. All these error messages must be edited into the question itself. The $SCRIPT_ROOT is a variable that was never set. Try first just $.getJSON('/_userCount', ....), — Antti Haapala 10 secs ago
 
@PM2Ring yes, I saw that one and was interested in it too. Would be great if the OP actually provided some code too. I have a foolish way of trying to do it. But, it does look like product will do this. But not sure....
 
@idjaw Yeah. As my comment suggests, I think they want the product of all the combinations. OTOH, they may have some restricted set of combinations in mind, and I don't like to guess, especially when they haven't posted a code attempt, and aren't even responding to comments.
 
I think that is a product of combinations then transposed
 
DSM
See, I was guessing it'd be 36 (assuming that the ordering of the 3-tuples doesn't matter). Who can say?
 
4:54 PM
Yeah, but why are obvious products missing from the initial output? Eg, [(1, 4, 8), (2, 5, 9), (3, 6, 7)] that Moses mentioned.
 
ah no
permutations
 
#offtopic why is this room so much more active than the java one?
 
Sorry, yes, I meant permutations earlier when I said combinations. :oops:
My first thought was to use cyclic permutations, so there'd by 3**3 output lines. But that doesn't match their output.
 
recbg
 
DSM
Typically the theory is that Python programmers are so much more productive than Java programmers that we have time to play while they're debugging.
 
4:56 PM
another question?
 
216 lines
 
DSM
@PM2Ring: I never trust OP's enumerations.
 
@PM2Ring solved
 
DSM
The question you asked yourself may have been solved. Whether that's what the OP is asking is anyone's guess.
 
WAT
WTF WHO CLOSED THE Q
I was just pressing the button
 
DSM
4:58 PM
Are you losing it?
> put on hold as unclear what you're asking by PM 2Ring, Antti Haapala, Akavall, Morgan Thrapp, vaultah 2 mins ago
 
You can still submit your answer :D
 
lol :D
 
@vaultah i cant
    import itertools as it

    a = [1, 2, 3]
    b = [4, 5, 6]
    c = [7, 8, 9]

    for i in it.product(it.permutations(a), it.permutations(b), it.permutations(c)):
        print(list(zip(*i)))
this makes those 216 lines
 
map(it.permutations,(a,b,c)) :P
 
4:59 PM
@AnttiHaapala Sure, but we don't know if that's actually what the OP wants.
I asked him if he wanted 216 lines & he didn't respond.
 
ooh whats the *?
 
@Kevin The star unpacks an iterable.
 
DSM
The OP's output is compatible with wanting only 36 (ignoring internal permutations), or with having an unmentioned constraint that rules out other missing cases. Nobody knows but OP, and he's AWOL.
 
@AnttiHaapala (you have a 4h grace period)
 
ahh
 
5:01 PM
ahha :D
@vaultah except I lost the page.
 
sooo, I have a C:\GitHub, and I'm wanting to move it to D:\GitHub without messing up GitHub for windows, Git Shell, etc.... any easy way of doing this?
 
question for the django devs out there, what's the benefit of separating models into sub apps within a project? I come from a rails background where I find it really nice to have all the models in one directory.
I know there's a benefit it, but I'm having a hard time seeing it (probably because of my rails background).
 
@westonplatter the point with apps is that they'd be independent and reusable
I am not a django dev, but I know that they hardly ever are independent and independently reusable
 
@AnttiHaapala right, having apps be reusable would help, but that usually doesn't happen.
 
@Kevin Zip expects a bunch of separate iterables. But we can pass it an iterable of iterables, and use star to unpack them, like this:
>>> a = [[1, 2, 3], [4, 5, 6]]
>>> list(zip(*a))
[(1, 4), (2, 5), (3, 6)]
Here's a more advanced example:
>>> list(zip(*[iter(range(12))]*3))
[(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11)]
 
5:06 PM
@westonplatter so that's the reason
 
@Kevin are you Kevin McCallister or real Kevin?
you use windows as well so its quite rare already
 
My only official alter ego is Terry.
 
wow, I've got 146 rep on ee (by answering a totally SO C question)
 
Kevin Bacon
 
umm wat, mac-whatever culkin got their avatar changed?
 
5:08 PM
ah ok fake kevin doesnt have italic nickname
may someone kick Kevin McCallister? =)
to change his avatar
 
macaulay
 
If being Kevin becomes a crime, then only criminals will be Kevin.
5
 
avatar got me confused for a moment
I was wondering why you didnt know * thing
 
you're pretty Kevinist marxin
 
So yeah, I apologize for answering that question....I let my obsession get the best of me :P
 
5:12 PM
@Kevin *you're pretty Marxist kevin
 
I think that question might have gotten me the gold badge though...Waiting for the recount to happen.
 
@AndrasDeak I refuse to learn to spell that name
 
@AnttiHaapala K-E-V-I-N... not so hard? :)
 
I'm guessing macaulay reminds him of his ex
 
@marxin sorry for not responding, I didn't see the chat request...
 
5:18 PM
Clicking shows other-other-Kevin's gravatar, which is far too similar to first-Kevin's gravatar. I advocate for keeping the current one.
 
nope, bad math again...two short heheh
 
oh I didn't see the gravatar version
that has to go
*flagging for impersonation of a Kevin*
 
But if they're actually Kevin, it's not impersonation, no?
 
oh no
McCallister is becoming more sentient
this is dangerous
 
Home Alone Kevin is one of the most dangerous of all Kevins.
6
 
5:36 PM
hey, can someone make me a room owner, will pay in "thanks."
 
But, Kevin, you are already a room owner. Why aren't you in italics?
Let me change that for you
 
this is getting out of hand, there are now 3 of them. lol
 
Being an RO's not so great. There isn't even salt on this margarita.
 
I'm RO in WPF, was RO in C#.
I hear you. I just want to be like you
and I want margaritas
 
Oh no, the avatar changed. Help.
BRB randomly generating emails until it gives me a similar gravatar
 
5:39 PM
The time of The Great Coalescence is not yet upon us, brother. Cool it in front of the normies.
 
@KevinMGranger FYI it's enough to change the hash
 
Yet another OP who hasn't though through how much space his algorithm is going to consume: stackoverflow.com/questions/45309975/…
 
i am reminded of someone who once tried to run primeSieve(10**18) and was getting frustrated
 
The other day there was a question asking how to replace twelve nested loops using itertools. I believe the OP was trying to exhaustively test all combinations of configuration options for his program. An admirable goal, but unless most of those options are bools, OP's going to be testing for a long time
 
@PM2Ring I always have to keep myself from suggesting downloading more ram in those cases
 
5:48 PM
The best case -- they're all bools -- is actually a pretty breezy 4,096 cases
 
Are python bools actually smaller than small ints?
 
I'm 85% sure that they aren't.
 
I choose you, combinatorial typhlosion!
 
best case -- they're all Trues
</shittypython>
 
@Kevin I think I checked numpy bools vs ints a few weeks ago
 
5:49 PM
@PM2Ring literally "too broad"
 
I want to say that at one point bools and ints had identical implementations (besides type name), but I might have imagined that during a fever dream
 
>>> sys.getsizeof(True)
14
>>> sys.getsizeof(1)
14
 
> The bool type would be a straightforward subtype (in C) of the int type, and the values False and True would behave like 0 and 1 in most respects
 
@Kevin merci
@Kevin that does ring a bell
 
5:53 PM
1 byte for the value, 1 byte for the checksum, 12 bytes reserved for future enhancements to the boolean format
;-)
> To a newbie,
it doesn't matter whether it's called a waffle or a bool; it's
a new word, and they learn quickly what it means.
Disappointed I don't live in the timeline where they called them "waffles" instead
 
I'd love to be able to use __waffle__
 
But like small integers, the True and False objects live in the interpreter, user code doesn't need to create them.
 
Hello guys I have one question related python objects memory allocation
a = 10
b =10
then
 
bool only has two instances so relatively expensive instantiation is still O(2) regardless ;-)
 
id(a) = 12121 id(b) = 12121
 
5:58 PM
How interesting, we were just talking about small integer interning.
 
16
A: What happens when you assign the value of one variable to another variable in Python?

enderlandIt is correct you can more or less thing of variables as pointers. However example code would help greatly with explaining how this actually is working. First, we will heavily utilize the id function: Return the “identity” of an object. This is an integer which is guaranteed to be unique and...

 
Your random question is exactly what we are talking about!
Kevin'd -__-
 
DSM
spooky
 
Guys, any suggestion for which library to use for accessing WordPress api from python
 
@enderland that title is surprisingly misleading
 
@AndrasDeak yeah... I guess now that you point it out, it is, but my answer is relevant to this convo heh
 
I assume the Wordpress API is accessed via HTTP. So... urllib? requests?
 
@enderland yeah, I checked first :)
 
though PM2Rings is more if it's specifically about integer stuff
 
also, I was wondering what happens if __bool__ doesn't actualy return a bool
In [478]: bool(f)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-478-7601a47ce7c0> in <module>()
----> 1 bool(f)

TypeError: __bool__ should return bool, returned int
 
5:59 PM
@Kevin
 
neat
 
jjj
@Vijay also maybe this can be helpful
 
any idea for library
there are some wordpress-python kind of
but they don't seem maintained
 
My ideas were the urllib library or the requests library.
 
and it is xmlrpc for wordpress
 
6:00 PM
Do they work? Then great. They don't? Then fork the code and fix it.
 
(again, assuming that wordpress has a convenient web-based API, which I have not verified at all)
 
Python literally has an xmlrpc lib built in, so if nothing else you fall back to using that.
 
@AndrasDeak So much for the "we're all adults here" principle -_- I should be able to return an int if I want to!
 
exactly!
 
I just searched and the second library returned for "python wordpress api" was last updated a couple weeks ago.
 
6:03 PM
@davidism link please
 
@vatsalparekh do your own work
 
haha okay @davidism
 
cbg all
 
cbg
 
Devil's advocate: "We're all adults here" isn't in the Zen of Python so it has no power to inform the design decisions of the language developers. The fact that the community adopted the idea doesn't mean the language will.
Despite all appearances, the inmates are not yet running the asylum
 
6:06 PM
not to mention that the Zen is not an official rulebook per se
 
Oh wow, that recommendation question got two upvotes, so the op's only lost 8 rep so far.
Who upvotes something that blatant?
 
On one hand, it's a silly poem. On the other hand, it's got its own PEP :-)
 
@PaulMcG I finally came up with x - x % n. (Where n is arbitrary rather than just the hard-coded 5 that we discussed earlier.
 
It doesn't even rhyme
 
@davidism colleagues?
 
6:08 PM
I like the abstract: "Long time Pythoneer Tim Peters succinctly channels the BDFL's guiding principles for Python's design into 20 aphorisms, only 19 of which have been written down. "
 
wafflean algebra
 
if they had more rep I'd flag it
 
@Kevin plus who says everyone here is actually an adult? you just have to be 13 anyways to be on SE :o
 
Reminds me of the kung fu movie trope where the wizened master says "I know 100 ways to kill a man. I will teach you only 99, in case I need to use the last one on you"
 
@enderland You just have to be able to type "13". Or otherwise click whatever verification the website asks for...if it does even that much.
 
6:09 PM
@Kevin ...and I resent the accusation ;)
 
GVR will keep the final aphorism to himself until his final breath, only then revealing it to his one true successor.
 
@Code-Apprentice I'm assuming everyone on the internet is truthful, you mean people lie!?
 
Oh yam. Someone answered that Rubiks Cube question. :facepalm: stackoverflow.com/a/45310421/4014959
 
@davidism
@AnttiHaapala I wonder if it's an issue because I defined the event as "click". I want it to appear on my main index.html page without having to click to get the data — Sarah 56 mins ago
... I wonder...
 
The first glimmer of trying to debug their own problem.
 
6:13 PM
"Oh, could it be this one thing that I didn't mention before but in hindsight is probably extremely important?" is a failure mode I fall into very very frequently when soliciting help on SO ;_;
 
is the rubicks cube question really asking, "how do I store 2^72 datapoints and access them?"
 
@AnttiHaapala you should probably just ignore it at this point, garlic, etc.
 
@jjj The two objects a,b shares the common memory but if I declare a , b objects with dict then it is not sharing the same memory
 
Yeah, dicts aren't interned like ints are.
(Natch, since dicts are mutable)
 
that rubiks cube answer
 
6:16 PM
>>> a = 23
>>> b = 23
>>> a is b
True
>>> a = "Hello"
>>> b = "Hello"
>>> a is b
True
>>> a = {}
>>> b = {}
>>> a is b
False
 
@Kevin Thanks Kevin
Yes Exactly Thanks a lot
 
>>> a = 300
>>> b = 300
>>> a is b
False
>>> a = "a really really long string"
>>> b = "a really really long string"
>>> a is b
False
 
Lien signing time, rhubarb
 
interesting, I wonder what the criteria for string internment actually is?
 
Disclaimer: interning is an implementation detail and may vary in behavior depending on your distribution/environment, so you should not depend on it to work the way you expect it to everywhere
 
6:18 PM
^learned that one the hard way
 
@Kevin is integer internment implementation specific though?
 
I don't know if I've ever had a legitimate reason to use id in a real program
 
interning worked differently if I ran it in PyCharm vs if I ran it from the terminal
 
@enderland I'm 75% sure it is.
 
@Kevin ah, so 94% sure on my system?
 
6:19 PM
the difference is:
Hello consists only of identifier chars
>>> a = 'Hello!'
>>> b = 'Hello!'
>>> a is b
False
 
I know that "id(x) returns the address in memory of x" is absolutely a CPython implementation detail, since it is pointed out as such in the documentation for id. But that's a separate (yet related) matter to "are ints interned?"
 
>>> a = "a_really_really_long_string"
>>> b = "a_really_really_long_string"
>>> a is b
True
@enderland ^
 
interesting
>>> a = 'HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello'
>>> b = 'HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello'
>>> a is b
True
 
I ran in Pycharm a = 300
b = 300

print a is b
True
 
6:21 PM
@Vijay print a is b is syntax error
>>> print a is b
  File "<stdin>", line 1
    print a is b
          ^
SyntaxError: Missing parentheses in call to 'print'
 
I am using python 2.7
 
If you don't get that error, you're doing something wrong. One of the possibilities is that you're still using Python 2.
 
In python 3.x we to have to use print() function not in python 2.x right?
 
wrong again
Python 2.7 has the print() function
but normally the parsing for print statement makes it not work correctly
so one can use from __future__ import print_function to disable the print statement, so the print function works ;)
 
So you don't have to use it, then.
 
6:23 PM
Okay got it
a = 300
b = 300

print(a is b)
True
Why it is behaving
when we run this terminal it gives False but not in Pycharm
 
Because interning has potentially different behavior on different machines / environments / distributions, just like I said
 
yes
 
Okay
 
it's not specified by the language standard, so all bets are off
 
Okay got it thank you guys
 
6:28 PM
@Vijay no
 
I read all of that with "interning" referring to low/unpaid "work experience" ....
 
@Kevin is wrong again :D
 
Why must you rustle my jimmies Antti
 
@Vijay the big integer interning / constant folding is done once per compiled excerpt of code.
 
@toonarmycaptain that's how interning works, there are secret armies of interns inside your computer determining when to/not intern
 
6:29 PM
when you run a program, the entire file is compiled once.
 
Which was answered in the question you were linked to an hour ago.
 
when you use the REPL, each line is translated independently.
 
37
Q: What's with the Integer Cache inside Python?

felix021After dive into Python's source code, I find out that it maintains an array of PyInt_Objects ranging from int(-5) to int(256) (@src/Objects/intobject.c) A little experiment proves it: >>> a = 1 >>> b = 1 >>> a is b True >>> a = 257 >>> b = 257 >>> a is b False But if I run those code together...

 
you're not to rely on this behaviour but it is sometimes handy to know what the behaviour is
@davidism is that in our canon?
 
@davidism I believe PM already linked to that...
 
6:30 PM
1 min ago, by davidism
Which was answered in the question you were linked to an hour ago.
 
oops, sorry
 
@AnttiHaapala not sure
 
I added it here. However I noticed a peculiar thing - that list of links is not ordered
 
Pretty sure there's a feature request open about that.
 
"You don't need to know how this works" is a fairly typical refrain in conversations like this but that seems to get very few "Oh OK"s and very many "tell me how it works anyway"s so maybe someone should bite the bullet and comprehensively document how/why it works in every combination of {Python 2.0-2.7, Python 3.0-current}, {CPython, Jython, Pypy, ...}, {Pycharm, REPL, executed file}
 
6:34 PM
how do I tell a coworker that it'd be easier for me to just plan something entirely myself than get "help" from a committee >.>
 
too broad (vague data format recommendation) with awful answers stackoverflow.com/questions/45294540/…
actually, at most one of the two answers tries to be an answer
 
@AndrasDeak I guess his self answer should be edited into the question
 
@enderland tell them a committee will require an extensive provisioning budget, vs the very small one you yourself will require.
 
basically I just need to randomize a list of names and create groups
 
@enderland yes but it seems to be beyond hope
and no, you shouldn't do that yourself
flag it for a mod because you can't remove the answer
 
6:38 PM
 
@enderland ...well yes you could tell them you require a committee made up of hobbits, an elve, the heir of Gondor, a wizard, a dwarf, and the ring of power...
 
@toonarmycaptain nah they just need convenient plot events in their life
 
@enderland The rules for string caching are dark and mysterious, but preference is given to strings that are valid to use as Python identifiers. That makes sense, since it means that the identifier names in locals(), globals() and int the attribute __dict__s of objects are likely to get cached.
@enderland I'm afraid so.
 
@AndrasDeak I'd flag the other as NAA but... bleh, it's technically trying to help?
 
So I've been stuck on this for way longer than I imagined. I want to add another variable to a table within a library I'm using that is setup like that, using sqlalchemy. I used setattr to override init and insert, but when I Nonetypes when I'm using self in these functions. Is there something I'm missing?
 
6:51 PM
@enderland yeah that wouldn't go through
@Programmer that last line looks weird and SyntaxErrory to me
and are you saying that self is None in those methods when called as a = A(); a.insert(...)?
and isn't the class-level id shadowed by the id passed to __init__ in B?
 
Yeah the last line is wrong, it should be var = B(id) my bad
When it calls the __init__, every self reference is None
 
what is an example showing your unexpected behavior?
 
yeah a proper MCVE would probably help
 
probably? always!
 
hi there; who has worked with google api's? (cloud vision...)
 
6:58 PM
if the problem is straightforward enough one can live without a proper MCVE
 
 Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or
explicitly create credential and re-run the application.
but I have the keyfile.json in my directory
$ export GOOGLE_APPLICATION_CREDENTIALS=keyfile.json
after this; I still get the same error.
 
Okay, I'll work on it.
 
@AndrasDeak most straightforward questions are answered with a proper MCVE...
 

« first day (2474 days earlier)      last day (2474 days later) »