« first day (1949 days earlier)      last day (3223 days later) » 
00:00 - 17:0017:00 - 00:00

00:57
hello guys. What is the best book for learning python? I just got started learning it on my spare time.
DSM
DSM
The room pages have some recommendations and an anti-recommendation..
@DSM thank you for the list :)
 
5 hours later…
06:27
Haven't found a solution for my question yet.
 
1 hour later…
07:46
cbg
08:03
@GauthamSK please don't link new (< 1-2 days) old questions into chat, as per sopython.com/chatroom
good morning people
cabbage
is there anyway to modify self variable?
print self spits out bar, I tried self = self.replace('b', 'a') but it won't work
Hey guys
cbg
In a module I've built I have 2 mixins, A and B.
B uses A but A can be used without B.
Is that fine to have A inherit B?
If my code inherits both for readability would that cause any problems?
08:23
@AvinashRaj you've been a member of the room/community long enough to realise we're not mind-readers. If you're going to ask a question then please also provide an MCVE.
@GLaDOS that relationship makes no sense to me.
If B uses A, how would A inherit B?
wanna return 2 variables that aren't strings in 2 different lines
return a,b put them on the same line, i tried with \n
but did not seem to work
@GLaDOS The only way this could happen is if A and B have something in common. If that's the case, you can isolate the common things in a different parent class.
@hmmmbob you mean print 2 variables
yes when i print the function that has a return statement of 2 variables
sorry
@hmmmbob The function returns a tuple of 2 elements. So all you have to do is print the elements of the tuple on 2 lines
08:33
ah so i deal with it when printing
Well, depends on the function but most probably yes
thank you, i know i have also those noob questions, i first always try to google it before asking
@hmmmbob The key thing here is to remember that the function does NOT return 2 variables. It returns a tuple. return a,b is the same as return (a,b)
08:50
Cbg :)
@khajvah Sorry, I meant to say is it fine to have B inherit A
since both are part of a mix in folder, I don't know how common this is.
@GLaDOS If the relationship is "is a" relationship, you can inherit
@khajvah No, the relationship is that B uses A and depends on it
09:05
it really depends. Inheritance is one way of reusing the code in other object. The other way is having a member instance. Whichever you should choose depends on the context.
What I do is think about the objects in question conceptually. If B is a kind of A, you should inherit. If B just includes A, you should just have a member instance.
Yeah, I have this feeling that on one hand its a good Idea but I might be forgetting something
It's more like A and B are plugins and B uses A for something
Since they're used as mixins and not as inheritance
If B uses A for something, it should just be a member instance.
Cabbage!
But then the whole purpose of having them as plugin modules is gone
@GLaDOS why is that?
09:12
I intend to use them as some sort of pluggable module, if I want my code to support something, I simply inherit the mixin. If something becomes a member instance, it becomes something entirely different. It could work on other scenarios, but not this.
How to find the X and Y coordinates of a gtk element eg: gtk.IconView
?
@GLaDOS oh yeah inheriting mixins is fine
sorry for confusion, I was confused too.
mixins are kind of different than classical class inheritance
Yeah
but they can work as really nice plug-in features
anyone having experience in oop? stackoverflow.com/questions/35425387/…
09:24
@GLaDOS I am really not sure how your plugin architecture uses mixins
but yea they are for reusing common features
Not really plugins, I just used that name because that's what it looks like to me
oh ok
09:38
I want a Scala job
@m0nhawk gtk_widget_translate_coordinates not working
@AvinashRaj please don't link new (< 1-2 days old) questions into chat, as per sopython.com/chatroom
@vaultah seems like a new rule :-)
It isn't
10:45
i think i have regophobia
fear of regexes, i don't think that word even exists :)
Probably fear of monarchy
Or would that be regiphobia
Material design is the Bauhaus version of UI
Just saying.
I often find that arts students think that classification (or: it looks/sounds a bit like this other thing) is deep analysis
@RobertGrant We can safely assume \w+phobia covers it probably.
But then my sample size is too small to be accurate
10:49
@m0nhawk now show a white space in space of gtk.IconView
@GLaDOS which material design framework do u love most (css framework)
i love materialize css cuz it's very similar to bootstrap
@danidee I'm a backend developer. I don't touch css as much...
I just wanted the world to know what I think
see
its like material design.
That would also mean that the Brutalist design is the equivalent of 2007 UI or something
"Very ugly"
http://www.bdonline.co.uk/Pictures/web/d/i/q/St-Giles-existin_636.jpg

see,
just like word art.
I am getting an import error: No module named gyp_chromium
It indicated to line 23 , But that line only has this line :
path = os.path.abspath(os.path.split(file)[0])
Where to find which one is the 'file' ?
11:07
@Anirban i've seen something similar to this this SO question might be of help stackoverflow.com/questions/18230095/…
it's a wild guess cuz i've never encountered this myself
11:20
Cᴀʙʙᴀɢᴇ
@danidee I don't fear regexes, but I don't like it when people use them in Python for stuff that can easily be done with str methods, unless the regex method is clearly faster, and they need the speed. Eg processing user input from the terminal doesn't need speed. :)
Regex has often been criticized as a write-only language. Sure, a small regex can be succinct, but complicated regexes can be painful to read and thus they are bad for code maintainability. OTOH, modern regex engines (like Python's) allow you to name capture groups and to embed comments in your regexes, but those features aren't used much, IME.
@PM2Ring I have a friend trying to improve ReGex, (he is on a mission!) Here is his (beta) repository: github.com/SonOfLilit/re2 (It's on github, so its not secret, but he isn't near completion, so don't go spreading this around). It's just a curiosity at the moment :)
@PM2Ring, i also feel the same way when regexes are over-used i always try to come up with an answer when i see any regex solution to a question that can easily be achieved with simple str methods
@InbarRose that's interesting...already watching
11:38
@InbarRose He's also a friend of mine
how do you know him?
@InbarRose Interesting! (Of course, that [Ll][Aa][Uu][Gg][Hh] example can be done easier in Python by using a case-insensitive flag). BTW, there's a new Python regex module, but its goal is for more power, not improved readability.
@GLaDOS I have known him for years. Since we were kids.... :P
Oh, I've known him for only 6 years or so
Small world
Well, when you live where we do.
The odds of being a python programmer do increase I agree.
11:41
@danidee Excellent. I assume you've seen the classic post warning against use of regex to parse HTML: stackoverflow.com/a/1732454/4014959
@PM2Ring It's practically a requirement by now.
Does anybody have experience in bookmaking?
@PM2Ring Nope i've not seen it....what got me cracking was Even Jon Skeet cannot parse HTML using regular expressions.
@khajvah That kind?
i thought jon skeet could do all things :)
11:46
@InbarRose More evil kind
@danidee He can: Jon Skeet can even do impossible things. But even he wouldn't attempt to parse HTML with regex. OTOH, Jon Skeet can parse regex with HTML. :)
@khajvah Like, an evil bookmaker? A bookmaker who worships the devil and puts razor blades between the pages?
@InbarRose almost. The one who worships the devil and others' money
@khajvah I think you will have to be more specific, and perhaps give an example of what you mean.
Hello
            file_name = 'result')
            fp = open(str(file_name), 'w')
            fp.write(partial_data+'\n\n')
            fp.close()
This code works fine with me
            file_name = 'result_'+str(url)
            fp = open(str(file_name), 'w')
            fp.write(partial_data+'\n\n')
            #json.dump(partial_data, fp)
            fp.close()
