willm

- friends
1,744 link karma
2,929 comment karma
send messageredditor for
what's this?

TROPHY CASE

George R. R. Martin is a master of surprise by spanishmuffinin gameofthrones

[–]willm 16 points17 points ago

Maybe he can't die before finishing the series. He's basically immortal till he writes the last book!

I took a picture of a dragon on my finger by willmin itookapicture

[–]willm[S] 0 points1 point ago

Doesn't look like Reddit has much love for dragon flies. sigh

What kind of dragon fly is this? by willmin whatsthisbug

[–]willm[S] 5 points6 points ago

After a bit of googling, I'm convinced this is a 'Broad-bodied Chaser Dragonfly'...

What kind of dragon fly is this? by willmin whatsthisbug

[–]willm[S] 1 point2 points ago

Taken in Oxford, England

To All: Stop begging the question by vistascanin DebateReligion

[–]willm 0 points1 point ago

Regardless of what the original definition of the phrase was, enough people use the phrase to mean 'raises a question' that the definition has changed. It's not even confusing, you can tell from the context what someone is meaning when they say it.

That in it's self is not a logical fallacy. It's just the English language changing over time. Get over it.

Displaying an image using Python; I feel like this should be easy! by Dancetrooperin learnpython

[–]willm 0 points1 point ago

How annoying! I think your best option would be to save the file yourself as a bmp to a temporary location, then use os.startfile to open it.

Can Python be used to create a high speed data logging tool? by gjwebberin learnpython

[–]willm 3 points4 points ago

That may be due to the accuracy of the system clock on Windows. Rather than datetime.now, try using time.clock() for a more accurate timer.

Edit: I should have said 'granularity' rather than 'accuracy'.

Displaying an image using Python; I feel like this should be easy! by Dancetrooperin learnpython

[–]willm 0 points1 point ago

That code should work. According to the PIL docs it saves the image as a BMP then launches the viewer. Do you have an app associated with '.bmp' files? Click a bmp file in explorer and see if that works...

If you ever need to reverse a string... by Disagreedin learnpython

[–]willm 0 points1 point ago

It's the number of operations required that makes it slow. Everything you do in a function takes a little time to execute, so the less operations you do, the faster the code (as a rule of thumb).

The recursive version creates three new strings, makes two function calls and three comparisons for every two characters in the input (for strings > 1 characters). Whereas the the non recursive version creates one new string, does one comparison and calls no functions -- for a string of any size.

It may be clever, but the recursion gains you nothing for this problem. The algorithm is basically 'compare each character from the first half of the string with the corresponding character from the second half' -- and that can be done more efficiently without recursion.

The following is essentially the same algorithm, but with an explicit loop:

def is_palindrome(s):
    for index, c in enumerate(s[:len(s)/2], 1):
        if c != s[-index]:
            return False
    return True

Still not as fast as 's == s[::-1]', but more efficient that the recursive code.

If you ever need to reverse a string... by Disagreedin learnpython

[–]willm 0 points1 point ago

No need to apologize! It is a good example of recursion in practice.

If you ever need to reverse a string... by Disagreedin learnpython

[–]willm 4 points5 points ago

A distinction only relevant in academia.

I would expect the simple solution to be faster than only comparing half of the string for strings up to a certain size. Not sure what that size is, but it wouldn't surprise me if it was in the order of a 1000 characters.

If you ever need to reverse a string... by Disagreedin learnpython

[–]willm 4 points5 points ago

I hope that's a demonstration of recursion, because it's horribly inefficient in what it does. This code is simpler (and faster):

def is_palindrome(s):
    return s == s[::-1]

40,000 Hassidic Jews gather at a rally against the internet in at Citi Field. I guess they'll never see this picture of them. by atcaskstrengthin WTF

[–]willm 2 points3 points ago

Mapoftasmania hasn't said anything particularly offensive. There are no women in that picture that I can see -- so he's correct about that. And if all you had to go on was that picture, one could draw the conclusion that the opinion of Hasidic women is not valued in their community. No, I think Mapoftasmia's comment is entirely valid. He has even acknowledge the limitations of his observation with the word 'apparently'.

Feel free to put him straight if you have contradicting information, otherwise your comments just make you seem pompous.

3rd Degree Black Belts in Python, what are the most common mistakes and stylistic faux-pas you see? by omginternetsin Python

[–]willm 1 point2 points ago

Granted. But I'd consider that a far worse offence than not fully grasping booleans!

3rd Degree Black Belts in Python, what are the most common mistakes and stylistic faux-pas you see? by omginternetsin Python

[–]willm 6 points7 points ago

This irks me:

If something() == True:
    ...

Hardly the greatest crime, but the '== True' is of course entirely superfluous.

What's the best job board for Python openings? by lucidguppyin Python

[–]willm 33 points34 points ago

Startups need rockstars like bands need Python developers.

What's the best job board for Python openings? by lucidguppyin Python

[–]willm 21 points22 points ago

Disregard any ad asking for 'rockstars'.

Any library that abstracts different filesystems such as sftp,s3,cloudfiles? by riksiin Python

[–]willm 0 points1 point ago

If you wrap your file system with PyFilesystem, you can mount it with FUSE and Dokan on Windows.

view more: next