Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84114
| Date | 2015-01-21 06:55 -0600 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: Trees |
| References | (1 earlier) <mailman.17884.1421734095.18130.python-list@python.org> <87ppa9944t.fsf@elektro.pacujo.net> <mailman.17906.1421827045.18130.python-list@python.org> <b37db482-1c2d-4b17-9b0b-0e37537482ef@googlegroups.com> <CAPTjJmqxKcMS-aquDsvMb60Mg26yAiB=oQsFXFJh2pbr6vPKWA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17911.1421844798.18130.python-list@python.org> (permalink) |
On 2015-01-21 23:35, Chris Angelico wrote:
> On Wed, Jan 21, 2015 at 11:09 PM, Rustom Mody wrote
> > Its a bit of a nuisance that we have to write set([1,2,3]) for
> > the first
>
> Wait, what?
>
> rosuav@sikorsky:~$ python
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> type({1,2,3})
> <type 'set'>
> >>>
> rosuav@sikorsky:~$ python3
> Python 3.5.0a0 (default:4709290253e3, Jan 20 2015, 21:48:07)
> [GCC 4.7.2] on linux
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> type({1,2,3})
> <class 'set'>
> >>>
>
> Looks like {1,2,3} works for me.
That hasn't always worked:
tim@bigbox:~$ python2.5
Python 2.5.5 (r255:77872, Nov 28 2010, 16:43:48)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> type({1,2,3})
File "<stdin>", line 1
type({1,2,3})
^
SyntaxError: invalid syntax
tim@bigbox:~$ python2.6
Python 2.6.8 (unknown, Jan 26 2013, 14:35:25)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> type({1,2,3})
File "<stdin>", line 1
type({1,2,3})
^
SyntaxError: invalid syntax
And, prior to 2.4, you had to write
from sets import Set as set
to even get sets.
https://docs.python.org/2/whatsnew/2.4.html#pep-218-built-in-set-objects
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Trees Terry Reedy <tjreedy@udel.edu> - 2015-01-20 01:08 -0500
Re: Trees Marko Rauhamaa <marko@pacujo.net> - 2015-01-20 11:45 +0200
Re: Trees Paul Rubin <no.email@nospam.invalid> - 2015-01-20 10:14 -0800
Re: Trees Marko Rauhamaa <marko@pacujo.net> - 2015-01-20 22:26 +0200
Re: Trees Stephen Hansen <me+python@ixokai.io> - 2015-01-20 23:56 -0800
Re: Trees Marko Rauhamaa <marko@pacujo.net> - 2015-01-21 10:35 +0200
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-21 04:09 -0800
Re: Trees Chris Angelico <rosuav@gmail.com> - 2015-01-21 23:35 +1100
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-21 07:24 -0800
Re: Trees Tim Chase <python.list@tim.thechases.com> - 2015-01-21 06:55 -0600
Re: Trees Chris Angelico <rosuav@gmail.com> - 2015-01-22 00:01 +1100
Re: Trees Tim Chase <python.list@tim.thechases.com> - 2015-01-21 08:26 -0600
Re: Trees Chris Angelico <rosuav@gmail.com> - 2015-01-22 01:31 +1100
Re: Trees Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-22 01:47 +1100
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-21 09:15 -0700
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-21 10:27 -0700
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 05:33 -0800
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 05:51 -0800
Re: Trees Marko Rauhamaa <marko@pacujo.net> - 2015-01-20 16:15 +0200
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 06:35 -0800
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-20 10:19 -0700
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 10:15 -0800
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 10:35 -0800
Re: Trees Mario <marfig@gmail.com> - 2015-01-20 22:47 +0100
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 17:23 -0800
Re: Trees Paul Rubin <no.email@nospam.invalid> - 2015-01-20 17:49 -0800
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-20 18:03 -0800
Re: Trees Paul Rubin <no.email@nospam.invalid> - 2015-01-21 14:27 -0800
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-21 21:17 -0800
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-21 15:54 -0700
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-21 21:20 -0800
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-22 00:01 -0700
Re: Trees Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-21 23:56 -0700
Re: Trees Paul Rubin <no.email@nospam.invalid> - 2015-01-21 23:16 -0800
Re: Trees Rustom Mody <rustompmody@gmail.com> - 2015-01-22 08:54 -0800
Re: Trees Terry Reedy <tjreedy@udel.edu> - 2015-01-20 21:19 -0500
Re: Trees Mario Figueiredo <marfig@gmail.com> - 2015-01-21 14:05 +0000
csiph-web