At Tuesday 14/11/2006 19:27, [EMAIL PROTECTED] wrote:
> >Can you point me to a description of this algorithm? It doesn't seem
> >to be described in the documentation for the rich comparison or __cmp__
> >methods...
>
> PEP 207
> http://www.python.org/dev/peps/pep-0207/
So since I implemented _
> >Can you point me to a description of this algorithm? It doesn't seem
> >to be described in the documentation for the rich comparison or __cmp__
> >methods...
>
> PEP 207
> http://www.python.org/dev/peps/pep-0207/
So since I implemented __cmp__ instead of the rich comparison
operators, Python f
At Tuesday 14/11/2006 09:33, Fredrik Lundh wrote:
GeneralizedTime() > datetime.now()
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: can't compare datetime.datetime to GeneralizedTime
>
> Clearly I'm misunderstanding something, here. As I understand my code,
> I'
At Tuesday 14/11/2006 13:41, [EMAIL PROTECTED] wrote:
> When the rich comparison methods raise NotImplementedError, the
> comparison logic inside the interpreter tries reversing the operands.
Can you point me to a description of this algorithm? It doesn't seem
to be described in the documentat
> why not just inherit from datetime instead?
I'll probably do that in the next iteration.
> or read footnote 4 under "supported operations" on this page for info on how
> to
> implement mixed-type comparisions:
>
> http://docs.python.org/lib/datetime-datetime.html
OK. I added a 'timetuple
[EMAIL PROTECTED] wrote:
>I have a class that has, as an attribute, an instance of
> datetime.datetime(). I would like to be able to compare my class
> directly to instances of datetime.datetime in addition to other
> instances of my class. The value used for the comparison in either
> case shou
> When the rich comparison methods raise NotImplementedError, the
> comparison logic inside the interpreter tries reversing the operands.
Can you point me to a description of this algorithm? It doesn't seem
to be described in the documentation for the rich comparison or __cmp__
methods...
-Ben
At Monday 13/11/2006 21:33, [EMAIL PROTECTED] wrote:
I have a class that has, as an attribute, an instance of
datetime.datetime(). I would like to be able to compare my class
directly to instances of datetime.datetime in addition to other
instances of my class. The value used for the compariso
I have a class that has, as an attribute, an instance of
datetime.datetime(). I would like to be able to compare my class
directly to instances of datetime.datetime in addition to other
instances of my class. The value used for the comparison in either
case should be the value of the datetime att