« first day (2170 days earlier)      last day (2779 days later) » 

11:01 AM
cabbage
 
cbg - how goes it?
 
cbg Jon, Going on well, Ty. Howyadoin?
 
same old, same old...
 
cbg all
 
Watched ARQ on netflix yesterday night - was reasonably impressed.... spent most of it going: "I know I've seen her in something before" - then realised she was in Jessica Jones...
@shuttle87 hey... just seen you answer - was wondering when you'd turn up :)
 
11:04 AM
@shuttle87 cbg \o
 
Ha glad you were waiting for me! Because I'm slightly perplexed about why python parses something the way it does.
 
It's been more than 3 months since I wrote a python answer :/
 
>>> def test():
...     return 0 <= 0 is True
...
>>> test()
False
But then there's no way of adding parens and getting the same result:
 
is True/False singleton?
 
>>> def test3():
...     return (0 <= 0) is True
...
>>> test3()
True
>>> def test4():
...     return 0 <= (0 is True)
...
>>> test4()
True
 
11:06 AM
so operator chaining?
right, this came up before:)
 
@shuttle87 typical operator precedence...
 
>>> 0 <= 0 and 0 is True
False
 
0<=0 is True ==== 0<=0 and 0 is True #???
 
Yes, IIRC
 
ohhh chained comparisons
 
11:08 AM
They're keywords in Python 3.x... in 2.x - it's safer to consider them a singleton sublcassed from int
 
I completely forgot about those
@AndrasDeak Yes believe so
 
So in both - you can have some fun with (False + 1) is True :p
 
Kevin did something like that which I had starred. But there are almost 25 pages that I have starred (Kevin's messages only). So can't search that :(
 
@shuttle87 I believe the moral is always that you should usually not test booleans like that, unless you want to know more than truthiness
 
Because I never do it that way I forgot about the chaining
 
11:12 AM
I mean you should not test them against True/False at all:P
 
Right, I don't
The code I posted up was just to explore something I wasn't understanding with the parser.
 
We should add chaining of boolean operators here stackoverflow.com/documentation/python/3553/common-pitfalls
 
@BhargavRao Good idea
 
@BhargavRao and to specify that they're not boolean operators per se:P
 
Hah, Yeah
 
11:53 AM
I would but that would require looking at SOD again and I don't want my eyes to bleed
 
WHAAAAT I thought BR linked to the sopy pitfalls
BOOO @Bhargav what are you doing? :P
 
Lol, Yeah. I mislinked :P
 
Hi everyone :) . I'm a python beginner.
 
.....now I wonder if any of that is copied and will have to look for more plagiarism
 
Hi, @GreenNoob, Or as we say here, Cabbage!
 
11:56 AM
^ saw that and wondered why you were calling me a noob for a second :)
 
lol:D
 
I'm trying to learn OOP using python. Can you guys help?
 
Probably not?:P
but I'm off anyway, the nice people will remain
 
