addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfolderfullheartglobegmailgoogleimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartrashtriangle-downtriangle-uptwitteruseryahoo

Re: [python-189] Python performance anti-patterns

From: Hy C.
Sent on: Thursday, January 10, 2013 4:04 PM
I think it depends on how one interprets Nam's suggestion. I think Nam meant using dict() is a popular anti-pattern, which I think is the thesis of Doug's article.

Alex makes a great point that these types of optimizations are rarely important.

What about examples of issues with performance or unexpected output that arise from using advanced features of Python? For example, wanting to iterate repeatedly but using a generator expression, which can only iterate through its items once?


On Thu, Jan 10, 2013 at 3:32 PM, Brendan <[address removed]> wrote:
That article appears to refute Nam's suggestion.  It's similar to why it's faster to use a list comprehension than a standard for loop.

On Thu, Jan 10, 2013 at 12:23 PM, Hy Carrel <[address removed]> wrote:
Here is a nice article supporting Nam's suggestion, at least for CPython <= 2.7


On Jan 9, 2013, at 10:10 AM, Nam Nguyen <[address removed]> wrote:

Using ``dict()`` for what the literal ``{}`` can do seems to get popular.

Local vs Global lookup.


On Mon, Jan 7, 2013 at 8:48 AM, Simeon Franklin <[address removed]> wrote:

Your feedback is appreciated!

Our Sponsors

  • Yelp

    Platinum Sponsor, also a host for majority of our events.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy