SV: Python Productivity over C++

Aahz Maruch aahz at netcom.com
Wed Jun 14 11:28:32 EDT 2000


In article <3946760F.C5E46FD3 at muc.das-werk.de>,
Thomas Thiele  <thiele at muc.das-werk.de> wrote:
>Thomas Thiele deleted the attribution for Aahz:
>>
>>   I do have to wonder whether you've yet learned to think in
>> Python; it's possible that you're trying to write C++ code in Python,
>> the way some Perl people find writing Python difficult.
>
>May be. But what are typical mistakes?  How should a REAL python
>program looks like.  I design classes like in C++, thats true. But I
>also use typical python features like lists, dicts, map etc. I'm not
>trying to write everything by myself.

Let me give you an example to illustrate what Martijn wrote:

Suppose you needed a file object to connect to some chunk of memory.  In
other languages, you would need to inherit from the Python file object
in order to ensure that random functions that expect file objects would
still work.  In Python, that's completely unnecessary.  It's probably a
lot simpler to create your own class, complete with open(), close(),
read(), and write() methods -- and because you've maintained *interface*
consistency, you can use your new class *ANYWHERE* a file object would
go.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"real love can't be explained by simplistic platitudes."  --piranha



More information about the Python-list mailing list