Python was designed (was Re: Multi-threading in Python vs Java)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Oct 12 23:38:21 EDT 2013


On Sun, 13 Oct 2013 09:37:58 +1100, Chris Angelico wrote:

> This is design. Python has a king (Guido). It wasn't built by a
> committee. Maybe you won't like some aspect of Python's design, but it
> has one, it's not just sloppily slapped together.


While I agree with your general thrust, I don't think it's quite so 
simple. Perl has a king, Larry Wall, but his design is more or less 
"throw everything into the pot, it'll be fine" and consequently Perl is, 
well, *weird*, with some pretty poor^W strange design decisions.

- Subroutines don't have signatures, you have to parse arguments 
  yourself by popping values off the magic variable @_ .

- More special variables than you can shake a stick at: @_ $_ $a $b @ARGV
  $& ${^ENCODING} $. $| $= $$ $^O $^S @F and many, many more.

- Context sensitivity: these two lines do very different things:

      $foo = @bar
      @foo = @bar 

  and so do these two:

      my($foo) = `bar`
      my $foo = `bar`

- Sigils. Sigils everywhere.

- Separate namespaces for scalars, arrays, hashes, filehandles,
  and subroutines (did I miss anything?), co-existing in the same 
  scope, all the better for writing code like this:

      $bar = &foo($foo, $foo[1], $foo{1})

  If you think that all three references to $foo refer to the same
  variable, you would be wrong.

- Two scoping systems (dynamic and lexical) which don't cooperate.

- Strangers to Perl might think that the way to create a local variable
  is to define it as local:

      local $foo;

  but you'd be wrong. "local" does something completely different. To
  create a local variable, use "my $foo" instead.


More here: http://perl.plover.com/FAQs/Namespaces.html


Likewise Rasmus Lerdorf, king of PHP (at least initially), but he had no 
idea what he was doing:

"I had no intention of writing a language. I didn't have a clue how to 
write a language. I didn't want to write a language," Lerdorf explained. 
"I just wanted to solve a problem of churning out Web applications very, 
very fast."

http://www.devshed.com/c/a/PHP/PHP-Creator-Didnt-Set-Out-to-Create-a-Language/



-- 
Steven



More information about the Python-list mailing list