Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83282

Re: Comparisons and sorting of a numeric class....

Date 2015-01-07 02:16 -0500
From Dave Angel <davea@davea.name>
Subject Re: Comparisons and sorting of a numeric class....
References (2 earlier) <54ABE383.3020801@r3dsolutions.com> <CAPTjJmpktyHfghEr+cjPrhso7JgB4VfS4=5Gdi95gT0aFbSYGA@mail.gmail.com> <54AC97D9.4010504@r3dsolutions.com> <CAPTjJmooTK_+HVoeyeSrqBHN1=YjRYQ2kfDyQtL9JoA9SbTqsQ@mail.gmail.com> <54ACAA04.60801@r3dsolutions.com>
Newsgroups comp.lang.python
Message-ID <mailman.17433.1420615002.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 01/06/2015 10:37 PM, Andrew Robinson wrote:
>
> On 01/06/2015 06:31 PM, Chris Angelico wrote:
>>
>
> I already KNOW that 'C++' does have a workaround mechanism, as I've
> mentioned in a different e-mail, so that there's no reason to
> instantiate an instance of the subclass of a singleton if you don't want
> to.  That objection is really spurrious... so I really don't understand
> why Rossum cut off subclassability itself ... wasn't there any other way
> he could have prevented instantiation of subclasses without preventing
> the definition of a subclass itself?
>
> I mean, even in python I can execute some methods of a class without
> actually INSTANTIATING that class.
> eg:
>
> import decimal
> decimal.getcontext()

Interesting that you pick as your example an ordinary function, not in a 
class at all.  In this example, decimal is a module;  you're calling a 
module level function.  Perfectly normal.

But you're right, you can call staticmethods of a class without 
instantiating it, and you can also call classmethods.  But in both 
cases, the caller knows exactly what class he's referring to.  Doesn't 
help your argument any.

If you're not going to instantiate the class, then the fact that such a 
class is, or is not, a subclass of another is invisible, in any context 
I can think of (other than debuggers and such that do inspection by 
reflection).

-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Comparisons and sorting of a numeric class.... Dave Angel <davea@davea.name> - 2015-01-07 02:16 -0500

csiph-web