Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83447

Re: Comparisons and sorting of a numeric class....

References (9 earlier) <CALwzidkn5E3uxQ3Et9r-0_WUTjPLfHtY7mqwnhNVe2MGCi528Q@mail.gmail.com> <mailman.17483.1420742711.18130.python-list@python.org> <54afc949$0$12985$c3e8da3$5496439d@news.astraweb.com> <mailman.17524.1420807429.18130.python-list@python.org> <87lhlcro2s.fsf@jester.gateway.sonic.net>
Date 2015-01-10 02:14 +1100
Subject Re: Comparisons and sorting of a numeric class....
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17528.1420816507.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jan 10, 2015 at 2:06 AM, Paul Rubin <no.email@nospam.invalid> wrote:
> Chris Angelico <rosuav@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Comparisons and sorting of a numeric class.... Andrew Robinson <andrew3@r3dsolutions.com> - 2015-01-06 18:01 -0800
  Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve@pearwood.info> - 2015-01-07 08:10 +0000
    Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-07 19:21 +1100
    Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-07 12:01 +0200
      Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 10:46 +1100
        Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-08 08:21 +0200
          Re: Comparisons and sorting of a numeric class.... Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-08 07:57 -0700
            Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-08 21:41 +0200
          Re: Comparisons and sorting of a numeric class.... Chris Kaynor <ckaynor@zindagigames.com> - 2015-01-08 10:44 -0800
            Re: Comparisons and sorting of a numeric class.... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 23:27 +1100
              Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-09 23:43 +1100
                Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-09 16:28 +0200
                Re: Comparisons and sorting of a numeric class.... Paul Rubin <no.email@nospam.invalid> - 2015-01-09 07:06 -0800
                Re: Comparisons and sorting of a numeric class.... Chris Angelico <rosuav@gmail.com> - 2015-01-10 02:14 +1100
                Re: Comparisons and sorting of a numeric class.... Marko Rauhamaa <marko@pacujo.net> - 2015-01-09 17:16 +0200

csiph-web