« first day (1469 days earlier)      last day (3462 days later) » 

user559633
1:08 AM
is it confusing to the english people in the room to get "united kingdom" as a dropdown option?
 
Yeah, because the only English option I should get is "America!"
 
user559633
Well played sir
 
user559633
1:36 AM
Do you have any copy/paste-able code for flask/wtforms "conditional based on outcome of other field" boilerplate?
 
user559633
i'm rounding hour 14 of work today and getting lazy
 
@tristan It's spectacularly annoying that in any country dropdown, you can never be quite sure whether you're going to have to look for (in alphabetical order) Britain, England, GB, Great Britain, UK or United Kingdom ... but this is a problem created by our bizarre constitutional setup, and only really soluble in UI by having multiple entries for the same "country".
(replace as appropriate if Scottish, Welsh or Northern Irish, obviously).
 
user559633
Oh, I'm going to do a bit of javascript to point you to either
 
user559633
eh, I think I'll just do input text box + options come to think of it
 
anyone up for a nice regex contest?
 
1:52 AM
let's hear it
 
I want to catch 'a' or 'b' or 'c' or two or three or none of them after an @ sign
but @aa is not a match
@ab is, @ba is, @abc is and @bca too
and ofc @ alone too
 
is @aaa a match? @aab?
 
none of the two
 
so no same characters next to each other
 
I have this so far, BUT DON'T LOOK IF YOU WANT TO BE IN THE CONTEST
@davidism exactly
and if possible, I want to make it extensible
so if abc become abcd
it would be nice not to rewrite the whole
 
1:55 AM
well there goes my brute force approach :)
 
and I forgot to mention one more thing: @abcx or @ax are not matches either
@davidism @aba is not a match either
so not only same characters next to each other
but you can use each character only once
 
at most one of each character, 0 or more characters, any order
 
thank you. that's the one
 
user559633
goodnight all
 
rhubarb(@tristan)
 
user559633
2:08 AM
rbrb :)
 
user559633
back in 8 hours. getting close to launching this site i've been hacking on and i'm unreasonably excited to get feedback from the regulars
 
looking forward to check it -- don't forget to ping me ;)
 
user559633
:D
 
I'll look for it tomorrow :)
@Peter here's all the valid inputs:
def valid(chars):
    for i in range(1, len(chars) + 1):
        yield from itertools.permutations(chars, i)

print(list(valid('abc')))
 
@davidism that's it, yes -- but what should be the regex?
 
2:12 AM
I'm working on it, that's just for testing
 
also the empty list is valid too don't forget that
 
good point
 
and it cannot be followed by any word-like character
 
that's simple, @ at the beginning, [^\w] at the end
I'm focusing on the letters
 
sure, sure ;)
 
2:14 AM
I'm also watching Genshiken at the same time, so keep swapping focus :)
 
I have no idea what Genshiken is, but let's google for that one ;)
ahh.. I'm not a huge fan of manga.. :/
 
It's pretty enjoyable so far, but yeah, not for everyone.
 
okay, I call it a night -- any result @davidism?
 
nope, I'll keep messing around
 
2:29 AM
umm.. I share my solution then, or do you want to think about it more?
 
I'll keep thinking
I didn't look at the link you pasted earlier
 
all righty -- if you come up with something ping me
I will read it back tomorrow (later today)
rhubarb(all)
 
 
3 hours later…
5:30 AM
Cbg
 
hi
 
6:16 AM
Cbg
 
6:28 AM
Cbg
i'm running Ubuntu. My system has both python 2.7 and 3.4 versions. I installed bs4 . But i can use it only on 2.7 interpreter. When i try to import bs4 on 3.4 , it shows no module named bs4 error.
What i need to get bs4 on 3.4 ?
 
How did you install it?
 
i think i installed bs4 through pip.
sudo apt-get install python3-bs4
solves my prob... thnks..
 
6:54 AM
cbg
 
@Kevin I think I am, yeah
 
7:45 AM
Cbg! :)
 
I'm buying the memory today! Whoohoo!
 
-4
Q: total change in career path

German3dI have a bachelor degree in CorpFin in top university in Russia and 1+year of professional experience in local major Petrochemical company (Finance&Planning department). Taking into consideration 1) unstable economic position of my country (weak currency, economic recession, staff reductions) 2...

 
> 3 hours spare time every day
He could read FAQ
 
