Re: Missing interfaces in Python...

2006-04-24 Thread bruno at modulix
bruno at modulix wrote: Neal Becker wrote: (snip) I see various answers that Python doesn't need interfaces. OTOH, there are responses that some large Python apps have implemented them (e.g., zope). Does anyone have an explanation of why these large systems felt they needed to implement

Re: Missing interfaces in Python...

2006-04-20 Thread Ben
Oh I agree entirely. They are just equivalent ways of managing the complexity of large projects. I guess interfaces are providing specifications, and generics are receiving specifications, so single dispatch methods can be identical to interfaces only inverted. Therefore, as there is no

Re: Missing interfaces in Python...

2006-04-20 Thread Michele Simionato
Carl Banks wrote: Only after a lot of effort, a lot of refactoring, and a large part of the problem space explored, will the interfaces be mature enough that writing interface definitions would be useful and not a burden. (And let's face it: there aren't many projects that get that far. :)

Re: Missing interfaces in Python...

2006-04-19 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I

Re: Missing interfaces in Python...

2006-04-19 Thread Rene Pijlman
Kay Schluehr: You won't find many deep class hierarchies and extensive frameworks. Zope comes to mind. This has the advantage that a classification you have done once at the beginning of your project in the design phase is not considered to be carved in stone. Zope 3 comes to mind. --

Re: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (snip) Everyone is getting off track here. Not that much... Java has interfaces because it doesn't support multiple inheritance. Java as interfaces because it relies on type declaration for subtyping *and* doesn't support MI. Python supports MI, so you don't need

Re: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
Rene Pijlman wrote: Kay Schluehr: You won't find many deep class hierarchies and extensive frameworks. Zope comes to mind. This has the advantage that a classification you have done once at the beginning of your project in the design phase is not considered to be carved in stone.

Re: Missing interfaces in Python...

2006-04-19 Thread Ben
bruno at modulix wrote: Rene Pijlman wrote: Kay Schluehr: You won't find many deep class hierarchies and extensive frameworks. Zope comes to mind. This has the advantage that a classification you have done once at the beginning of your project in the design phase is not

Re: Missing interfaces in Python...

2006-04-19 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: Roy Smith [EMAIL PROTECTED] wrote: Peter Maas [EMAIL PROTECTED] wrote: He probably means that with interfaces one could test compliance with the interface as a whole instead of testing each member and each

Re: Missing interfaces in Python...

2006-04-19 Thread Neal Becker
[EMAIL PROTECTED] wrote: I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Roy Smith [EMAIL PROTECTED] wrote: ... A class asserting, e.g., implements IPainter, doesn't thereby risk being accidentally misused where an IGunslinger is required (OTOH, implementing 1 of these IS a bother, but that's sort of inevitable). I suppose, but all you've really done is

Re: Missing interfaces in Python...

2006-04-19 Thread Roy Smith
Alex Martelli [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] wrote: ... A class asserting, e.g., implements IPainter, doesn't thereby risk being accidentally misused where an IGunslinger is required (OTOH, implementing 1 of these IS a bother, but that's sort of inevitable). I

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Ben [EMAIL PROTECTED] wrote: ... It seems to me that a lot of python projects reimplement interfaces or adaption of some kind once they reach a certain size (Zope, PEAK, eggs, TurboGears, etc), which implies that they really do have some benefits, particularly in documentation. PEAK is an

Re: Missing interfaces in Python...

2006-04-19 Thread Rene Pijlman
Alex Martelli: PEAK is an interesting counterexample, particularly since Philip Eby tends to be ahead of the curve: I never noticed PEAK before. Is it well worth studying? -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-19 Thread Rene Pijlman
Neal Becker: I see various answers that Python doesn't need interfaces. OTOH, there are responses that some large Python apps have implemented them (e.g., zope). Does anyone have an explanation of why these large systems felt they needed to implement interfaces? A programming language doesn't

Re: Missing interfaces in Python...

2006-04-19 Thread bruno at modulix
Neal Becker wrote: (snip) I see various answers that Python doesn't need interfaces. OTOH, there are responses that some large Python apps have implemented them (e.g., zope). Does anyone have an explanation of why these large systems felt they needed to implement interfaces? These interface

Re: Missing interfaces in Python...

2006-04-19 Thread Alex Martelli
Rene Pijlman [EMAIL PROTECTED] wrote: Alex Martelli: PEAK is an interesting counterexample, particularly since Philip Eby tends to be ahead of the curve: I never noticed PEAK before. Is it well worth studying? Oh yes. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-19 Thread Carl Banks
Ben wrote: It seems to me that a lot of python projects reimplement interfaces or adaption of some kind once they reach a certain size (Zope, PEAK, eggs, TurboGears, etc), which implies that they really do have some benefits, particularly in documentation. Yes. On my current largish project

