[Python-Dev] deprecating string module?

Steven Lott s_lott@yahoo.com
Fri, 31 May 2002 19:11:06 -0700 (PDT)


In python, you don't need overloading, you have a variety of
optional parameter mechanisms.

I think the "member functions" issues from C++ don't apply to
Python becuase C++ is strongly typed, meaning that many similar
functions have to be written with slightly different type
signatures.  The lack of strong typing makes it practical to
write generic operations.

I find that use of free functions defeats good object-oriented
design and leads to functionality being informally bound by a
cluster of free functions that have similar names.  I'm
suspicious of this, finding it tiresome to maintain and debug.


--- "Martin v. Loewis" <martin@v.loewis.de> wrote:
> Guido van Rossum <guido@python.org> writes:
> 
> > Is this still relevant to Python?  Why are C++ member
> functions
> > difficult to generic programs?  Does the same apply to
> Python methods?
> 
> In a generic algorithm foo, you can write
> 
> def foo1(x):
>   bar(x)
> 
> if you have global functions. With methods, you need to write
> 
> def foo1(x):
>   x.bar()
> 
> which means that bar must be a method of x. This might be
> difficult to
> achieve if x is of a class that you cannot control. In C++, it
> is then
> still possible to define a function
> 
> def bar(x of-type-X):
>   pass
> 
> which, by means of overload resolution, will be found from
> foo1
> automatically.
> 
> In Python, this is not so easy since you don't have
> overloading.
> 
> Regards,
> Martin
> 
> 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev


=====
--
S. Lott, CCP :-{)
S_LOTT@YAHOO.COM
http://www.mindspring.com/~slott1
Buccaneer #468: KaDiMa

Macintosh user: drinking upstream from the herd.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com