Objects in Python
MRAB
python at mrabarnett.plus.com
Wed Aug 22 11:58:31 EDT 2012
More information about the Python-list mailing list
Wed Aug 22 11:58:31 EDT 2012
- Previous message (by thread): Objects in Python
- Next message (by thread): Objects in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 22/08/2012 15:59, lipska the kat wrote: > On 22/08/12 15:13, shaun wrote: > > [snip] > >> Im very new to python and the object orientated feature doesnt seem to be as well put together as Java. Can anyone help with this problem? > > From one Java head to another I suggest you park what you know about > Java and approach Python with a clear mind. > > Python is not Java and Java is not Python, that much has become clear. > Python has actually been around longer than Java and contains many > features you will be familiar with, serialization and introspection to > name but two. The whole 'everything is an object' thing is a bit strange > at first but actually it just means that everything you write is wrapped > up in a component that exposes various standard methods and attributes, > you treat functions as Objects and modules as Objects and even your > classes will automagically sprout new attributes and properties, at > least that's what I've discovered so far. > > There is no real enforced concept of information hiding, no binding of > type to variable in fact no concept of typing at all as far as I can > see. strong typing != static typing Python is strongly typed, but not statically typed. > No interfaces and no subtype polymorphism (Python has 'Duck Type' > polymorphism and I haven't really explored all the ramifications of this > yet). It does however have multiple inheritance. > [snip] Python doesn't have interfaces as in Java because it isn't statically typed. The idea behind Duck Typing is that the actual type doesn't matter; if it supports the required method(s) and returns the expected type, then that's good enough! http://en.wikipedia.org/wiki/Duck_typing
- Previous message (by thread): Objects in Python
- Next message (by thread): Objects in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list