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
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
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. :)
[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
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.
--
[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
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.
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
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
[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
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
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
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
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
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
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
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
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
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
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
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
[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
[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
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
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
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
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 {
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
# 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
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
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
[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
# 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
--
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
# 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
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
--
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
# 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
# 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
--
[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.
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
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
[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
[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
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
[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
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
[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
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
# 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
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.
# 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
52 matches
Mail list logo