« first day (1038 days earlier)      last day (3926 days later) » 
00:00 - 14:0014:00 - 23:00

12:07 AM
@PeterVaro @ZeroPiraeus if the decorator function is a method (using the funky method in Funky as an example), how do you apply it to a method of another class?
 
There's really no reason to do that ... a decorator is a regular function by definition; it takes an argument (the function to be decorated) and returns a value (the decorated function).
I suppose you could use a staticmethod, but they're kinda pointless anyway.
 
so, if you have to do that, you are definitely doing something wrong?
 
Why do you think you have to do it?
 
let's assume I have an Authentication class
 
You know that this:
@deco
def func(): pass # or whatever
 
12:13 AM
and it contains a method to check if someone is logged in, amongst other things
 
... is the same as this:
def func(): pass # or whatever
func = deco(func)
... right?
The @ is just syntactic sugar.
 
no...it won't work like that in a class
let me revise that code and paste it again
 
Two problems:
1. You're attempting to call Funky.funky before you've defined it - swap the order of the classes to fix that.
 
will do... second problem?
 
2. You forgot to explicitly pass self again.
@staticmethod
def funky(func):
    def fun(self, x, y, z):
        x = x ** 2
        y = y ** 2
        z = z ** 2
        return func(self, x, y, z)
    return fun;
This is the fixed version - return func(self, x, y, z) is the line I fixed.
 
12:26 AM
okay.....will fix; check the Funk class; the decorator in the method is what I'm mainly asking about
 
But honestly, putting the decorator inside a class like that is pointless. If you want to keep decorators in a namespace, put them in a module.
With the changes I mentioned your code runs fine ... it's just not very pythonic.
 
wow...it actually runs;
I guess I was initially using instance methods
 
By the way, since the only thing you're using Funky for is a namespace, you don't need that __init__ method ... it's never getting initialized.
 
alright....you mentioned that it wasn't pythonic the way I used the decorator, can you explain why?
 
The Funky class is just a namespace at the moment - i.e. you're just using it as a box to store functions in (a staticmethod really is just a function; that's why you don't need self or cls arguments).
That's just not the way Python programmers do things. The right way to make a namespace (a box to keep functions in) is to put them in a module.
 
12:34 AM
that's just an example....the actual class I'm using the decorator for will contain more related information
 
It's still not the way this sort of thing is done. Just put the decorator at the top level, outside any classes.
People will think you're a Java programmer otherwise ;-)
 
okay.....let me see if I can make a distinction between the usage of modules and classes in Python
modules: related functions with nothing in common
classes: related functions and properties..... (obviously with something in common)
 
Sort of. A module contains (usually conceptually related in some way) classes, functions and constants - and occasionally some initialization code. A class describes a thing, and its methods are ways it can behave or be interacted with.
Okay, gotta go eat. Back in a bit ...
 
alright.....thanks very much. :) rhubarb
 
 
1 hour later…
1:45 AM
classes describe a class of objects (like a Chair, a Payment, a Human), with common set off attributes for the said class (properties) (number of legs, amount transferred, eye color) and operations (methods) - (throw the chair, complete the payment, list the characteristics of the said human). The instances of a class are called instances of the class ;)
 
 
2 hours later…
3:25 AM
0
Q: Python : will paramiko wait for the first command to finish executing before sending the next command to ssh?

Python 2 Serverif i were to run a script like this... import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('119.********', username='root', password='*********') stdin, stdout, stderr = ssh.exec_command("yum install httpd -y") stdin, stdout, stderr =...

troll alert
 
 
3 hours later…
6:16 AM
hahhah seriously this guy is funny
 
7:14 AM
cbg
That's Python Newbies.
He quickly deleted his question when he saw I edited it though, I think we are having an effect removing his soapbox^Wtags.
 
Of course, those tags
 
cabbage!
havent been here in a while!
 
Should I bump my meta post?
 
