1 Jun 2002 04:45
RE: Re: Adding Optik to the standard library
Steven Lott <s_lott <at> yahoo.com>
2002-06-01 02:45:53 GMT
2002-06-01 02:45:53 GMT
The class isn't really the unit of reuse. The old one-class-per-file rules from C++ aren't helpful for good reusable design. They are for optimizing compiling and making. This is great book on large-scale design considerations. Much of it is C++ specific, but parts apply to Python. Large-Scale C++ Software Design, John Lakos Addison-Wesley, Paperback, Published July 1996, 845 pages, ISBN 0201633620. The module of related classes is the unit of reuse. A cluster of related modules can make sense for a large, complex reusable component, like an application program. As a user, anything in a module file that is not class definition (or the odd occaisional convenience function) is a show-stopper. If there is some funny business to implement submodules, that ends my interest. Part of the open source social contract is that if I'm going to use it, I'd better be able to support it. Even if you win the lottery and retire to a fishing boat in the Caribbean. The question of <was>Optik</was><is>options</is> having several reusable elements pushes my envelope. If it's job is to parse command line arguments, how many different reusable elements can their really be? Perhaps there are several candidate modules here. It seems difficult to justify putting them all into a library. The problem doesn't seem complex enough to justify a complex solution.(Continue reading)
.
Tcl's interpreter data structure has a return value field which can
receive a string of arbitrary length. In order to make this
efficient, this is initialized with a pointer to a limited-size array
on the stack of the caller; when the return value is longer, a
malloc()'ed buffer is used. There is a little dance you have to do to
free the malloc()'ed buffer. The big win is that most calls return
short strings and hence you save a call to malloc() and one to free()
per invocation. This is used *all over* the Tcl source, so good luck
getting rid of it.
--Guido van Rossum (home page:
Using dis(), you'll find that x[1]+=3 executes
the following:
6 LOAD_FAST 0 (x)
9 LOAD_CONST 1 (1)
12 DUP_TOPX 2
15 BINARY_SUBSCR
16 LOAD_CONST 2 (3)
19 INPLACE_ADD
20 ROT_THREE
21 STORE_SUBSCR
> How does Python decide that sequence elements are immutable?
Huh? It doesn't. If they were mutable, had you expected something
else?
RSS Feed