« first day (1632 days earlier)      last day (3328 days later) » 

12:34 AM
cbg
no one
 
Kimchi, mate
 
 
4 hours later…
5:01 AM
hiya
 
5:22 AM
cbg
 
c-b-gg
 
6:02 AM
@RobertGrant hmmh
@RobertGrant colanderalchemy is not the best tool really
 
6:20 AM
Cbg
 
6:57 AM
c-b-g
 
@AnttiHaapala int.bit_length was introduced in 2.7...
 
rly
:P
 
7:58 AM
Cabbage boys
 
cbg
@AnttiHaapala The answer to that!!!
 
@BhargavRao you never cv anytihng :D
 
> That became clear the instant someone turned on syntax highlighting by pasting it in a code block.
 
8:03 AM
cved it now
 
cv and do not edit
you will get the copy editor anyhow :D
 
I've already got
:D
 
no need to remove thanks from posts that will be removed in 2 days :D
 
I have edited 1680 posts
:P
 
8:06 AM
The deleted posts on that are too good!
> Make love, not WAR.
Daf?
 
that is not deleteable post
but it is like yet another endless thread on "do this do that"
0
Q: Python: how to get coordinates on a canvas on click without matplotlib

user3429913I'm using python 3 on a raspberry pi. In a game that I'm making I want a function that, when the player clicks on the canvas, returns the coordinates of the click. I know there's probably a way of doing it using matplotlib but I don't really want to use that. I've spent hours searching and I can...

lol :D
 
> Is this the right say of doing it?
 
Yeah
I was waiting for 10 mins
 
it does not change in 10 mins I'd guess
 
8:18 AM
This looks opinion-based stackoverflow.com/questions/588749/…
cv it?
 
recommendation and off site resources
 
So here it goes
:D
 
8:37 AM
Low number of questions today
Any idea why?
 
bc some guy got executed 2000 years ago :D
 
@AnttiHaapala Or did he?
 
so they say
 
8:51 AM
cbg - sorry - was walking the dog
 
@AnttiHaapala thanks for the answer :) What should I use, if not colanderalchemy?
 
9:09 AM
@JonClements Puppy walks a Puppy... Hmmm
 
@thefourtheye it's puppy's all the way down!
 
lol... Infinite puppies...
 
@RobertGrant depends on what you're doing
just saying that colanderalchemy failed more than not :D
are you doing forms?
or json api?
 
Ah :)
Trying to convert SQLAlchemy models into forms that deform can display and back
 
yeah
I have been supposed to write that :D
 
9:16 AM
Haha
 
the deform/colander is OK
but what is wrong with colanderalchemy is that the ppl doing that are no geniouses :D
in our case our models were really complicated
and there was no way to map them to colander via colanderalchemy except by forking every single function in their codebase
that is to say: it is not customizable at all
 
Bleh, wow.
 
it just throws random exceptions on harder cases
I mean: if you do something like an ordinary django model, it is a sure match :d
 
So is it better to just make deform forms and map stuff?
 
well you can try colanderalchemy :D
but just so that if you get any problems with it know that the problem is with the CA not anything else specifically
In any case I have never actually ended up doing forms with deform/colander/any other form lib
 
9:19 AM
Cool, thanks sir
So how do you do them?
 
html templates, all of them are that much custom job anyway for us
and we need javascript on client anyways, so
it wouldn't save our time at all
 
Sure
 
YMMV though :D
 
Okay, so you expose an API
I was wondering about doing that as well
 
ah and for the POST/GET parsing
we actually use our own stuff that looks a lot like argparse
So our view code looks like
    feedback_form = FormParser()
    feedback_form.add('sentiment_id')
    feedback_form.add('comment', required=False)
    feedback_form.add('correct_sentiment')

    @expose(permission='write', request_method='POST', renderer='json')
    @require_form(feedback_form)
    def feedback(self, form):
the pro side is that we also have an automatic system that goes through all the view funcs and can write API docs based on these :P
 
9:24 AM
Yeah that's cool
 
