"Filip Gruszczynski" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>>  If you want to just declare that name exist, but doesn't want to
>>  declare the type, why don't you just do this:
>>
>>  def somefunc():
>>     nonlocal = nonlocal
>>     local = 0 # or None or [] or an initial value
>>     #
>>     return nonlocal * local
>
> Err.. I don't quite get. How it may help me? Could you explain?

Hi Filip,

In Python the standard patten for "declaring" variables is just to assign to 
them as they are needed.  If you want the effect of a declaration as you 
would do in C, you can just define the variable and initialize it to 0 or 
None.  (Or {} for a new dictionary, or [] for a new list.)

eg,

def collaterecs():
    recordscount = 0
    recordlist = []
    ...
   return recordlist



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to