« first day (2494 days earlier)      last day (2454 days later) » 

12:00 AM
array broadcasting is a weird thing if you see it for the first time, but it's reaaaally powerful so I suggest getting to know it better
 
tehy are a special mathematical name for that, I mean , they are a name for that operation
 
for which operation?
if it wasn't division but multiplication, it would be called "outer product" or "dyadic product"
or even "tensor product" depending on context
division is typically not defined between vectors in mathematics
 
aah ok, I thinking they was, maybe a name , like when we can see some matrix with a diagonal of "1" of like correlation matric
*matrix
*or like
 
you can edit/delete messages in the first 2 minutes after posting, see also the second pinned message on the right --->
@YoanBouzin well I'm not very good with special named matrices, so it's not impossible.
 
So thank you a lot ;) I will continue my work (even if its 2am here ;) )
 
12:06 AM
there are a handful of special matrices in scipy.linalg
@YoanBouzin same here ;)
smaller stuff like this are not worth asking about on the main site, feel free to pop in and ask (assuming you tried to learn/solve it yourself first)
 
yes all right
I dont like posting little thing like this I post only if its very rare
 
yeah, I can only agree with that :)
chat is much more suitable for this
 
or if after 2 days I dont found anything ^^
(maybe a week)
 
hehe, yeah
@Rawing sorry, I missed that ping when I came back
 
you know, that in this website, poeple asking for very simple thing like 'how to have all the key of a dict ?' also the answer and question a very old too, but high ranked because many poeple things about stuff like that
 
12:10 AM
I'll need to look at __get__, looks interesting, thanks
@YoanBouzin unfortunately most people don't try to find those questions and ask again :/
 
^^ in fact yes
but I have my proud so ... :P
 
and you'll get heavily downvoted if you ask a trivial dupe, too ;)
@vaultah first time seeing objgraph, looks neat
 
When I don't understand python features, I sometimes (only sometimes) look at Common Lisp to explain it, and when my mind is done twisting and turning itself I return to the python feature and see its utility.
 
yes I see, like I don't know for example the "fatest" or more "less memory" to do one stuff
 
those can be tricky, because the answer might only be trivial once they tell you the answer
 
12:15 AM
yes too
also I'm in bioinformatics, and I see a tool called clustergrammer, its wrote in javascript but they're a python API, it's look very cool to see thousand of data, the answer you give me its a starting point to make it
https://clustergrammer.readthedocs.io/
SO i go to play with my data ! Thanks again and have nice day /night !
 
have fun:) bonne nuit
 
Andras Merci beaucoup ! (where you come from ? England ? spain ?)
 
Hungary
the other end of our time zone
 
aah oki ;)
I'm in Montpellier ;) lot of sun ! ^^
 
sounds good
 
12:20 AM
so see you next time !
 
bye
 
 
3 hours later…
3:26 AM
cbg
 
 
2 hours later…
5:30 AM
cbg
just before my bed time
 
Morning cbg
 
6:11 AM
Morning cbg
 
6:31 AM
have read 10+ posts already trying to solve this issue and just trying to see if anyone here has any idea. im getting a setup.py egg_info failed with error code 1 issue when installing certain packages
any idea?
upgraded setuptools
and pip
 
That's... really broad
 
I get it if I run "pip install --trusted-host pypi.python.org pytest-xdist" it spits back "python setup.py egg_info failed with error code 1 in C:/.../pytest-xdist"

again not trying to get too terribly in depth, just seeing if anyone here was familiar with the issue.
 
6:59 AM
@JoshPeel What's just before the "error code 1"? You will probably have another thing that failed, which is the root cause of the setup failure.
 
7:26 AM
cbg
 
7:59 AM
morning
 
Esoteric visual data-flow language programmed in Python: motherboard.vice.com/en_us/article/a33dvb/…
/--#$--\
|      |
>-*>{+}/
| \+-/
1  |
#  #
|  1
|  |
|  .
.
Fibonacci sequence in Asciidots.
 
About 125 away from reaching 800,000 questions tagged with python.
 
8:38 AM
@MartijnPieters you should try mentoring :D
and @AndrasDeak too :D
 
@mayautobot Kindly read the room rules - sopython.com/chatroom
> Do not link your recent (< 1-2 days) questions in the room. The main site is the dedicated space for posting questions, and having them answered.
 
