Method default argument whose type is the class not yet defined

Ian Kelly ian.g.kelly at gmail.com
Sun Nov 11 01:43:46 EST 2012


On Sat, Nov 10, 2012 at 7:53 PM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.3549.1352601828.27098.python-list at python.org>,
>  Ian Kelly <ian.g.kelly at gmail.com> wrote:
>
>> On Sat, Nov 10, 2012 at 7:13 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> > I would not assume that. The origin is a point, just like any other.
>> > With a Line class, you could deem a zero-length line to be like a
>> > zero-element list, but Point(0,0) is more like the tuple (0,0) which
>> > is definitely True.
>>
>> It's more like the number 0 than the tuple (0,0).
>>
>> 0 is the origin on a 1-dimensional number line.
>> (0,0) is the origin on a 2-dimensional number plane.
>
>> In fact, it might be pointed out that Point(0, 0) is a generalization
>> of 0+0j, which is equal to 0.
>
>
> If (0,0) is the origin on a plane, then (0,) should be the origin on a
> line.  If you consider 0 + 0j to be the origin of a plane, then 0 is the
> origin of a line.  Either way is plausible, but you need to be
> consistent.

Where I wrote "(0,0) is the origin" above I was not referring to a
point, not a tuple, but I can see how that was confusing.



More information about the Python-list mailing list