Comparisons and sorting of a numeric class....

Chris Angelico rosuav at gmail.com
Fri Jan 9 16:14:58 CET 2015


On Sat, Jan 10, 2015 at 2:06 AM, Paul Rubin <no.email at nospam.invalid> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> for instance, I might have a socket object, and I might not, so I can
>> use "if not self.socket: self.connect()" ...
>
> This sounds like you want a Maybe or Option object.

That's exactly what it is - a name that's always bound to either None
or a socket object. Since a socket object is always true, I can safely
use the above code.

ChrisA



More information about the Python-list mailing list