@Volatility: Which one?
 
Obviously the one about the troll
 
7:22 AM
I had to look it up.
No, no need.
We can coordinate here just fine.
I think I found his achilles heel though.
 
That's a start.
 
In the last 3 attempts I replaced his tags with something obsure, say, < 10 questions.
no followers for the tag.
and he self deleted the last 2.
he was still nuked, of course.
I flagged the deleted post for good measure.
 
7:43 AM
:D
I actually went through the trouble of answering 1 of his least stupid questions and then found out it was the 4rd he had asked within an hour
 
Arg. It's that troll again
 
Voted to delete the post now.
 
Wish I could :(
 
But he did get a (normal) response, plus a comment. He's not responding to these because the soapbox is gone; he tried to revert my tag edits though.
 
7:57 AM
It's so pointless only being able to vote to delete after two days
 
That question has enough downvotes and is closed, you can vote on it now.
 
I don't see any option to
"You must wait for a question to be closed for 2 days before you can vote for deletion. This restriction is removed for trusted users. If you feel a post should be deleted despite having lots of votes or for being new, please flag it for community moderator attention."
I'm not a trusted user
Is this technically breaking any policy?
 
Nope, it is an attempt at an answer.
 
True
 
ah srsly his previous user was nuked too?
 
8:10 AM
His previous 100+ users were nuked.
This troll has been at it for over a year now.
 
:D:D good to know
 
Cabbageeeeee
 
I just recently started being active again on SO, haven't seen the guy before
 
@AnttiHaapala: He uses a broad spectrum of tags to get attention. I now replace those tags with something obscure.
 
8:19 AM
done
as someone said on the troll thread, no attention to him :D
 
jamylak
Which I have not seen in ages. Where is he?!
 
Wanna earn a spam flag?
-4
Q: Could somebody name some places worthy of being visited?

user35343ChinaTour com is a reliable China travel agency based in USA, which has specialized in inbound China travel for decades. We provide spectrum of private China tours, China group tours, customized China tours, China hotel booking and China-USA air ticket booking service for individuals, groups, fam...

on meta, of course, so even worth more as helpful flag counts go a bit slower there.
 
cbg
just had dinner
 
morning
 
wow, didn't noticed I'd asked 5 questions of meta already
As for jamylak, his rep page doesn't show much activity
Hasn't gotten much rep in a day since Jun 21
Gotten most of his rep from random upvotes, apparently
Too bad I don't get that treatment :(
 
8:35 AM
Answer more questions..
 
Last answer was Jun 27
 
The more answers you have, the more chance for random upvotes! :-P
 
(jamylak, that is)
 
Yes, so, he's on holiday perhaps?
 
Last seen Jul 30
probably
My last answer was Jul 21
 
8:37 AM
My last answer was less than an hour ao
ago*
 
I've lost the motivation to answer
 
my answering motivation fluctuates
 
Right, you want to have you cake and eat it. :-P
Aaand the troll adjusted his name to his true nature.
heh, his last accept gave him +2 points.
Needs more downvotes.
Ah, already done.
 
Just gave him 2
I like his use of "explode"
Not sure what to close this new troll attempt as
Apparently no-one is voting to close, so cleaned up the post
Let's see the troll's reaction
 
8:54 AM
Terminal is a name he's used before.
 
Yeah, I know
 
Hi @glglgl
Sorry, but "Terminal" is one of a list of usual names.
First post or two: almost reasonable.
Slightly dumb question, but too many tags.
often including WSGI and PHP.
then, total derailment towards Iraq and conspiracy.
best tactic so far: removing the tags.
 
to obscured-view
 
Quite appropriate
 
or anything else with no followers and low question count.
You have to be careful that we don't pollute legitimate tags too much.
I have to run; train to catch.
 
9:02 AM
Perhaps create a new tag called ?
 
ok, wasn't aware of this till now...
 
why are these people trolling
theyre like real questions but not
 
It's probably only one person
 
in the beginning there were almost sane questions...
 
Oh, you should've seen what he was like before
 
9:04 AM
Python Server 2 and Python to Server and something like that, 6 questions that started feeling stranger and stranger...
then the question was how to concatenate 2 variables bc print a + " : " + b
does not work
 
He was like "I am an allah akbar club member and I will troll you to death!"
 
yeah whats with the ALLAH AKBAR
 
Means "God is the greatest" in Arabic (according to wikipedia)
 
i know what it is but whyyy
 
9:07 AM
He's a troll. What do you expect?
 
hahha true
 
cant see
 
http://stackoverflow.com/questions/18310095/ruby-array-starting-at-1
 
And the review history for this
Lol, @ChristianCareaga you answered that question
 
@Volatility hahahhahaha oh my gosh
atleast i got 10 rep
whats mod-wsgi and allah akbar and UGH IM SO CONFUSED
 
9:16 AM
wsgi akbar!
 
Apparently he's sifting through the transcript
Oh, and look, he rolled back my tag edit
 
im so confused
 
Yes, the transcript is public.
I knew that; no point in trying to hide that.
Just vote to close, vote down, and flag for moderator attention.
@ChristianCareaga: That is a known troll.
Just don't engage. Don't respond to him, that's what he is posting for.
 
But the tag edits?
 
yeah but whats the mod-wsgi and akbar and str concatenation and such
 
9:27 AM
It was already listed in the python page, for a short while.
@ChristianCareaga: It is trying to troll you.
It doesn't matter what he posts; it'll be nonsense foaming at the mouth within minutes.
 
How did 5 downvotes just get suddenly removed from that question?
 
cbg
 
Because people flagged it as spam or offensive perhaps?
Those carry automatic downvotes, but it may be the flags are cleared when the question is closed.
I also note that it was ChrisF, moderator, that cast the final close vote.
 
Hmm, the two questions of mine that were downvoted only 2 days ago have both been upvoted
Ooh, got a bronze badge for first retag!
 
9:40 AM
:-D
Positive result!
 
Is it possible to get all tkinter widget attributes in a list?
Or a dict?
 
He seems to have adapted to the tag changes
 
and closed
 
9:44 AM
hahhaa martijn
 
damnit wrong tags
 
If you guys, think this is useful, I'll post it as a question, but honestly, I just need a hint.

I have to arrays. The first one tells me what to delete from the second.

deleter = [0,1,1,0]
victim = ["a","b","c","d"]
result = ["a","b"]

Has someone asked this question before?
 
9:48 AM
Holy moly.
As if that exists...
Thanks Volatility.
 
No worries
Except you need to invert the deleter first
 
We are having an effect; he's started bragging about rolling back the edits.
Little does he know that only brings in the moderators faster.
 
Except now that he's seen the message in the transcript...
 
shrugs.
I don't care about that.
All I care about is neutralizing the troll quickly and efficiently.
the less attention from regular users, and the more from moderators, the better.
If he starts spewing nonsense earlier, the better he's recognized and nuked.
The accounts will be removed and cleared up. It's the rest of the community we are protecting here.
Those that answer, get upvotes and get accepts have wasted their time as the reputation will be gone again once the account is nuked.
@limelights I don't mind the occasional non-python VTC request, but keep it to those that really would not get attention otherwise, those that use obscure tags only.
Ruby has it's own community to garden their patch, doesn't it?
I'd like to keep the channel a little bit more on topic than that, and Ruby VTCs are not something most of us can really judge on.
 
10:10 AM
cabbage!
 
10:34 AM
not too much... he's only searching a versioned document database..
 
Yes, and that's a external resource recommendation at best.
He's really looking for a complete architecture however.
 
oh right. i've just re-read it and he talks about forking etc...
 
@PeterVaro: That question asker is confused between the source literal and the value.
@PeterVaro: Just because you can define a number using binary notation doesn't mean it is stored in that same notation.
 
@MartijnPieters yeah, I noticed;)
I updated my answer, I tried to explain that
@Martijn we won -- he got it now;)
 
