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
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
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
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
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)
[
> >
> >> 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
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)
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
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
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
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
[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
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.
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
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
15 matches
Mail list logo