Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46557

Re: How clean/elegant is Python's syntax?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <torriem@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'level,': 0.07; 'created,': 0.09; 'etc).': 0.09; 'implements': 0.09; 'means,': 0.09; 'mixed': 0.09; 'oop': 0.09; 'subject:How': 0.10; 'python': 0.11; 'language.': 0.14; 'attributes,': 0.16; 'c++.': 0.16; 'callable.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'java.': 0.16; 'singleton': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; "python's": 0.19; 'seems': 0.21; '(the': 0.22; 'code,': 0.22; 'programming': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'oriented': 0.24; 'java': 0.24; 'class.': 0.26; 'define': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'code': 0.31; "d'aprano": 0.31; 'piece': 0.31; 'steven': 0.31; 'run': 0.32; 'quite': 0.32; 'skip:_ 10': 0.34; 'could': 0.34; 'problem': 0.35; 'classes': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'consistent': 0.36; 'object,': 0.36; 'subject:?': 0.36; 'implement': 0.38; 'message-id:@gmail.com': 0.38; 'needed': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'functional': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'simply': 0.61; 'simple': 0.61; 'more': 0.64; 'essence': 0.91; 'procedural': 0.91
X-Virus-Scanned amavisd-new at torriefamily.org
Date Thu, 30 May 2013 17:30:34 -0600
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12
MIME-Version 1.0
To python-list@python.org
Subject Re: How clean/elegant is Python's syntax?
References <CAGVx7UWXAFHSHq37Ep-Vk=cM2wYrEGHSUhNc8s43bCvj_VcVow@mail.gmail.com> <mailman.2374.1369852683.3114.python-list@python.org> <51a6ef42$0$11118$c3e8da3@news.astraweb.com>
In-Reply-To <51a6ef42$0$11118$c3e8da3@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2462.1369956642.3114.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369956642 news.xs4all.nl 15995 [2001:888:2000:d::a6]:60832
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46557

Show key headers only | View raw


On 05/30/2013 12:18 AM, Steven D'Aprano wrote:
> In some ways, Python is a more pure OOP language than Java: everything in 
> Python is an object, including classes themselves.
> 
> In other ways, Python is a less pure and more practical language. You 
> don't have to wrap every piece of functionality in a class. Python 
> encourages you to write mixed procedural, functional and object oriented 
> code, whatever is best for the problem you are trying to solve, which is 
> very much in contrast to Java.

Depending on your understanding of what object-oriented means,
procedural and functional code is still object-oriented.  In fact
modules (the "file") are in essence singleton objects that define
attributes, but in practice there can only be one instance of this
object (module).  Seems like in Java a lot of code is needed to
implement singletons (factory, etc).  module-level code (procedural
code) could simply be thought of as singleton initialization/constructor
code that's automatically run when the singleton is created, using
import or __import__().

At the function level, a simple function is still an object that
implements callable.

Python's implementation of OO isn't quite smalltalk pure, but it is much
more consistent than in Java or C++.

But yes, Python does not force you to shoe-horn your programming into
one particular pattern.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-30 02:37 +0800
  Re: How clean/elegant is Python's syntax? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-30 06:18 +0000
    Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-30 16:54 +0800
      Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-30 10:12 -0700
        Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 03:28 +1000
          Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-30 10:59 -0700
            Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 04:22 +1000
        Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-31 01:46 +0800
        Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 03:50 +1000
        Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-31 01:50 +0800
        Re: How clean/elegant is Python's syntax? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-30 19:36 +0000
    Re: How clean/elegant is Python's syntax? Michael Torrie <torriem@gmail.com> - 2013-05-30 17:30 -0600

csiph-web