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


Groups > comp.lang.python > #48889

Re: Default Value

Date 2013-06-21 23:49 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: Default Value
References (7 earlier) <565a1c8f-6fd9-4bab-9834-076eaea527f8@googlegroups.com> <kq23at$i39$1@dont-email.me> <7e1ed740-df18-4978-b11d-8ca9c4b5bd04@googlegroups.com> <mailman.3667.1371842756.3114.python-list@python.org> <03e9544e-9d6d-4155-a793-56f0c22c7f7a@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3674.1371854996.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 21/06/2013 21:44, Rick Johnson wrote:
> On Friday, June 21, 2013 2:25:49 PM UTC-5, MRAB wrote:
>> On 21/06/2013 19:26, Rick Johnson wrote:
>> > ============================================================
>> >   The Apathetic Approach:
>> > ============================================================
>> > I could just assume that a programmer is responsible for the
>> > code he writes. If he passes mutables into a function as
>> > default arguments, and then mutates the mutable later, too
>> > bad, he'll understand the value of writing solid code after
>> > a few trips to exception Hell.
>> > ============================================================
>> >   The Malevolent Approach (disguised as beneva-loon-icy):
>> > ============================================================
>> > I could use early binding to confuse the hell out of him and
>> > enjoy the laughs with all my ivory tower buddies as he falls
>> > into fits of confusion and rage. Then enjoy again when he
>> > reads the docs. Ahh, the gift that just keeps on giving!
>>
>> How does the "Apathetic Approach" differ from the
>> "Malevolent Approach"?
>
> In the apathetic approach i allow the programmer to be the
> sole proprietor of his own misfortunes. He lives by the
> sword, and thus, he can die by the sword.
>
> Alternatively the malevolent approach injects misfortunes
> for the programmer on the behalf of esoteric rules. In this
> case he will live by sword, and he could die by the sword,
> or he could be unexpectedly blown to pieces by a supersonic
> Howitzer shell.
>
> It's an Explicit death versus an Implicit death; and Explicit
> should ALWAYS win!
>
> The only way to strike a reasonable balance between the
> explicit death and implicit death is to throw up a warning:
>
>   "INCOMING!!!!"
>
> Which in Python would be the "MutableArgumentWarning".
>
> *school-bell*
>
I notice that you've omitted any mention of how you'd know that the
argument was mutable.

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


Thread

Default Value Ahmed Abdulshafy <abdulshafy@gmail.com> - 2013-06-19 12:17 -0700
  Re: Default Value Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-19 22:35 +0300
  Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-19 12:38 -0700
    Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-20 05:57 -0700
      Re: Default Value Roy Smith <roy@panix.com> - 2013-06-20 09:19 -0400
        Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-20 06:31 -0700
        Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 00:17 +0000
          Re: Default Value Roy Smith <roy@panix.com> - 2013-06-20 20:25 -0400
      Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 07:49 -0700
        Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-21 01:38 +1000
          Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 11:05 -0700
            Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 00:57 +0000
              Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 20:16 -0700
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-21 17:10 +1000
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 07:32 -0700
                Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 16:22 +0000
            Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 15:57 +0000
              Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 10:01 -0700
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-21 18:47 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 11:26 -0700
                Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 18:37 +0000
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 12:18 -0700
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 12:35 -0700
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-22 05:07 +1000
                Re: Default Value Neil Cerutti <neilc@norwich.edu> - 2013-06-21 19:20 +0000
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 13:27 -0700
                Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-22 01:31 +0000
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-22 11:40 +1000
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 18:42 -0700
                Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-22 03:04 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 19:32 -0700
                Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-22 20:36 +0100
                Re: Default Value Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-22 18:51 -0400
                Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-21 19:43 -0700
                Re: Default Value Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-22 09:26 +0100
                Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-21 20:25 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 13:44 -0700
                Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-21 23:49 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 16:51 -0700
                Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-22 02:54 +0100
                Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-22 01:15 +0000
                Re: Default Value Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-21 19:27 -0600
                Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-21 19:32 -0700
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 19:55 -0700
                Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-21 23:23 -0700
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-22 08:07 -0700
                Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-22 08:31 -0700
                Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-22 09:11 -0700
                Re: Default Value Grant Edwards <invalid@invalid.invalid> - 2013-06-24 14:22 +0000
                Re: [SPAM] Re: Default Value MRAB <python@mrabarnett.plus.com> - 2013-06-24 16:22 +0100
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-22 11:41 +1000
                Re: Default Value Michael Torrie <torriem@gmail.com> - 2013-06-21 20:46 -0600
                Re: Default Value Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-22 16:40 +0200
                Re: Default Value Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-22 12:49 -0400
                Re: Default Value Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-22 12:57 -0600
                Re: Default Value Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-22 18:48 -0400
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-22 00:40 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 18:15 -0700
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-22 11:37 +1000
                Re: Default Value Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-21 19:42 -0600
                Re: Default Value Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-21 19:38 -0600
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 19:40 -0700
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-22 03:01 +0100
                Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-22 12:18 +1000
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-22 03:25 +0100
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-22 18:19 +0100
                Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-22 11:49 -0700
                Re: Default Value Rotwang <sg552@hotmail.co.uk> - 2013-06-23 01:49 +0100
        Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-20 10:12 -0700
          Re: Default Value Chris Angelico <rosuav@gmail.com> - 2013-06-21 03:19 +1000
            Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-20 10:30 -0700
          Re: Default Value Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-20 11:57 -0600
            Re: Default Value rusi <rustompmody@gmail.com> - 2013-06-20 11:15 -0700
            Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 01:08 +0000
              Re: Default Value Tim Chase <python.list@tim.thechases.com> - 2013-06-20 20:26 -0500
                Re: Default Value Roy Smith <roy@panix.com> - 2013-06-20 21:40 -0400
                Re: Default Value Tim Chase <python.list@tim.thechases.com> - 2013-06-20 21:02 -0500
          Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-20 11:07 -0700
            Re: Default Value alex23 <wuwei23@gmail.com> - 2013-06-21 10:55 +1000
          Re: Default Value 88888 Dihedral <dihedral88888@gmail.com> - 2013-06-20 19:18 -0700
          Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 02:26 +0000
          Re: Default Value "Lefavor, Matthew (GSFC-582.0)[MICROTEL LLC]" <matthew.lefavor@nasa.gov> - 2013-06-20 17:28 -0500
            Re: Default Value Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-21 08:17 -0700
        Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-21 01:28 +0000
  Re: Default Value Gary Herron <gherron@digipen.edu> - 2013-06-19 12:57 -0700
  Re: Default Value Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-20 01:17 +0000

csiph-web