[Python-bugs-list] [ python-Feature Requests-516076 ] Assign boolean value to a weak reference

noreply@sourceforge.net noreply@sourceforge.net
Sat, 16 Feb 2002 16:03:23 -0800


Feature Requests item #516076, was opened at 2002-02-11 12:32
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=516076&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Stefan Franke (sfranke)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Assign boolean value to a weak reference

Initial Comment:
To test if a weak reference r is still alive, you type

    if r() is not None:
        print "Alive"

Wouldn't be

    if r:
        print "Alive"

more pythonic, since all values of any datatype that 
are not empty evaluate to "true"? Same if you think
about r as a pointer.

principle-of-least-surprise-ly yr's
Stefan


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-02-16 16:03

Message:
Logged In: YES 
user_id=21627

Looks reasonable. Fred?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=516076&group_id=5470