Python questions from C/Perl/Java programmer
Garry Hodgson
garry at sage.att.com
Wed Jul 26 15:12:46 EDT 2000
"ye, wei" wrote:
> Remco Gerlich wrote:
> > "ye, wei" wrote:
> > > 2. Why variable doesn't have to be declared before use?
> >
> > Because it's not necessary!
>
> I can bear the {} issue, however I couldn't bear with variable without
> declaration.
> I wrote many applications, I couldn't live without declaration.
the short answer is: if this is really important to you, then you
don't want to use python. alternately, you might give it a try and
discover
what many others have. it turns out not to be a problem in practice.
the third option, insisting that python change to meet your
presuppositions
of what is important, is unlikely to be fruitful.
> > Although there is work in progress on this issue - it may become optional
> > in the future. If you make everything strict and using { } and so on you've
> > just got some dialect of Objective C or Java or something...
>
> I will be very *HAPPY* if it's true!!!!! I believe Python will be much
> stronger and grow faster
> if such features are enabled.
if memory serves, much of the impetus for this was that it would
enable certain performance improvements, rather than for safety
purposes.
> However it should be a good language,
ahem.
> which can as more as possible
> to correct the mistake people may make. This help programmers to
> shorten development and testing time.
many people's experience has shown the opposite to be true.
> If don't specify the variable type:
> 1. When you read code, it's not easy for you to understand how to invoke that
> function.
> For example, compare
> def f(x, y, z): ... with def f(int x, complex b, Employ c): ...
> which declaration give you more information without read further code?
> You know how to invoke the latter one without read its code and comments in
> most cases.
either of these is poor code. how about having the names reflect usage,
which is arguably more relevant than type?
def ComputeSalary( employeeID, salary, employee )
(my salary is very complex :-)
--
Garry Hodgson Every night
garry at sage.att.com a child is born
Software Innovation Services is a Holy Night.
AT&T Labs - Sophia Lyon Fahs
More information about the Python-list
mailing list