[Baypiggies] Baypiggies snippets
Shannon -jj Behrens
jjinux at gmail.com
Wed Mar 28 03:30:07 CEST 2007
On 3/26/07, Alex Martelli <aleax at google.com> wrote:
> On 3/26/07, Keith Dart ♂ <keith at dartworks.biz> wrote:
> > Shannon -jj Behrens wrote the following on 2007-03-26 at 11:04 PDT:
> > ===
> > > I think it's fine in your own code to save time, but probably a bad
> > > idea for libraries that you distribute.
> > >
> > ===
> > But if your own code is also a library that you distribute? ;-)
> > Why would it be a bad idea? Perhaps some documentation would fix any
> > problems with that?
> A typical applicaiton program uses N > 1 "libraries that [others]
> distribute". Suppose that M of those N libraries polluted the
> __builtin__ namespace: how long before mysterious name clashes started
> to happen? Should the poor application programmer double check the
> set of names stuck into __builtin__ by each of the M against each of
> the other M-1...?!
> "Act only on a maxim that you can will to be a universal law."
> The maxim "leave __builtin__ alone in libraries you distribute", you
> can will to be a universal law without creating any problems.
> The maxim "allow libraries you distribute to pollute __builtin__", if
> willed into a universal law, rapidly guarantees chaos... "the tragedy
> of the commons"!-)
> Or, if you prefer Zen (of Python) to Kant:
> "Namespaces are one honking great idea -- let's do more of those!"
> Good fences make good neighbors; good namespaces make good libraries
> -- keep the namespaces cleanly separate, in libraries you distribute,
> don't pollute __builtin__.
And if you insist, then let the user himself shove it into the builtins ;)
More information about the Baypiggies