Summer reading list

Andrew Dalke adalke at mindspring.com
Tue Aug 12 19:54:26 EDT 2003


Chad Netzer
> Quick heap class (any error corrections are appreciated):
> ---------------------------------------------------------

>     def __init__( self, heap=[] ):

make that
        def __init__(self, heap = None):
            if heap is None:
                heap = []

Otherwise, all Heaps created with default args will share the
same data.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list