(so effectively all of our form posting ends up being json api, and form writing is in html templates)
but again YMMV :D
interaction_search_form.add(
    'limit', type=bounded(int, 1, 100), default=50,
    description="Limit results to 'limit' items"
)
so this will a) do validation, b) can do form error reporting in json, c) provides metadata for generating docs
of course we could use colander/deform/whatever for this too
I just decided I will try this approach
 
Yeah it seems like a smart approach.
I'm going to try this colander thing, but I might switch to something like that (but less clever)
 
all of them make sense :D
that is the good thing
the difference between django and pyramid is that django scratches the developers itch while a pyramid is a framework for building itch-scratchers :D
ah, maybe I should formulate it like this: the model from DB are usually not a very good match for what should be sent over wire so again YMMV with colanderalchemy anyway - the only place I would use something like it would be an automatic admin interface
 
Hm yeah, the nice thing about Django is you can just say make a form object out of this model, but only these fields.
But yeah, I won't sweat it; I'm only doing a little application :)
 
9:41 AM
Is 'bub' considered rude?
 
What is bub?
 
umm... think my last answer is a bit overkill - but throwing it out there
 
Wait - jinja2 has dropped support for 3.x?
Oh, sorry, never mind. I get it
 
@Antti @thefourtheye can you just my explanation on this please? See if it makes sense...
 
9:57 AM
Ah, the itertools treat. +1 :-)
 
@thefourtheye well, I know how much you love itertools puppy :)
(also has the benefit that no one is gonna hand that in as homework :p)
(well - if they do - I'd imagine alarm bells ringing...)
 
The explanation is good, but I am afraid if OP is an absolute beginner he may not understand it completely I guess
@JonClements lol
@thefourtheye Overlooking the obvious things.. :/ I am so sorry :( — jonicious 3 mins ago
Ah, after spending half an hour with him, he says this.
 
awww. have a scooby snack!
 
yay yay yay
 
cbg
@JonClements You could have used n<sup>th</sup> for nth :'(
 
10:08 AM
@BhargavRao true... just typing some * is easier though :p
 
n<sup>th</sup>
sup along with the *!
Lazily
 
cbg @Martijn
Umm.... might make some cottage pie for lunch
 
@JonClements izip not in python 3
 
@JonClements now I want that
 
@Antti oh so glad you mentioned that - I never knew :p
@Robert well... got some fresh mince that needs to be used today... plenty of potatoes... so - seems a good use of stuff
 
10:15 AM
also it eats the nonmatching from strings
 
Most of the times, OPs don't mention the version which they use. So, we are giving two solutions more often :(
 
@AnttiHaapala huh?
 
before some smartass posts an answer
 
Done
 
10:17 AM
You should not have commented!!!
 
I say the default should be: assume a noob is using Python 3
 
Answered, that is. HERE COME THE VOTES!
 
we should make the canonical syntax errors
 
@Robert we should remix youtube.com/watch?v=SrlhLaNClgw with VOTES instead of DRUMS :)
 
like that is caused by a dangling parenthesis (if it was indentation, it would raise indentationerror)
 
10:19 AM
Day 5 - Still no birthdays in January
 
@AnttiHaapala Hmmm, That's a fair guess which we can rely on :-)
 
@JonClements I was lost
@thefourtheye it is caused by a dangling parenthesis with a token that does not accepts a name following
(if the error was indented correctly)
  File "y.py", line 2
    ApiUrl = "http://api.wunderground.com/api/*****************/forecast/lang:NL/q/FR/Paris"
           ^
SyntaxError: invalid syntax
 
Oh, I thought that you were responding to this
6 mins ago, by thefourtheye
Most of the times, OPs don't mention the version which they use. So, we are giving two solutions more often :(
 
ah :D
yes
that one
I think it is a good thing to do that for newbies
if they say "I use 2.7" - "oh I thought since you were a learner of Python that you'd be using 3.4 and not some artifact from the era of Ming Dynasty"
 
10:23 AM
Wow... 92 users that have the sopython app auth'd...
 
Yup. I am actually worried that, immediately somebody will comment that "it will not work in Python 2.7 -1"
 
@JonClements Party when the 100th guy uses it!!!
 
In fact, I stopped using map, filter. I use only LC in my answers these days
 
then flag that as non constructive
and raise the thing here in room and get countering upvotes
I think the "not working on Python 3" when no tag is given, is genuine reason to downvote :D
but not working on 2.6 or so is not :D
also someone advocating the use of except Exception, e "because it is compatible with 2.5" or crap like that
 
I love answering questions which actually have proper Python versioned tags.
 
10:25 AM
soon someone says we need to use has_key so that we are compatible with 1.5.2
 
But that is not there in 3.x :D
 
I mean, that is downvoteable behaviour
except Exception as e appeared in Python 2.6
no one is writing new programs for 2.5
they are maintaining old systems yes, and poor jython...
but the expectation should be that no one is doing it
 
Oh...yeah... Probably we should have a generic comment to prompt the user to tag with appropriate version. That might clear-up things I guess
 
there are some silly things people still do nowadays, like:
exec "foo" in bar, baz
six even has a wrapper for exec
even though exec has always worked with Python 3 compatible syntax
 
Well... does mention specifying a version - but a green bean isn't going to read it
 
10:29 AM
Quoting this,
> For static languages perhaps it's simple as we can change methods, variable but how its done in dynamic languages (Java for example)
Java became a dynamic language?
 
cbg @Ian
 
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exec('print "42"', {}, {})
42
>>>
 
Cbg @Jon! Merry bunny day
 
Python 2.5.5 (r255:77872, Nov 28 2010, 16:43:48)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exec('print "42"', {}, {})
42
 
0
A: Compare two lists different in two elements in the same position

sweet_sugarYou can stop compare the corresponding elements if the comparison criterion is exceeded and return False. The else suite is executed after the for, but only if the for terminates normally (not by a break). Function return True if comparison exactly meet cirteria. I used the break to emphasize the...

wow - lots of lines there :)
 
