2011/8/31 Yaşar Arabacı :
> @Ian: Thanks for you comments. I indeed didn't need the _sozcuk attribute at
> all, so I deleted it. My class's addition and multiplication works without
> overwriting __add__ and __mul__ because, this class uses unicode's __add__
> and __mul__ than creates a new kelime
@Ian: Thanks for you comments. I indeed didn't need the _sozcuk attribute at
all, so I deleted it. My class's addition and multiplication works without
overwriting __add__ and __mul__ because, this class uses unicode's __add__
and __mul__ than creates a new kelime instance with return value of thos
2011/8/31 Yaşar Arabacı :
> I made a class like this (I shortened it just to show the point), what do
> you think about it, do you think it is the python way of subclassing str (or
> unicode in this case)
You don't need the _sozcuk attribute at all here. It's just the same
as the value of the uni
On 8/31/2011 7:43 AM, Yaşar Arabacı wrote:
Hİ,
I originally posted my question to here:
http://stackoverflow.com/q/7255655/886669 Could you people please look
at it and enlighten me a little bit? I would appreciate an answer either
from here or at stackoverflow.
I believe two people already ga
I made a class like this (I shortened it just to show the point), what do
you think about it, do you think it is the python way of subclassing str (or
unicode in this case)
# -*- coding:utf-8 -*-class kelime(unicode):
def __init__(self,sozcuk):
self._sozcuk = sozcuk
def __getattr
On Wed, Nov 10, 2010 at 8:14 PM, not1xor1 (Alessandro) <"
"@libero.it> wrote:
> Il 09/11/2010 03:18, Lawrence D'Oliveiro ha scritto:
>
>> How exactly does
>>
>> a.f(b, c)
>>
>> save time over
>>
>> f(a, b, c)
>
> unfortunately in real world you have:
>
> objId = objId.method(args)
>
> vs.
>
Il 09/11/2010 03:18, Lawrence D'Oliveiro ha scritto:
How exactly does
a.f(b, c)
save time over
f(a, b, c)
unfortunately in real world you have:
objId = objId.method(args)
vs.
objId = moduleName.method(objId, args)
I know you can use "from moduleName import *", but IMHO that pro
In message <87lj52kwln.fsf@metalzone.distorted.org.uk>, Mark Wooding
wrote:
> One option is to implement a subclass which implements the additional
> protocol.
This is why I think object orientation ruins your ability to think properly.
For “protocol” read “function”. If you want to impleme
Lawrence D'Oliveiro writes:
> In message <87lj52kwln.fsf@metalzone.distorted.org.uk>, Mark Wooding
> wrote:
>
> > One option is to implement a subclass which implements the additional
> > protocol.
>
> This is why I think object orientation ruins your ability to think
> properly. For “proto
rantingrick writes:
> 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 c
On Nov 8, 8:18 pm, Lawrence D'Oliveiro wrote:
> In message <5dlbo.1024$w8@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 managea
In message <5dlbo.1024$w8@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
Il 07/11/2010 07:41, Chris Rebert wrote:
You could subclass UserString instead of str; all of UserString's
methods seem to ensure that instances of the subclass rather than just
plain strs or UserStrings are returned. See
http://docs.python.org/library/userdict.html#UserString.UserString
I'll
On Sat, Nov 6, 2010 at 10:43 PM, not1xor1 (Alessandro) <"
"@libero.it> wrote:
> Hi,
>
> I'd like to know what is the best way to subclass str
> I need to add some new methods and that each method (both new and str ones)
> return my new type
>
> For instance I've seen I can do:
>
> class mystr(str):
14 matches
Mail list logo