Re: Data Types

2016-09-22 Thread Chris Angelico
On Thu, Sep 22, 2016 at 10:33 PM, BartC wrote: >>> print (10<20)=> True >>> print (type(10<20)) => >> >> >> 10<20 shouldn't be thought of as some alternative value which is a bool, >> any >> more than we should think of 1+1 as being a different value to 2. > > > They're a little di

Re: Data Types

2016-09-22 Thread BartC
On 22/09/2016 02:40, Steve D'Aprano wrote: On Wed, 21 Sep 2016 10:25 pm, BartC wrote: On 21/09/2016 05:03, Cai Gengyang wrote: Are there any other data types that will give you type(A) or type(B) = besides True and False? No types but any variable or expression containing True or False wil

Re: Data Types

2016-09-22 Thread Steve D'Aprano
On Thu, 22 Sep 2016 01:46 pm, Sayth Renshaw wrote: > What about 0 or 1 they are true and false like no other numbers? what > category do they fall in with regards to booleans? 0 and 1 are ints: py> type(0) py> type(1) just like 2, 3, 4, -1, -999, 1098765432 etc. But just like 1 == 1.0 (a fl

Re: Data Types

2016-09-22 Thread Lawrence D’Oliveiro
On Thursday, September 22, 2016 at 3:47:27 PM UTC+12, Sayth Renshaw wrote: > What about 0 or 1 they are true and false like no other numbers? >>> isinstance(1, bool) False >>> isinstance(True, int) True -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Types

2016-09-22 Thread Larry Hudson via Python-list
On 09/20/2016 09:03 PM, Cai Gengyang wrote: [snip...] So for example for "bool" , it only applies to True/False and nothing else? (2 data types), i.e. : Not exactly... bool is the data type (or class), True and False are the only two _values_ (not types). type(True) type(False) [

Re: Data Types

2016-09-21 Thread Sayth Renshaw
> > > >> Are there any other data types that will give you type(A) or type(B) = > >> besides True and False? > > > > No types but any variable or expression containing True or False will be > > a bool type (or class bool): > > "Containing" True or False? Certainly not: > > py> type( [1, 2, Tr

Re: Data Types

2016-09-21 Thread Steve D'Aprano
On Wed, 21 Sep 2016 10:25 pm, BartC wrote: > On 21/09/2016 05:03, Cai Gengyang wrote: > >> Are there any other data types that will give you type(A) or type(B) = >> besides True and False? > > No types but any variable or expression containing True or False will be > a bool type (or class bool)

Re: Data Types

2016-09-21 Thread BartC
On 21/09/2016 05:03, Cai Gengyang wrote: Are there any other data types that will give you type(A) or type(B) = besides True and False? No types but any variable or expression containing True or False will be a bool type (or class bool): A = 10<20 print (type(A)) => print (10<20

Re: Data Types

2016-09-20 Thread Steven D'Aprano
On Wednesday 21 September 2016 14:03, Cai Gengyang wrote: > So for example for "bool" , it only applies to True/False and nothing else? Correct. True and False are the only instances of the type 'bool'. > (2 data types), i.e. : > type(True) > type(False) > > > Are there any other d

Re: Data Types

2016-09-20 Thread Cai Gengyang
On Wednesday, September 21, 2016 at 11:22:42 AM UTC+8, Steve D'Aprano wrote: > On Wed, 21 Sep 2016 01:00 pm, Cai Gengyang wrote: > > > So I am going through chapter 7.1 (Data Types) of > > http://programarcadegames.com/index.php… What do these terms (input and > > output) mean --- Can someone expl

Re: Data Types

2016-09-20 Thread Steve D'Aprano
On Wed, 21 Sep 2016 01:00 pm, Cai Gengyang wrote: > So I am going through chapter 7.1 (Data Types) of > http://programarcadegames.com/index.php… What do these terms (input and > output) mean --- Can someone explain in plain English and layman's terms ? http://www.dictionary.com/browse/input http

Re: Data types

2005-03-24 Thread Tim Jarman
[EMAIL PROTECTED] wrote: > I am new to python and learning it. Can you please give me a simple > example of user defined type through class mechanism. Python 2.4 (#1, Dec 31 2004, 17:21:43) [GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2 Type "help", "copyright", "credits" or "license" for

Re: Data types

2005-03-24 Thread Bill Mill
On 24 Mar 2005 10:29:40 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am new to python and learning it. Can you please give me a simple > example of user defined type through class mechanism. GIYF: http://www.python.org/2.2/descrintro.html#subclassing Peace Bill Mill bill.mill at gmail.

Re: Data types

2005-03-24 Thread vahmad70
I am new to python and learning it. Can you please give me a simple example of user defined type through class mechanism. -- http://mail.python.org/mailman/listinfo/python-list

Re: Data types

2005-03-24 Thread Lonnie Princehouse
Lists, tuples, and dictionaries are built-in types. Classes are the mechanism for user-defined types in Python. -- http://mail.python.org/mailman/listinfo/python-list