10:31 AM
That variable name, how_many_elements_must_differ_at_the_same_position
 
Python 3.4.2 (default, Oct  8 2014, 13:08:17)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exec('print("42")', {}, {})
42
 
That's taking explicit is better than implicit to a whole new level hey @thefourtheye? ;p
 
Tim would never have seen this one coming :D
 
@thefourtheye ^ see those
 
You well @Jon? :)
 
@Ian always the same old mate :p You?
 
Explicit is better than implicit (not for variable names green been) :D
 
delete it 20k+
 
10:34 AM
@Jon well thanks, actually looks fairly pleasant outside today :D
 
@Ian yeah... walked the dog this morning as I thought it was going to get worse... but now it's actually sunny and warming up a bit... made the wrong choice there...
 
Bad timing :P
 
@AnttiHaapala You lost me there exec "foo" in bar, baz
 
@Ian plus for an old boy - he still likes his puddles and mud stuff... so gonna have to get around to steaming the kitchen floor at some point... but it can wait :p
 
10:36 AM
@thefourtheye that six has a wrapper for "exec statement" bc "exec does not work like that in Python 2"
except it works exactly like the other syntax of exec statement in Python 2
 
Oh, I never use it before so I didn't know that exec was a statement :(
There is a line where a good self-documenting variable name turns bad... it might just be that you've crossed the line :D — Antti Haapala 6 mins ago
lol
 
cough - we're not above the rules :)
(lead by example and all that :p)
 
10:58 AM
Umm... not sure the potatoes are going to make good mash... more decent jackets
mince and some onion/some chilli - and a side salad... might be more reasonable for lunch... ummm
 
You makin me feel hungry
Question - The 10 min restriction is only for [cv-pls] or even for [delv-pls]?
 
@BhargavRao a Q has to be closed before deletion
 
It's closed
 
have you read the bottom of sopython.com/wiki/cv-pls re delv-pls?
 
Yep! But that ques ain't goin no-where!
Anyway let the auto-bot kick in!
Why take trouble
:D
 
