[Baypiggies] Python is not immune to WTF

Lucas Wiman lucas.wiman at gmail.com
Wed Sep 21 22:56:29 CEST 2011


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: <baypiggies-request at python.org>
Date: Wed, Sep 21, 2011 at 11:03 AM
Subject: Baypiggies Digest, Vol 71, Issue 18
To: baypiggies at python.org


Send Baypiggies mailing list submissions to
       baypiggies at python.org

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
       baypiggies-request at python.org

You can reach the person managing the list at
       baypiggies-owner at python.org

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 <rajanikanth at gmail.com>
To: Dwight Hubbard <dwight_hubbard at yahoo.com>
Cc: BayPiggies <baypiggies at python.org>
Subject: Re: [Baypiggies] Python presentation for Perl audience
Message-ID: <FE438D56-7746-4F5D-B941-9F09B1D0F965 at gmail.com>
Content-Type: text/plain; charset="us-ascii"

Thanks for your suggestions.

Thanks,
Raj

On Sep 21, 2011, at 3:50 AM, Dwight Hubbard <dwight_hubbard at yahoo.com>
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 <venkat83 at gmail.com>
> To: BayPiggies <baypiggies at python.org>
> 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
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> 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 <simeonf at gmail.com>
To: Baypiggies <baypiggies at python.org>
Subject: [Baypiggies] Python is not immune to WTF
Message-ID:
       <CAK0d_GpoKL3xg8UFv8yQw2jxVjt91X4q6Uwiup5Vw-TyeGfMcA at mail.gmail.com>
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 <hcarrinski at gmail.com>
To: Simeon Franklin <simeonf at gmail.com>
Cc: Baypiggies <baypiggies at python.org>
Subject: Re: [Baypiggies] Python is not immune to WTF
Message-ID: <-965688184506095424 at 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 <simeonf at gmail.com> 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
Baypiggies at python.org
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 <nagappan at gmail.com>
To: Baypiggies <baypiggies at python.org>
Subject: [Baypiggies] Announce: Linux Desktop Testing Project (LDTP)
       2.2.0   released
Message-ID:
       <CAJk6DvWNdt0O6vQ0tgkB2F0QLCq+qdjfBjq_jYSYSSBXTgzHew at mail.gmail.com>
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 <michael.terry at canonical.com> for the patch
 Fixes bug#654685 Frequent LookupErrors, thanks Michael Terry <
michael.terry at canonical.com> 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
Baypiggies at python.org
To change your subscription options or unsubscribe:
http://mail.python.org/mailman/listinfo/baypiggies

End of Baypiggies Digest, Vol 71, Issue 18
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20110921/f84570a7/attachment-0001.html>


More information about the Baypiggies mailing list