user6568562
@GreenNoob You can start by reading this [ : sopython.com/chatroom
 
user6568562
@AndrasDeak Laters [ :
 
11:57 AM
see ya Andras
 
"You do not need to ask if it’s okay to ask a question.
You may ask your question without a preamble."
Noted.
Here's some code that I've written:
class scheme(object):

def __init__(self,n,amount,increment):
self.encashed = 0
self.n = n
self.amount=amount
self.increment = increment

self.installment = self.amount/self.n+self.increment*self.encashed

def apple(self):
print "Some random text."

thing = scheme(n=3,amount=1000,increment=10)
thing.apple()
print thing.installment

thing.encashed =1
print thing.installment
 
Rbrb Andras
@GreenNoob Use 4 spaces to format your code, Or better, put it in a pastebin and give us the link
 
Here's the link: pastebin.com/1SFbeaZw
The output that I intend to get from the last line print thing.installment is 1000/3+10*1 = 343
The output that I get is 333
 
self.encashed = 0
wait, it's 333 both times?
 
12:07 PM
Yes. I expected 333 first and 343 the second time.
 
Who's that who's using python2? Rolls Eyes
 
change it to 1.0 (both values from 1)
this will force float in Python 2
 
nono it's not that
you need to recalculate the installment
 
or import future division
 
it's only being calculated once during __init__
changing encashed after you've already calculated and stored installment won't retroactively redo that calc for you
@JGreenwell it's not a float-div problem
def installment(self):
    return self.amount / self.n + self.increment * self.encashed
 
12:09 PM
yeah, I just glanced and saw the "I want 343 not 2 interation" so @tzaman is correct
 
@tzaman Thanks. I assumed that it was retroactive.
 
think about why you thought that, then :D
 
morning cbg
 
because there's no reason for it to be
and you may have some bugs in your mental model :)
cbg @idjaw!
 
o/
 
12:11 PM
did I mention teaching children is like 8* the work of teaching college "kids" - my mental model is fried today
 
@tzaman As a follow up, I think I know what functions are but what is a property in a class definition?
 
you can put @property before a function definition
which lets you access it as an attribute (like thing.installment instead of thing.installment()) even though it's a function
it's mostly there so you can seamlessly turn something that used to be a static property into a method without having to change all the places where you're using it
 
here is a nice long answer that explains how to use property and what's going on
 
got some cv, delv-pls above^
 
past my scrollback buffer, Antti, can you link?
 
12:15 PM
same
 
4 hours ago, by Antti Haapala
http://stackoverflow.com/questions/39335619/python-if-else-does-not-run-within-f‌​or-loop#
starting from this
 
Cabbage @idjaw
 
cabbage @BhargavRao
@AnttiHaapala done. did what I could
 
okie :D
 
Damn, The internet always sucks while I'm traveling :/
 
cleanup complete!
 
I wish I had the ability to fire people
 
the delvs are all gone, I think. a couple of the cvs still need more votes
 
this shit is crazy. I have spent 3 days on cleaning up somebody else's code
 
\o/
 
12:23 PM
Thanks everyone. @property and the function definition fixed my code.
@BhargavRao What's wrong with Python 2?
 
3 is better
 
@GreenNoob It was deprecated (in this room) once @AnttiHaapala arrived :P
 
^^ yeah that's about right
 
@BhargavRao most stuff are deprecated by Antti
tornado and Linux survive
 
Python released Python3 out of fear of Antti
 
12:26 PM
depreciated or deprecated? :P
or both?
:P
 
nah the latter sounds better
 
more seriously division is float based by default, unicode is handled automagically (for the most part), print works better as a function, and there are a bunch of improvements to methods like intertools and expanding arguements which give some nice options @GreenNoob
 
Isn't unicode handled in Ver 2?
 
will pypy ever go mainstream?
> Automagically
 
12:29 PM
it is unfortunately still required to be used on occasion (like I know Kivy just added support for Python 3 so it is still occasionally required to us 2.x)
we hate these occasions and once you use 3 you will too
 
I have never used python 2
 
brag some more why don't ya? ;)
 
I use Jython
 
Semirelated: python3statement.github.io Most of us use 2.x because we work on old codebases that was wrote in Py2. But writing new code and targeting 2.x is not a very good idea, especially since 2.x will be deprecated in 2020.
 
@JonClements Hi
 
12:31 PM
What's the easiest way for a beginner to create a GUI in Python?
 
GUIs suck
 
@Sami Cabbage
 
@GreenNoob cbg :)
 
@GreenNoob Maybe TkInter
although it heavily depends on what you are doing.
 
I'm trying to implement a simple database application. @shuttle87
 
12:35 PM
the easiest way? There is none, GUIs are hard and are as much a secondary form of development as web development is
 
I don't understand what you mean sir @JonClements
 
0
Q: Recommendations for Python GUI application

stan1220What are your recommendations for GUI libraries for Python. My own research has me looking at TKinter, but I am open to suggestions. FYI, the Python application will serve as a kind of bridge between 2 applications. It will use the third party API to extract data, then move and rename the data...

 
or make a web application instead so you can throw javascript under tool belt as well
 
@Sami I have no idea what you're talking about?
 
but in the end, as a wise Tristan would say: do what you want, I'm not your real dad
 
12:37 PM
3 hours ago, by Jon Clements
@Sami well... you can think of a module as a dict with its variable names as keys...
 
@Sami oh... sorry... I pinged the wrong person - my bad - ignore me :p
 
@JonClements nvrm sir :)
 
@GreenNoob well you have a few options depending on what "simple" means in this context. Sometimes the easiest approach is to use a web server and just serve webpages for your UI. Sometimes I do that. Other times I have used TkInter.
 
@JonClements Pup were you hungry at the time? If you're confused like that next time, eat a scooby snack :P
 
@idjaw any in the cupboards?
 
