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


Groups > comp.lang.python > #36328

Re: Over 30 types of variables available in python ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <yacinechaouche@yahoo.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; 'python,': 0.02; 'classes,': 0.05; 'context': 0.05; 'c++,': 0.07; 'classes.': 0.07; 'type,': 0.07; 'python': 0.09; 'methods,': 0.09; 'slices': 0.09; 'structure,': 0.09; 'terry': 0.09; 'subject:python': 0.11; '(there': 0.16; 'buffers,': 0.16; 'bytearrays,': 0.16; 'c++.': 0.16; 'confusion': 0.16; 'email addr:udel.edu&gt;': 0.16; 'email name:&lt;tjreedy': 0.16; 'frames': 0.16; 'hashed': 0.16; 'instances,': 0.16; 'iterators,': 0.16; 'mappings,': 0.16; 'none),': 0.16; 'reedy': 0.16; 'tuples,': 0.16; 'url:html)': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'integer': 0.17; 'pointer': 0.17; 'unicode': 0.17; 'variables': 0.17; '(in': 0.18; 'jan': 0.18; 'appears': 0.18; 'equivalent': 0.20; 'to:name:python- list@python.org': 0.20; 'bit': 0.21; 'programming': 0.23; '&gt;': 0.23; 'class.': 0.23; 'monday,': 0.23; 'needed.': 0.23; "python's": 0.23; 'third-party': 0.23; 'to:2**1': 0.23; 'header :In-Reply-To:1': 0.25; 'question': 0.27; 'library.': 0.27; 'structures': 0.27; 'arrays': 0.29; 'dictionary': 0.29; 'protocols': 0.29; 'strings,': 0.29; 'types.': 0.29; 'url:mailman': 0.29; '"the': 0.29; "i'm": 0.29; 'classes': 0.30; 'normally': 0.30; 'subject: ?': 0.30; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; 'structure': 0.32; 'skip:_ 30': 0.32; 'url:listinfo': 0.32; 'getting': 0.33; 'instances': 0.33; 'null': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'reply- to:addr:yahoo.com': 0.34; 'wrong': 0.34; 'thanks': 0.34; 'list': 0.35; 'built-in': 0.35; 'principal': 0.35; 'so,': 0.35; 'pm,': 0.35; 'there': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'characters': 0.36; 'programmers': 0.36; 'url:library': 0.36; 'email addr:python.org': 0.36; 'anything': 0.36; 'charset :us-ascii': 0.36; 'does': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'object': 0.38; 'skip:o 20': 0.38; 'url:docs': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'url:mail': 0.40; 'your': 0.60; 'easy': 0.60; 'most': 0.61; 'email name:python-list': 0.62; 'between': 0.63; 'here': 0.65; 'virus': 0.66; 'header:Reply-To:1': 0.68; 'direct': 0.69; 'received:41': 0.73; '2013': 0.84; 'comparable': 0.84; 'follow,': 0.84; 'notion': 0.84; 'received:98.138.91.90': 0.84; 'received:nm14-vm2.bullet.mail.ne1.yahoo.com': 0.84; 'sets,': 0.84; 'wheel': 0.84; 'subject:available': 0.96
X-Yahoo-Newman-Property ymail-3
X-Yahoo-Newman-Id 344260.90021.bm@omp1030.mail.ne1.yahoo.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357548806; bh=0oAIEj0HRuGaC6Synv6qRy/7TdDVJpQUJlev4ubd7VQ=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=oceN0J0fzxU8FjwD5UtCvtoYhSrFtW/bfoJD4+madg7s/8WdyLUGjkjQ1a6ZJ5n92gtrnc8nvC1fWvRuiTTZVBvk8a1BMtK4tZ2lWgJa6BQ38oKNkxCDR9dSqktl8ipxAj/D0TiNVK7MXwK9lR8JcdJSLTjb/mM5kJ/0gHy8dSU=
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=4nqUEAaKAsDbyMvpdS9qiap29o5Wr3Yl1KJres7mIBVxpMr6EqObRkcfHrUx0KJxZVwxw2Sw/RDAhgGs0kN5QSM3lMAZFfYHWaLFrRlj4UzG2wShGhJYNvDSDVu0EcX2/elJCG1x6U0srvfTkns1qQDq4iU9w4CDv+KDGmRGC1U=;
X-YMail-OSG ujMFmqMVM1ldeEA9iYUVFR87nUTa1mdh5ezSZCz_KUZK6FZ 8lCidMK8JLoedUK8K.5lhTh86FTR7Zhs742iHg.X7YOnVsc13sXACou6MebQ YC7j0t0dOAy6EBAWBOkS7BE2z49cAxtfuxrETi6e_akH8TzZgghj.CN34IQm iDSV5CE3ITHX.ttIUttUk4XRrhOXf3R2wKzDx45U6npi0oe2mVQAHOI7ComT FJXOFDDo7mP7_w0F5T_5d6A3rbCkuknVL7_gI1PL1zuFjq_uc5khQ_XBhNpP yIUxIeNaORfwvQPqgGIF_Zt1ggXkISamCeiiL2WfxQQKeaWFAJAzjNNmYgVt 4IHC5NesxQAfFOaL2POScHsa72fC3TP0TC00OoFYxeRM02YTIjQY1zkm5oeM 3c5NDDvuu9mgKvZvNIN0fYExo9QPf5LLMZtmUS0aordMfgpnMWZwB8hLpNbI 5S_XabMJC5Tcd4L2qCs1U5ekJvo.1WWhNG7cNOwX9WvNho9n1AfM3Yd9uyJX gtLsc7osJDOPtEcrSpO50doGMrtNa
X-Rocket-MIMEInfo 001.001, VGhhbmtzIGZvciBhbGwgeW91ciBjb21tZW50cy4gSXQgYXBwZWFycyB0byBtZSB0aGF0IHRoZXJlIGlzIGEgc2xpZ2h0IGNvbmZ1c2lvbiBiZXR3ZWVuIHR5cGVzIGFuZCBjbGFzc2VzIHRoZW4sIHBsdXMgb3RoZXIgZW50aXRpZXMgKHByb3RvY29scyA_KQoKU28gbXkgcXVlc3Rpb24gaXMgOiBpcyB0aGVyZSBhIG5vdGlvbiBvZiAidHlwZSIgaW4gcHl0aG9uLCBsaWtlIGluIG90aGVyIGxhbmd1YWdlcyAgKGludGVnZXJzLCBib29sZWFucywgZmxvYXRzLCBzdHJpbmdzLCBjaGFyYWN0ZXJzIChpbiBjKSkgPyABMAEBAQE-
X-Mailer YahooMailWebService/0.8.130.494
References <1357513931.54941.YahooMailNeo@web125504.mail.ne1.yahoo.com> <kcd5sg$dtq$1@ger.gmane.org>
Date Mon, 7 Jan 2013 00:53:26 -0800 (PST)
From chaouche yacine <yacinechaouche@yahoo.com>
Subject Re: Over 30 types of variables available in python ?
To Terry Reedy <tjreedy@udel.edu>, "python-list@python.org" <python-list@python.org>
In-Reply-To <kcd5sg$dtq$1@ger.gmane.org>
MIME-Version 1.0
Content-Type multipart/alternative; boundary="329289550-1678659847-1357548806=:71297"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To chaouche yacine <yacinechaouche@yahoo.com>
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.209.1357548954.2939.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357548954 news.xs4all.nl 6930 [2001:888:2000:d::a6]:38874
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36328

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Thanks for all your comments. It appears to me that there is a slight confusion between types and classes then, plus other entities (protocols ?)