11:49
@user123 Please see our chat room rules
@InbarRose I though you were sarcastic. The one who takes bets
okay
@khajvah A bookie!
@user123 Do you have question?
11:54
@InbarRose An evil bookmaker, one that makes the books with already folded edges
and has really bad press quality.
12:13
@GLaDOS Where you have to squint to read some words, and others are smudged. yuck!
@danidee I had installed python 2.7.11, But the command looking for gyp_chromium was using python 2.7.6 and it was supposed to be. So, changing the version by force can make more error.
user559633
12:36
g'afternoon
269
Q: How do I "cd" in python

too much php"cd" as in the shell command to change working directory ...

there's an answer that deserves downvotes :D
@AnttiHaapala I started reading the accepted answer and thought "What's Antti on about? This looks ok" but then I saw that horrible class, and the abuse of __del__. :(
yes, and what is more, that answer is behind 68 % of that guy's rep :D
Last seen Feb 12 at 23:57
there is a comment with 96 upvotes, online all the time and no fixes :D
12:51
Maybe we should edit the answer so we don’t have such an answer advertising __del__ like that
Wouldn't the appropriate approach be to flag the answer?
Isn't editing an answer to change its original meaning frowned upon?
The question could use some editing too.
Yeah, I am happy with my edit to that question, simple and to the point.
You could upvote my comment there:
Note, the currently accepted answer is dangerous, rather use this answerInbar Rose 14 secs ago
@poke There are comments saying that it's bad, and that a proper context manager is far better. And there's already an answer(s) using a context manager. So I don't think an edit is necessary. But I guess a note at the end of the accepted answer directing people to the better answer would be ok, since I'm sure many readers don't bother looking at comments.
@PM2Ring I’m not saying correct the answer, but rather just take the bad part out
It would be easy enough to just modify the 2. list item to say “use a context manager for example”, remove the code and the sentence afterwards; and the answer is fine
@poke True, but I'm still uncomfortable with the idea of making a significant change to the original author's intent, even when they're giving bad advice. OTOH they didn't bother responding to comments criticizing their code...
13:07
Let’s meta it, and make the meta effect fix it :D
THE PROBLEM WITH OPEN SOURCE SOFTWARE IS IT CAN'T FIX THIS POST
waits
@poke That might work... :) And if it doesn't, it'd still be interesting to see the meta consensus on editing the answer.
;)
Please post the meta question here once it is open.
>>> "THE PROBLEM WITH OPEN SOURCE SOFTWARE IS IT CAN'T FIX THIS POST".title()
"The Problem With Open Source Software Is It Can'T Fix This Post"
13:13
>>> "THE PROBLEM WITH OPEN SOURCE SOFTWARE IS IT CAN'T FIX THIS POST".bait_title()
"You Wouldn’t Believe This Problem With Open Source Software!"
Pity that str.title is a pile of poo.
I didn't know that title didn't account for apostrophes.
I knew, but I'd forgotten.
@poke "When this programmer saw the problem with open source software, he couldn't believe his eyes!"
Also nice
user559633
13:18
@poke The -1 Problems With Open Source Software Maintainers Don't Want You To Find
I don't use str.title much. I use it in a script that cleans up MP3 / video file names: it converts or removes spaces and most punctuation marks, and finally uses title to make it look a little prettier. So I don't have to worry about title's inability to handle apostrophes (or hyphens).
"One weird Open Source Software trick discovered by a mom".
@PM2Ring I use Mp3tag for that
This Nebraska Mum is Baffling Open Source Developers With This Weird Old Trick
> why you should forget everything you learned about Open Source Software
> 10 ways Open Source Software can help you live to 100
> 8 deadly uses for Open Source Software
@poke I have easytag, and I use it for more complex stuff, but I wrote my script ages ago, and it does what I want. Mostly. :) I also occasionally use eyeD3, both from the command line & via Python if I want to do simple stuff involving tags.
13:26
> guns don't kill people -- Python kills people
> why you should give up sex and devote your life to Python
Because you're ugly and smart!
Have you ever used yield to synchronize between steps required in your code?
For example in here http://paste.ofcode.org/6tWrjAT5rZAxTPCLrwkeJH
I cant have foo use bar because that would be bad design in my case.
Yeah, I've used yield in a similar manner.
@GLaDOS I guess that's ok, but I'd probably prefer a more explicit control flow, rather than "hiding" the synchroniztion inside foo_func.
It may make more sense to use threading, or an external coroutines library
13:35
Yeah, I'll probably find myself changing the design later if I find something better
As of now this will do though. Just wanted to make sure I'm not doing something which is a big nono
@poke Speaking of editing code in answers, see this very recent Meta answer: meta.stackoverflow.com/a/316889/4014959
Doesn’t really help us though since removing the only code is not really a minor code change :P
Maybe editing in a comment into the code explaining that using __del__ is dangerous
Surely that can't be bad, it is indeed an improvement to the answer.
> Implying I had a choice.
^^"
@InbarRose Oh, whatever. I fixed it now. I couldn’t stand this anymore.
13:51
@InbarRose Sure. And editing to improve answers is encouraged. But such edits are supposed to be minor things, like cosmetic changes (improved formatting, changing variable name like list, etc) and fixing obvious typos. Major changes to the original author's intent should not be undertaken lightly, otherwise SO would degenerate into continual edit wars. So we're supposed to make suggestions in comments, downvote, and write alternative answers.
However, in this situation it's clear that the original author isn't going to change his answer, and it would take a huge meta effect to reverse the votes. So it looks like some kind of major edit is justified here.
@PM2Ring I’m not going to be bothered by the question whether this was the correct move now or not any more, until someone actually complains about my edit.
@poke Fair enough. The OP is still active. Let's see how quickly he responds...
14:12
morning everyone
I like how greetings are never consistent.
@corvid Good afternoon
My greeting is always the same
@GLaDOS Well, it's morning for me. Mind you, it's Wednesday morning here. :)
When working late into the night I'd usually say "It's probably work hours in China"
To be fair I'd sometimes say that without any special care for the current hour.
Hello everyone
Somebody using XML-ROC?
14:22
@Gangashman as per sopython.com/chatroom you do not need to ask if anyone knows X. If you have a question (about Python) then just ask.
I confuse about that. I try to use XML-ROC client: server = ServerProxy(url) and then server.someFunction() but I get {'error': 'Wrong xml'} all the time as result. May I do it wrong?
Travis should build no matter which branch you push to, right?
It would be helpful if someone else has already used XML-ROC told something about it.
Hi Team,
http://stackoverflow.com/questions/35365236/prospector-disable-model-missing-unicode-not-working