10:49 AM
@MartijnPieters yeah, sorry
 
hey @David.Zheng 'sup?
 
11:12 AM
sigh.
And now we have 5 different ways of spelling "don't do that, use a dictionary instead"
@Haidro: Did your answer really add so much more over the two already posted?
 
I didn't actually see alecxe's answer until I posted mine
 
for i in data: exec i ;)
 
@MartijnPieters If you want me to delete it then I will :)
 
Just wondering why you felt a third answer was needed.
I am actually looking for dupe targets here now.
This has been asked so many times, I should have looked for dupes in the first place.
 
11:18 AM
Be back soon
 
I shall now depart. My friends, rhubarb.
 
Night, @Volatility
 
@Volatility rbrb!
Yea, I'm going to sleep now too
@MartijnPieters Catch ya later
 
Night@Haidro
 
@MartijnPieters if you read the OP's question, that is exactly what he was looking for!
 
11:25 AM
I read the question.
 
sure you do -- this is just a phrase;)
 
The 13.5 being split is not what the OP wants; it is never touched upon explicitly, but reading between the lines...
The OP wants to split mathematical operators from numbers.
 
umm... he copied this line:
"this is what I want":
 
and I read 13.5 as a number, not 13, the . operator, then 5.
 
['x', '+', '13', '.', '5', '*', '10', 'x', '-', '4', 'e', '1']
                  ^
          separated dot
 
