Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-11 Thread Akira Kitada
Opened a ticket for this and attached a patch. (experimental) http://bugs.python.org/issue5736 On Fri, Apr 10, 2009 at 8:39 AM, "Martin v. Löwis" wrote: I assumed there were some decisions behind this, rather than it's just not implemented yet. >>> I believe this assumption is wrong - i

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Martin v. Löwis
>>> I assumed there were some decisions behind this, rather than it's just >>> not implemented yet. >> I believe this assumption is wrong - it's really that no code has been >> contributed to do that. > > But doesn't the issue at http://bugs.python.org/issue662923 imply that > there *was* suitable

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread andrew cooke
"Martin v. Löwis" wrote: >> I assumed there were some decisions behind this, rather than it's just >> not implemented yet. > > I believe this assumption is wrong - it's really that no code has been > contributed to do that. But doesn't the issue at http://bugs.python.org/issue662923 imply that the

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Martin v. Löwis
> I assumed there were some decisions behind this, rather than it's just > not implemented yet. I believe this assumption is wrong - it's really that no code has been contributed to do that. For gdbm, you can also use the firstkey/nextkey methods. Regards, Martin -- http://mail.python.org/mailma

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread skip
Joshua> Why not Joshua> for key in d.keys(): Joshua> print key Joshua> That worked for me. Time & space. One motivation for using dbm files is to write large (huge, in fact) mappings to disk. Simply reconstituting the entire set of keys may consume a lot of time (they must

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Akira Kitada
keys() returns a list and my question was not about "how to" but more like "why"... I assumed there were some decisions behind this, rather than it's just not implemented yet. Best, On Friday, April 10, 2009, Joshua Kugler wrote: > Akira Kitada wrote: > >> The loop has to be: >> """ > k = d.f

Re: Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Joshua Kugler
Akira Kitada wrote: > The loop has to be: > """ k = d.firstkey() while k != None: > ...print k > ...k = d.nextkey(k) > key2 > key1 > """ Why not for key in d.keys(): print key That worked for me. j -- http://mail.python.org/mailman/listinfo/python-list

Why is it that *dbm modules don't provide an iterator? (Language design question)

2009-04-09 Thread Akira Kitada
Hi, I was wondering why *dbm modules in Python do not give us an iterable interface? Take a look at an example below """ # Python 2.6 >>> import gdbm >>> d = gdbm.open("spam.db", "n") >>> d["key1"] = "ham" >>> d["key2"] = "spam" >>> >>> for k in d: ... print k ... Traceback (most recent call

Re: language design question

2006-07-11 Thread Bryan
Fredrik Lundh wrote: > "Bryan" wrote: > >>> and how do you make sure that everything subclasses this base class ? >> in this hypothetical case, i was assuming len() would be put in object and >> every >> class subclasses object implicitly or explicitly (ie, new style classes >> only). >> if it w

Re: language design question

2006-07-11 Thread vdrab
> >>> isinstance(1, object) > True > > What's 1 . len() ? That's easy! since 1 is actually syntactic sugar for set([set([])]), clearly 1.len() == 1. ;-) v. (actually, make that frozenset([frozenset([])])...) -- http://mail.python.org/mailman/listinfo/python-list

Re: language design question

2006-07-11 Thread Steve Holden
Bryan wrote: > Fredrik Lundh wrote: > >>Bryan wrote: >> >> >>>could you get the same result by putting these methods in base >> >> > class object that everything subclasses? >> >>and how do you make sure that everything subclasses this base class ? >> >> >> > > in this hypothetical case, i was as

Re: language design question

2006-07-11 Thread Fredrik Lundh
"Bryan" wrote: >> and how do you make sure that everything subclasses this base class ? > > in this hypothetical case, i was assuming len() would be put in object and > every > class subclasses object implicitly or explicitly (ie, new style classes only). > if it was done that way, would len(obj)

Re: language design question

2006-07-10 Thread Bryan
Fredrik Lundh wrote: > Bryan wrote: > >> could you get the same result by putting these methods in base > > class object that everything subclasses? > > and how do you make sure that everything subclasses this base class ? > > > in this hypothetical case, i was assuming len() would be put in

Re: language design question

2006-07-10 Thread Steve Holden
Terry Reedy wrote: > "OKB (not okblacke)" <[EMAIL PROTECTED]> wrote in message [...] > > The underlying answer to the original question is that while Pyt;hon is > object-based, it is not strictly OO but is intentionally multiparadigmatic > and will remain so. For instance, no one will be force

Re: language design question

2006-07-10 Thread Steven Bethard
Paul Rubin wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: >> If len() were a method of string objects, you could try using the >> unbound method and writing this as:: >> >> >>> sorted(['aaa', 'bb', 'c'], key=str.len) >> ['c', 'bb', 'aaa'] >> >> But then your code would break on lists

Re: language design question

2006-07-10 Thread Steven Bethard
Bryan wrote: > Steven Bethard wrote: > >> The advantage of a functional form over a method shows up when you >> write a function that works on a variety of different types. Below are >> implementations of "list()", "sorted()" and "join()" that work on any >> iterable and only need to be defined

Re: language design question

2006-07-10 Thread Fredrik Lundh
Bryan wrote: > could you get the same result by putting these methods in base > class object that everything subclasses? and how do you make sure that everything subclasses this base class ? -- http://mail.python.org/mailman/listinfo/python-list

Re: language design question

2006-07-10 Thread Sébastien Boisgérault
Steven Bethard a écrit : > The advantage of a functional form over a method shows up when you write > a function that works on a variety of different types. Below are > implementations of "list()", "sorted()" and "join()" that work on any > iterable and only need to be defined once:: > > [... skip

Re: language design question

2006-07-10 Thread Bruno Desthuilliers
Piet van Oostrum wrote: >>Bruno Desthuilliers <[EMAIL PROTECTED]> (BD) wrote: > > >>BD> Actually, and AFAIK, len(obj) = lambda obj : obj.__len__(). > > > You mean: len = lambda obj : obj.__len__(). yes, of course - not enough caffein, I guess... Thanks -- bruno desthuilliers python -c "p

Re: language design question

2006-07-10 Thread Piet van Oostrum
> Bruno Desthuilliers <[EMAIL PROTECTED]> (BD) wrote: >BD> Actually, and AFAIK, len(obj) = lambda obj : obj.__len__(). You mean: len = lambda obj : obj.__len__(). -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] --

Re: language design question

2006-07-10 Thread Ant
>- why is len() not a member function of strings? Instead one says len(w). Coming from a Java background, I also thought this a weird setup. However IMHO there is another good reason to have len(obj) as we do in Python: it helps to enforce some sort of uniformity across code. If I want to fi

Re: language design question

2006-07-10 Thread Fredrik Lundh
"guthrie" wrote: > But if (as I proposed..!) the user interface is better if presented as a > method. one could porovide convenience methods which would then > interface to these underlying library functions; yes? but if it isn't? and why this obsession with superficial syntax details? there's

Re: language design question

2006-07-10 Thread Bruno Desthuilliers
guthrie wrote: > Good point, thanks. > > But if (as I proposed..!) the user interface is better if presented as a > method. one could porovide convenience methods which would then > interface to these underlying library functions; yes? > Actually, and AFAIK, len(obj) = lambda obj : obj.__len__().

Re: language design question

2006-07-10 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > If len() were a method of string objects, you could try using the > unbound method and writing this as:: > > >>> sorted(['aaa', 'bb', 'c'], key=str.len) > ['c', 'bb', 'aaa'] > > But then your code would break on lists that weren't strings. s

Re: language design question

2006-07-10 Thread Bruno Desthuilliers
Steven Bethard wrote: > Terry Reedy wrote: > >> "Gregory Guthrie" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>> - why is len() not a member function of strings? Instead one says >>> len(w). >> >> >> Consider >> > map(len, ('abc', (1,2,3), [1,2], {1:2})) >> >> [3, 3, 2

Re: language design question

2006-07-10 Thread Bruno Desthuilliers
Alex Martelli wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >... > >>>This would allow things like: >>>key = '',join( list(word.lower().strip()).sort() ) >> >>key = ''.join(list(sorted(word.lower().strip())) > > > No need to make yet another list here (also, I think eac

Re: language design question

2006-07-09 Thread Bryan
Steven Bethard wrote: > The advantage of a functional form over a method shows up when you write > a function that works on a variety of different types. Below are > implementations of "list()", "sorted()" and "join()" that work on any > iterable and only need to be defined once:: > > def

Re: language design question

2006-07-09 Thread guthrie
Good point, thanks. But if (as I proposed..!) the user interface is better if presented as a method. one could porovide convenience methods which would then interface to these underlying library functions; yes? So the main datatype classes could support such a method style, and just layer on t

Re: language design question

2006-07-09 Thread guthrie
Many thanks; great information. Best, Gregory Steven Bethard wrote: > guthrie wrote: > >> Steven Bethard wrote: >> >>> Why would ``x.len()`` be any more convenient than ``len(x)``? Your >>> preference here seems pretty arbitrary. >> >> -- Perhaps; >> but having all standard operations as a m

Re: language design question

2006-07-09 Thread Steven Bethard
Terry Reedy wrote: > "Gregory Guthrie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> - why is len() not a member function of strings? Instead one says >> len(w). > > Consider map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using meth

Re: language design question

2006-07-09 Thread Steven Bethard
guthrie wrote: > Steven Bethard wrote: >> Why would ``x.len()`` be any more convenient than ``len(x)``? Your >> preference here seems pretty arbitrary. > -- Perhaps; > but having all standard operations as a method seems more regular (to > me), and allows a simple chained operation format of a se

Re: language design question

2006-07-09 Thread Terry Reedy
"OKB (not okblacke)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: > >> Consider > map(len, ('abc', (1,2,3), [1,2], {1:2})) >> [3, 3, 2, 1] >> >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})]

Re: language design question

2006-07-09 Thread guthrie
Steven Bethard wrote: > Gregory Guthrie wrote: > >> For example, >>- why is len() not a member function of strings? Instead one says >> len(w). > > Why would ``x.len()`` be any more convenient than ``len(x)``? Your > preference here seems pretty arbitrary. -- Perhaps; but having all standa

Re: language design question

2006-07-09 Thread Alex Martelli
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: ... > > This would allow things like: > > key = '',join( list(word.lower().strip()).sort() ) > > key = ''.join(list(sorted(word.lower().strip())) No need to make yet another list here (also, I think each of you omitted a needed closed-

Re: language design question

2006-07-09 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Length is an obvious property of any one-dimensional non-scalar, not just > strings. As such, it makes sense to have a length function that takes an > argument. As a design decision, it could go either way, but early > Python wasn't fully object-oriente

Re: language design question

2006-07-09 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] > > Did you actually try that? No of course not. It's in a hypothetical python where .len() is a class operation instead of a global fu

Re: language design question

2006-07-09 Thread Erik Max Francis
Steven D'Aprano wrote: > On Sun, 09 Jul 2006 22:45:53 +, OKB (not okblacke) wrote: > >> Terry Reedy wrote: >> >>> Consider >> map(len, ('abc', (1,2,3), [1,2], {1:2})) >>> [3, 3, 2, 1] >>> >>> Now try to rewrite this using methods (member functions). >> [a.len() for a in ('abc', (1,2,3), [

Re: language design question

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 22:45:53 +, OKB (not okblacke) wrote: > Terry Reedy wrote: > >> Consider > map(len, ('abc', (1,2,3), [1,2], {1:2})) >> [3, 3, 2, 1] >> >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] Did you actually

Re: language design question

2006-07-09 Thread Steven D'Aprano
On Sun, 09 Jul 2006 12:19:13 -0500, Gregory Guthrie wrote: > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive

Re: language design question

2006-07-09 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes: > Consider > >>> map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using methods (member functions). [x.len() for x in ('abc', (1,2,3), [1,2], {1:2})] > > - Why doesn't sort() return a value? > > Because it is an in-pl

Re: language design question

2006-07-09 Thread OKB (not okblacke)
Terry Reedy wrote: > Consider map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using methods (member functions). [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, inste

Re: language design question

2006-07-09 Thread Terry Reedy
"Gregory Guthrie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - why is len() not a member function of strings? Instead one says > len(w). Consider >>> map(len, ('abc', (1,2,3), [1,2], {1:2})) [3, 3, 2, 1] Now try to rewrite this using methods (member functions). > - Why d

Re: language design question

2006-07-09 Thread Paddy
Gregory Guthrie wrote: > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive program styles that I > wanted - rever

Re: language design question

2006-07-09 Thread Bruno Desthuilliers
Gregory Guthrie a écrit : > I am comparing Python to a few other scripting languages, and used a simple > anagrams program as a sample. > > I was surprised ast a few python features that did not work as I would > expect/wish; which caused less compact/expressive program styles that I > wanted -

Re: language design question

2006-07-09 Thread Steven Bethard
Gregory Guthrie wrote: > For example, >- why is len() not a member function of strings? Instead one says len(w). Why would ``x.len()`` be any more convenient than ``len(x)``? Your preference here seems pretty arbitrary. > - Why doesn't sort() return a value? > > This would allow thing

language design question

2006-07-09 Thread Gregory Guthrie
I am comparing Python to a few other scripting languages, and used a simple anagrams program as a sample. I was surprised ast a few python features that did not work as I would expect/wish; which caused less compact/expressive program styles that I wanted - reverting to a FORTRAN like series of

Re: OOP / language design question

2006-04-27 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Carl Banks" <[EMAIL PROTECTED]> wrote: > > >>bruno at modulix wrote: >> >>>[EMAIL PROTECTED] wrote: >>> I was wondering, why you always have to remember to call bases' constructors >>> >>> >>>s/constructors/__init__/ >>> >>>

Re: OOP / language design question

2006-04-27 Thread Carl Banks
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Carl Banks" <[EMAIL PROTECTED]> wrote: > > >bruno at modulix wrote: > >> [EMAIL PROTECTED] wrote: > >> > I was wondering, why you always have to remember to call bases' > >> > constructors > >> > >> > >> s/constructors/__init__/ > >

Re: OOP / language design question

2006-04-27 Thread Duncan Booth
Lawrence D'Oliveiro wrote: >>In other words, the object is constructed in Python before any >>__init__ is called, but in C++ it isn't constructed until after all >>the base class constructors have returned. > > But if "construction" is what a constructor does, then you're wrong. > I may be wrong

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: >> [EMAIL PROTECTED] wrote: >> > I was wondering, why you always have to remember to call bases' >> > constructors >> >> >> s/constructors/__init__/ >> >> the __init__() method is *not* the construct

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: > >> You know, Python's __init__ has almost the same semantics as C++ >> constructors (they both initialize something that's already been >> allocated in memory, and neither can return a substitute object).

Re: OOP / language design question

2006-04-26 Thread bruno at modulix
Brian van den Broek wrote: > Bruno Desthuilliers said unto the world upon 25/04/06 06:52 PM: > >> Duncan Booth a écrit : >> (snip) >>> Apart from the fact that you can delete the method 'dothis' from both >>> classes with no effect on the code? >> >> Mmmm... Oh, I see. Agreed, this is not a very g

Re: OOP / language design question

2006-04-26 Thread Brian van den Broek
Bruno Desthuilliers said unto the world upon 25/04/06 06:52 PM: > Duncan Booth a écrit : > >>bruno at modulix wrote: >> >> >> >>>class Base(object): >>> def __init__(self, arg1): >>> self.attr1 = arg1 >>> self.dothis() >>> >>> def dothis(self): >>> return self.attr1 >>> >>>class Derived(Base

Re: OOP / language design question

2006-04-26 Thread bruno at modulix
Duncan Booth wrote: > bruno at modulix wrote: > > >>It's *already* split : __new__ construct the object, __init__ >>initialize it. >> >>>That's why I would go for the 2-phase construction: >> >>But that's already what you have. > > Very good point. > > >>>after the first phase >>>you have an

Re: OOP / language design question

2006-04-26 Thread Duncan Booth
bruno at modulix wrote: > It's *already* split : __new__ construct the object, __init__ > initialize it. > >> That's why I would go for the 2-phase construction: > > But that's already what you have. Very good point. >> after the first phase >> you have an object which is fully initialised,

Re: OOP / language design question

2006-04-26 Thread Carl Banks
Duncan Booth wrote: > Alex Martelli wrote: > > >> What I think I'm trying to get at is that I believe that most > >> situations where someone actually tries to do something in the base > >> initialiser which requires calling a virtual method are probably also > >> cases where the initialiser is do

Re: OOP / language design question

2006-04-26 Thread bruno at modulix
Duncan Booth wrote: > Alex Martelli wrote: > > >>>What I think I'm trying to get at is that I believe that most >>>situations where someone actually tries to do something in the base >>>initialiser which requires calling a virtual method are probably also >>>cases where the initialiser is doing t

Re: OOP / language design question

2006-04-26 Thread Duncan Booth
Alex Martelli wrote: >> What I think I'm trying to get at is that I believe that most >> situations where someone actually tries to do something in the base >> initialiser which requires calling a virtual method are probably also >> cases where the initialiser is doing too much: i.e. separating th

Re: OOP / language design question

2006-04-25 Thread Alex Martelli
Duncan Booth <[EMAIL PROTECTED]> wrote: ... > Actually, this is quite an interesting example becaue it wouldn't work in > C++: if you tried the same trick the call to dothis from the base > constructor (even assuming it is virtual) would actually call Base.dothis. Yep. > I think you have demo

Re: OOP / language design question

2006-04-25 Thread Bruno Desthuilliers
Duncan Booth a écrit : > bruno at modulix wrote: > > >>class Base(object): >> def __init__(self, arg1): >>self.attr1 = arg1 >>self.dothis() >> >> def dothis(self): >>return self.attr1 >> >>class Derived(Base): >> def __init__(self, arg1, arg2=0): >>self.attr2 = arg2 >>Base.

Re: OOP / language design question

2006-04-25 Thread Duncan Booth
bruno at modulix wrote: > class Base(object): > def __init__(self, arg1): > self.attr1 = arg1 > self.dothis() > > def dothis(self): > return self.attr1 > > class Derived(Base): > def __init__(self, arg1, arg2=0): > self.attr2 = arg2 > Base.__init__(self, arg1) > > de

Re: OOP / language design question

2006-04-25 Thread bruno at modulix
Duncan Booth wrote: > bruno at modulix wrote: > > >>Duncan Booth wrote: >>(snip) >> >>>Usually though, if a subclass doesn't immediately call the base class >>>constructors as the first thing it does in __init__ it indicates poor >>>code and should be refactored. >> >>Not necessarily. It's a comm

Re: OOP / language design question

2006-04-25 Thread Carl Banks
Duncan Booth wrote: > In other words, the object is constructed in Python before any __init__ is > called, but in C++ it isn't constructed until after all the base class > constructors have returned. That's true. Good point. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP / language design question

2006-04-25 Thread Duncan Booth
Carl Banks wrote: > You know, Python's __init__ has almost the same semantics as C++ > constructors (they both initialize something that's already been > allocated in memory, and neither can return a substitute object). There is a significant difference: imagine B is a base type and C a subclas

Re: OOP / language design question

2006-04-25 Thread Carl Banks
bruno at modulix wrote: > [EMAIL PROTECTED] wrote: > > I was wondering, why you always have to remember to call bases' > > constructors > > > s/constructors/__init__/ > > the __init__() method is *not* the constructor. Object's instanciation > is a two-stage process: __new__() is called first, t

Re: OOP / language design question

2006-04-25 Thread Duncan Booth
bruno at modulix wrote: > Duncan Booth wrote: > (snip) >> Usually though, if a subclass doesn't immediately call the base class >> constructors as the first thing it does in __init__ it indicates poor >> code and should be refactored. > > Not necessarily. It's a common case to have some computati

Re: OOP / language design question

2006-04-25 Thread Carl Banks
[EMAIL PROTECTED] wrote: > Heiko Wundram wrote: > > Because sometimes you don't want to call the base classes constructors? > Sounds strange to me at the moment, but I'll try to adjust to this > thought. In Java and C++, classes have private members that can only be accessed by the class itself (a

Re: OOP / language design question

2006-04-25 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I was wondering, why you always have to remember to call bases' > constructors s/constructors/__init__/ the __init__() method is *not* the constructor. Object's instanciation is a two-stage process: __new__() is called first, then __init__(). -- bruno desthuillier

Re: OOP / language design question

2006-04-25 Thread bruno at modulix
Duncan Booth wrote: (snip) > Usually though, if a subclass doesn't immediately call the base class > constructors as the first thing it does in __init__ it indicates poor code > and should be refactored. Not necessarily. It's a common case to have some computations to do/some attributes to set i

Re: OOP / language design question

2006-04-25 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Heiko Wundram wrote: >> Because sometimes you don't want to call the base classes constructors? > Sounds strange to me at the moment, but I'll try to adjust to this > thought. It makes sense in more static languages such as C++. The base class is initialised by the con

Re: OOP / language design question

2006-04-25 Thread Diez B. Roggisch
> Well, I can imagine it's done to make sure that the base(s) are > properly constructed. Sound s sensible to me. It often is - there are popular examples in python where missing a constructor will cause a program to fail spectacular. But is it _always_ a sensible thing to do? No. If you only want

Re: OOP / language design question

2006-04-25 Thread Rene Pijlman
[EMAIL PROTECTED]: >I think I'll need some shift in thinking after C++. +1 qotw -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP / language design question

2006-04-25 Thread cctv . star
Heiko Wundram wrote: > Because sometimes you don't want to call the base classes constructors? Sounds strange to me at the moment, but I'll try to adjust to this thought. > Python zen says: "Better explicit than implicit," and in this case it hits > the nail on the head. Better to see right away

Re: OOP / language design question

2006-04-25 Thread cctv . star
Diez B. Roggisch wrote: > I have another question for you: why does JAVA enforce that a constructor of > a base-class must be called prior to everything else in the derived class's > constructor? Well, I can imagine it's done to make sure that the base(s) are properly constructed. Sound s sensible

Re: OOP / language design question

2006-04-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I was wondering, why you always have to remember to call bases' > constructors explicitly from the derived class constructor? Why hasn't > this been enforced by the language? I have another question for you: why does JAVA enforce that a constructor of a base-class must

Re: OOP / language design question

2006-04-25 Thread Heiko Wundram
Am Dienstag 25 April 2006 12:34 schrieb [EMAIL PROTECTED]: > I was wondering, why you always have to remember to call bases' > constructors explicitly from the derived class constructor? Why hasn't > this been enforced by the language? Because sometimes you don't want to call the base classes cons

Re: OOP / language design question

2006-04-25 Thread Rene Pijlman
[EMAIL PROTECTED]: >I was wondering, why you always have to remember to call bases' >constructors explicitly from the derived class constructor? Why hasn't >this been enforced by the language? Probably because the language doesn't know whether the subclass wants to override its base class's constr

OOP / language design question

2006-04-25 Thread cctv . star
I was wondering, why you always have to remember to call bases' constructors explicitly from the derived class constructor? Why hasn't this been enforced by the language? -- http://mail.python.org/mailman/listinfo/python-list