11:11 AM
@thefourtheye Fair enough, not backtracking but this solution is recursive too. — Selcuk 1 min ago
But..but.. I don't see recursion there :'(
 
user559633
11:43 AM
morning chaps
 
hi
 
Cabbage Easter
 
@poke they did a whole hour on the radio station I listen to re: "Do kids even know what Easter is about apart from chocolate eggs?" :)
 
user559633
happy zombie day
 
It’s about bunnies of course!
@thefourtheye Use a userscript plugin, e.g. Scriptish, Greasemonkey, Tampermonkey
 
11:47 AM
everything is about puppies and bunnies! If only the world thought differently... :p
 
*If only the world thought correctly!
 
@poke my latest itertools abomination...
 
Uhhh… I’m gonna need a bit of time to get what’s going on there…
 
^^^ the compulsory easter bunny pic
 
@poke I recently became a RO of a room and it is full of crappy stars. I want to remove all of them. Can that Userscript help?
 
11:52 AM
@thefourtheye are you moonlighting on us puppy!? :(
 
@JonClements No puppy, no. You know that I would never do that :(

Indian Enthusiastic Programmers

Anyone can join, it's not only for indians. Room is most acti...
This is that room
 
@thefourtheye you know I'm joking (I hope)
 
yeah ;)
 
user559633
Yeah, I went into that room and pass
 
I want to clean that room up.
 
user559633
11:54 AM
The starred list is boring images are inspirational messages that would even make a room full of fat women taking yoga roll their eyes
 
@Jon Okay… that is … I’m not sure if it’s clever or pure madness…
 
Yup, that's why I want to clear the stars in a single shot.
 
Shouldn’t the function return the lists though when it doesn’t return false?
@thefourtheye If you want to clear all of them, including the most recent ones, doing that from the right list is probably easier
 
@poke going by the OP's description, but was figuring they could do that outside on a test
 
@thefourtheye If you really want to delete all stars, I could help you write a quick thing.
 
11:57 AM
@poke ie: couldn't think of anything more meaningful than either return the two lists, or return False, which is then gotta make it awkward, maybe return two empty lists... who knows
 
@Jon What do you think about this solution?
sum(1 for x, y in zip(a, b) if x != y) <= n
 
for lists - fine... but won't short-circuit
so - mine - as I pointed out is probably overkill, but will short circuit asap
however, the state of consumerable interables... should they hold their point at something, or should they tee etc...
 
def no_diff_by(a, b, n):
    for x in (1 for x, y in zip(a, b) if x != y):
        n -= 1
        if n < 0:
            return False
    return True
Also short-circuiting
 
@poke that has more than 200 stars :(
 
@poke I like that - post it as an answer :)
same logic, no imports, and better than the other one with 10 lines or something
 
user559633
12:04 PM
anyone seen iplodman lately?
 
user559633
i wonder how he's doing
 
@thefourtheye What browser are you using? Let me fix you something quick.
 
@poke Chrome only. I am reading about User Scripts now. Its not that urgent. So take your time. Thanks for doing this :-)
 
Meh, Chrome ;P
Do you use a prerelease version?
 
Nope. Version 41.0.2272.118 (64-bit)
Automatically updated few days back
 
12:10 PM
Meh.
No fetch then.
 
How do I activate the script?
 
If you have Tampermonkey and then open the script’s URL, it should prompt you to install it.
 
I installed Tampermonkey and it shows the script now
Now, how will I clear the stars?
 
@poke Nicely done - have an upvote
 
I gave him the first upvote :-)
 
12:17 PM
I also think it's a better way of thinking of the OP
 
@thefourtheye It only works from the transcript. You basically have to click the permalink in the star list and then to unstar, click the star next to the message.
 
@poke Oh thanks. It works :-)
But I would rather select "Cancel all the stars" right there in the right side list, right?
 
@JonClements But the question is not very clear puppy :(
 
And happy easter. :-)
 
12:24 PM
@Martijn wow - you're yo-yo'ing :)
 
@JonClements: I fear my office laptop is still signed into chat.
 
Cabbage and Happy Easter @MartijnPieters :-)
 
cbg :)
 
