Message73994
I agree to Martin's patch for 2.6, because it seems to provide a more
clean solution. And, as he states, there will be time and opportunity to
discuss it more thoroughly later to possibly find another approach. As I
remarked before I know that singleton+inheritance is a controversial
subject. However the gang of four state in their book that one should
use the singleton design pattern if one needs exactly one instance af a
class and this should be extensible by subclassing ... (And there are
reasons why I'd like to have Screen() subclassable.)
Anyway, I think there are two more things to do:
1) Add a docstring to the Screen() function
2) Insert (at least) one sentence in the docs, 9.th paragraph of the
Introduction. Something like:
... so there can exist only one instance of Screen at a time.
*Notice that consequently Screen cannot be sublassed.*
It should be used when turtle is used as a standalone tool for doing
graphics. ...
Perhaps one should also note, that the singleton object is returned by a
function.
I've applied the proposed patch (file11645) to a working copy and I've
tested it in interactive mode as well as with turtleDemo and all the
supplied demoscripts and found it to work well.
Last, but not least: thanks Martin for your contribution.
Regards,
Gregor |
|
Date |
User |
Action |
Args |
2008-09-28 22:07:46 | gregorlingl | set | recipients:
+ gregorlingl, loewis, georg.brandl, benjamin.peterson |
2008-09-28 22:07:46 | gregorlingl | set | messageid: <1222639666.3.0.611031375522.issue3956@psf.upfronthosting.co.za> |
2008-09-28 22:07:45 | gregorlingl | link | issue3956 messages |
2008-09-28 22:07:44 | gregorlingl | create | |
|