> 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.)
Yep
"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
"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:
Names do not 'exist' in Python, nor do they have types. They are bound to
objects that have t
> 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?
On Apr 23, 4:52 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> > You mean the type? Not in 2.x, but in 3.x, there are function
> > annotations:
>
> > def a_function(arg1: int, arg2: str) -> None: pass
>
> Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
> typing can b
Wow! This is extremely easy and seems to do exactly what I need. Those
decorators are pretty powerful then. Thanks for your help, I'll try to
use this.
> def uses(names):
> def decorator(f):
> used = set(f.func_code.co_varnames)
> declared = set(names.split())
> undecl
Steve Holden <[EMAIL PROTECTED]> wrote:
> Filip Gruszczy"ski wrote:
>> Just declaring, that they exist. Saying, that in certain function
>> there would appear only specified variables. Like in smalltalk, if I
>> remember correctly.
>>
> Icon has (had?) the same feature: if the "local" statement
Filip Gruszczyński wrote:
You mean the type? Not in 2.x, but in 3.x, there are function
annotations:
def a_function(arg1: int, arg2: str) -> None: pass
Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
typing can be appreciated by some people.
Declaring what about them
> You mean the type? Not in 2.x, but in 3.x, there are function
> annotations:
>
> def a_function(arg1: int, arg2: str) -> None: pass
Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
typing can be appreciated by some people.
> Declaring what about them? If you mean declari
En Tue, 22 Apr 2008 21:39:41 -0300, Filip Gruszczyński
<[EMAIL PROTECTED]> escribió:
Hello everyone!
It is my first message on this list, therefore I would like to say
hello to everyone. I am fourth year student of CS on the Univeristy of
Warsaw and recently I have become very interested in d
"Filip Gruszczyński" <[EMAIL PROTECTED]> writes:
> I have become very interested in dynamically typed languages,
> especially Python.
Good to know. Welcome to the group.
> I would like to ask, whether there is any way of explicitly
> declaring variables used in a function?
Declaring what about
On Apr 22, 7:39 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> Hello everyone!
>
> It is my first message on this list, therefore I would like to say
> hello to everyone. I am fourth year student of CS on the Univeristy of
> Warsaw and recently I have become very interested in dynamically ty
On Apr 22, 7:39 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> Hello everyone!
>
> It is my first message on this list, therefore I would like to say
> hello to everyone. I am fourth year student of CS on the Univeristy of
> Warsaw and recently I have become very interested in dynamically ty
13 matches
Mail list logo