So my question is : is there a notion of "type" in python, like in other languages  (integers, booleans, floats, strings, characters (in c)) ? if so, can you give a list of the available "types" ? 


The documentation (http://docs.python.org/2/library/stdtypes.html) states "The principal built-in types are numerics, sequences, mappings, files, classes,
instances and exceptions."






________________________________
 From: Terry Reedy <tjreedy@udel.edu>
To: python-list@python.org 
Sent: Monday, January 7, 2013 1:45 AM
Subject: Re: Over 30 types of variables available in python ?
 
On 1/6/2013 6:12 PM, chaouche yacine 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.

They would better be called classes. Every thing is Python is an instance of a class. 'Iterator' and 'context manager' are protocols that multiple classes can follow, not classes themselves.

> 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.

C has up to 8 integer types, Python 3 just 1. Most of the above are structures in C, which may or may not by typedef-ed, or classes in C++. If you counted all the structures and classes that come with C or C++, you would find a comparable number.

C stdlib has a pointer to file structure type, which is equivalent to Python's file class. It is true that C does not come with hashed arrays (sets) and hashed associative arrays (dicts), but they are often needed. So C programmers either reinvent the wheel or include a third-party library. C also has frame structure, but they are normally hidden. C programmers do not have easy direct access. However, virus writers learn to work with them ;-(.

-- Terry Jan Reedy

-- http://mail.python.org/mailman/listinfo/python-list

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


Thread

Re: Over 30 types of variables available in python ? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-07 00:53 -0800
  Re: Over 30 types of variables available in python ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-07 09:52 +0000
    Re: Over 30 types of variables available in python ? marduk <marduk@python.net> - 2013-01-07 09:32 -0500
    Re: Over 30 types of variables available in python ? Dave Angel <d@davea.name> - 2013-01-07 09:45 -0500
    Re: Over 30 types of variables available in python ? Chris Angelico <rosuav@gmail.com> - 2013-01-08 01:59 +1100
  Re: Over 30 types of variables available in python ? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-10 21:20 -0800
  Re: Over 30 types of variables available in python ? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-10 21:20 -0800

csiph-web