On Thu, 27 Mar 2014 20:29:17 -0400, Roy Smith wrote:
In article 5334b747$0$29994$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote:
In article
In article 533558fa$0$29994$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
Yes. The whole idea of OOD is to decouple internal representation from
external behavior.
The *whole* idea? You don't think that encapsulation and inheritance
In article mailman.8667.1396012782.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
On Sat, Mar 29, 2014 at 12:10 AM, Marko Rauhamaa ma...@pacujo.net wrote:
If encapsulation exists outside OO and inheritance is not key to it,
what is OO then, a marketing term?
Yep,
On Sat, Mar 29, 2014 at 12:22 AM, Roy Smith r...@panix.com wrote:
In article mailman.8667.1396012782.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
On Sat, Mar 29, 2014 at 12:10 AM, Marko Rauhamaa ma...@pacujo.net wrote:
If encapsulation exists outside OO and
In article 871txmwjt4@elektro.pacujo.net,
Marko Rauhamaa ma...@pacujo.net wrote:
what is OO then, a marketing term?
Sometimes, I think it must be :-)
(It's a different thing, then, that encapsulation and inheritance are
mutually exclusive principles.)
There're certainly not mutually
On Friday, March 28, 2014 6:52:15 PM UTC+5:30, Roy Smith wrote:
Chris Angelico wrote:
On Sat, Mar 29, 2014 at 12:10 AM, Marko Rauhamaa wrote:
If encapsulation exists outside OO and inheritance is not key to it,
what is OO then, a marketing term?
Yep, OO is a marketing term. So's
On Sat, Mar 29, 2014 at 1:35 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
It's difficult to pin-point exactly what characteristics of OOP are
fundamental, but inheritance is surely one of them.
I've always understood OOP to be all about binding code and data
together (methods
Roy Smith r...@panix.com:
There're certainly not mutually exclusive. Mutually exclusive means if
you have one, you can't have the other.
Correct.
The classic inheritance diamond:
class A(B, C):
def add_bean(self):
??? # how to implement
class B(D): pass
class
Roy Smith r...@panix.com:
I'm not sure how decoupling internal representation from external
behavior is substantially different from encapsulation.
Yes, that's encapsulation. The idea of encapsulation is older than OO.
And, no, I don't think inheritance is a fundamental characteristic of
On Sat, Mar 29, 2014 at 12:10 AM, Marko Rauhamaa ma...@pacujo.net wrote:
If encapsulation exists outside OO and inheritance is not key to it,
what is OO then, a marketing term?
Yep, OO is a marketing term. So's programming - after all, it's just
flipping bits in memory... we only pretend it
On Fri, 28 Mar 2014 08:30:11 -0400, Roy Smith wrote:
In article 533558fa$0$29994$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
Yes. The whole idea of OOD is to decouple internal representation
from external behavior.
The *whole* idea?
On 27/03/2014 01:38, Roy Smith wrote:
In article mailman.8597.1395883727.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
On Thu, Mar 27, 2014 at 11:16 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
If an event happened 30 hours ago, it is correct to say
On 26.03.2014 10:53, Jean-Michel Pichavant wrote:
Note : I don't see what's wrong in your example, however I have the feeling
the term stupiditie is a little bit strong ;)
The problem is that for a given timedelta t with t 0 it is intuitive
to think that its string representation str(t)
On 27.03.2014 01:16, Steven D'Aprano wrote:
py divmod(30, 24)
(1, 6)
That makes perfect intuitive sense: 30 hours is 1 day with 6 hours
remaining. In human-speak, we'll say that regardless of whether the
timedelta is positive or negative: we'll say 1 day and 6 hours from now
or 1 day
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
Besides, there's an infinite amount of (braindead) timedelta string
representations. For your -30 hours, it is perfectly legal to say
123 days, -2982 hours
Yet Python doesn't (but chooses an equally braindead
On 27.03.2014 11:44, Chris Angelico wrote:
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
Besides, there's an infinite amount of (braindead) timedelta string
representations. For your -30 hours, it is perfectly legal to say
123 days, -2982 hours
Yet Python
On 27.03.2014 11:44, Chris Angelico wrote:
It's not equally braindead, it follows a simple and logical rule:
Only the day portion is negative.
The more I think about it, the sillier this rule seems to me.
A timedelta is a *whole* object. Either the whole delta is negative or
it is not. It
On Thu, Mar 27, 2014 at 10:05 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
On 27.03.2014 11:44, Chris Angelico wrote:
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
Besides, there's an infinite amount of (braindead) timedelta string
representations. For your -30
On Thu, Mar 27, 2014 at 10:25 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
And it makes it extremely error-prone to the reader:
str(datetime.timedelta(0, -1))
'-1 day, 23:59:59'
This looks MUCH more like almost two days ago than
'-00:00:01'
does.
It's easy when the timedelta is -1
I took a moment to scan the datetime documentation. The behavior of
str() on timedelta objects is very consistent, and matches the
internal representation. From the docs:
str(t) Returns a string in the form [D day[s], ][H]H:MM:SS[.UU],
where D is negative for negative t. (5)
Note (5) reads:
On Thu, Mar 27, 2014 at 10:56 PM, Skip Montanaro s...@pobox.com wrote:
There are,
as I see it, two common cases where t is negative:
-1 day t 0
and
t = -1 day
There are two types of negative numbers: Those closer to zero than -1,
and those not closer to zero than -1. Yeah, I think
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
Besides, there's an infinite amount of (braindead) timedelta string
representations. For your -30 hours, it is perfectly legal to say
123 days, -2982 hours
Yet Python doesn't (but chooses an equally braindead
There are,
as I see it, two common cases where t is negative:
-1 day t 0
and
t = -1 day
There are two types of negative numbers: Those closer to zero than -1,
and those not closer to zero than -1. Yeah, I think those are the most
common cases. :)
Sorry I wasn't clear. I see two
On Fri, Mar 28, 2014 at 1:12 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
I don't recall specifics, but I do remember multiple times
where I was working with a structure that consisted of
a whole part and a fracture part where I found it useful
to have the fracture part always
Skip Montanaro s...@pobox.com:
Feel free to submit a patch to improve str(t), where t is negative,
The cat's out of the bag already, isn't it?
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On 27-03-14 13:52, Roy Smith wrote:
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote:
Besides, there's an infinite amount of (braindead) timedelta string
representations. For your -30 hours, it is perfectly legal to say
123 days, -2982 hours
Yet Python doesn't (but
On 3/27/2014 7:42 AM, Chris Angelico wrote:
In any case... what I'd suggest would be opening a tracker issue, or
discussing this on python-ideas, and seeing what core devs think of
the matter. I think that, on balance, it's probably better to show the
whole thing with the same sign; but should
On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote:
In article mailman.8613.1395917059.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
It's not equally braindead, it follows a simple and logical rule:
Only the day portion is negative.
Simple and logical, yes. But
On 03/27/2014 02:10 PM, Terry Reedy wrote:
On 3/27/2014 7:42 AM, Chris Angelico wrote:
In any case... what I'd suggest would be opening a tracker issue, or
discussing this on python-ideas, and seeing what core devs think of
the matter. I think that, on balance, it's probably better to show the
In article 5334b747$0$29994$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote:
In article mailman.8613.1395917059.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
It's
Roy Smith r...@panix.com writes:
In article 5334b747$0$29994$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 27 Mar 2014 08:52:24 -0400, Roy Smith wrote:
Give ma a real-life situation where you would want such behavior
[the
On 3/27/2014 5:10 PM, Terry Reedy wrote:
On 3/27/2014 7:42 AM, Chris Angelico wrote:
In any case... what I'd suggest would be opening a tracker issue, or
discussing this on python-ideas, and seeing what core devs think of
the matter. I think that, on balance, it's probably better to show the
In article mailman.8647.1395971209.18130.python-l...@python.org,
Terry Reedy tjre...@udel.edu wrote:
On 3/27/2014 5:10 PM, Terry Reedy wrote:
On 3/27/2014 7:42 AM, Chris Angelico wrote:
In any case... what I'd suggest would be opening a tracker issue, or
discussing this on python-ideas,
On 3/27/2014 9:59 PM, Roy Smith wrote:
In article mailman.8647.1395971209.18130.python-l...@python.org,
Terry Reedy tjre...@udel.edu wrote:
On 3/27/2014 5:10 PM, Terry Reedy wrote:
On 3/27/2014 7:42 AM, Chris Angelico wrote:
In any case... what I'd suggest would be opening a tracker
On Fri, Mar 28, 2014 at 1:24 PM, Terry Reedy tjre...@udel.edu wrote:
I do know that the people responsible are not normally braindead ;-).
Yeah, anyone who develops Python is clearly abnormally braindead...
*dives for cover*
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 26/03/2014 01:19, Ethan Furman wrote:
On 03/25/2014 05:58 PM, Roy Smith wrote:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have some code which computes how long ago the sun set. Being a nice
It's not clear to me what the correct str should be. I think the
desired format changes depending on the relative magnitude of the
timedelta object. For small values (less than a day), I agree, the
behavior is, well, odd. You can get around that easily enough:
d = datetime.timedelta(seconds=-2)
On 26-03-14 01:58, Roy Smith wrote:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have some code which computes how long ago the sun set. Being a nice
pythonista, I'm using a timedelta to represent
On Thu, Mar 27, 2014 at 1:02 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
There is a difference between how people say things and what is useful.
I remember when I was studying logarithms, a negative number like -5.73
was written down as ̅6.27 (with a bar only over the six). That
Antoon Pardon antoon.par...@rece.vub.ac.be:
On 26-03-14 01:58, Roy Smith wrote:
previous sunset: -1 day, 22:25:26.295993
The idea of str() is that it's supposed to return a human-friendly
representation of a value. Humans do not say things like, The sun set
1 day ago plus 22 hours and 25
On Wednesday, March 26, 2014 9:37:06 AM UTC-4, Skip Montanaro wrote:
The problem gets more challenging once you get into magnitudes one
day:
e = datetime.timedelta(days=-4, seconds=3605)
e
datetime.timedelta(-4, 3605)
print e
-4 days, 1:00:05
Hmmm... It's printing just what we
On Wed, Mar 26, 2014 at 10:04 AM, Roy Smith r...@panix.com wrote:
No, what you said was negative four days, positive 3605 seconds.
My apologies for not showing all my work, professor. I use datetime
and timedelta objects all the time. I did the arithmetic to go from
3605 to one hour, five
On Mar 26, 2014, at 11:39 AM, Skip Montanaro wrote:
The point of my post was that there is no obvious one best way to
present negative timedeltas in a human readable form.
I agree that there are a number of possible representations which might make
sense. But, using negative days and
Skip Montanaro s...@pobox.com:
Note though, that the ISO8601 representation isn't without its own
flaws (which might explain why Tim avoided it BITD):
* It doesn't appear to provide a way to represent fractions of a
second (though perhaps all the fields can be fractional)
* How many days
On Wed, Mar 26, 2014 at 10:58 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Fractions of seconds are supported -- the other fields can't be
fractional.
Actually, it appears that whatever the last value you give can be
fractionated. From the Wikipedia page you referenced:
The smallest value used
Skip Montanaro s...@pobox.com:
There is a good reason that the internal units of timedelta objects
are days, seconds, and microseconds. They are well-defined outside of
a calendar context.
So, I guess Roy is back to square one. He can always roll his own
timedelta subclass and give it a
On 2014-03-26, Skip Montanaro s...@pobox.com wrote:
On Wed, Mar 26, 2014 at 10:58 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Fractions of seconds are supported -- the other fields can't be
fractional.
Actually, it appears that whatever the last value you give can be
fractionated. From the
Grant Edwards invalid@invalid.invalid writes:
We're still just papering-over the basic problem: the entire
time/calendar system use by western civilization is a mess. I don't
know a lot about other systems in use, but from what I have seen they
were all pretty much just as bad. We should fix
- Original Message -
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those
times.
I have some code which computes how long ago the sun set. Being a
nice
pythonista, I'm using a timedelta to represent this
Chris Angelico wrote:
By showing those last ones as 1̅.091... and 2̅.091..., you emphasize
the floating-point nature of the data: everything after the decimal is
the mantissa, and everything before the decimal is the exponent.
The reason for writing them that way is so that you
can look the
On 03/26/2014 04:25 PM, Dennis Lee Bieber wrote:
On Tue, 25 Mar 2014 20:58:27 -0400, Roy Smith r...@panix.com declaimed the
following:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have some code
On Wed, 26 Mar 2014 19:25:45 -0400, Dennis Lee Bieber wrote:
On Tue, 25 Mar 2014 20:58:27 -0400, Roy Smith r...@panix.com declaimed
the following:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have
On Thu, Mar 27, 2014 at 11:16 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
If an event happened 30 hours ago, it is correct to say that it occurred
18 hours after 2 days ago, but who talks that way?
That response demonstrates real genius. Rue the datetime? Who talks like
In article mailman.8597.1395883727.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
On Thu, Mar 27, 2014 at 11:16 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
If an event happened 30 hours ago, it is correct to say that it occurred
18 hours after 2
On Thu, 27 Mar 2014 00:16:57 +, Steven D'Aprano wrote:
py divmod(-30, 24)
(-2, 18)
If an event happened 30 hours ago, it is correct to say that it
occurred 18 hours after 2 days ago, but who talks that way?
Well, not *exactly*, but:
If today happens to be Wednesday, and an event
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have some code which computes how long ago the sun set. Being a nice
pythonista, I'm using a timedelta to represent this value. It would be
difficult to
On 03/25/2014 05:58 PM, Roy Smith wrote:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module. This is one of those times.
I have some code which computes how long ago the sun set. Being a nice
pythonista, I'm using a timedelta to
57 matches
Mail list logo