Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26725

Re: I thought I understood how import worked...

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: I thought I understood how import worked...
References <roy-B56619.09182407082012@news.panix.com> <50211dba$0$29978$c3e8da3$5496439d@news.astraweb.com> <1fca6543-2c01-4f31-8ca7-a81b42b2e4a5@googlegroups.com>
Date 2012-08-07 08:53 -0700
Message-ID <7xa9y6bswp.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


Roy Smith <roy@panix.com> writes:
>> In general, you should avoid non-idempotent code. 
> I don't understand your aversion to non-idempotent code as a general
> rule.  Most code is non-idempotent.  Surely you're not saying we
> should never write:
>>>> foo += 1
> or
>>>> my_list.pop()
> ???

I don't think "in general avoid" means the same thing as "never write".

One of the tenets of the functional-programming movement is that it is
in fact reasonable to write in a style that avoids "foo += 1" and
"my_list.pop()" most of the time, leading to cleaner, more reliable
code.

In Python it's not possible to get rid of ALL of the data mutation
without horrendous contortions, but it's pretty easy (and IMHO of
worthwhile benefit) to avoid quite a lot of it.  

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I thought I understood how import worked... Roy Smith <roy@panix.com> - 2012-08-07 09:18 -0400
  Re: I thought I understood how import worked... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 13:52 +0000
    Re: I thought I understood how import worked... Roy Smith <roy@panix.com> - 2012-08-07 08:25 -0700
      Re: I thought I understood how import worked... Paul Rubin <no.email@nospam.invalid> - 2012-08-07 08:53 -0700
      Re: I thought I understood how import worked... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 17:54 +0000
    Re: I thought I understood how import worked... Cameron Simpson <cs@zip.com.au> - 2012-08-08 08:47 +1000
      Re: I thought I understood how import worked... Roy Smith <roy@panix.com> - 2012-08-07 19:05 -0400
      Re: I thought I understood how import worked... Ben Finney <ben+python@benfinney.id.au> - 2012-08-08 14:14 +1000
        Re: I thought I understood how import worked... Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-08 08:40 +0200
        Re: I thought I understood how import worked... Roy Smith <roy@panix.com> - 2012-08-08 09:12 -0400
        Re: I thought I understood how import worked... Cameron Simpson <cs@zip.com.au> - 2012-08-09 15:52 +1000
  Re: I thought I understood how import worked... Ben Finney <ben+python@benfinney.id.au> - 2012-08-07 23:55 +1000
    Re: I thought I understood how import worked... Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-07 16:14 +0200
    Re: I thought I understood how import worked... Roy Smith <roy@panix.com> - 2012-08-07 08:32 -0700
      Re: I thought I understood how import worked... Terry Reedy <tjreedy@udel.edu> - 2012-08-07 13:15 -0400
  Re: I thought I understood how import worked... Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-07 15:10 +0100
  Re: I thought I understood how import worked... Terry Reedy <tjreedy@udel.edu> - 2012-08-07 12:49 -0400
  Re: I thought I understood how import worked... Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-07 18:44 +0100
  Re: I thought I understood how import worked... Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-08-08 10:47 +0200

csiph-web