RE: variable declaration

From: Robert Brewer (fumanchu_at_amor.org)
Date: 01/31/05


Date: Sun, 30 Jan 2005 21:33:22 -0800
To: "AlexanderZatvornitskiy" <Alexander_Zatvornitskiy@p131.f3.n5025.z2.fidonet.org>,  <python-list@python.org>

AlexanderZatvornitskiy wrote:
> I'am novice in python, and I find one very bad thing (from my
> point of view) in
> language. There is no keyword or syntax to declare variable,
> like 'var' in
> Pascal, or special syntax in C. It can cause very ugly
> errors,like this:
>
> epsilon=0
> S=0
> while epsilon<10:
> S=S+epsilon
> epselon=epsilon+1
> print S
>
> It will print zero, and it is not easy to find such a bug!
>
> Even Visual Basic have 'Option Explicit' keyword! May be,
> python also have such
> a feature, I just don't know about it?

The feature is called "pychecker", and, although it isn't included in
the standard distribution, it's readily available:
http://pychecker.sourceforge.net/

Robert Brewer
MIS
Amor Ministries
fumanchu@amor.org



Relevant Pages

  • Re: Whats so funny? WAS Re: rotor replacement
    ... that a feature is good and inviting people to work on it. ... when they started, there were zero actual IPSEC implementations, ... >> That's not in any Python distro that I know of. ...
    (comp.lang.python)
  • Re: __name__ becoming read-write?
    ... > But all at a cost. ... _Any_ new feature has a cost - whether it is in the additional ... One of my internal measures for evaluating new decorator syntax ... It might be that new python ...
    (comp.lang.python)
  • Re: Small inconsistency between string.split and "".split
    ... throughout the current C sources for Python (across all ... accepting just one), and less than 4% accept keyword-style arguments. ... given Python release, I suspect, and raising enthusiasm for such a job ... will HAVE to take them in keyword form, ...
    (comp.lang.python)
  • Re: A __getattr__ for class methods?
    ... or am I trying to mirror a functionality that Python simply does ... I'm not sure that the way you tackled this is the good approach: while it's quite flexible as far as the search criteria go, it'll require less than obvious code to match keywords and values, will lead to somewhat verbose syntax, and the syntax itself is unforgiving, brittle and not really pythonic. ... As you probably know, Python has a good support for keyword args, allowing you to fill your arguments out of order. ... But **kwargs goes beyond the regular explicit keyword arguments: when specified, **kwargs is a dict populated with the implicit keyword arguments, the ones you haven't specified in the argument tuple of your method. ...
    (comp.lang.python)
  • Re: Python becoming less Lisp-like
    ... think I've seen a lot of whining about lambda and little evidence of ... fundamental wart in Python :-) ... orthogonality: "If you want to do this, then use that, but if you want ... while that use case covered by that special feature, ...
    (comp.lang.lisp)