subclassing str

rantingrick rantingrick at gmail.com
Mon Nov 8 21:55:04 EST 2010


On Nov 8, 8:18 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <5dLBo.1024$w8.... at twister2.libero.it>, not1xor1 (Alessandro)
> wrote:
>
> > I'm already using plain functions, but thought that wrapping most of
> > them in a str subclass would let me save some time and yield cleaner
> > and more manageable code
>
> How exactly does
>
>    a.f(b, c)
>
> save time over
>
>     f(a, b, c)
>
> ?

I think if you'll re-read the OP's statements (specifically the ones
you quoted!) then you will see it's not an issue of time, its an issue
of form and structure. Its an issue of paradigm. The OP wishes to keep
his code as true to OOP as possible and what is wrong with that?
Nothing in my book!

One thing i love about Python is the fact that it can please almost
all the "religious paradigm zealots" with it's multiple choice
approach to programming. However some of the features that OOP
fundamentalists hold dear in their heart are not always achievable in
a clean manner with Python. Yes you could use a function but that is
not the OOP way. Yes you could use UserString but that also seems too
excessive. Ruby allows redefining everything. However this can open a
REAL can of worms in group environment greater than one!



More information about the Python-list mailing list