List of Functions
Marko Rauhamaa
marko at pacujo.net
Tue Mar 29 00:49:38 EDT 2016
Steven D'Aprano <steve at pearwood.info>:
> On Tue, 29 Mar 2016 08:40 am, Chris Angelico wrote:
>
>> On Tue, Mar 29, 2016 at 12:40 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>> Dan Sommers <dan at tombstonezero.net>:
>>>
>>>> On Mon, 28 Mar 2016 11:58:54 +0300, Marko Rauhamaa wrote:
>>>>> As for Python, I don't feel a great need for anonymous functions.
>>>>> However, I keep running into a need for anonymous classes, or,
>>>>> rather, classless objects. Not a biggie. I just create a one-off
>>>>> inner class and instantiate it, but I do appreciate Java's
>>>>> syntactic innovation.
>
> "Classless object" is an oxymoron in Python since all values without
> exception have a class. Can you explain what you mean?
In class terms, I mean a closure class that has precisely one instance.
Just like a closure function has precisely one instance.
In object terms, I mean an object that implements an interface but whose
class is not of essence.
> Also, for the benefit of those who aren't Java coders, what do you mean
> by "Java's syntactic innovation"?
HelloWorld frenchGreeting = new HelloWorld() {
String name = "tout le monde";
public void greet() {
greetSomeone("tout le monde");
}
public void greetSomeone(String someone) {
name = someone;
System.out.println("Salut " + name);
}
};
<URL: https://docs.oracle.com/javase/tutorial/java/javaOO/anonym
ousclasses.html>
Marko
More information about the Python-list
mailing list