[Tutor] Why use apply()?

Bernard Lebel 3dbernard at gmail.com
Fri May 13 16:39:20 CEST 2005


All right, thank you.


Bernard



On 5/12/05, Bob Gailer <bgailer at alum.rpi.edu> wrote:
>  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:bgailer at alum.rpi.edu
>  510 558 3275 home
>  720 938 2625 cell


More information about the Tutor mailing list