Pls check this issue and let me know your feedback ..
14:42
morning cbg all
anyone else experiencing a fun amount of snow this morning? I called it quits and set myself up to work from home today. Not outsiding today.
It actually rained so bad here that my work called and said "don't come in until ten"
Which I didn't even think was a thing that could happen.
I should probably get out of bed soon.
It's so cold here I had to spend 30 seconds defrosting the car windscreen. #neverforget
@idjaw That's not an option in my area.
14:46
OH yeah, it was disgusting outside this morning.
I just got back from shovelling the driveway to make way for all the freezing rain in a few hours
it's gonna be one heck of a day
It's all slush covered roads in my area.
I had an absolutely frigid weekend and now it's in the high 40s (F)
High 40s (C) would be impressive.
High 40s (K) would be impressiver.
I have lot of snow and rain at the same time. I prefer to be hungry than go to dinner...
14:55
May your afternoons be littered with cabbage
true story, I have stuffed cabbage in my fridge.
Was it just for this moment?
I can make it part of this moment. But then I wont have lunch at lunchtime. So I will fight the urge to eat it now.
I need a word to describe the fear of running something after you've coded for a while without running it and you know it's not going to work
something like Companoia
Life.
15:00
yolo

*ducks for cover*
will give ducks in exchange of cover?
If that's the case, what would you accept as cover? And what kind of ducks are on offer?
There is a scale
A d3 scale?
I use the scale to weigh your objects against a witch
if they weigh like a witch they are atleast worth one duck.
15:04
I like it. Witch-typing. "If it weighs like a witch, it's a witch."
I only have foul waterfowl
Sounds legit.
A more PETA-friendly alternative to duck punching.
How do you weigh an object? sys.sizeof?
yes
15:08
@MorganThrapp yeah, and to do it properly you must ignore container contents. Go mediaeval on your measurements!
Hey guys, good morning/afternoon/evening!
I was wondering how you would recommend validating that a string is a valid datetime string? Right now, I have a regex that checks that the string matches a certain format, but it's ugly. Is there a more pythonic way to do it?

