Do I always have to write "self." ?

Cedric Adjih adjih at crepuscule.com
Sun Apr 30 13:43:05 EDT 2000


Steve Crane <craniac at datapro.co.za> wrote:
> On Sun, Apr 30, 2000 at 02:08:00PM +0000, Louis M. Pecora wrote:

>> Isn't this called something like "Hungarian" variable naming?

> Hungarian Notation was introduced by Charles Simonyi (who happened to
> work for Microsoft).  In it's initial form it used a prefix to indicate
> the data type of the variable but not the scope.  Later people started
> to add a scope prefix but I don't think that Microsoft uses this as a
> standard.

> While it may seem to make code harder to read it is in fact very useful
> when working on large projects involving may programmers. 

  Actually this is debatable.

  If you can read, you should be able to read the definition of 
any variable, and there are serious drawbacks. A flame of this
notation is for instance in "Developing Windows NT Device Drivers":
"The so-called `Hungarian Notation' (developped by a Hungarian
programmer at Microsoft) is one of the worst ideas to have hit
software development in many years"
  The main problem, is that when you change the type of a structure
you _cannot_ change the name (because other people are using it),
so the type specification becomes plain wrong. The 'wParam'
is reported to be such an example (now unsigned 32 bits), there
are other examples in Microsoft API (should be worse with Win64).
  Also each time you change the type of one variable/parameter, 
you have change all the variable names of all the code under
your control.
  And finally, for multi-platform code, it makes less sense:
what happens if you don't have 2-bytes integers and you
have code with wXXXX variables (unsigned int 16 bits) ?

-- Cedric




More information about the Python-list mailing list