well, but then, no one notices that link :D
 
Bad UI? Or maybe not.
 
@AnttiHaapala Apropos of what?
(no time to do professional mentoring atm).
 
8:52 AM
cbg @AnttiHaapala, 'sup?
 
cbg, all
 
@AshishNitinPatil ok...thanks..
 
Cabbage
 
Cabbage
 
Hiya @bhargav
 
9:06 AM
Cbg prof \o
 
I see @PM2Ring isn't in. I'll leave this for him (and anyone else that might like it) youtube.com/watch?v=WtZ3yoNrGl8
 
...is it worth re-opening a question just so we can close it for a reason that isn't wrong? (currently marked as duplicate even though it's not)
 
@MartijnPieters no, the question mentoring :D
 
specifically, this question
 
@Rawing How can I generate this string with python?
 
9:10 AM
"this string", not "a random uuid"
 
what is a custom uuid :D
that UUID is invalid
it is not an UUID, because the type bit is not set.
 
he did call it "uuid-like string" in the first revision
he just messed it up when he edited to clarify
 
reopened because this is a duplicate, but still, the question makes no sense. This is not UUID because the type field is wrong. Also why would you want to generate "Universally" unique identifiers that wouldn't be universally unique (using this code will lead to your UUID not being universally unique). — Antti Haapala 1 min ago
 
oh, it's been opened. now we can close it as too broad.
 
downvoted
that question is the worst XY problem I've ever seen.
 
9:15 AM
@AnttiHaapala No time, too many other commitments atm.
 
@MartijnPieters it was a joke
it is the worst waste of time
worse than SOD.
 