Hi everyone. Does syntax like this not work?
subprocess.call(["cat", tmpfilename, ">>", filename])
 
@FaheemMitha I don't know, why don't you try it and see?
 
Tried running it?
Though it should work
 
8:14 AM
@Ffisegydd I doesn't seem to. That's why I asked.
Though I haven't tried running it by itself. One sec.
 
Yes but my point was that you were asking whether it worked or not, not why it didn't work.
Oh I see.
 
I'm not sure if I am making a syntax error, but here is the code run in isolation.
In [2]: subprocess.call(["cat", "foo.txt", ">>", "foonew.txt"])
this is foo
cat: >>: No such file or directory
In this case, both foo.txt and foonew.txt already exist.
Maybe operators are treated specially.
 
What is the >> operator called? I don't remember.
Pipe?
 
It's a redirection operator.
 
48
A: Python subprocess command with pipe

TaymonTo use a pipe with the subprocess module, you have to pass shell=True. However, this isn't really advisable for various reasons, not least of which is security. Instead, create the ps and grep processes separately, and pipe the output from one into the other, like so: ps = subprocess.Popen(('ps...

11
A: Python: How to Redirect Output with Subprocess?

Marcelo CantosUse os.system: os.system(my_cmd) If you really want to use subprocess, here's the solution (mostly lifted from the documentation for subprocess): p = subprocess.Popen(my_cmd, shell=True) os.waitpid(p.pid, 0) OTOH, you can avoid system calls entirely: import shutil with open('myfile', 'w')...

Google is your friend.
 
8:20 AM
Thanks.
 
Arghghg... left my wallet at my brother's last night
f*
 
Lol I've had highlights=true in my URL, that's why I don't see the conversations
I thought either the room had died, or I had.
 
hah
 
8:37 AM
@Robert this room - like the Cabbage - is eternal!
 
Ah :)
Apologies if I haven't replied to anything in the last few days, all. I wasn't being rude :)
Ps I have to use Laravel for something. ORM not nearly as nice as Django's from what I can see so far.
 
cbg all
@Ffisegydd err , that code removes numbers as well . like '32' is popped out..
 
Can you link to the question again @Swordy?
You'll need to adjust the set allowed
 
will it take all possible numerals??
 
At the moment, IIRC, it's just string.ascii_letters which is 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
8:49 AM
from string import letters, numbers; allowed = set().union(letters, digits)... done
 
You don't need to initialize set
 
@Swordy what @Jon said but replace letters with ascii_letters and numbers with digits
 
@vaultah in that example you do...
although probably set(ascii_letters + digits) is more readable :)
 
should i go with ffisegydd's method or the ones that u and zero piraes were discussing?
 
8:52 AM
@Swordy whatever floats your boat, depends whether you want readability or speeeeeeed.
Though I don't recall how much of a speed increase it was.
 
speeed
ascii.intersection was twice as fast as urs
 
Then go for: list(filter(set().union(ascii_letters, digits).intersection, your_list))
perfectly readable cough
 
Bad cough that.
 
Yeah... sadly, I do actually have a slight cough and sore throat at the moment... not happy
 
I've had a cough for the past 2 years (I'm not even kidding)
 
8:55 AM
umm... that's a long time to have whooping cough baby
 
@JonClements muaahh thanx.. worked like a _py_charm
 
@Ffisegydd did Lois not get you your jabs?
 
Been to the doctors for it and they don't know what it is.
I've had an x-ray to check for lung cancer which thankfully came back clean.
Just had a cough for 2 fudging years straight.
 
Neurological?
 
Possibly. The doctor suggested that sometimes people can get a bad chest infection and with it have a bad cough, and if it lasts too long it can kinda get stuck, like the body is used to coughing.
In which case there's no treatment.
 
