sub-classing the types in the builtin module datetime

C

Colin J. Williams

I wish to sub-class (if that's the right word) datetime and to use a
different signature for the constructor.

The second part has gone smoothly, but it is difficult to access the
type's methods from the sub-class instance.

I'm beginning to wonder whether it might might be simpler to write my
own Date class.

Does anyone have any comments please?

Colin W.
 
M

Michael Amrhein

Colin said:
I wish to sub-class (if that's the right word) datetime and to use a
different signature for the constructor.

The second part has gone smoothly, but it is difficult to access the
type's methods from the sub-class instance.
What's difficult?
mydt(2007, 8, 15, 18, 57, 58, 562000)

How did you overwrite the constuctor?
Are you sure your constructor really returns a subclass of datetime?
I'm beginning to wonder whether it might might be simpler to write my
own Date class.
If you only want to change the signature of the constuctor, just write a
factory function.
Does anyone have any comments please?

Colin W.

Have fun,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top