Re: an oop question

2022-11-02 Thread Greg Ewing
On 2/11/22 9:54 am, Julieta Shem wrote: But we've left behind a more basic requirement --- the Stack class wishes for all the methods already written in some class called Pair, Is that *really* what you want, though? To my way of thinking, a Stack and a Pair are quite different data structures

Re: an oop question

2022-11-02 Thread Alan Gauld
On 01/11/2022 17:58, Julieta Shem wrote: > nowhere in trying to detect in high-precision what is OOP and what is > not. Stefan has given a good answer but essentially OOP is a program that is structured around objects communicating by sending messages to one another. Objects are, in most (but n

Re: Operator: inappropriate wording?

2022-11-02 Thread elas tica
Le lundi 31 octobre 2022 à 22:18:57 UTC+1, Chris Angelico a ecrit : > Wording is hard. Just ask the SQL standard whether NULL is a value. > Indeed, but I think our problem here is simpler ;) One could for example omit the incorrect term "operator" while remaining unambiguous. This would give:

Re: [correction]an oop question

2022-11-02 Thread Alan Gauld
On 02/11/2022 20:21, Dennis Lee Bieber wrote: >> shows that in Python we do *not* need subclassing/inheritance >> for polymorphism! >> > To me, that is not really an example of polymorphism, but more an > example of Python's "duck typing". But duck typing is a perfectly good implementatio

Re: an oop question

2022-11-02 Thread Julieta Shem
Greg Ewing writes: > On 2/11/22 9:54 am, Julieta Shem wrote: >> But we've left behind a more basic requirement --- the Stack >> class wishes for all the methods already written in some class called >> Pair, > > Is that *really* what you want, though? > > To my way of thinking, a Stack and a Pair

Re: an oop question

2022-11-02 Thread Julieta Shem
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Julieta Shem writes: >>Any book recomendations on getting this thing mathematics-clear? > > OOP cannot be mathematics-clear because it is an /attempt/ to > abstract from several different programming languages. > > When you ask Alan Kay (and I

Re: [correction]an oop question

2022-11-02 Thread Julieta Shem
Dennis Lee Bieber writes: > On 2 Nov 2022 09:56:28 GMT, r...@zedat.fu-berlin.de (Stefan Ram) declaimed > the following: > > >> Now, in the next program, I have removed the subclassings, >> there is no inheritance from the base class "Language" >> anymore. Yet the polymorphism in "f" still work

Re: an oop question

2022-11-02 Thread Julieta Shem
Alan Gauld writes: > On 01/11/2022 17:58, Julieta Shem wrote: [...] >>> IS-A relationship, so Stack inheriting Pair would mean that a Stack >>> was a Pair. That is not really true. >> >> That's another interesting observation. I do not have much >> understanding of how to really think of thes

Re: an oop question

2022-11-02 Thread Greg Ewing
On 3/11/22 1:37 pm, Julieta Shem wrote: The code for computing the length of a Pair (which is really a linked list) happens to be the same for computing the length of a Stack. I would question whether that should be a method of Pair at all, since it's not the length of the pair itself, but the

Re: an oop question

2022-11-02 Thread Julieta Shem
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Greg Ewing writes: >>I don't see any overlap between these at the conceptual level. > > It might come from early LISP dialects. In early LISPs, the > only basic means to combine data into a larger assembly of > data was the dotted pair and NULL

typing: property/setter and lists?

2022-11-02 Thread Paulo da Silva
Hi! And a typing problem again!!! ___ class C: def __init__(self): self.__foos=5*[0] @property def foos(self) -> list[int]: return self.__foos @foos.setter def foos(self,v: int):