8:58 AM
:(
 
u must have had a real bad time..
the worst feeling is when u feel like you've got sand inside your throat. everytime u swallow , it hurts..
 
@Ffisegydd aww :*(
 
9:13 AM
@Ffisegydd wasn't something very similar asked yesterday?
 
and wasn't it closed??
History repeats itself
 
c-b-g.
@Swordy hungary is screwed up anw
 
I have a feeling my answers going to go way above that guy's head, but oh well
pretty sure that screws up the indentation
umm... 2 accepts, 2 rejects (thanks @vaultah)
 
9:36 AM
what say abt this?
1
Q: How to efficiently turn a boolean numpy array into threshold boolean array?

ProGMI'm using Python 2.7 and NumPy to work on big arrays of boolean values. I have an array A, that is something like this: >>> A array([[[False, False, True, True, True], [False, False, False, True, True], [False, False, True, True, True], [False, False, False, True, True],...

 
@Swordy looks like a question on SO about numpy? :)
 
thanks couldn't have known that
check this prank out
in India..
 
@Jon approved by a Java guy :D
With 0 score in Python tag
 
9:55 AM
Bah... rolled it back
@vaultah bah... rolled back and left a note for d-coder... who I've seen around here a fair few times...
 
And he apologized
 
Yup... mind you... I remember once I went to edit my answer, and actually edited the question with my copy/paste of my answer instead... :)
 
@JonClements whoops..
I've been lucky so far; hitting edit on the wrong post has so far always lead to WTF double-takes before hitting the save button.
 
Well, the problem was, I had two tabs open: one that I'd used edit on to be able to copy/paste more easily, and in the other, my answer with edit mode... and since I was quoting some code from the OP they look fairly similar... and yep...
It got pointed out and corrected fairly quickly though :)
 
Yo all, someone just said to me "Having a dict as a default value in function signatures is a bad idea" - is this true, and if so, why?
 
@Ian the default mutable argument :)
801
Q: "Least Astonishment" in Python: The Mutable Default Argument

Stefano BoriniAnyone tinkering with Python long enough has been bitten (or torn to pieces) by the following issue: def foo(a=[]): a.append(5) return a Python novices would expect this function to always return a list with only one element: [5]. The result is instead very different, and very astonish...

 
@Jon - great, thanks for this - though this is an overriding context in Django used in a view - so I guess that would never really happen - but I get the general practice :)
 
That's coded according to the principle of most astonishment, I think :)
 
@BadgerGirl miaow!
 
10:24 AM
@JonClements woooof
 
@JonClements Should be added to SOPython, if it hasn't already
 
@IntrepidBrit think it's there... if not... feel free :)
 
Or at least named according to the principle of most astonishment
 
Well... you've both got edit access... help yourselves :)
 
I was reading the comments, and hit one where I thought, "I 100% agree with that!" Turned out to have been written by me.
5
 
10:30 AM
@Robert lucky you agreed with it then :)
Much better than.. "Wow... that guy is talking such b*s... oh dammit - it's me!"
3
 
Yeah, I've had that as well :)
 
I've done it for an entire (very early) code base I wrote
I was going through it and thinking... "gonna have to get this guy in my office and have a little chat..." :(
 
@JonClements you should've done that, Gollum-style
Python devs do it Gollum style. def have_a_chat_with(self):
 
I've tempted to write as the tagline: "This guy typed a mutable default argument and you WON'T believe what happened next..."
 
Yeah :)
 
10:34 AM
@IntrepidBrit you bought the new Civ game yet? Gonna join me and Jon?
 
@FfisegyddI've bought it - but client has informed me that the product HAS to be shipped on Monday
 
@IntrepidBrit "Python dev creates surprising function behaviour using this weird old trick..."
 
Despite the code not being anywhere near stable for clients to be dicking about with. So my weekend just imploded
 
@Ffisegydd oh - you're allowed an hours practice if you want... I couldn't sleep before my conference call... so errr... I was bored
 
...dastardly.
 
10:36 AM
@Ffisegydd Beyond Earth? That looks amazing.
 
Sad face
 
@Ffisegydd what do you think of it?
 
It does. @Robert you should join us.
I've not played it yet.
Only came out today.
 
I love it... enjoy it way more than Civ5
apart from the first two games I tried, I died within 30 turns
 
@JonClements interesting. Why do you prefer it?
 
10:37 AM
I hear from my "Pokemon flu" mates that it's absolutely cracking
 
@RobertGrant the tech and virtue system is great... makes progression much less linear
 
