Re: Python is not immune to WTF

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Python is not immune to WTF

Lucas Wiman
The "corrected" version in the comments is quite good.  Also, you can replace all 15 nested for loops with one call to itertools.product, and all 15 if statements to one very compact line, so I'm not sure you can really blame Python here.  The big question is why the function exists in the first place.  Why would you need to write lexicographically ordered strings to a file when they can be generated on the fly?

To wit:

...
    for chars in itertools.product(*([wlc] * 15)):
        word = ''.join(chars[-maxchar:])
...

- Lucas
---------- Forwarded message ----------
From: <[hidden email]>
Date: Wed, Sep 21, 2011 at 11:03 AM
Subject: Baypiggies Digest, Vol 71, Issue 18
To: [hidden email]


Send Baypiggies mailing list submissions to
       [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
       http://mail.python.org/mailman/listinfo/baypiggies
or, via email, send a message with subject or body 'help' to
       [hidden email]

You can reach the person managing the list at
       [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Baypiggies digest..."


Today's Topics:

  1. Re:  Python presentation for Perl audience
     (Rajanikanth Jammalamadaka)
  2.  Python is not immune to WTF (Simeon Franklin)
  3. Re:  Python is not immune to WTF (Hy Carrinski)
  4.  Announce: Linux Desktop Testing Project (LDTP) 2.2.0
     released (Nagappan Alagappan)


----------------------------------------------------------------------

Message: 1
Date: Wed, 21 Sep 2011 12:29:31 -0400
From: Rajanikanth Jammalamadaka <[hidden email]>
To: Dwight Hubbard <[hidden email]>
Cc: BayPiggies <[hidden email]>
Subject: Re: [Baypiggies] Python presentation for Perl audience
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

Thanks for your suggestions.

Thanks,
Raj

On Sep 21, 2011, at 3:50 AM, Dwight Hubbard <[hidden email]> wrote:

> My past experience talking to people who script in Perl is there is frequently an emotional attachment to their brackets and bringing up the whitespace/vs brackets tends to cause them to tune out the rest of the conversation.   I would leave the brackets/vs whitespace issue out of the conversation, after using python for a few weeks it's pretty self evident to a person that their scripts don't look like a word processor threw up...
>
> I know when I first switched from Perl to Python the things that attracted me was that python had a small and simple syntax and logical and concise way to build upon it in a way that a person could get up to speed quickly (much more quickly than with Perl).  Also I found the python documentation itself a great selling point, there are python modules to do damn near anything and the documentation is very consistent which makes using them fairly simple.
> From: Venkatraman S <[hidden email]>
> To: BayPiggies <[hidden email]>
> Sent: Tuesday, September 20, 2011 8:47 PM
> Subject: Re: [Baypiggies] Python presentation for Perl audience
>
> In an interview  that a recently gave(in a pretty big company), the team was using Perl and i told the Manager about the 'awesomeness' of Python, and the response was :'well, its great if you get the indentations right'; my response was 'it is due to the same reason that python is so awesome. since the code looks clean, its easy to read and you do not have to go searching for braces..etc etc'.
>
> So i think, a 'clean-readable' code would be a great selling point along with the 'ease of learning' to your target audience.
>
> -V
> http://blizzardzblogs.blogspot.com/
>
> _______________________________________________
> Baypiggies mailing list
> [hidden email]
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
> _______________________________________________
> Baypiggies mailing list
> [hidden email]
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110921/e02256c3/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 21 Sep 2011 09:35:22 -0700
From: Simeon Franklin <[hidden email]>
To: Baypiggies <[hidden email]>
Subject: [Baypiggies] Python is not immune to WTF
Message-ID:
       <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

I thought I'd make up a new drinking game for Baypiggies like:

1. Feast your eyes upon the code snippet at
http://thedailywtf.com/Articles/Python-Charmer.aspx
2. Take a shot of your beverage of choice every time you see the zen of
python violated

but on second thought this could well prove fatal. I don't know if anybody
else reads the daily WTF but today's article is proof you can write ugly
code in any language! I hope you find it as amusing as I did.

-regards
Simeon Franklin

ps - I've perpetrated some atrocities in various programming languages
myself (hopefully not quite so bad as this one) so I also related to Luke
Plant's recent "Prayer to the programming gods".
http://lukeplant.me.uk/blog/posts/a-prayer-to-the-programming-gods/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110921/1957604a/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 21 Sep 2011 10:08:37 -0700
From: Hy Carrinski <[hidden email]>
To: Simeon Franklin <[hidden email]>
Cc: Baypiggies <[hidden email]>
Subject: Re: [Baypiggies] Python is not immune to WTF
Message-ID: <-965688184506095424@unknownmsgid>
Content-Type: text/plain; charset="utf-8"

Simeon et al.,

Thank you for a post whose comments contain a link for goto for Python:
http://entrian.com/goto/

I like the way Python allows wtf but only after making you work hard or set
an intention to not-think.

Hy

On Sep 21, 2011, at 9:36 AM, Simeon Franklin <[hidden email]> wrote:

I thought I'd make up a new drinking game for Baypiggies like:

1. Feast your eyes upon the code snippet at
http://thedailywtf.com/Articles/Python-Charmer.aspx
2. Take a shot of your beverage of choice every time you see the zen of
python violated

but on second thought this could well prove fatal. I don't know if anybody
else reads the daily WTF but today's article is proof you can write ugly
code in any language! I hope you find it as amusing as I did.

-regards
Simeon Franklin

ps - I've perpetrated some atrocities in various programming languages
myself (hopefully not quite so bad as this one) so I also related to Luke
Plant's recent "Prayer to the programming gods".
http://lukeplant.me.uk/blog/posts/a-prayer-to-the-programming-gods/

_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110921/2bb05663/attachment-0001.html>

------------------------------

Message: 4
Date: Wed, 21 Sep 2011 11:02:58 -0700
From: Nagappan Alagappan <[hidden email]>
To: Baypiggies <[hidden email]>
Subject: [Baypiggies] Announce: Linux Desktop Testing Project (LDTP)
       2.2.0   released
Message-ID:
       <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

About LDTP:

Linux Desktop Testing Project is aimed at producing high quality test
automation framework (using GNOME / Python) and cutting-edge tools that can
be used to test Linux Desktop and improve it. It uses the Accessibility
libraries to poke through the application's user interface. We strive to
help in building a quality desktop.

Changes in this release:

 Many fixes with respect to GTK3
 Added new function rightclick

Bugs fixed:
 Fixed bug#657290 - getpanelchildcount is not implemented
 Fixed bug#656801 - hasstate return wrong status result on solaris
 Check partial_match, compatible with LDTPv1
 handle_table_cell when handletablecell function was called
 Handled exception: ResponseNotReady, noticed in VMware Automation
environment, specific to Ubuntu 11.04
 Added two new methods to LDTPv2 as per LDTPv1 API set - verifytoggled,
verifypushbutton
 Patch to fix bug#654683 getallstates does not work with pyatspi2, thanks
to Michael Terry <[hidden email]> for the patch
 Fixes bug#654685 Frequent LookupErrors, thanks Michael Terry <
[hidden email]> reporting the issue

Special thanks:
 Tim Miao
Jean-Baptiste Lallement
Michael Terry
Brain Nitz

Download source:
http://download.freedesktop.org/ldtp/2.x/2.2.x/ldtp-2.2.0.tar.gz

Download RPM from
http://download.opensuse.org/repositories/home:/anagappan:/ldtp2:/rpm/
Will schedule deb build in openSUSE build service later

Documentation references:

For detailed information on LDTP framework and latest updates visit
http://ldtp.freedesktop.org

For information on various APIs in LDTP including those added for this
release can be got from http://ldtp.freedesktop.org/user-doc/index.html

Report bugs - http://ldtp.freedesktop.org/wiki/Bugs

To subscribe to LDTP mailing lists, visit
http://ldtp.freedesktop.org/wiki/Mailing_20list

IRC Channel - #ldtp on irc.freenode.net

Thanks
Nagappan


--
Linux Desktop (GUI Application) Testing Project -
http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110921/ca4653bd/attachment.html>

------------------------------

_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies

End of Baypiggies Digest, Vol 71, Issue 18
******************************************


_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: Python is not immune to WTF

Simeon Franklin
On Wed, Sep 21, 2011 at 1:56 PM, Lucas Wiman <[hidden email]> wrote:
The "corrected" version in the comments is quite good.  Also, you can replace all 15 nested for loops with one call to itertools.product, and all 15 if statements to one very compact line, so I'm not sure you can really blame Python here. 

Oh I'm definitely blaming the programmer on this one! You can write ugly code in any language - and beautiful code in most languages as well. Some languages work with you instead of against you - that's why I love Python!

-regards
Simeon Franklin


_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies
Reply | Threaded
Open this post in threaded view
|

Re: Python is not immune to WTF

Bryce Verdier-2
OH MY EYES!!!

Bryce

On Wed, Sep 21, 2011 at 2:01 PM, Simeon Franklin <[hidden email]> wrote:
On Wed, Sep 21, 2011 at 1:56 PM, Lucas Wiman <[hidden email]> wrote:
The "corrected" version in the comments is quite good.  Also, you can replace all 15 nested for loops with one call to itertools.product, and all 15 if statements to one very compact line, so I'm not sure you can really blame Python here. 

Oh I'm definitely blaming the programmer on this one! You can write ugly code in any language - and beautiful code in most languages as well. Some languages work with you instead of against you - that's why I love Python!

-regards
Simeon Franklin


_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies


_______________________________________________
Baypiggies mailing list
[hidden email]
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies