At 02:17 PM 5/12/2005, Bernard Lebel wrote:
Just a generic question: why one would use apply()?

In Learning Python, on page 357, there is an example of generating an
instance using apply():

class A:
      def __init__( self, number ):
             self.number = number

a = apply( A, 3 )
What is the benefit of doing this over simply creating an instance "the usual way":
a = A( 3 )

No benefit. See 2.2 Non-essential Built-in Functions in the Python Library Reference. 'Use of apply() is not necessary since the ``extended call syntax,'' as used in the last example, is completely equivalent."

Bob Gailer
mailto:[EMAIL PROTECTED]
510 558 3275 home
720 938 2625 cell

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to