"I want to write text on my screen." Use a pen.
 
@Robert mind you... I f*ing hate the siege worms...
 
Yeah the tech web thing sounds cool. I was reading Eurogamer last night.
So I now know all the social ramifications of the design decisions as well
Just kidding, I think EG is great
 
and there's miasma all over the blooming place that you can't see very well, so your units end up stopping in the middle of it, then losing half their life
 
10:40 AM
@Jon that's one thing I'm a bit apprehensive about, I always liked not necessarily going for military victories but with the alien life on the plant I think you're going to need a decent-ish standing army.
 
@Ffisegydd well... I ended up trying to do a ultrasonic fence thing... but that takes ages to build... (you're probably dead by then)...
but it's difficult to expand quickly because aliens are blooming everywhere and do just turn up out of nowhere
and they'll be fine for a bit, then just go psycho on you and you've lost all your units
 
I'll probably play some single player on Saturday
 
@Ffisegydd it's different... but I really like it so far
 
Then we can try multiplayer on Sunday
 
@Ffisegydd sounds good to me
 
10:43 AM
Though I also want to do some Nidaba so I'll just use dualscreen :P
 
wait... men can multi-task? :p
oh gosh darn it... I fixed the CSRF rubbish, and now I'm getting it again
 
11:03 AM
Ooo... the Queen has sent her first ever tweet... that's nice? :)
heya @d-coder - didn't see you around here, so that's why I left the comment... glad you didn't take it the wrong way :)
 
SOPythonistas - just double check my draft to make sure my 'Common Question' is up to scratch before I publish it
 
I suppose you're lucky it ultimately got accepted though.. your accept/reject isn't looking too great at the moment, so you might wish to tread warily so you don't end up getting a suggested edit ban...
 
It's a pity the reviewers didn't pay enough attention there; three accepts from people with 0 Python knowledge who all should have at the very least skipped instead.
And what @Jon said. :-)
 
Woot - fixed the CSRF - but it's broken something else
wonder if the client will notice :)
 
cbg(all)
 
11:08 AM
cbg @Peter
 
@JonClements I didn't mean to do that. Next time I'll pay my best attention while editing questions and fixing indentations
 
so, from yesterday night -- I have a nice regex contest, which we started with @davidism -- anyone in? (looking at @JonClements and @MartijnPieters)
 
uhhhhhh, cbg(all, overdue=true)
 
@d-coder I'd suggest for the moment to avoid "fixing" indentation... focus on correcting spelling/grammar, titles and tags for the time being...
Make each edit significant... your last edit (apart from corrupting the code block) changed about 3 letters :)
 
@JonClements Will keep that in mind :)
 
11:10 AM
(and that might have got rejected as too minor - or whatever the reason is now)
 
CONTEST: <'@'><'a','b','c', at most one of the chars, 0 or more chars><not followed by word-like chars>
 
@MartijnPieters If I make mod, minitech and I can team up and go hard-core on stupid reviewers :)
@Peter weren't you asking that about 3am ?
 
@PeterVaro not really in much of a position to play atm, sorry!
 
@MartijnPieters np at all :)
@JonClements I did, and even though I had my solution back then -- I'm not really happy with it
and I'm looking forward to get a better one -- and no one really had a nice answer
;)
so the game is still on
 
@JonClements Guys! For the last time. I'm truly sorry. :(
 
11:13 AM
@JonClements the best solution would be easily extensible: if I add or remove a single character from the char-set it would work fine
 
@d-coder it's okay... your efforts to make edits is truly appreciated, we're just giving a heads up that if you keep going as you're going, you could risk getting edit banned...
and we like you, so we don't want that to happen :)
 
NOOOO!!
Already I'm facing question ban :)
@MartijnPieters You answered about del variable
did you see my answer ?
@JonClements Sweet!
 
avi
cbg
 
how to read a file fully in python?
i tried.
 
avi
?
 
11:18 AM
with open('/home/avinash/Desktop/f', 'r+') as f:
    for i in f.read():
 
avi
naa
 
is this correct?
 
avi
with open('/home/avinash/Desktop/f', 'r+') as f:
    file_content = f.read()
 
thanks , i'll try..
 
@AvinashRaj why the +?
 