Re: Missing interfaces in Python...

2006-04-18 Thread Pablo Orduña
This article in Guido van Rossum's blog might be interesting for this thread http://www.artima.com/weblogs/viewpost.jsp?thread=92662 -- Pablo -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-18 Thread Kent Johnson
I V wrote: To use interfaces in python, just what you would do in Java, except don't use interfaces. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-18 Thread gmilas
I am currently working in C# after I spent about 3 years almost only in python, The way I see thinks is that for me we need interfaces in C# to allow for flexibility in using OOP because we must only pass defined and known types at all times so for us to have the flexibility of passing either a

Re: Missing interfaces in Python...

2006-04-18 Thread olsongt
[EMAIL PROTECTED] wrote: I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I

Re: Missing interfaces in Python...

2006-04-18 Thread Rene Pijlman
[EMAIL PROTECTED]: If it looks like a duck, and quacks like a duck, then for all practical purposes it supports the 'duck' interface. The problem with that of course, is that there's much more to being a duck than being called 'duck'. public interface JarFile { void explode(); } public

Re: Missing interfaces in Python...

2006-04-18 Thread Mark True
This is quite possibly one of the funniest examples of how Duck Typing can break down that I have ever seen!On 4/18/06, Rene Pijlman [EMAIL PROTECTED] wrote: [EMAIL PROTECTED]:If it looks like a duck, and quacks like a duck, then for all practicalpurposes it supports the 'duck' interface.The

Re: Missing interfaces in Python...

2006-04-18 Thread Peter Maas
Fredrik Lundh schrieb: Jonathan Daugherty wrote_ # In Python, you would simply call the functions you need. No need to # make things that rigidly defined. Except when you need to handle exceptions when those methods don't exist. I think interfaces can definitely be useful. so with

Re: Missing interfaces in Python...

2006-04-18 Thread Peter Maas
Roy Smith schrieb: Python is a very dynamic language. Java is a very static language. What is the difference between static and very static? Is Java more static than Fortran I? ;) Peter Maas, Aachen -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-18 Thread olsongt
Rene Pijlman wrote: [EMAIL PROTECTED]: If it looks like a duck, and quacks like a duck, then for all practical purposes it supports the 'duck' interface. The problem with that of course, is that there's much more to being a duck than being called 'duck'. public interface JarFile {

Re: Missing interfaces in Python...

2006-04-18 Thread Roy Smith
Peter Maas [EMAIL PROTECTED] wrote: He probably means that with interfaces one could test compliance with the interface as a whole instead of testing each member and each signature as a single piece. All interfaces (as implemented by Java) prove is that your class has a bunch of methods with

Re: Missing interfaces in Python...

2006-04-18 Thread Jonathan Daugherty
# All interfaces (as implemented by Java) prove is that your class has # a bunch of methods with the right names and signatures. It doesn't # prove that those methods do the right things. I don't think anyone is suggesting that interfaces do (or should) prove that the implemented methods

Re: Missing interfaces in Python...

2006-04-18 Thread Alex Martelli
Roy Smith [EMAIL PROTECTED] wrote: Peter Maas [EMAIL PROTECTED] wrote: He probably means that with interfaces one could test compliance with the interface as a whole instead of testing each member and each signature as a single piece. All interfaces (as implemented by Java) prove is

Missing interfaces in Python...

2006-04-17 Thread redefined . horizons
I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I can use in Python to get

Re: Missing interfaces in Python...

2006-04-17 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: I see that Python is missing interfaces. No it isn't. It just hasn't got them. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. In Java I would accomplish

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# In Python, you would simply call the functions you need. No need to # make things that rigidly defined. Except when you need to handle exceptions when those methods don't exist. I think interfaces can definitely be useful. -- Jonathan Daugherty http://www.parsed.org --

Re: Missing interfaces in Python...

2006-04-17 Thread Fredrik Lundh
Jonathan Daugherty wrote_ # In Python, you would simply call the functions you need. No need to # make things that rigidly defined. Except when you need to handle exceptions when those methods don't exist. I think interfaces can definitely be useful. so with interfaces, missing methods

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# so with interfaces, missing methods will suddenly appear out of thin # air ? With interfaces, the idea is that they're enforced; so, they'll appear because someone implements them. -- Jonathan Daugherty http://www.parsed.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-17 Thread Fredrik Lundh
Jonathan Daugherty wrote: # so with interfaces, missing methods will suddenly appear out of thin # air ? With interfaces, the idea is that they're enforced; so, they'll appear because someone implements them. enforced by whom, at what point ? /F --

