Re: "no variable or argument declarations are necessary."



Brian Quinlan wrote:
Paul Rubin wrote:

Brian Quinlan <brian@xxxxxxxxxxxx> writes:


Have those of you who think that the lack of required declarations in
Python is a huge weakness given any thought to the impact that adding
them would have on the rest of the language? I can't imagine how any
language with required declarations could even remotely resemble
Python.


Python already has a "global" declaration;


Which is evaluated at runtime, does not require that the actual global variable be pre-existing, and does not create the global variable if not actually assigned. I think that is pretty different than your proposal semantics.

I believe that "global" is the one Python statement that isn't actually executable, and simply conditions the code generated during compilation (to bytecode).

Hard to see why someone would want to use a global declaration unless they were intending to assign to it, given the sematnics of access.

[...]

regards
 Steve
--
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/

.



Relevant Pages

  • Re: Does Python really follow its philosophy of "Readability counts"?
    ... with enforcing that "shouldn't" in the language itself? ... In Python, direct access to pointers is a MUST NOT. ... where you are allowed to mess with the implementation. ... human assembly language programmers? ...
    (comp.lang.python)
  • Re: Python for Fortran programmers
    ... proposition for Python in the Fortran community", ... compiled language such as Fortran or C++, but I would still prefer to ... greater number of programming errors that are typically detected by a ...
    (comp.lang.fortran)
  • Re: Basic inheritance question
    ... used 'this' in C++ and Java. ... but in Python it doesn't. ... language, they would write a lot of ten liners that is changed a LOT ... Add three levels of inheritence and a couple globals and you'll find out ...
    (comp.lang.python)
  • Re: Is there a "Large Scale Python Software Design" ?
    ... around 20 developers, assuming colocation... ... situation with Python, yet, only with Fortran, C, C++. ... It sure beats "retrofitting" unit tests post facto. ... Jones' estimates for Java's language level; ...
    (comp.lang.python)
  • Re: About alternatives to Matlab
    ... Python will almost certainly be notably slower than moderately ... the powerful and flexible Python language. ... particularly that an OCaml user can easily switch back and forth ... The knowledge is there for the compiler to use but I don't believe any of ...
    (comp.lang.python)