11:19 AM
read+write
 
avi
@JonClements I did not see that.... I copy pasted and changed the second line
 
@AvinashRaj WHHAATT!???
 
is that wrong?
 
@avi my bad - had a blonde moment - I edited my post :)
 
avi
woahkay
 
11:20 AM
i got a ping Jon.. Use @avi$ :-)
 
blooming chat :)
 
@d-coder: in CPython, unbinding can lead to insta-release of the memory.
Because CPython uses reference counting.
If the reference count drops to 0, the object is insta-reaped.
The GC is only needed to break ref cycles.
 
@MartijnPieters exactly!
if number of pointer drop to 0 then it's reclaimed right ?
 
avi
can anyone explain me what exactly are hashtables and how are they different from (python) dictionary? most of the google search results, i get results about non-python... and I am getting more confused
 
@avi The python dictionary is a dynamic hash table.
 
avi
11:24 AM
dynamic? as in
 
a hash table is one approach to implementing a dictionary.
dynamic as in the table grows as needed.
it starts with 8 slots, and if you add more elements, the table is recreated with more slots.
Adding elements can lead to the table being recreated smaller too.
 
@MartijnPieters I thought x = None will do the trick. But again I remembered it'll not free the pointer
 
as deletions result in sentinels being inserted in place of the deleted keys.
@d-coder rebinding will also drop the reference count to the previous object.
so x = None will do the trick too.
 
Okay! I need to refresh my memory in this regard.
 
avi
thanks @MartijnPieters
 
11:29 AM
chemistry is a weird class :|
 
Hi
 
Hello
 
Does anyone worked with nvd3 ? I have a nvd3 chart in my site and I'm trying to create a png file using the svg code. I've checked around stakoverflow and google, but couldn't find anything useful, mentions to pycairo and pysvg but those packages doesn't work fine for me
Could any of you point me to a good library or any kind of "simple" solution ?
 
What does cbg mean anyway ? :0
 
cbg ?
 
11:34 AM
@Liarez Not you. At others.
 
avi
>>> cbg == cbg
True
 
cbg is cbg ?:P
 
avi
yup
thats what my python says
 
what is hertz a measure of, really?
 
number of oscillations per second
 
11:36 AM
It's not so much a "measure" of, it's a description of how many oscillations .. a second
 
could that be considered energy?
 
eyes @d-coder the "thunder stealer"
Depends on what your system is all about
 
doing chemistry. The wording on these questions gets a little ambiguous
 
@IntrepidBrit Energy ? Explain please
can be considered as energy too ?
 
Well, the energy produced through photovoltaic effect is very much affected by the frequency of incident light
@corvid hissssssss Chemistry. Ain't nobody got time for that. (Never studied it, even at high school)
 
11:41 AM
hm. I just wish I knew where these formulas came from. Are the proofs far too complicated for my puny mind?
 
It's probably not that, sometimes at school they haven't taught the necessary mathematical tools to calculate the proofs
 
it's kind of interesting, though not a huge fan of very abstract subjects. I like to actually do things. That's how crows learn best.
at most schools I go to they give you the formula and tell you it's right and to memorize it. Then obviously it doesn't make sense.
 
Then, my friend you should consider engineering rather than theoretical subjects :)
So, what's got a frequency in the Q?
 
there is a question involving frequency if that counts, but calculating it doesn't seem particularly complex
"What is the frequency of light with a wavelength of 299 nm?", wouldn't it just be 299nm * v = speed of light
 
Well, think about the units
 
11:46 AM
yeah speed of light needs to be in nanometers/second, that just looks wrong for whatever reason... frequency is in seconds?
or is it in 1/s, which is to say hertz?
 
@corvid Actually frequency means number of occurrences.
 
@corvid Yes, 1 Hertz is once per second
 
@corvid wave velocity = wavelength * frequency
m/s = m * 1/s
Both sides of the equation need to balance, so if you know the units - it gives you a clue on how the formulas are constructed
 
Pyhton not physics :(
:P
 
@d-coder Hm?
 
11:57 AM
I need to know about generator expression
 
this one chart. I just don't get what it is trying to express but I see it everywhere
 
Which chart ?
 

« first day (1469 days earlier)      last day (3462 days later) »