@AnttiHaapala lets see how it pans out. I can't say I'm optimistic either though.
It can work, but it doesn't scale.
(or at least, I don't see it scale)
 
no, it doesn't work
today I helped 4 people, I wasn't going to help any of them...
but I was the lone person there...
wasted a hour
one ended up actually posting a question that was somewhat answerable...
I mean I didn't do anything else except try to leave but got pinged back.
it is the HV++ :(
 
9:35 AM
Why is this code giving me a `TypeError: expected string or buffer`?

response = requests.get('http://quotes.rest/qod.json?category=inspire')
dict = json.loads(response.json())
And why can't I format it into code? :(
 
response.json() is already parsing the JSON for you.
 
So you're saying response.json() is returning a dict?
 
Possibly yes.
 
It is, just checked it, okay then I misunderstood it. Thanks!!
 
I'd recommend reading the documentation related to that method and its usage: docs.python-requests.org/en/master/user/quickstart/…
 
9:39 AM
I did.. but I must've missed something :)
 
9:53 AM
python cool python cute
 
Going out for lunch, by the time I am back, we will have crossed 800,000 questions tagged
 
10:32 AM
@Rawing close to the most pointless thing in the world:/
at least higher chance for roomba
@AnttiHaapala "how about no" :P
 
That OP actually did a 180 and accepted an answer that generates random UUIDs.
 
@Rawing the whole question is an i*****c XY
 
Is it? What's his X?
 
I don't know
so, you suppose that this is the actual problem he's having?
he's been given a task: "generate UUIDs that are not UU"
 
Hmm, you may be right.
 
10:42 AM
Cabbage!
Was just looking at some code and got a new idea for a tabs vs spaces discussion: What about using 2 tabs!?! That gives you the bost of both world: Tabs for indentation, and two button presses for the space-people!
 
and 16 space indents!!
 
11:02 AM
799,995 questions tagged... 5 more to go
 
time to delete questions!
 
lol
Or maybe tag correctly?
799,999
 
couldn't find any with 2 delv
 
I tried looking at the last pages of questions, sorted by votes…
I’m internally bleeding.
 
We're finally at 800,000 questions tagged with ! Roughly 5.56% of total SO questions.
 
11:08 AM
Well that was quick
 
75.9% answered (rather 24.1% unanswered)
 
@poke delv, cv?
 
@AnttiHaapala hm?
 
1.5B views ooh
 
11:19 AM
discussed on meta on being ontopic :d
 
crazy right :P
 
11:38 AM
hehe I untagged one python quetsion
it was actually a perl question, here
 
11:56 AM
@AnttiHaapala -31 for an answer... kind of deserved for the comment
 
My suggestion for the English vocabulary:
workflaw (noun) - a workflow that "works for me" but should actually be killed with fire
8
 
12:09 PM
@AndrasDeak I love that
 
@AndrasDeak You have just described my entire current working practice in one word :(
 
stackoverflow.com/questions/25970488/… – Just ONE more and we get rid of this monstrosity!
Virtual high-five to the sopython team!
Let’s mark this day in our calendars as a day we made the world a better place.
 
Print-screen anyone? Still ~5.2k to go for my access to such questions.
 
You had two years for that :P
 
12:25 PM
@poke Well, 4 years. But yeah, I try to get there whenever I get decent time. Balance in all things :D
And, thanks!
 
I meant you had (over) two years to read that question :P
 
Oh, yep. I even cved it :-p
Doing my part :)
 
Monday cbg
 
@AshishNitinPatil lol.
 
cbg
 
12:35 PM
Number of times this month that I have modified temporary_asp_files/random_hex_string/widgetViewer.aspx instead of actual_project_path/widgetViewer.aspx because the former is the one that gets opened by VS while debugging, and only noticed halfway through the lengthy deployment process: 5
 
I hope you have a funny calendar style thingy in your office where you can rip off the numbers as they increase.
 
The IDE makes a half-hearted effort to prevent this mistake by making the temporary file read-only... But only as long as the debugger is attached to the process and running. So it does nothing to stop my usual work flow of "I have identified the bug. I will now stop the debugger and modify the file"
 
i have upgraded django 1.6 to 1.11. so when starting server RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. getting this error.has anyone know this issue? i tried solution in stackoverflow.
 
12:43 PM
morning everyone
 
@poke, that two solutions i tried already, yet no luck! its not working? any idea?
 
Not really. But you’re doing a big upgrade, there’s bound to be some complications. You should try to find some migration guides for each individual step.
 
@SaravananN try all of them
not just the accepted answer
(and yeah django is a bit bad :D)
 
@poke,@AnttiHaapala . ok. Or can i upgrade one by one like...1.7 then 1.8....finally 1.11. is it a better solution?
 
Sure, you can do that. That’s probably a safe way to make sure that you catch the problematic change and find out what exactly might be the problem.
 
@poke okie.
 
cabbage
What is the most pythonic way of updating a DB via looping over a dict?
 
Whatever way that works and is comprehensible to the reader.
 
@SaravananN That may take quite some time, and might actually be harder since you may struggle finding outdated errors / bugs.
 
Update = selection criteria + field updates
Which one is the dict?
 
12:58 PM
Minutes spent today performing a lengthy deployment process because someone decided that it would be fine to have a try-catch that silently ignores 100% of errors inside a DB-facing function: 57
 
@Anarach - assuming this is SQL?
 
@PaulMcG Yup
 
Incidentally, any question phrased like "what is the most Pythonic way to do X?" rather than "how do I do X?" will get a response from me that assumes that you already have tried multiple ways to do X, and they all worked perfectly, and you're just trying to decide which one you like best. Therefore, if you don't know how to do X yet, I don't suggest phrasing your question like that.
 
And the dict has the field updates? Or the selection criteria?
 
1:01 PM
@Kevin Valid point, I am currently doing it by manually assigning each value to the corresponding table name and it works
 
Basically you can get a philosophical answer or a technical answer respectively
 
@PaulMcG The dict is just a Json from the web
 
@AshishNitinPatil then any suggestions?
 
Oof - what does it represent, relative to whatever in the DB it is you are updating?
 
@SaravananN I'd suggest sticking to the "direct jump" and solving the errors as you go.
 
1:03 PM
@AshishNitinPatil Ok.
 
But yeah, going through individual changelogs of major versions will definitely help in the process and reduce possible errors
 
@PaulMcG DB(table) has the same fields as the dict Keys.. so doing it manually one by one is not an issue. I was just wondering how to update the values
G is a dict , Presently I am doing it like so..
region = (G['region']) where the region in quotes is the key inside G
next I am updating region in DB using ORM
Imagin doing this line by line for 50 items
 
Does this DB contain more than one record? If so, how do you know which one to update?
 
So i assumed i must be doing something wrong
 
Usually this involves some kind of WHERE clause to specify which record(s) should be updated. Without a WHERE clause, all the records will be updated
 
1:08 PM
DB (table) has field names corresponding to the key names from the dict. So i basically update the 'region' from the dict into the region of the DB
I will be creating a new entry , not updating existing data
 
Ah, your use of the word "update" threw me off
 
@PaulMcG Ohhhhh I get it now. I am so sorry
My apologies
 
Why not construct a single insert query instead of looping for the update multiple times?
 
@AshishNitinPatil How would One do that? I generally use SQLAlchemy
 
You should be able to construct a single SQL INSERT statement, listing each of the fields in the dict, and "?" placeholders for the values. Then use sql.execute(dict.values()).
 
1:10 PM
Can you guys give an example?
 
Try this by hand with just two fields, "INSERT whatever_the_table_name_is (fieldA, fieldB) values (?,?)"
 
55
Q: Bulk insert with SQLAlchemy ORM

Nick HoldenIs there any way to get SQLAlchemy to do a bulk insert rather than inserting each individual object. i.e., doing: INSERT INTO `foo` (`bar`) VALUES (1), (2), (3) rather than: INSERT INTO `foo` (`bar`) VALUES (1) INSERT INTO `foo` (`bar`) VALUES (2) INSERT INTO `foo` (`bar`) VALUES (3) I've ...

 
What does the '?' at the end indicate?
 
Then call sql_statement.execute(list_containing_values_for_a_and_b)
It is an actual question mark in the SQL - it is a placeholder for the values that will be passed in in the execute call
 
@AshishNitinPatil Looks interesting , Thank you :-)
@PaulMcG Oh , I see... Thank you Sir, I shall look into it..
:-D
 
1:13 PM
Once you have that working for two fields, then you should be able to generate the list of field names from the dict keys, and the values to pass to execute from the dict.values()
And you'll need to generate as many "?"s as there are field values being inserted
 
Ahh I see..
Learnt something new today..
Feels good
 
But do NOT insert the actual values into the values clause itself - this is how SQL injection can occur
 
little Bobby Tables
 
\o cbg
 
1:31 PM
cbg
 
morning
 
morning cbg
 
cbg
 
cbg
 
1:47 PM
Right, secrets.choice does not help, it is still a jerk name. As Uncle Bob writes, functions should be well names to convey what they do. — zaph 5 mins ago
 
user image
6
The upcoming Python 3 version can reach 69 feet!
 
"high performance"
 
"for maximum performance"
 
> Python 2 holds up to 52 oz of water.
 
Does it make a sssssssssssssssssssssssssssssssssssss sound when you spray things :D ?
 
1:54 PM
@poke I don't think that statement holds water
 
haven't seen that one
 
@Kevin That does not really go well with the Zen of Python though
 
Yeah I think it's more a commentary on our unusually batteries-included standard library
 
but I don't see any batteries in the picture
 
2:05 PM
They're already hidden away in the housing, since they come included.
 
And you can tell there are a lot because it does a lot at the same time which would consume a lot of energy.
 
batteries included.
 
And you can also tell that is has already been running for a while since there are already fired shots, so you can assume that the batteries last a bit.
 
I was going to say "surely the autofiring handguns must be battery powered since they are clearly not connected to any external power source" but perhaps it could autofire just by harnessing the kinetic energy of the kickback. I'm no gun-ologist.
 
Maybe it can even charge batteries
 
2:09 PM
With that, perhaps one day all warriors can be eco-warriors
(Cbg)
 
2:22 PM
I feel like we ought to have a dupe for Run Python console after script execution in same environment which I interpret as asking "how do I execute a script and then get a REPL where I can inspect values?"
The answer to which is some mixture of pdb and execfile or similar
 
or IDLE
 
Yes, that was just suggested in a comment (which should have been an answer :-I)
 
Quality requirements are far lower in comments than questions, so I don’t judge them…
I would also rather put something like that in the comment than writing an answer on how to do all this in IDLE.
 
Yeah to be fair an answer like "try using IDLE" is not going to get a swarm of upvotes
 
2:41 PM
I am building a Python script, I guess you would call it. It's not an application since it's deterministic and will be executed like a script. Right now I don't have any classes, just files with different functions in them. Does it make sense to introduce classes under these circumstances?
 
Not necessarily.
 
In Java I would have classes, in JS I would not use classes, not sure what to do here. Any benefits to either approach?
 
In my opinion, classes should only be employed when you can't get the behavior you desire without them. Or, at least, getting the behavior without classes would be considerably more cumbersome than getting it with classes
 
DSM
Back-at-work cabbage for all!
(Soooo many emails..)
 
Ok, one question then. No class means no constructor. Which means I would put something like logger = logging.getLogger(__name__) among the imports?
or where would I put such init code?
 
2:45 PM
I might put that just below the import statements.
You might also put it towards the bottom of your file, after all your function definitions. Perhaps inside the if __name__ == "__main__": conditional, if you have one.
if __name__ == "__main__": serves roughly the same purpose as Java's main entry point, although it's not at all mandatory in Python
I don't have a concrete guideline for whether code should appear above or below my function definitions. I guess would roughly categorize things as "imports -> configuration -> class and function definitions -> executable code"
 
@DSM how was your vacation ?
 
Setting up a logger feels more like "configuration" than "executable" to me
 
DSM
Was nice. Was the first time in a while I'd been back out West during the summer -- I'm used to seeing the town coloured white, was weird to see it green!
 
@Kevin Thanks for your input, I'll probably put it under the imports as you recommended
 
🎝 I see a white town and I want it painted green 🎝
 
2:51 PM
That makes no sense to me what so ever, sorry
 
That's fine, it was in reference to the other conversation.
 
@DSM You have my sympathy (in solidarity - also clearing post vacation emails)
 
cbg all
 
recbg
 
DSM
@JRichardSnape: imagine a Marvin-style "the first hundred were the worst, and the second hundred, they were the worst too. The next hundred I didn't enjoy at all. After that I went into a bit of a decline."
 
2:54 PM
Adding a string to a list in Python 3 [duplicate] is a nice piece of evidence for my theory of "+='s behavior trips up newbies" from last week's conversation.
How can one man be so right all the time B-)
 