11:27 AM
I know, but I am saying the OP missed that part.
 
all righty then;)
 
Parsing expressions is not a task for regular expressions, really. At least, not just regular expressions.
I am more and more inclined to just VTC as the related post I linked to.
The answer is to use a proper, dedicated parser.
shlex is a proper parser, but for the wrong token structure.
 
@MartijnPieters I fixed it anyway..
if this is really a 'fix'
 
13.5.5 is invalid, but would be parsed by your version. The OP never mentioned validation, so you should be good there still..
 
I've put that comment into my answer ^
 
11:35 AM
Upvoted; but it won't be enough. Not if the OP is then going to try and include more numeric formats..
 
I completely understand you -- and you are right -- this is like parsing a language, which needs a lexer, not just some simple regexes..
but we'll see, what the OP is answering.. oh thanks for the up.
 
 
1 hour later…
12:47 PM
Hullo there @Jon
 
Howdy @Martijn - how's things?
 
Fine, bit busy.
We'll be off to the Edinburgh festival later this week.
 
Always a great one - not a festival goer myself, but only ever heard good things from my mates that go ;)
 
An amusing comment on Hacker News:
> A conversation I had the other week:
> Him: Do you know how to check if it's possible to write a regular expression for this?
> Me: Either create an automata and then it's demonstrably possible, or apply the pumping lemma to prove it's impossible?
> Him: No. Dare Stackoverflow to write it.
 
Umm... I like the worship in "the answer if you're using perl or pcre, is probably yes, but for the love of djikstra don't ever do it"
 
12:58 PM
I feel that a lot of users view regexes as brain teasers, so they're more likely to post solutions to "gimmie the codes" questions, if the solution is a regex.
 
@Kevin to be fair - anything that approaches non-simple for a regex, does require quite a lot of knowledge about regex's to be able to realise how to approach the problem....
 
That's why I usually answer such questions with a non regex alternative :-)
I prefer a 3-10 line solution over a one line regex, provided the former is more comprehensible.
 
Question... say you were gonna have a dictionary of lists. Each key was a month+year, eg, this month is 082013. I want to make a method that deletes all keys past a specified month. They put in 062013 and only get a dictionary with keys up to 062013. Also it's an ordereddict so that might help. How would you manage to do that?
 
