Re: [Tutor] defined()

2006-04-04 Thread Alan Gauld
>> Which language(s) do you know that has such a feature? > > I should came from Marco Cantu's Delphi 2005 book, that I have read just > recently. > But I am unable to find it again. I'd be very surprised if it came from Delphi for two reasons: a) I used Delphi a lot for several years and never c

Re: [Tutor] defined()

2006-04-03 Thread János Juhász
Dear Tim, Dear Alan, >> I can't find the defined() function in python, so I used >>'variable name' in dir() > >> Is it really missing, or I am just so simple ? > > It is really missing, just as it is for most programming languages. > Which language(s) do you know that has such a feature? I shou

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
* Danny Yoo <[EMAIL PROTECTED]> [060403 18:14]: > > > > I'm interested in what use you would make of such a thing? > > My business partner is a perl programmer. He uses defined() a lot, I > > think, I've seen it in his code > > Now, if your business partner doesn't have the line 'use stri

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
* Bob Gailer <[EMAIL PROTECTED]> [060403 17:12]: > > def defined(name): > return name in globals() > Hah! Good tip. I'll call it value() I think "language wars" are a waste of time, but I like the way that using different languages inform the programmer. cheers tj -- Tim Johnson <[

Re: [Tutor] defined()

2006-04-03 Thread Danny Yoo
> > I'm interested in what use you would make of such a thing? > My business partner is a perl programmer. He uses defined() a lot, I > think, I've seen it in his code Hello! The common idiom in Perl, I think, is to at least declare the variable, even if one doesn't give an initial value

Re: [Tutor] defined()

2006-04-03 Thread Tim Johnson
* Alan Gauld <[EMAIL PROTECTED]> [060403 09:10]: > > > I can't find the defined() function in python, so I used > >'variable name' in dir() > > > Is it really missing, or I am just so simple ? > > It is really missing, just as it is for most programming languages. > Which language(s) do you know

Re: [Tutor] defined()

2006-04-03 Thread Bob Gailer
Hugo González Monteverde wrote: > Alan Gauld wrote: > > >> Which language(s) do you know that has such a feature? >> And why do you consider it so useful that you expect to find >> it in Python? >> > > I'm not the original poster, but being a perlhead before, I can say it > exists in Perl.

Re: [Tutor] defined()

2006-04-03 Thread Hugo González Monteverde
Alan Gauld wrote: > Which language(s) do you know that has such a feature? > And why do you consider it so useful that you expect to find > it in Python? I'm not the original poster, but being a perlhead before, I can say it exists in Perl. It is very often used too. I used to miss it at first,

Re: [Tutor] defined()

2006-04-03 Thread Alan Gauld
> I can't find the defined() function in python, so I used >'variable name' in dir() > Is it really missing, or I am just so simple ? It is really missing, just as it is for most programming languages. Which language(s) do you know that has such a feature? And why do you consider it so useful th

Re: [Tutor] defined()

2006-04-03 Thread Tim Golden
[János Juhász] | I can't find the defined() function in python, so I used | | 'variable name' in dir() | | for check if the variable defined. | | >>> name = 'Joe' | >>> if 'name' in dir(): | ... print name | ... I'm not entirely sure where you'd want to use this,

[Tutor] defined()

2006-04-03 Thread János Juhász
Hi All, I can't find the defined() function in python, so I used         'variable name' in dir() for check if the variable defined. >>> name = 'Joe' >>> if 'name' in dir(): ...         print name ...         Joe Is it really missing, or I am just so simple ? Yours sincerely, __