[yt-dev] Region object API change

Cameron Hummels chummels at gmail.com
Mon Jul 28 06:55:05 PDT 2014


That's true.  I'll make an issue for this so we deal with it after 3.0 is
out.


On Mon, Jul 28, 2014 at 6:52 AM, Britton Smith <brittonsmith at gmail.com>
wrote:

> For what it's worth, I agree that this merits another look in the future.
>  In principle, I like the two-argument syntax for create a region much
> better.  Python doesn't support overloading to my knowledge, but you can
> make a function accept different numbers of arguments like the following:
>
> def some_func(*args):
>     if len(args) == 2:
>         do something
>     elif len(args) == 3:
>         do something else
>
>
> On Sat, Jul 26, 2014 at 3:20 AM, Matthew Turk <matthewturk at gmail.com>
> wrote:
>
>> -1. Too late in the cycle, but we can revisit (with compat layer) in the
>> future.
>> On Jul 25, 2014 8:40 PM, "Cameron Hummels" <chummels at gmail.com> wrote:
>>
>>> As I'm writing up the objects documentation, I realize that we have some
>>> weirdness with our "region" object in that we require it to have a
>>> specified center, even though the only things which are really needed to
>>> specify a 3D box are the left corner and right corner.  I know in the past
>>> I've been perplexed by this additional center point requirement, and it
>>> might confuse others.  Since 3.0 is the time to break API, how do people
>>> feel about changing the constructor for the region object to just be:
>>>
>>> region(left corner, right corner)
>>>
>>> instead of the current constructor:
>>>
>>> region(center, left corner, right corner)
>>>
>>> ?
>>>
>>> I realize that this is right before the release, but it seems like if
>>> we're going to change it, now is the time to do it.  In fact, I was looking
>>> at ways to overload the region class with a wrapper so that we could just
>>> automatically accept 2 arguments and calculate the average of the left and
>>> right corners to pass to the 3-argument constructor.  But I couldn't seem
>>> to find a way to make this work.
>>>
>>> +/-1 on changing the region constructor?
>>>
>>> Cameron
>>>
>>> --
>>> Cameron Hummels
>>> Postdoctoral Researcher
>>> Steward Observatory
>>> University of Arizona
>>> http://chummels.org
>>>
>>> _______________________________________________
>>> yt-dev mailing list
>>> yt-dev at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>>>
>>>
>> _______________________________________________
>> yt-dev mailing list
>> yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>>
>>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>


-- 
Cameron Hummels
Postdoctoral Researcher
Steward Observatory
University of Arizona
http://chummels.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20140728/cf4c2f10/attachment.html>


More information about the yt-dev mailing list