1:15 PM
hi @user2337094
 
heya @JonClements! 'sup?
 
Nothing at the moment... just in one of those "fed up - can't be bothered moods"
 
@Crowz, YYYYMM is preferable over MMYYYY, since ordinary string comparison will work for determining the ordering of dates. Example:
dates = ["198801","200112","201305","201307","201501","999909"]
target =  "201306"
for date in dates:
    if date > target:
        print date,
Result: 201307 201501 999909
 
@Kevin doesn't look year 10k compatible... ;)
Look at all that happened for Y2K ;)
(wouldn't want to repeat that again, would we!?)
@PeterVaro how's yourself?
 
For anything more complicated, you should probably be using datetime.date instead of strings.
 
1:21 PM
what do you think @JonClements is this 'bounty' thing works?
I mean, is that motivates the people more, to answer my question?
22 hours and 63 visits but nothing..
 
@PeterVaro sometimes... depends how interesting your question, and if it is interesting, if it's just it takes too much to answer, then how much rep would entice someone to bother writing an answer....
Wow.... that has to be the worse sentence I've ever written here... just reading that back makes me cringe
 
umm.. I think it is an interesting problem;)
 
@JonClements, I'll say the same thing that programmers said in 1950. By the time that could be a problem, I'll be dead or at least retired.
 
it's an honour that you wrote the worst sentence to ME @JonClements:D:D:D
 
@PeterVaro :P
@PeterVaro you've missed "Python" off your CV btw ;)
 
1:27 PM
oh on my webpage?
well, I did not update that since.. I don't know.. 2 years?
or 1.5?
 
Are you asking me? :)
 
and well, JavaScript is a lie there
I never knew any JS except some hover-actions and onclick-actions;)
 
Think that's enough for professional developer standard ;)
 
hehehe
sadly I did not updated my portfolio..
 
@MartijnPieters Um..... apparently they're not that fussy about a Careers 2.0 profile
@MartijnPieters unless for some reason PythonCabbage with its 40 rep or whatever, has somehow shown its worthiness of an invite...
Ummm. "In recognition of your contributions to Stack Overflow, we’d like to invite you to create a professional profile on Stack Overflow Careers 2.0."
 
1:33 PM
@JonClements did I show you this? (it is a really-really old portfolio of mine from the end of 2009)
 
@PeterVaro You hadn't. Interesting stuff ;)
 
yeah, well, I did so much better things than that in the last 3-4 years.. I really have to collect it together..
 
I like you guys
 
hi! this is my first day in this chat
 
Welcome
 
1:41 PM
heya @user2337094
what's up?
 
fine, you?
 
I'm OK as usual, thx;)
 
I shouldn't be here now, I'm writing c! but I choose this for first chat..
 
writing C?
 
Must be our tremendous natural charisma :-)
 
1:45 PM
No @Kevin, this is the power of Cabbage...
 
yes, I'm a student and I have to write C code now..
 
Oh i C:)
 
CPython is written in C, so by the transitive property, all Python experts must also be C experts.
 
that's right
 
And, taking the argument further, also experts in assembly, CPU design, electrical engineering, and quantum physics.
 
1:49 PM
@Kevin that smiley was in no way cheeky enough?
 
wow
 
I prefer :-D for maximum cheekiness
 
The truth is - everyone loves a cute puppy... and they follow me here ;)
 
Sounds reasonable to me.
 
probably a stupid question but I changed something in my bash shell and when I echo the variable it's unchanged. I tried to restart the terminal and that didn't work
 
1:54 PM
you probably forgot export
and obviously the variable change is lost in any case after exiting the shell
 
I did export someVariable=/path/to/something in the .bash_profile
 
profile is executed only on login usually
 
cbg @AnttiHaapala
 
00:00 - 14:0014:00 - 23:00

« first day (1038 days earlier)      last day (3926 days later) »