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


Groups > comp.lang.python > #36304

Re: Over 30 types of variables available in python ?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'context': 0.05; 'float': 0.05; 'class,': 0.07; 'rest,': 0.07; 'python': 0.09; 'int)': 0.09; 'methods,': 0.09; 'objects.': 0.09; 'slices': 0.09; 'subclass': 0.09; 'subject:python': 0.11; '(there': 0.16; 'binding.': 0.16; 'buffers,': 0.16; 'bytearrays,': 0.16; 'frames': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instances,': 0.16; 'iterators,': 0.16; 'none),': 0.16; 'object()': 0.16; 'quite.': 0.16; 'tuples,': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'unicode': 0.17; 'jan': 0.18; 'are:': 0.20; 'bit': 0.21; 'int,': 0.22; 'object.': 0.22; 'programming': 0.23; 'sets': 0.23; 'long,': 0.24; 'header:In- Reply-To:1': 0.25; 'am,': 0.27; 'handling': 0.27; 'message- id:@mail.gmail.com': 0.27; 'about.': 0.29; 'concern': 0.29; 'dictionary': 0.29; 'strings,': 0.29; 'types.': 0.29; 'unlikely': 0.29; "i'm": 0.29; 'maybe': 0.29; 'subject: ?': 0.30; 'code': 0.31; '(and': 0.32; 'url:python': 0.32; 'getting': 0.33; 'null': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'built-in': 0.35; 'generic': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'anything': 0.36; 'available.': 0.37; 'ones': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'object': 0.38; 'skip:o 20': 0.38; 'url:docs': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'most': 0.61; "you'll": 0.62; 'different': 0.63; 'here': 0.65; 'yourself': 0.77; '2013': 0.84; 'sets,': 0.84; 'virtue': 0.84; 'subject:available': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7b3gKuM3CZ7I4Tec1ESEvdqXgaH7tpsKxZ3zNTGawsE=; b=oLgNmTqz4uCFoX5QrDhWwwi8jH83fVpaJqk71VCT7qpcuY/SHAYLTYZbl3unk47Xn3 mu+gu2PNSmVjuhU5Clna2MMtyKPaTjvhQeJlUv0ZL4iUjFxTmE00Rzxuf8ak4WF8G057 0Orux038fRlfm6Sre9rEt6r092Mem/q/nRv/ApoBszHrDP5y49jo60beIGo9qxVBob1E hQfhZ8NQiLYFN+uE6IT66SBJu4jc6Sr3zCL5rlJYgwxY7kFbazeSCE+++UkA9nCHBr8i tp5RjANGdhsJy6nZdaHQ2qCQ1cEU3cGxXKpU8zFLpCnzOs/m8mXc2FdTlUckkUrXfXtQ Fwyw==
MIME-Version 1.0
In-Reply-To <1357513931.54941.YahooMailNeo@web125504.mail.ne1.yahoo.com>
References <1357513931.54941.YahooMailNeo@web125504.mail.ne1.yahoo.com>
Date Mon, 7 Jan 2013 10:22:39 +1100
Subject Re: Over 30 types of variables available in python ?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.197.1357514561.2939.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357514561 news.xs4all.nl 6947 [2001:888:2000:d::a6]:59468
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36304

Show key headers only | View raw


On Mon, Jan 7, 2013 at 10:12 AM, chaouche yacine
<yacinechaouche@yahoo.com> wrote:
>
> booleans
> ints, floats, longs, complexes
> strings, unicode strings
> lists, tuples, dictionaries, dictionary views, sets, frozensets, buffers,
> bytearrays, slices
> functions, methods, code objects,modules,classes, instances, types, nulls
> (there is exactly one object of type Null which is None), tracebacks, frames
> generators, iterators, xranges,
> files,
> memoryviews,
> context managers,
>
> These are all listed in this page
> http://docs.python.org/2/library/stdtypes.html as built-in types. Am I
> getting anything wrong here ? I'm a bit confused about it. I have never seen
> so many types in the few programming languages I saw.

Not quite. Python has one type of variable: the name binding. Those
are different types of objects.

Since you can subclass object to make your own class, there's an
infinite number of types available. But the ones you'll be using in
most programs are:
* boolean, int, float (and long, in Python 2, but in Python 3 that's
the same as int)
* Unicode strings
* In Python 2, bytes strings
* lists, tuples, dicts, maybe sets
* functions
* files

The rest, you're unlikely to worry much about. The program will use
them under the covers, but you don't need to concern yourself with the
details. The only other thing you'll need to look at is the generic
handling of object() and, by virtue of subclassing, every other
object.

ChrisA

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


Thread

Re: Over 30 types of variables available in python ? Chris Angelico <rosuav@gmail.com> - 2013-01-07 10:22 +1100

csiph-web