@thefourtheye Of course it does :P
@thefourtheye The script was never meant to be for mass removal, but rather just for removal of old stars that no longer appear in the right list.
Okay, I need to test something, so lots of stars incoming.
Whoo, magic.
Now, let’s make this into a userscript.
 
It removes all the stars in the current page?
 
12:30 PM
No, but it allows you to unstar from the star list.
 
All the stars in the side box can be removed?
 
I’m referring to this list
 
Awesome :-)
As of now I am manually deleting them.
 
Let me actually change the script a bit more to make it a bit more secure…
(right now, it deletes the stars as soon as you click on them, without asking any questions, so that might be dangerous in normal situations)
 
Yup, accidental unstars
 
12:45 PM
oh ffs... appears it's almost sleep time for me
thought someone else was dealing with the issue
 
Rhubarb... My friend calls me for tea
 
Hey.
Stop unstarring when I test things :(
 
declare it's a test before you do so? :p
 
:P
“You have already voted, but the voting has been cleared by a moderator”
what the…
 
1:06 PM
Trying to restar something? Yeah the wording isn't exactly the best.
 
@Ffisegydd cbg
 
Hey up
 
user559633
STARS
 
user559633
1:10 PM
Should I: Read a book about a) programming or b) non-programming?
 
1:40 PM
I would say.... non-programming.
 
@tristan depends what you like: check out: sopython.com/wiki/Recommended_Reading
 
2:35 PM
@tristan about programming I would advice read "the pragmactic programmers" if you did not already
cabbage everybody by the wway
 
@XavierCombelle +1
 
any help appreciated for this question..
http://stackoverflow.com/questions/29458260/python-pyodbc-unicode-issue
just now saw the house rules that I should have waited for sometime before asking for help here.. apologies..
 
@mig-foxbat no worries - you didn't one box it - thanks for reading the rules
 
2:50 PM
@JonClements Is "one box it" when you post the link so that the question gets inlined?
 
@WayneConrad yup
 
@JonClements Thanks.. I will come back here after a couple of days :)
 
(figured it out)
 
3:08 PM
Does anyone have a good use the command line, not Python, to run your command answer?
 
That would be it :)
 
I need to direct this user to such explanations. I don't think they quite connected my explanations to their situation yet.
I'm not even sure if the user actually has a .bed file or that they understand how to pass it in...
 
That's a tough one.
If you were looking over his shoulder and pointing at the screen, he would understand in no time. But without being able to see what he's doing, it's kind of hopeless.
 
@WayneConrad That actually gave me an idea; quick google gives me: youtube.com/watch?v=IokKz-LZsEo
Not the most suitable, continuing my search, but that should already give me something to steer by.
 
Good idea!
 
Still, I am also considering walking away because I don't even know if they have a .bed file anywhere yet or understand that they need one.
@JonClements you are comparing your dancing with an ABBA stage routine?
 
@Martijn yes... only because it's the only performance I could possibly win over?
 
@JonClements can you do it while singing and looking at the camera? :-P
 
cbg
 
3:38 PM
@Martijn of course - but only for £1000/sec on codementor :)
 
@JonClements If I had money spare, I'd make a bet about at what amount per hour you'd do this on Codementor..
I have a feeling it'd be a bit lower than £3.6 million/hour :-P
 
"Oh - you have a question about Python metaclasses"? - I'll explain in interpretive dance :)
 
@Martijn well, 3.6m/hr... I think after 20 years I'd probably have retired by now :)
 
OP fixed the question.
 
3:48 PM
Bah... still not happy with my explanation of this one
 
I see the variable name again and I laugh
:D
 
@JonClements Bah.. I'd close that question as unclear. That question body needs some serious editing and clarification.
 
Marty, did ya see the comment on the 1 upvote answer?
There is a line where a good self-documenting variable name turns bad... it might just be that you've crossed the line :D — Antti Haapala 5 hours ago
:)
 
@Bhargav at what point was it deemed acceptable to call @Martijn, Marty?
 
Oops sorry ... bends head down
 
3:57 PM
@JonClements just noticed that you trashed my upvote pls :D
grr
it was not "repvise" but just some info that should be acked
 

« first day (1632 days earlier)      last day (3328 days later) »