@DSM I feel that!
 
Devil's advocate: but last week's conversation was about the difference in mutability of in-place add and regular assignment. That question is about the difference between addition and what is effectively extend.
[1] + "2" doesn't work, but [1].extend("2") does.
(not that it's particularly useful to extend a literal, but that's besides the point)
 
@Kevin Ohh so thats what its doing.. Nice!!
 
"It's Python's entry point" is a convenient oversimplification. If/when you find yourself surprised by some behavior and say to yourself "but it couldn't possibly do this unless if __name__ == "__main__": isn't exactly Python's entry point", that's a great time to learn about the more intricate truth.
(Which isn't that much more intricate, I'm just too lazy to give the two paragraph breakdown right now)
 
I don't think that would be necessary
 
3:06 PM
You could probably figure it out empirically through judicious experimentation.
 
@Kevin Now that I know why it's used, I get it why people use it in their app, at specific places, Till now I assumed python does not have an entry point and it magically figures out the correct entry point,
So much to learn
 
it's also important for multiprocessing+windows
 
Python figures out the entry point by looking at the file you told it to run and thinking "I guess line 1 of this file is my entry point"
 
Lol yeah
 
It might look like the executable code below all of your imports and function definitions is magically chosen as the entry point, but that's just because the vast majority of import statements and function definitions do not display any indication that they're being executed
 
