Headsup: I have started with python 2.6 about 2 hours ago. Been doing Java, C, etc. till now
TL;DR
In Java I want to understand what is an Object, I look at the javadoc here Where do I find a similar clear documentation of what a function does in python?
Long story
I understood the following
- A variable 'a' is not restricted to a given datatype.
- A variable 'a' can hold an 'int' and a 'float' at different points in time.
Ended up with a simple code and out of curiosity checked up type()
a = 1 # type(a) is int
a = 1.2 # type(a) is float
a = 1 # type(a) is int
Wanted to understand what type() in python really does and found type function that reads 'class type(object)' but Built-in data-types has no mention of either 'class' or 'object'
when i read 'class type(object)' I interpret it as
- there is a function called 'type'
- this accepts an object as a parameter
- this returns a class
But python documentation is contradicting saying "return the type of an object. The return value is a type object." and the code snippet at the documentation seemed to be creation of a class which made no sense either.
a = False # type(a) returns 'bool'
Built-in data-types talks about Boolean, so where is bool documentation located?