Re: Missing interfaces in Python...

2006-04-17 Thread redefined . horizons
Thanks for the responses...Looks like I might have opened Pandora's box here. Could I accomplish the above with an abstract class? If the mechanic class had a fixIt() method defined, could I pass it any object I wanted, and then just call the method that I expect to find there, or do I need to

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# enforced by whom, at what point ? In the case of Java, I think the JVM enforces interface implementation (probably at the parser level). -- Jonathan Daugherty http://www.parsed.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# Thanks for the responses...Looks like I might have opened Pandora's # box here. Could I accomplish the above with an abstract class? Zope 3 has an interface system which is good. I recommend you look at that. -- Jonathan Daugherty http://www.parsed.org --

Re: Missing interfaces in Python...

2006-04-17 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: If the mechanic class had a fixIt() method defined, could I pass it any object I wanted absolutely. and then just call the method that I expect to find there yes. or do I need to strictly define the type, or class, of an object that is passed to a method. no.

Re: Missing interfaces in Python...

2006-04-17 Thread Benji York
Jonathan Daugherty wrote: # Thanks for the responses...Looks like I might have opened Pandora's # box here. Could I accomplish the above with an abstract class? Zope 3 has an interface system which is good. I recommend you look at that. Zope 3's interface system is quite good, but it's

Re: Missing interfaces in Python...

2006-04-17 Thread Egon Frerich
PROTECTED] schrieb am 17.04.2006 22:39: I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what

Re: Missing interfaces in Python...

2006-04-17 Thread I V
[EMAIL PROTECTED] wrote: I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I can use in Python to get the same benefits to a program design

Re: Missing interfaces in Python...

2006-04-17 Thread Larry Bates
[EMAIL PROTECTED] wrote: I'm coming from a Java background, so please don't stone me... I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I

Re: Missing interfaces in Python...

2006-04-17 Thread I V
Jonathan Daugherty wrote: Except when you need to handle exceptions when those methods don't exist. I think interfaces can definitely be useful. I think I see what you mean, but that's an odd way to put it. Typically, you aren't going to handle the exceptions produced by type errors. Of

Re: Missing interfaces in Python...

2006-04-17 Thread Roy Smith
[EMAIL PROTECTED] wrote: I see that Python is missing interfaces. The concept of an interface is a key to good programming design in Java, but I've read that they aren't really necessary in Python. I am wondering what technique I can use in Python to get the same benefits to a program design

Re: Missing interfaces in Python...

2006-04-17 Thread Serge Orlov
Jonathan Daugherty wrote: # so with interfaces, missing methods will suddenly appear out of thin # air ? With interfaces, the idea is that they're enforced; so, they'll appear because someone implements them. But if you're writing tests you will check method signatures anyway, so why

Re: Missing interfaces in Python...

2006-04-17 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm coming from a Java background, so please don't stone me... Most of us came to Python from some other language background ;-) I see that Python is missing interfaces. As someone else noted, Python objectively does not have

Re: Missing interfaces in Python...

2006-04-17 Thread Alex Martelli
Jonathan Daugherty [EMAIL PROTECTED] wrote: # enforced by whom, at what point ? In the case of Java, I think the JVM enforces interface implementation (probably at the parser level). parser...?! If you have an 'Object o', say one just received as an argument, and cast it to IBlahble, a la

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# parser...?! If you have an 'Object o', say one just received as an # argument, and cast it to IBlahble, a la # # IBlahble blah = (IBlahble) o; # # ...what can the parser ever say about it? Maybe you didn't read the I think in my OP. Anyway, you clearly know more about (or have more

Re: Missing interfaces in Python...

2006-04-17 Thread Alex Martelli
Jonathan Daugherty [EMAIL PROTECTED] wrote: # parser...?! If you have an 'Object o', say one just received as an # argument, and cast it to IBlahble, a la # # IBlahble blah = (IBlahble) o; # # ...what can the parser ever say about it? Maybe you didn't read the I think in my OP.

Re: Missing interfaces in Python...

2006-04-17 Thread Jonathan Daugherty
# My real-world experience with Java is very dated -- nowadays, I'm # told, the NEED to cast is vastly reduced by Java 1.5's generics (I # haven't yet written one line of Java 1.5, not even for play # purposes, much less real world ones;-). Interesting; thanks. # So much for compiler