12:39 PM
Just re-stocked. I'm leaving soon, so help yourself
 
Well beye all . @JonClements take care ;).
 
@Sami sorry to have disturbed you - bye for now
@idjaw ninja'ing in to your cupboards is no fun if invited :(
 
oh...a nice mocking bounty question, but Martijn got to it a while ago....upvote and move on :P
@JonClements hmm...OK..I un-invite you!
 
yay! Next time get the ones with choccie-chips though - k thx bye...
 
much later than I thought
gotta run for now.....rbrb
 
12:48 PM
Rhubarb \o
I think it's time for SE to add a unilateral "Close as typo" for OPs on their own posts.
7
Just like self-dupe hammer
 
@BhargavRao yeah I needed it a few times
> the JavaScript eco-system is insanely awesome.
-_-
 
bwahah! That's a great joke ^
 
dunno if I should start arguing in facebook
I would agree with every JS defense except the ecosystem. It is literally cancer
 
> Don't argue with stupid people, They'll drag you to their level and beat you with their experience
3
 
12:56 PM
I assumed the joke was the insanely part as only an insane person would find it awesome
 
nah he is serious and he is not stupid(I think)
I dunno what's going on. Maybe trolling
 
1:13 PM
@GreenNoob Tkinter is a popular GUI framework for Python. It's not fantastic, but because it is fairly small compared to full-featured frameworks like GTK or Qt it won't take a long time to learn how to use it. Tkinter is commonly bundled with Python distributions, so most people with Python installed will be able to run Python Tkinter programs without having to install anything else.
And if you do later decide that you want to learn a bigger framework your experience with event-driven programming in Tkinter will be valuable. However, at this stage I strongly recommend that you master the core of the Python language (and the main standard library modules that ship with it) before you start learning to do GUI stuff.
All GUI framework docs assume that the reader is competent in core Python, so you will have problems understanding those docs & using the framework properly if that's not the case.
 
^^^ great advice there.
 
user559633
> Don't argue with lizard people. They'll drag you underwater and beat you with their tridents.
 
Mark Twain (or whoever said that original quote) would be proud of you.
 
1:30 PM
I just answered a "translate this pseudocode" question. We kept pestering the OP to explain what he didn't understand about the pseudocode, but he couldn't give a specific answer. In the end, I decided to put him out of his misery. :) stackoverflow.com/questions/39675412/…
I agree that OEIS can be a bit dense & cryptic, especially if you aren't familiar with it, but I didn't think that particular chunk of pseudocode was that bad. The only potentially confusing thing I noticed was the use of ^ instead of ** for exponentiation.
 
9
Q: Origin of "do not argue with idiots"

annawieWhat is the origin of the phrase “do not argue with idiots”? Please cite some credible references. From googling around, I found these three variations. One came from the Bible but I couldn’t find any credible source for the other two. Don’t argue with idiots because they will drag you do...

Twain did one version but not the one you used
 
message.replace("Mark Twain","Greg King")
 
@idjaw I thought there was a difference but ppl say they both mean the same :(
 
@AnttiHaapala The meanings are similar, but there is certainly a difference.
 
2:01 PM
Rhubarb
 
2:47 PM
@PM2Ring yeah, there is a difference, for example the word that logically would be "self-depreciating" if derived as in Finnish language, is now written "self-deprecating" and the other is considered a typo :D
 
user6568562
3:04 PM
@tristan I laughed so hard at the title after knowing what those three things are. Would've been so touching had MS' history been otherwise
 
3:41 PM
 
4:08 PM
@vaultah haha, the user put their question in the "job" field of their profile
 
hmm...oh, hey. I got my 1k back :)
 
pineapple
 
user6568562
Congrats JG [ :
 
next target: Python Bronze (or Marshal if people keep asking bad questions)
 
4:27 PM
Woohoo, filebeats sending stuff from BobCorp product logs to logstash!
Turns out you can as good a log line parsing setup as you like, if you accidentally point it at the logs of the wrong (and disabled) server instance, you don't see any results
 
user559633
what kind of log are you processing?
 
Just the main log file for a java webapp server
 
user559633
Ah, cool.
 
Why?
 
user559633
I'm using logstash for a lot of my current stuff and was going to ask for your confs so I could steal from them
 
4:37 PM
afternoon salutations
 
user559633
cbg
 
what's the good word
 
user559633
sucking at counterstrike: go
 
nice
 
So. I have my python server build (mostly) but theres an issue. the i format character is only packing 3 bytes.
when this
ack = pack('!bbbi', 7, incoming_data[1], errorCode, result)
gets sent across the network, it pops out on the other side as 710180000 (there should be two more 0s at the end)
also I'm using python 2 because reasons
I'm sending with s.sendto(ack, addr)
 
4:54 PM
@tristan ah sorry :-)
Trying elkstack to see if it'll fit as a general-purpose central logging tool for our stuff
So far no reason why not
 