3:09 PM
Right
Also , I had this question on how do the Pros maintain variables in python? since we can create them on the go , how does one manage variables in production level code?
 
As in, "how can you keep all of the variables straight in your mind?"? Keeping individual functions as small and encapsulated as possible goes a long way.
 
I have a flask web app, it just looks wrong to me, so many variables here and there.
 
VariableFactoryProviderSingleton of course:
foo = VariableFactoryProviderSingleton.instance.get().create('foo')
foo = 4
 
Namespaces and other hierarchical organization structures* help too. Better to have 5 namespaces with 5 variables each, than to have 25 variables floating around the global scope
(*such as classes and class instances)
 
> Namespaces are one honking great idea -- let's do more of those!
 
3:14 PM
Quickly googling Namespaces :-D
 
(I better google it too to make sure I'm using the term right... "Namespaces in Python are implemented as Python dictionaries". Wait, what? No, dictionaries aren't namespaces)
 
Also , Why do all python documentation contain this word 'SPAM' ? for all examples
 
Python is named after the comedy troupe Monty Python, who had a popular sketch involving a bizarre restaurant with a heavily spam-oriented menu.
 
You can never have enough spam..?
 
Forgive me but I thought spam was when you 'spam' someone's email or something
 
3:18 PM
it originates from spam
by way of Monty Python, actually
 
