[PD] [PD-announce] Pd-0.40.3-extended-rc2 released

Chris McCormick chris at mccormick.cx
Tue Jul 22 16:39:15 CEST 2008


On Tue, Jul 22, 2008 at 09:56:58AM -0400, marius schebella wrote:
> >>Frank Barknecht wrote:
> >>>$ python
> >>>Python 2.4.4c0 (#2, Jul 30 2006, 15:43:58) 
> >>>[GCC 4.1.2 20060715 (prerelease) (Debian 4.1.1-9)] on linux2
> >>>Type "help", "copyright", "credits" or "license" for more information.
> >>>>>>sin(0.5)
> >>>Traceback (most recent call last):
> >>>  File "<stdin>", line 1, in ?
> >>>NameError: name 'sin' is not defined
> >>>>>>math.sin(0.5)
> >>>Traceback (most recent call last):
> >>>  File "<stdin>", line 1, in ?
> >>>NameError: name 'math' is not defined
> >>>>>>import math
> >>>>>>math.sin(0.5)
> >>>0.47942553860420301
> 
> as opposed to a philosophical one, where I have to explain every word.
> communication.human.writtenlanguage.english.word.and 
> communication.human.writtenlanguage.english.word.leave

In Python you can also say:

>>> from math import sin
>>> sin(0.5)
0.47942553860420301

or even

>>> from math import *

so for your examples you'd say:

from communication.human.writtenlanguage.english.word import *
and
leave

The reason for this is that if you import absolutely everything into
your global namespace by default, you pollute it and cause conflicts and
name clashes. This has been discussed several times on the list and is a
terrible idea. This has also been solved 100% by languages like Python
already, as illustrated by Frank above.

Things like [bang] are core types of the language and should probably be
imported into the global namespace by default.

Best,

Chris.

-------------------
http://mccormick.cx




More information about the Pd-list mailing list