Re: Everything is an object in python - object class and type class

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 03:26 am, BartC asked about Value and Object: Are they in fact the same, or is there something else that can be done more reliably to show the difference? In *Python*, they are the same. All values are implemented as objects. But, speaking generically, Value and Object are

Re: Everything is an object in python - object class and type class

2015-06-04 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to get anywhere there, although RPython sounds intriguing.) Why not? We built the thing for people like you

Re: Everything is an object in python - object class and type class

2015-06-04 Thread BartC
On 04/06/2015 11:06, Laura Creighton wrote: In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to get anywhere there, although RPython sounds intriguing.) Why

Re: Everything is an object in python - object class and type class

2015-06-04 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 13:01:00 +0100, BartC writes: On 04/06/2015 11:06, Laura Creighton wrote: In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 17:29, Mark Lawrence wrote: On 03/06/2015 17:00, BartC wrote: On 03/06/2015 13:08, Marko Rauhamaa wrote: BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Mark Lawrence
On 03/06/2015 19:59, BartC wrote: Does anyone need to understand CPython for anything? No you (plural) don't. If people were to spend more time writing code and less time on hypothetical claptrap the amount of noise on this list would probably be reduced by 99%. Then knock out those

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 21:58, Mark Lawrence wrote: On 03/06/2015 19:59, BartC wrote: Does anyone need to understand CPython for anything? No you (plural) don't. If people were to spend more time writing code and less time on hypothetical claptrap the amount of noise on this list would probably be

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Mark Lawrence
On 03/06/2015 22:33, BartC wrote: On 03/06/2015 21:58, Mark Lawrence wrote: Not so hypothetical in my case as I have to implement a lot of this stuff. I'm also quite interested in how Python does things. If it's a good idea I'll copy it, if not I'll try and avoid it! Which implementation,

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 22:49, Mark Lawrence wrote: On 03/06/2015 22:33, BartC wrote: On 03/06/2015 21:58, Mark Lawrence wrote: Not so hypothetical in my case as I have to implement a lot of this stuff. I'm also quite interested in how Python does things. If it's a good idea I'll copy it, if not I'll

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 05:16, Eddilbert Macharia wrote: On Tuesday, June 2, 2015 at 2:27:31 PM UTC+3, Steven D'Aprano wrote: Eddilbert, have you programmed in any other languages? It would help you understand if you have. Sadly yes i have worked with java, and that is what is causing me so much

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 11:38, Chris Angelico wrote: On Wed, Jun 3, 2015 at 8:20 PM, BartC b...@freeuk.com wrote: I have a lot of trouble with this stuff too, as my ideas are decidedly old-fashioned. (Also I'm developing a language with some OO aspects without ever having used OO!) But, it is mostly

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 11:20, BartC wrote: 'genfield' is a field (attribute) that can't be resolved, but the possibilities have been reduced to a small, finite set which is resolved at load-time (in Python, the attribute could be anything, and you don't even know at runtime what it might be until you

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 05:31, Jon Ribbens wrote: On 2015-06-02, Dr. Bigcock dreamingforw...@gmail.com wrote: On Tuesday, June 2, 2015 at 1:49:03 PM UTC-5, Jon Ribbens wrote: On 2015-06-02, Dr. Bigcock dreamingforw...@gmail.com wrote: It doesn't really do anything. No one uses integers as

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Chris Angelico
On Wed, Jun 3, 2015 at 8:20 PM, BartC b...@freeuk.com wrote: I have a lot of trouble with this stuff too, as my ideas are decidedly old-fashioned. (Also I'm developing a language with some OO aspects without ever having used OO!) But, it is mostly just jargon. If you go back to using

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 03:59, BartC wrote: Javascript primitives include Number and String. What does Python allow to be done with its Number (int, etc) and String types that can't be done with their Javascript counterparts, that makes /them/ objects? That's a good question, and I'm not

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: Grant Edwards invalid@invalid.invalid: On 2015-06-02, Ian Kelly ian.g.ke...@gmail.com wrote: Accepting for the sake of argument that something to be subclassed is a reasonable definition of object, Huh? You can't subclass an object.

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 08:49, Dr. Bigcock wrote: You need classes for objects. Anything else, and you're confusing yourself. Not quite. https://en.wikipedia.org/wiki/Prototype-based_programming -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: In Python, classes are little more than constructor functions. [...] Classes give you an inheritance hierarchy. That's encapsulated in the constructor. From the class user's point

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Ian Kelly
On Wed, Jun 3, 2015 at 2:57 AM, Marko Rauhamaa ma...@pacujo.net wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: In Python, classes are little more than constructor functions. [...] Classes give you an inheritance

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marko Rauhamaa
BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in mind that: -12 == -12 True -12 is -12 False IOW, the literal expression -12 happens to construct a

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marco Buttu
On 03/06/2015 13:08, BartC wrote: Come on, we're trying to keep this simple. If we really want to keep it simple, we can take this starting point: http://en.wikipedia.org/wiki/Object_(computer_science) If we agree with the Wikipedia definition: ``In the class-based object-oriented

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Chris Angelico
On Wed, Jun 3, 2015 at 9:08 PM, BartC b...@freeuk.com wrote: On 03/06/2015 11:38, Chris Angelico wrote: On Wed, Jun 3, 2015 at 8:20 PM, BartC b...@freeuk.com wrote: I have a lot of trouble with this stuff too, as my ideas are decidedly old-fashioned. (Also I'm developing a language with some

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Eddilbert Macharia
Hello guys, After i read http://python-history.blogspot.com/2009/02/first-class-everything.html . where Guidos says One of my goals for Python was to make it so that all objects were first class. By this, I meant that I wanted all objects that could be named in the language (e.g., integers,

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 13:08, Marko Rauhamaa wrote: BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in mind that: -12 == -12 True -12 is -12 False IOW, the

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Terry Reedy
On 6/3/2015 12:00 PM, BartC wrote: That's a different matter. However, you appear to be wrong. print (-12 is -12) gives True. As does (abc is abc). I assume constructions for immutable values will do the same (([10,20,30] is [10,20,30]) gives False because the constructs are mutable, although

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Terry Reedy
On 6/3/2015 6:20 AM, BartC wrote: But, it is mostly just jargon. If you go back to using 'variable' and 'type', then it becomes a bit easier: * A variable is an instance of some type. That is clear enough in itself, but be aware that many people use 'variable' as a synonym for typeless

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Mark Lawrence
On 03/06/2015 17:00, BartC wrote: On 03/06/2015 13:08, Marko Rauhamaa wrote: BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in mind that: -12 == -12 True

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Michael Torrie
On 06/03/2015 10:00 AM, BartC wrote: The others all give True in all cases. It seems that older Python versions have a purer object model. No. It's just an under-the-hood optimization that the interpreter is making. It's an implementation detail that you should never rely on. It says nothing

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Eddilbert Macharia
can you please stick to the point.take your differences else where.please.stay on target...some of us are learning... its annoying and tiring to have to read the insults and innuendo -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 17:36, Michael Torrie wrote: On 06/03/2015 10:00 AM, BartC wrote: The others all give True in all cases. It seems that older Python versions have a purer object model. No. It's just an under-the-hood optimization that the interpreter is making. It's an implementation detail

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Chris Angelico
On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody rustompm...@gmail.com wrote: Plates and spoons and knives and forks are objects. Cars and trucks and ships and planes are objects. Books and shoes and maps and compasses are objects. Buildings are objects. And blueprints of buildings are objects

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 2:08:08 PM UTC+5:30, Chris Angelico wrote: On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody wrote: Plates and spoons and knives and forks are objects. Cars and trucks and ships and planes are objects. Books and shoes and maps and compasses are objects. Buildings are

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: On Tue, Jun 2, 2015 at 5:44 PM, Rustom Mody rustompm...@gmail.com wrote: 1 ∈ all these Are the '∈'s here same? Similar? Yes, they are. Every one of them is asserting (or asking, depending on your point of view) whether or not the instance to its left is a

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 10:24, TheDoctor wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. Nobody says that blueprints are *buildings*. But buildings are not the only kind of object that exists.

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 12:42:31 PM UTC+5:30, Steven D'Aprano wrote: On Tuesday 02 June 2015 10:24, TheDoctor wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. Nobody says that

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Jon Ribbens
On 2015-06-02, BartC b...@freeuk.com wrote: On 02/06/2015 18:00, Steven D'Aprano wrote: Again, this is not relevant. Javascript is dynamically typed, but some values are machine primitives and other values are objects. The interpreter keeps track of this at runtime. Javascript primitives

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 02/06/2015 18:00, Steven D'Aprano wrote: On Tue, 2 Jun 2015 10:49 pm, BartC wrote: On 02/06/2015 12:27, Steven D'Aprano wrote: In the programming language Java, *some* values are objects, and some values are not objects. In the programming language Python, *all* values are objects, in

Re: Everything is an object in python - object class and type class

2015-06-02 Thread random832
On Tue, Jun 2, 2015, at 13:59, BartC wrote: On 02/06/2015 18:00, Steven D'Aprano wrote: Again, this is not relevant. Javascript is dynamically typed, but some values are machine primitives and other values are objects. The interpreter keeps track of this at runtime. Javascript

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Jon Ribbens
On 2015-06-02, Dr. Bigcock dreamingforw...@gmail.com wrote: It doesn't really do anything. No one uses integers as objects. (Any dissenters?) Yes. *Everyone* uses integers as objects. Containers such as lists and dictionaries and tuples etc contain objects. If integers weren't objects then you

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 12:10 PM, Ned Batchelder n...@nedbatchelder.com wrote: On Tuesday, June 2, 2015 at 1:59:37 PM UTC-4, BartC wrote: Javascript primitives include Number and String. What does Python allow to be done with its Number (int, etc) and String types that can't be done with their

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ned Batchelder
On Tuesday, June 2, 2015 at 1:59:37 PM UTC-4, BartC wrote: On 02/06/2015 18:00, Steven D'Aprano wrote: On Tue, 2 Jun 2015 10:49 pm, BartC wrote: On 02/06/2015 12:27, Steven D'Aprano wrote: In the programming language Java, *some* values are objects, and some values are not objects.

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Tue, Jun 2, 2015 at 3:47 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: The classic response to Super Considered Harmful for those who may be interested is https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ and recently https://www.youtube.com/watch?v=EiOglTERPEo I feel

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Grant Edwards
On 2015-06-02, Ian Kelly ian.g.ke...@gmail.com wrote: Sorry. I meant object in the sense of OOP: something you might extend or make a derived class with. I'm not sure you get to define which properties of objects you want not to count. Accepting for the sake of argument that something to

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
Grant Edwards invalid@invalid.invalid: On 2015-06-02, Ian Kelly ian.g.ke...@gmail.com wrote: Accepting for the sake of argument that something to be subclassed is a reasonable definition of object, Huh? You can't subclass an object. You can subclass a Class. More to the point: you don't

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Eddilbert Macharia
On Tuesday, June 2, 2015 at 2:27:31 PM UTC+3, Steven D'Aprano wrote: On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, and still i have understood ,what makes everything in python an object. hey is where i'm at : *** type in

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Mark Lawrence
On 03/06/2015 05:16, Eddilbert Macharia wrote: Sadly yes i have worked with java, and that is what is causing me so much grief.In java objects are instance of a class.pretty simple. You might like to read http://dirtsimple.org/2004/12/python-is-not-java.html and

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Eddilbert Macharia
On Sunday, May 31, 2015 at 5:34:20 PM UTC+3, Eddilbert Macharia wrote: Hello All , I'm wrecking my head trying to understand. where the class object comes into play . Is it only meant to act as base class and does it mean there is an actual class called object in python which all the

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 4:16:02 PM UTC+5:30, BartC wrote: On 01/06/2015 23:59, BartC wrote: In the new class style, type and class sort of mean the same thing. I'm developing a new language along the lines of Python, (After reading some of the rest of the sub-thread, I'm glad I

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 01/06/2015 23:59, BartC wrote: In the new class style, type and class sort of mean the same thing. I'm developing a new language along the lines of Python, (After reading some of the rest of the sub-thread, I'm glad I reined in some of the proposed changes to my existing language to

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, and still i have understood ,what makes everything in python an object. hey is where i'm at : *** type in python refers to data types e.g. int, str, boolean e.t.c. right ? Yes. Also

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Mark Lawrence
On 02/06/2015 11:36, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, and still i have understood ,what makes everything in python an object. After 14 or more years writing Python I can't really answer that and quite frankly it doesn't worry me as I can

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, and still i have understood ,what makes everything in python an object. hey is where i'm at : *** type in

Re: Everything is an object in python - object class and type class

2015-06-02 Thread BartC
On 02/06/2015 12:27, Steven D'Aprano wrote: Object has a general meaning in computer science and programming, it is a compound data structure that is explicitly linked to a type which provides functionality that operates on that data structure. In the programming language C, *no* values are

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Marko Rauhamaa
BartC b...@freeuk.com: If you define 'object' in a certain way (eg. as boxed, tagged data), then it follows that some values don't need to be objects. The word object really barely carries any meaning -- that's the point. It's a Latin-based synonym of the Germanic thing. To say that

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Ian Kelly
On Mon, Jun 1, 2015 at 4:59 PM, BartC b...@freeuk.com wrote: I'm developing a new language along the lines of Python, perhaps a brief description of how things are done there might help. Or just give a different perspective. Objects in this language are tagged: there's a code attached to each

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 09:40 pm, Rustom Mody wrote: On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: [...] *** The instance of class type is a data type an instance of class type. right ? type(type) class 'type'

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 8:38:42 PM UTC+5:30, Steven D'Aprano wrote: On Tue, 2 Jun 2015 09:40 pm, Rustom Mody wrote: On Tuesday, June 2, 2015 at 4:57:31 PM UTC+5:30, Steven D'Aprano wrote: On Tue, 2 Jun 2015 08:36 pm, Eddilbert Macharia wrote: [...] *** The instance of class type is

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Terry Reedy
On 6/2/2015 6:36 AM, Eddilbert Macharia wrote: you guys are just confusing me, you are going in loops, Ignore the troll who is trying to confuse you by slandering the rest of us. I have been using python for 18 years, I believe. Current Python has a loop at the core isinstance(type,

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tue, 2 Jun 2015 10:49 pm, BartC wrote: On 02/06/2015 12:27, Steven D'Aprano wrote: Object has a general meaning in computer science and programming, it is a compound data structure that is explicitly linked to a type which provides functionality that operates on that data structure. In

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 11:15, TheDoctor wrote: A type is not an object. Yes it is. py isinstance(type, object) True py isinstance(int, object) True You see it as one, because you are MENTALLY lexing your own code on the screen. No, I see it as one, because it is one. But python does

Re: Everything is an object in python - object class and type class

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 11:02, TheDoctor wrote: On Monday, June 1, 2015 at 7:33:11 PM UTC-5, Chris Angelico wrote: On Tue, Jun 2, 2015 at 10:24 AM, TheDoctor dreamingforw...@gmail.com wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a

Religion [was Re: Everything is an object in python - object class and type class]

2015-06-02 Thread Steven D'Aprano
On Tuesday 02 June 2015 15:01, Rustom Mody wrote: eg Would it make sense to you if you were told that there are widespread religions like Buddhism that are agnostic or Jainism that are strictly atheistic? No of course it wouldn't make sense. But nothing to do with religion, spirituality and

Re: Religion [was Re: Everything is an object in python - object class and type class]

2015-06-02 Thread Mark Lawrence
On 02/06/2015 07:04, Steven D'Aprano wrote: On Tuesday 02 June 2015 15:01, Rustom Mody wrote: eg Would it make sense to you if you were told that there are widespread religions like Buddhism that are agnostic or Jainism that are strictly atheistic? No of course it wouldn't make sense. But

Re: Religion [was Re: Everything is an object in python - object class and type class]

2015-06-02 Thread Rustom Mody
On Tuesday, June 2, 2015 at 11:34:34 AM UTC+5:30, Steven D'Aprano wrote: On Tuesday 02 June 2015 15:01, Rustom Mody wrote: eg Would it make sense to you if you were told that there are widespread religions like Buddhism that are agnostic or Jainism that are strictly atheistic? No of

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Eddilbert Macharia
Thank you for you responses guys. So what I'm getting from above responses, everything in python is an object because the are instance of the metaclass type (from Steven response) and also because they are subclasses of the class object (from Marco and Terry response)? I'm having headache

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Eddilbert Macharia
So what im getting from above reponse, everything in python is an object because the are instance of the metaclass type and also because they are subclasses of the class object ? On Sunday, May 31, 2015 at 5:34:20 PM UTC+3, Eddilbert Macharia wrote: Hello All , I'm wrecking my head trying

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Steven D'Aprano
On Mon, 1 Jun 2015 10:29 am, Eddilbert Macharia wrote: So what im getting from above reponse, everything in python is an object because the are instance of the metaclass type and also because they are subclasses of the class object ? No. Everything in Python is an object because Python has

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Steven D'Aprano
On Mon, 1 Jun 2015 01:09 pm, Eddilbert Macharia wrote: Thank you for you responses guys. So what I'm getting from above responses, everything in python is an object because the are instance of the metaclass type (from Steven response) and also because they are subclasses of the class object

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Eddilbert Macharia
Thank you all who have taken there time to assist me. Special thanks to Steven D'Aparo even though you didn't have two you have taken you time to go into details. I think i kind of understand now. Instead of python having data types like int, string, e.t.c it has two primitive types which are

Re: Everything is an object in python - object class and type class

2015-06-01 Thread vern . muhr
On Sunday, May 31, 2015 at 7:34:20 AM UTC-7, Eddilbert Macharia wrote: Hello All , I'm wrecking my head trying to understand. where the class object comes into play . Is it only meant to act as base class and does it mean there is an actual class called object in python which all the

Re: Everything is an object in python - object class and type class

2015-06-01 Thread BartC
On 01/06/2015 13:03, Eddilbert Macharia wrote: Thank you all who have taken there time to assist me. Special thanks to Steven D'Aparo even though you didn't have two you have taken you time to go into details. I think i kind of understand now. Instead of python having data types like int,

Re: Everything is an object in python - object class and type class

2015-06-01 Thread random832
On Mon, Jun 1, 2015, at 20:24, TheDoctor wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. What is an object? It's something you can call str or repr on. It's something you can lookup attributes

Re: Everything is an object in python - object class and type class

2015-06-01 Thread TheDoctor
On Monday, June 1, 2015 at 7:33:11 PM UTC-5, Chris Angelico wrote: On Tue, Jun 2, 2015 at 10:24 AM, TheDoctor dreamingforw...@gmail.com wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. And

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Rustom Mody
On Tuesday, June 2, 2015 at 10:17:55 AM UTC+5:30, TheDoctor wrote: Mark, one of my real names. Thanks -- that helps. People are dumb, but perhaps I am dumb for treating them as equals. Perhaps that's not a fair assumption. That doesn't. It's quite clear, that there's a bit of

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Chris Angelico
On Tue, Jun 2, 2015 at 10:24 AM, TheDoctor dreamingforw...@gmail.com wrote: On Monday, June 1, 2015 at 7:03:49 AM UTC-5, Eddilbert Macharia wrote: I think i kind of understand now. Instead of python having data types like int, string, e.t.c it has two primitive types which are class type and

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Chris Angelico
On Tue, Jun 2, 2015 at 11:15 AM, TheDoctor dreamingforw...@gmail.com wrote: Let me make this clearer to you, Chris, because I don't want you to have to suck it too, like the rest of this community. A type is not an object. You see it as one, because you are MENTALLY lexing your own code on

Re: Everything is an object in python - object class and type class

2015-06-01 Thread TheDoctor
On Monday, June 1, 2015 at 11:09:09 PM UTC-5, rand...@fastmail.us wrote: On Mon, Jun 1, 2015, at 20:24, TheDoctor wrote: A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. What is an object? It's

Re: Everything is an object in python - object class and type class

2015-06-01 Thread TheDoctor
On Monday, June 1, 2015 at 7:03:49 AM UTC-5, Eddilbert Macharia wrote: I think i kind of understand now. Instead of python having data types like int, string, e.t.c it has two primitive types which are class type and class object which are created by python interpreter during its setup

Re: Everything is an object in python - object class and type class

2015-06-01 Thread random832
On Mon, Jun 1, 2015, at 21:15, TheDoctor wrote: In Python 2.7 type(type) is type (not object), but isinstance(type, object) is true -- so it is ambiguous, even contradictory, in the language. isinstance(type, object) is true because object is the parent class of type. issubclass(type, object)

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Rustom Mody
Two unrelated points: On Tuesday, June 2, 2015 at 5:54:43 AM UTC+5:30, TheDoctor wrote: On Monday, June 1, 2015 at 7:03:49 AM UTC-5, Eddilbert Macharia wrote: I think i kind of understand now. Instead of python having data types like int, string, e.t.c it has two primitive types which

Re: Everything is an object in python - object class and type class

2015-06-01 Thread TheDoctor
A type is not an object in the same way an instantiated type is an object -- anymore than a blueprint for a building is the building itself. Point 1 Yes. You may be onto something here Mark [I assume that's your name]. Some very intelligent people have suggested that the sloppy use of

Re: Everything is an object in python - object class and type class

2015-06-01 Thread Mark Lawrence
On 02/06/2015 04:15, Rustom Mody wrote: Two unrelated points: On Tuesday, June 2, 2015 at 5:54:43 AM UTC+5:30, TheDoctor wrote: On Monday, June 1, 2015 at 7:03:49 AM UTC-5, Eddilbert Macharia wrote: I think i kind of understand now. Instead of python having data types like int, string, e.t.c

Re: Everything is an object in python - object class and type class

2015-06-01 Thread TheDoctor
On Monday, June 1, 2015 at 7:33:11 PM UTC-5, Chris Angelico wrote: And a type is an object too. There is no significant difference here. Let me make this clearer to you, Chris, because I don't want you to have to suck it too, like the rest of this community. A type is not an object. You see

Re: Everything is an object in python - object class and type class

2015-05-31 Thread Marco Buttu
On 31/05/2015 16:34, Eddilbert Macharia wrote: Also when we say everything is an object in python, are we referring to the fact that everything is an instance of the class type or does it have to with the object class inherited ? From Wikipedia: In the class-based object-oriented

Re: Everything is an object in python - object class and type class

2015-05-31 Thread Terry Reedy
On 5/31/2015 10:34 AM, Eddilbert Macharia wrote: I'm wrecking my head trying to understand. where the class object comes into play . Leaving custom metaclasses aside. 1. All python data values are instances of some class. 2. Every class is a instance of the metaclass 'type'. 3. Every

Re: Everything is an object in python - object class and type class

2015-05-31 Thread Steven D'Aprano
On Mon, 1 Jun 2015 12:34 am, Eddilbert Macharia wrote: Hello All , I'm wrecking my head trying to understand. where the class object comes into play . This is just the standard object-oriented concept of class and instances. Have you programmed in any other OO language? Lassie is an

Re: Everything is an object in python - object class and type class

2015-05-31 Thread random832
On Sun, May 31, 2015, at 10:34, Eddilbert Macharia wrote: Hello All , I'm wrecking my head trying to understand. where the class object comes into play . Is it only meant to act as base class and does it mean there is an actual class called object in python which all the objects created

Everything is an object in python - object class and type class

2015-05-31 Thread Eddilbert Macharia
Hello All , I'm wrecking my head trying to understand. where the class object comes into play . Is it only meant to act as base class and does it mean there is an actual class called object in python which all the objects created using the class type inherit ? i'm assuming the metaclass if