On 2023-04-14 10:19:03 +1000, Chris Angelico wrote:
> The entire Presentation Manager and Workplace Shell (broadly
> equivalent to a Linux "desktop manager", I think? Kinda?) were object
> oriented; you would have a WPDataFile for every, well, data file, but
> some of those might be subclasses of WPDataFile. And it was fairly
> straight-forward to write your own subclass of WPDataFile, and there
> was an API to say "if you would ever create a WPDataFile, instead
> create one of my class instead". This brilliant technique allowed
> anyone to enhance the desktop in any way, quite impressive especially
> for its time. I've yearned for that ever since, in various systems,
> although I'm aware that it would make quite a mess of Python if you
> could say "class EnhancedInt(int): ..." and then "any time you would
> create an int, create an EnhancedInt instead". A bit tricky to
> implement.
Or alternatively you might be able to add or replace methods on the
existing int class. So 5 is still just an int, but now (5 + "x") calls
the modified __add__ method which knows how add a string to an int.

Might make even more of a mess ;-).

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to