That is the typical interpretation in tech-oriented circumstances, yes
 
Woah, the word spam came from a comedy skit ?? LOL
didnt know that
 
Surprisingly, most tech words originate from somewhere else.
 
Funny
 
keep in mind that the name "Python" came from Monty Python, too...
 
3:20 PM
Sometimes it's jarring to remember that the founders of our profession were probably weirdos with the same sense of humor as us
 
Going to download monty python
Hope its not too old.
 
Didn't they officially upload the whole thing to Youtube, or did I imagine that?
It's from the 70's or so, so depends on your definition of "old"
 
@Kevin Amen to that
70s wow
thats pretty old
 
@Kevin or worse. I mean think of linus. lol
 
very old actually
 
3:21 PM
@Anarach it's not too old but it's British. Very.
 
DSM
> For 7 years you YouTubers have been ripping us off, taking tens of thousands of our videos and putting them on YouTube. Now the tables are turned. It's time for us to take matters into our own hands. We know who you are, we know where you live and we could come after you in ways too horrible to tell. But being the extraordinarily nice chaps we are, we've figured a better way to get our own back: We've launched our own Monty Python channel on YouTube.
 
Currently estimating how many users are quietly hurt when they hear the 70's being referred to as old...
 
I was born 30 years after so
VERY OLD
 
Maybe you’re just very young?
 
DSM
Childlike, even.
 
3:23 PM
I hope its not black and white
 
:|
yamming toddlers
 
It's a talkie, at least
 
DSM
A moving picture isn't a moving picture without ragtime piano.
 
and intermittent pictures with text on them
 
Dont tell me the editor IDLE is named after the guy eric idle!
 
3:24 PM
I'm really more into zoetropes, the image just has more "warmth" than sterile film
 
<calligraphic>"Our hero is in quite a conundrum!"</calligraphic>
 
> Author Guido van Rossum says IDLE stands for "Integrated DeveLopment Environment",[1][7] and since van Rossum named the language Python partly to honor British comedy group Monty Python, the name IDLE was probably also chosen partly to honor Eric Idle, one of Monty Python's founding members.
Odds are pretty good it's a backronym
 
According to Wikipedia, these guys are legends!!
 
DSM
...
 
Even Sacha Baron .. Nice I love him
But who is Monty Python? Is that a character they do?
 
3:27 PM
I have decided that this whole conversation is brilliant satire
Carrying on MP's grand tradition
@Anarach I don't recall it ever being explained.
 
I see..
 
> Differing, somewhat confusing accounts are given of the origins of the Python name, although the members agree that its only "significance" was that they thought it sounded funny. In the 1998 documentary Live at Aspen during the US Comedy Arts Festival, where the troupe was awarded the AFI Star Award by the American Film Institute, the group implied that "Monty" was selected (Eric Idle's idea) as a gently mocking tribute to Field Marshal Lord Montgomery, a legendary British general of World War II; requiring a "slippery-sounding" surname, they settled on "Python". On other occasions, Idle
 
my people keep writing it "Monthy Python" because they don't know (nor care) that it stands for Montgomery
they also pronounce "th" as "t" so they don't see the problem
"Monthy Python [pronounced Monty Pyton]"
 
Monthly Python
 
DSM
I've just today been invited to a monthly meeting of Python architects. I think we have our new name.
 
3:34 PM
:-)
 
lol
Ha ha ha ha ha
 
The documentation here mentions a few test tools, py.test, nose, tox and unittest2. Which one do you guys think I should use, and why?
I'm using Python 2.7
Nose?
 
pytest is best
by best , i mean easier to pick up for a beginner and works out of the box.
 
Ok I'll give that a try, thanks
 
3:58 PM
@Anarach: Python is chock-full of easter eggs that reference Monty Python. IDLE is one of the more visible ones.
 

« first day (2494 days earlier)      last day (2454 days later) »