[Beginer Question] I heard about python needing some sort of_VariableName_ boiler plate?

Tim Chase python.list at tim.thechases.com
Mon Nov 1 08:10:18 EDT 2010


On 10/31/10 23:51, Ben Finney wrote:
>> Sorry, to clarify I heard that when you declare a variable in python
>> you have to use some sort of standard boiler plate _variable_ however
>> this has not been my experience using IDLE so is this even true?
>
> I don't know what “some sort of boiler plate _variable_” might mean.

With the same lack of context as everybody else, two ideas occur 
to me, both involve thinking the OP means "__variable__" (with 
the double-underscores) instead of with single underscores:

1) the *completely optional and certainly not manditory 
CONVENTION* of using things like __author__ or __version__ in a 
module for various meta-data.  For some projects, these sorts of 
faux-special-variables may be more demanded, but that's a 
project-thing, not a Python-thing

2) the use of the __foo__ magic methods such as __init__ or 
__add__ to hook into language bindings/functionality.  In this 
case, there's not a lot of use a boiler-plate template would do 
for you...what? perhaps create

   def __|__(self):
     """Docstring"""

(leaving the cursor on the "|")  But this isn't really much 
different from a generic function template with extra underscores 
and automatically adding "self" as the first parameter.

But I've never found that terribly hard to type in the first 
place -- this is Python, not Pascal (where I'd have to 
distinguish between "procedure" and "function" and remember to 
correctly spell both)


Or, it could be way too early on a Monday morning and I don't 
have a clue what the OP is talking about...which doesn't put me 
any further behind the other folks on the list. :*)

-tkc







More information about the Python-list mailing list