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


Groups > comp.lang.python > #43665

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

Date 2013-04-16 11:07 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Subject Re: The type/object distinction and possible synthesis of OOP and imperative programming languages
References (1 earlier) <516bd241$0$29872$c3e8da3$5496439d@news.astraweb.com> <516C3C44.6010706@rece.vub.ac.be> <mailman.651.1366073708.3114.python-list@python.org> <516cb85b$0$29977$c3e8da3$5496439d@news.astraweb.com> <kkifse$60e$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.661.1366103332.3114.python-list@python.org> (permalink)

Show all headers | View raw


Op 16-04-13 05:17, Terry Jan Reedy schreef:
> On 4/15/2013 10:32 PM, Steven D'Aprano wrote:
>> On Mon, 15 Apr 2013 20:52:58 -0400, Terry Jan Reedy wrote:
>
>>> Some builtin classes cannot be subclassed. There is an issue to
>>> document
>>> which better. That does not mean that it is not a class.
>>
>>
>> I think it is also important to document whether that is a language
>> feature, or a mere restriction of the implementation. There is an
>> important distinction to be made between:
>>
>> "In CPython, you cannot subclass slice or FunctionType. Other Pythons
>> may
>> have more, or fewer, restrictions."
>>
>> and:
>>
>> "No language that calls itself Python is permitted to allow slice and
>> FunctionType to be subclassable."
>>
>>
>> If I had a say in this, I would vote for the first case, with the
>> possible exception of documented singleton types like NoneType and bool.
>
> I will keep the above in mind if I write or review a patch. here are 4
> non-subclassable builtin classes. Two are already documented. Bool in
> one, forget which other. I believe it was recently decided to leave
> the other two as is given the absence of any practical use case.

Why should there be a practical use case here? Since classes are in
general subclassable, shouldn't you have a reason to not make them so
instead of people needing to give you a practical use case before you
treat them as you do most of them?

I once had an idea of a slice-like class that I would have liked to
experiment with. As things were I didn't get far because slice not being
subclassable was a major hurdle in getting it practical. Would the end
result have been a practical use case? I don't know, I didn't get the
chance to find out because making a class that looked like a slice
didn't work either. Python wanted, maybe still wants, a real slice in a
number of circumstances and not a ducktyped slice-like object.

Now maybe there are good reasons for slice not being subclassable but
there not being a practical use case doesn't seem to be one in this case.

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


Thread

The type/object distinction and possible synthesis of OOP and imperative programming languages Mark Janssen <dreamingforward@gmail.com> - 2013-04-14 20:48 -0700
  Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-15 10:11 +0000
    Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-04-15 19:43 +0200
      Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-16 02:15 +0000
    Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Dave Angel <davea@davea.name> - 2013-04-15 17:13 -0400
      Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Rotwang <sg552@hotmail.co.uk> - 2013-04-15 23:12 +0100
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Chris Angelico <rosuav@gmail.com> - 2013-04-16 08:32 +1000
          Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Rotwang <sg552@hotmail.co.uk> - 2013-04-15 23:54 +0100
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Mark Janssen <dreamingforward@gmail.com> - 2013-04-16 15:38 -0700
          Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-17 06:40 +0000
            Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Chris Angelico <rosuav@gmail.com> - 2013-04-17 16:56 +1000
            Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Chris Rebert <clp2@rebertia.com> - 2013-04-17 00:16 -0700
            Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-17 18:40 -0400
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-16 17:14 -0600
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Michael Torrie <torriem@gmail.com> - 2013-04-18 10:37 -0600
          Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Neil Cerutti <neilc@norwich.edu> - 2013-04-18 17:57 +0000
          Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-19 01:00 +0000
            Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Roy Smith <roy@panix.com> - 2013-04-18 21:08 -0400
              Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Mark Janssen <dreamingforward@gmail.com> - 2013-04-18 18:24 -0700
              Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ned Batchelder <ned@nedbatchelder.com> - 2013-04-18 22:10 -0400
              Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Mark Janssen <dreamingforward@gmail.com> - 2013-04-18 19:30 -0700
                Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-19 03:38 +0000
              Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ned Batchelder <ned@nedbatchelder.com> - 2013-04-18 22:39 -0400
              Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Mark Janssen <dreamingforward@gmail.com> - 2013-05-01 13:32 -0700
                Re: The type/object distinction and possible synthesis of OOP and imperative programming languages alex23 <wuwei23@gmail.com> - 2013-05-01 18:13 -0700
    Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-15 20:52 -0400
      Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-16 02:32 +0000
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-15 23:17 -0400
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-15 22:46 -0600
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages rusi <rustompmody@gmail.com> - 2013-04-15 21:56 -0700
          Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-16 05:59 +0000
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Serhiy Storchaka <storchaka@gmail.com> - 2013-04-16 11:25 +0300
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-04-16 11:07 +0200
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-16 12:49 -0400
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ethan Furman <ethan@stoneleaf.us> - 2013-04-16 10:29 -0700
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-16 14:29 -0400
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-16 12:22 -0600
        Re: The type/object distinction and possible synthesis of OOP and imperative programming languages Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-04-17 14:04 +0200
  Re: The type/object distinction and possible synthesis of OOP and imperative programming languages 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-15 23:54 -0700
  Re: The type/object distinction and possible synthesis of OOP and imperative programming languages 88888 Dihedral <dihedral88888@googlemail.com> - 2013-04-15 23:54 -0700
  Re: The type/object distinction and possible synthesis of OOP and imperative programming languages rusi <rustompmody@gmail.com> - 2013-04-21 08:44 -0700

csiph-web