Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9065
| Date | 2011-07-07 21:32 -0500 |
|---|---|
| From | Andrew Berg <bahamutzero8825@gmail.com> |
| Subject | Re: Does hashlib support a file mode? |
| References | (4 earlier) <0cd66788-5603-421e-82fb-fa3ac089711c@u42g2000yqm.googlegroups.com> <mailman.740.1310045106.1164.python-list@python.org> <6218f9fc-2155-4f31-aa07-fe2caadac190@y30g2000yqb.googlegroups.com> <mailman.741.1310047140.1164.python-list@python.org> <4e166165$0$29983$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.766.1310092389.1164.python-list@python.org> (permalink) |
On 2011.07.07 08:46 PM, Steven D'Aprano wrote: > None is not a type, it is an instance. > > >>> isinstance(None, type) # is None a type? > False > >>> isinstance(None, type(None)) # is None an instance of None's type? > True > > So None is not itself a type, although it *has* a type: > > >>> type(None) > <type 'NoneType'> > >>> isinstance(type(None), type) # is NoneType itself a type? > True I worded that poorly. None is (AFAIK) the only instance of NoneType, but I should've clarified the difference. > The is operator does not compare types, it compares instances for identity. > There is no need for is to ever care about the type of the arguments -- > that's just a waste of time, since a fast identity (memory location) test > is sufficient. "Compare" was the wrong word. I figured the interpreter doesn't explicitly compare types, but obviously identical instances are going to be of the same type.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Does hashlib support a file mode? Carl Banks <pavlovevidence@gmail.com> - 2011-07-06 13:25 -0700
Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-06 14:07 -0700
Re: Does hashlib support a file mode? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-07 09:16 +1000
Re: Does hashlib support a file mode? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-07 07:50 -0500
Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-07 06:11 -0700
Re: Does hashlib support a file mode? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-07 08:24 -0500
Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-07 06:39 -0700
Re: Does hashlib support a file mode? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-07 08:58 -0500
Re: Does hashlib support a file mode? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-08 11:46 +1000
Re: Does hashlib support a file mode? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-07 21:32 -0500
Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-07 20:26 -0700
Re: Does hashlib support a file mode? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-08 17:42 +1000
Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-08 06:03 -0700
Re: Does hashlib support a file mode? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-09 14:44 +1000
csiph-web