Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.05; '(python': 0.05; 'attributes': 0.07; 'problem?': 0.07; 'see.': 0.07; 'statically': 0.07; 'type,': 0.07; 'wrapped': 0.07; 'python': 0.09; 'suggest': 0.11; 'static': 0.13; 'component': 0.15; 'interfaces': 0.15; 'attributes,': 0.16; 'clear.': 0.16; 'doesnt': 0.16; 'exposes': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'java.': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'properties,': 0.16; 'subject:Objects': 0.16; 'subtype': 0.16; 'two.': 0.16; 'wrote:': 0.17; 'typing': 0.17; 'variable': 0.20; 'bit': 0.21; 'java': 0.21; "haven't": 0.23; "i've": 0.23; 'idea': 0.24; 'feature': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'url:wiki': 0.26; 'mind.': 0.27; 'strongly': 0.27; "doesn't": 0.28; 'actual': 0.28; 'far.': 0.29; 'received:192.168.1.3': 0.29; 'url:wikipedia': 0.29; 'objects': 0.29; 'classes': 0.30; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'clear': 0.35; 'expected': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'modules': 0.36; 'does': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'fact': 0.38; 'object': 0.38; 'supports': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'your': 0.60; 'real': 0.61; 'first': 0.61; 'strange': 0.62; 'information': 0.63; 'become': 0.65; 'treat': 0.65; 'header:Reply-To:1': 0.68; 'reply- to:no real name:2**0': 0.72; 'discovered': 0.83; 'enforced': 0.84; 'reply-to:addr:python.org': 0.84; 'kat': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=W6e6pGqk c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=DKcI9XZsuF4A:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=bbxUIyF837gA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=8pif782wAAAA:8 a=LDUN8wJHQHpglWMrxpcA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Wed, 22 Aug 2012 16:58:31 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Objects in Python References: <18409992-1e28-4721-8e64-60c69668da4e@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345651107 news.xs4all.nl 6902 [2001:888:2000:d::a6]:34634 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27649 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