"Andrew Koenig" <[EMAIL PROTECTED]> writes:
> "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > If you try this sort of inheritance, I'd recommend writing down the
> > formal grammar before you start writing classes. Don't try to define
> > the grammar thr
Andrew Koenig wrote:
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
You would normally try to avoid type queries, and rely on virtual
methods instead, if possible.
Of course.
It seems likely for the application
that code can be shared across different subclasse
Hi All--
Michele Simionato wrote:
>
> recently I realized that they look better on the paper
> than in practice. A non-needed class just adds cognitive
> burden to the maintainer.
Agreed. Too many classes make me think I'm back trying to figure out
what the )([EMAIL PROTECTED] those guys were t
Koenig:
> want to know about the Python community's stylistic
> preferences for defing
> such hierarchies that don't absolutely need a root.
I don't know if there is an official style guide or a Guido's
prononcement on the issue. Personally
I found such hierarchies attractive in the past, but
rece
Well, that's true, but I meant to convey that no grammatical entity is
the base class of another entity, so it's a flat inheritance tree in
that respect. ASTNode would not be something that the parser would
know anything about.
I guess that's sort of moot if your expression trees are just a
contr
Andrew Koenig wrote:
"Carl Banks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Well, Python seems to get along fine without the ability to do
isinstance(foo,file_like_object); probably better off in the end for
it. So I'd say you should generally not do it. Inheritence is for
whe
On Thu, 31 Mar 2005 20:24:08 GMT, "Andrew Koenig" <[EMAIL PROTECTED]> wrote:
>""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>
>> You would normally try to avoid type queries, and rely on virtual
>> methods instead, if possible.
>
>Of course.
>
>> It seems likely
Andrew Koenig wrote:
So, for example, you don't think it's worth including the base class as a
way of indicating future intent?
No. In this respect, I believe in XP: refactor when the need comes up,
but not before.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Koenig wrote:
Of course, there are reasons to have a base class anyway. For example, I
might want it so that type queries such as isinstance(foo, Expr) work. My
question is: Are there other reasons to create a base class when I don't
really need it right now?
Coming from C++ myself, I s
In article
<[EMAIL PROTECTED]>,
"Andrew Koenig" <[EMAIL PROTECTED]> wrote:
> "Carl Banks" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > Well, Python seems to get along fine without the ability to do
> > isinstance(foo,file_like_object); probably better off in the end for
Andrew Koenig wrote:
> "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>
>>If you try this sort of inheritance, I'd recommend writing down the
>>formal grammar before you start writing classes. Don't try to define
>>the grammar through the inheritance hierar
"Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If you try this sort of inheritance, I'd recommend writing down the
> formal grammar before you start writing classes. Don't try to define
> the grammar through the inheritance hierarchy; it's too easy to
> accide
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You would normally try to avoid type queries, and rely on virtual
> methods instead, if possible.
Of course.
> It seems likely for the application
> that code can be shared across different subclasses, for example
"Carl Banks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well, Python seems to get along fine without the ability to do
> isinstance(foo,file_like_object); probably better off in the end for
> it. So I'd say you should generally not do it. Inheritence is for
> when different c
If you try this sort of inheritance, I'd recommend writing down the
formal grammar before you start writing classes. Don't try to define
the grammar through the inheritance hierarchy; it's too easy to
accidentally build a hierarchy that can't be translated into a
single-pass-parsable grammar...
I
Andrew Koenig wrote:
Of course, there are reasons to have a base class anyway. For example, I
might want it so that type queries such as isinstance(foo, Expr) work. My
question is: Are there other reasons to create a base class when I don't
really need it right now?
You would normally try to a
Andrew Koenig wrote:
[snip]
> Of course, there are reasons to have a base class anyway. For
example, I
> might want it so that type queries such as isinstance(foo, Expr)
work. My
> question is: Are there other reasons to create a base class when I
don't
> really need it right now?
Well, Python
Suppose I want to define a class hierarchy that represents expressions, for
use in a compiler or something similar.
We might imagine various kinds of expressions, classified by their top-level
operator (if any). So, an expression might be a primary (which, in turn,
might be a variable or a con
18 matches
Mail list logo