user559633
@RobertGrant yeah, basically. i'm doing syslog + logstash. i think logstash is the weakest part of that stack, but elasticsearch is very piggy
 
Ah okay yeah
Why do you think logstash is weaker?
 
user559633
Well, it might be better now that it's go, but a crappy filter will bring the whole system down
 
(I think you can send filebeats straight to elasticsearch?)
Ah okay yeah
 
user559633
one that's either poorly written or misconfigured means it all stops working
 
4:56 PM
And yeah I noticed it was go; very cool.
 
user559633
yeah, i'm going to look into beat -- should be better now that it's go
 
I like the component boundaries in elkstack; they seem right
 
user559633
I haven't played with that
 
I'm not following what you mean by component boundaries?
 
As in this component does this stuff; this one does this stuff
 
5:02 PM
should pack('i' 3) not store 3 within 4 bytes?
 
user559633
@RobertGrant Ah, got it. Yeah, the separation is at least decent in ELK
 
@RobertGrant ah gotcha.
logstash really helps collecting much needed logs when system tests go bonkers in jenkins
 
The right direction is to convert PHP to Python. I KID OF COURSE! — Robert Grant 10 secs ago
I couldn't resist
 
you were good until you said you were kidding
 
Yeah I just wanted to soften it before it got flagged :)
Bah, I missed that
 
5:08 PM
You have to catch my regret sooner
or just bribe someone in making you a RO :P
 
I ain't got the means, playa
 
that's true, you just got a house.
OK. I'll spot you on this one.
Tristan, name the price.
 
It seems the price is a yawning chasm of silence
Even I can supply that!
 
jeeeeez. You try to throw away free money and people just go silent
 
5:28 PM
well this is certainly less productive than yesterday was
OMG WTF IS THIS???
>>> calcsize('i')
4
>>> calcsize('b')
1
>>> calcsize('bbb')
3
>>> calcsize('bbbi')
8
WHYYYYYYYY
3 + 4 = 8 :'(
 
@ZachThompson There's this funny thing called alignment.
 
@ZachThompson
> The ordering of format characters may have an impact on size since the padding needed to satisfy alignment requirements is different:
per the documentation
search for that line I quoted here
 
yeah
 
Bah, Idjaw'd
 
5:42 PM
It's now double true!
 
Hmm, There's no good visualizer for struct.
@JGreenwell Haha, You can get 27 flags in 5 mins. :D
Congrats on 1k :)
 
9 more to go!
:P
 
user6568562
Oh it's a lego man van gogh in your picture, idjaw : D Now I double love it
 
\o/
 
user6568562
Man, why people frown upon stalking, sometimes it's great !
 
5:46 PM
I kno right?
btw...nice pants @randomhopeful
 
user6568562
Hahahaha, well thank you :D
 
@idjaw n more to go :P Where n is the rep that you aim to divided by 1000
 
fun with math!
I really should find another tag to help out with this bump to 10K
 
@idjaw Free to CV a few posts?
 
well sending it in 'ibbb' works if I change the struct on the c client end
except it's supposed to be a certain byte order.
 
5:49 PM
@BhargavRao sure. kids are still asleep. Let's see how many I can nuke
 
(Total Message Length (1B), Request Number (1B), Error Code (1B), Result (4B)
 
@idjaw I've sent you an invite to SOCVFinder room. Check in your invites :) (or click here)
 
@ZachThompson it's been a reaaaaally long time since I did any of this, but based on very rough reading, I think you need to play with order here, so (and someone please correct me if I'm wrong), but I think you have to indicate your order explicitly here
>>> calcsize('>bbbi')
7
which is indicating big-endian
 
yeah I was actually doing '!bbbi'
actually when I do that calcsize it came out as 7 wtf
except it still comes through incorrectly on the other end
 

« first day (2170 days earlier)      last day (2779 days later) »