The horror:
time_regex = "^({date})[:]{{1}}[0-9]{{2}}[:]{{1}}[0-9]{{2}}[.]{{1}}[0-9]{{6,9}}[+]00:00".format(date=some_date)
Try to parse it with datetime.strptime() and catch the exception.
Kevin'd by Martijn. (Aside: sounds like a perfume)
Otherwise you'll have a bear of a time validating leap years and such.
(e.g. is 2013-02-29 a valid date? Your regex won't tell)
Yea, that's what's happening, and some other small issues occurring with the regex that just make it spotty at best.
15:09
Kevin'd by Martijn - Smell like Magic (The Gathering cards)
4
True, good point.
@Ffisegydd I have yet to see the stars flood in.
datetime takes that into account?
datetime.strptime() will not accept an invalid date.
Okay, I'll play around with it. Thanks for the suggestion. Is it just me or is time, datetime, and the like really oddly handled in Python?
15:11
>>> from datetime import datetime
>>> datetime.strptime('2013-02-29', '%Y-%m-%d')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mjpieters/Development/Library/buildout.python/parts/opt/lib/python2.7/_strptime.py", line 447, in _strptime
    datetime_date(year, 1, 1).toordinal() + 1
ValueError: day is out of range for month
@HEADLESS_0NE define 'oddly' here?
This-API-smells-like-legacy oddly or "why does this accept a timezone but that doesn't" oddly?
I had a bad experience with datetime a while ago because of my locale
good times
The thing is, you don't understand why you cant parse stuff correctly until you try to print something using datetime on its own and realize a part of it is not in English.
@GLaDOS So, if it weighs like a witch, does that mean it's gotta float?
Exactly!
floods the market with small, light 3D printed balls
DUCK ME
Well, give me all the available water fowl you have in stock
15:27
*foul waterfowl
okay, this might be a strange question but... if you have a computer connected to a device via ethernet, is there any way to make that device publicly available to a server that is not connected to that device?
@MartijnPieters, both. Also, specifying tztime objects is ... bad. Unless I use pytz
@IntrepidBrit no need for fowl language
@GLaDOS What makes them foul?
@RobertGrant hangs head, and kicks dirt on the ground. idjaw started it
There should be an effort to improve the Python datetime module, it's like legacy code imported from C or something right?
15:32
@IntrepidBrit Tattletale!!!
A while back I was having troubles getting it to format dates in the locale setting, it's a nuisance!
@corvid should be possible by using the computer as an intermediary proxy... though I have no idea how to actually do it
(In fact, the records of that are here in the chat room logs for all to see)
cabbage, everyone!
@inspectorG4dget so you're saying, write something to the computer that is connected, which will write something to the device that the computer is attached to?
15:33
heya gadget!
@InbarRose something tells me we've encountered the same problem.
@IntrepidBrit water
that's why theyre waterfowl
they swim in fowl water
Weird evolutionary niche. That makes them rare, and thus more valuable. Amirite?
That's what they want you to think.
@HEADLESS_0NE timezones change to often to be shippable with Python core.
hence the reliance on external packages providing those; pytz can be released several times a year while Python proper has a far slower release cycle.
15:49
Wow do they change that often?
Didn't know that
@RobertGrant each country can arbitrarily decide to follow/no follow the "international" time zone schedule on their own whim. usually because of early/late winters/summers to change the DST (or not to change it)
Case in the point, it's part of the reason why the UK tax year starts in April
Once you realize that dates and time are purely a man made construct and have no actual natural implications except procession, then you understand how shakey, and arbitrary it is to even have such a concept as "international time". In fact, the only reason we have synchronized time around the globe is because it's easier to work that way, yet each country still has it's own quirks. Like China being only 1 time zone even though it technically covers 5 time zones.
The hubris that we can then take this arbitrary notion and codify it is even more ludicrous.
and north korea being in a different timezone than south korea
What if I just want to abolish daylight savings time?
@corvid yes
@idjaw heya!
out of curiosity: did anyone watchthe live stream of the opening of the TED conference about 15 hours ago?
@QuestionC yes please
I submitted this to HN. The comments it's generating are pretty terrible.
Read the whole article first, people!
@davidism I read that this morning, I thought it was really good.
Yeah, eevee is hit or miss when talking about the social stuff, but this one was pretty well thought out.
16:04
happy belated birthyesterday @davidism!
Thanks! :-)
@davidism I haven't been reading their blog for very long, only a couple months, but I've definitely enjoyed it. I think I actually found it through you.
user559633
happy bday davidism
i've noticed something
a lot of users don't answer pyqt/pyside questions
Wheee, spent half an hour trying to figure out what OP was talking about, spent another 15 minutes writing an answer, only to get "ah, yeah, i got you. thanks. i will try". (╯°□°)╯︵ ┻━┻
user559633
16:18
never mind, i can't be bothered to read this much about twitter and someone taking a joke too seriously
or should i say pyside/pyqt questions are not answered, nobody even drops a hint or comment
Time will be complicated until every city on Earth is ensconced in individual domes with individual artificial suns that all rise and set simultaneously.
@davidism I think the article is too broad. If someone reads an article making 3 orthogonal points, they're going to prioritize the one they disagree with.
Yeah, it doesn't set up the point of the article before just diving into part 1, which is only half related to part 2.
It probably could have made its point just as well by leaving out the first section.
16:41
At first he reads too deep into Fry's tweets and is wrong for that. That doesn't pull the rug out from under the rest of what he says, but that's not what the brain thinks.
I'm reading it now... I don't think the "lol sportsball handegg" joke is getting pushback because it's hurtful to jocks. I think it's getting pushback because after N years it's become hopelessly stale.
user559633
twitter/tumblr/increasingly more of the internet does seemingly consist of people just begging to take offense and classify it as a systematic discriminatory pattern using "feelings" as a surrogate for facts as evidence. the "social justice" trend is a cancer. by claiming discrimination, "abuse", harassment when someone disagrees with their crybaby bullshit, they're slowly chipping away at the weight of actual injustices.
Societal cancer tends to collapse in on itself for the same reason that whales don't have a cancer-related mortality rate proportional to their size. A tumor lacks internal structure, so it tends to devour itself before it can grow large enough to threaten its larger host organism.
Whale cancer metaphor courtesy of Living By The Sword, an article which is sort of pro-social-justice but also sort of not because the author doesn't want to associate with the most vocal jerks of that community
"Yes, but I came here for python!!"
"OH! Oh! I'm sorry! This is umbrage!"
user559633
16:56
@QuestionC twitter warning on that please -- having grounds for suspicion is a power dynamic and implies morality privilege
I see the whole "over-SJWing" thing being analogous to an auto-immune disease.
So I guess what I'm saying is, they have some toxic viewpoints but it's nothing to seriously worry about because they can't grow to engulf the Internet and retain their current standards at the same time.
Either they'll hover around the same population level they're at now, or they'll become more palatable to the mainstream as they adopt more moderate members.
Parroting jokes from a colonial empire is a microaggression.
What's moderate can move
00:00 - 17:0017:00 - 00:00

« first day (1949 days earlier)      last day (3223 days later) »