To compare two instances of objects defined by others in the same class or in
derived classes from the same base class is an old problem in OOP.
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 22, 10:51 pm, SigmundV wrote:
> On Oct 22, 6:32 am, Steven D'Aprano
> +comp.lang.pyt...@pearwood.info> wrote:
>
> > Sure. But the downside of sets is that, like lists, they are not lazy,
>
> Thank you for pointing this out. I agree that it's not a viable
> alternative for large domains. St
On Oct 22, 6:32 am, Steven D'Aprano wrote:
>
> Sure. But the downside of sets is that, like lists, they are not lazy,
Thank you for pointing this out. I agree that it's not a viable
alternative for large domains. Storing the bounds and the resolution
should be enough.
/Sigmund
--
http://mail.py
On Sat, 22 Oct 2011 05:32:44 +, Steven D'Aprano wrote:
> On Fri, 21 Oct 2011 16:42:16 -0700, SigmundV wrote:
>
>> On Oct 21, 2:55 am, Yingjie Lan wrote:
>>>
>>> In simulation, one can use range objects to denote a discrete domain,
>>> and domain comparison could be very useful. Not just equa
On Fri, 21 Oct 2011 16:42:16 -0700, SigmundV wrote:
> On Oct 21, 2:55 am, Yingjie Lan wrote:
>>
>> In simulation, one can use range objects to denote a discrete domain,
>> and domain comparison could be very useful. Not just equality, but also
>> things like if one domain is contained in another.
On Oct 21, 2:55 am, Yingjie Lan wrote:
>
> In simulation, one can use range objects to denote a discrete domain,
> and domain comparison could be very useful. Not just equality, but also
> things like if one domain is contained in another.
Can't sets [help(set)] be used for this?
--
http://mail
On Thu, Oct 20, 2011 at 8:16 PM, Chris Angelico wrote:
> Hmm. I wonder would slice objects be appropriate? They're comparable:
>
a=slice(1,10)
b=slice(1,10)
a==b
> True
>
> They're not iterable though - not directly (but you could slice
> range(maxint) down to size). You could possi
On Oct 21, 12:16 pm, Chris Angelico wrote:
> Hmm. I wonder would slice objects be appropriate?
> They're not iterable though
They're not hashable either, which kind of surprised me.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 21, 2011 at 12:55 PM, Yingjie Lan wrote:
> In simulation, one can use range objects to denote a discrete domain,
> and domain comparison could be very useful. Not just equality, but also
> things like if one domain is contained in another.
>
Hmm. I wonder would slice objects be approp
- Original Message -
> From: Westley Martínez
> To: python-list@python.org
> Cc:
> Sent: Friday, October 21, 2011 12:22 AM
> Subject: Re: compare range objects
>
> There's already a discussion about this on python-ideas. But somebody
> please tell m
The range() in python is an iterable generator that returns an object ref/id.
The xrange() is different.
--
http://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
On Thu, Oct 20, 2011 at 12:00 PM, Hans Mulder wrote:
There's already a discussion about this on python-ideas. But somebody
please tell me, why would you ever need to compare ranges?
It could be useful if you're unit-testing a function that returns a range.
Easy:
list(range
On Thu, Oct 20, 2011 at 12:00 PM, Hans Mulder wrote:
>> There's already a discussion about this on python-ideas. But somebody
>> please tell me, why would you ever need to compare ranges?
>
> It could be useful if you're unit-testing a function that returns a range.
Easy:
list(range1) == list(r
On 20/10/11 18:22:04, Westley Martínez wrote:
On Thu, Oct 20, 2011 at 06:19:40AM -0700, Yingjie Lan wrote:
Hi,
Is it possible to test if two range objects contain the same sequence of
integers by the following algorithm in Python 3.2?
1. standardize the ending bound by letting it be the first
On Thu, Oct 20, 2011 at 06:19:40AM -0700, Yingjie Lan wrote:
> Hi,
>
> Is it possible to test if two range objects contain the same sequence of
> integers by the following algorithm in Python 3.2?
>
> 1. standardize the ending bound by letting it be the first excluded integer
> for the given s
Hi,
Is it possible to test if two range objects contain the same sequence of
integers by the following algorithm in Python 3.2?
1. standardize the ending bound by letting it be the first excluded integer for
the given step size.
2. compare the standardized starting bound, ending bound and step
16 matches
Mail list logo