[Python-Dev] PEP 292 for Python 2.4 (original) (raw)
François Pinard pinard at iro.umontreal.ca
Wed Jul 14 14:22:27 CEST 2004
- Previous message: [Python-Dev] PEP 292 for Python 2.4
- Next message: [Python-Dev] PEP 292 for Python 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Nick Coghlan]
François Pinard wrote:
>I know that
string' and
socket' [modules] exist, despitestring'_ _>is evanescent, but they surely forced users at choosing other_ _>identifiers where
string' and `socket' would have been perfect.
I would suggest that bare type names are rarely appropriate for use a variable names, except in toy examples.
Or small enough functions. Small functions are not necessarily toys.
If I'm reading someone else's code, and they create a string or a socket, I want to know what it is for, rather than the mere fact this it is a string or a socket.
If I write a function receiving a string as an argument, and the effect
of the function being already documented, I see no point writing
parameter_string' or
the_argument_of_the_function' instead of
string', which is clear, clean and simple. Some people would write
s' instead, but for one, I stopped overly liking algebraic notation in
programs after I left FORTRAN :-). When you speak to someone else about
the argument of a simple function, don't you say "then the function
takes the string, it massages the string this way, etc.". I like naming
my variables the way I would speak about them! :-)
If the type is all that is important, then prepending some simple word such as 'astring' or 'thestring' or 'mystring' makes it clear to the maintainer that the object doesn't really have any significant semantic meaning beyond its type.
Come on, be serious! :-)
-- François Pinard http://www.iro.umontreal.ca/~pinard
- Previous message: [Python-Dev] PEP 292 for Python 2.4
- Next message: [Python-Dev] PEP 292 for Python 2.4
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]