error in usin list with boost
i have created a cpp file which has the followin code and when i try to compile it..it does not know what list is..it says its undefined..i also tried using #include boost/python/list.hpp but no differe...can someone please help. thanks static list retrieval_as_list(SplitText self, int position, int retrieveLength) { list result; int *characters = new int[retrieveLength]; int lenRet = self.RetrieveUTF32(position, characters, retrieveLength); for (int i=0;ilenRet;i++) { result.append(characters[i]); } delete []characters; return result; } -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with pythonpath
Observer [EMAIL PROTECTED] wrote: Hi, im a newbie both to python and this list. I hope someone can help me whith this: I have a directory structure like this: . |-- src | `-- pkg | |-- __init__.py | |-- main.py | `-- spkg1 | |-- __init__.py | `-- config.py `-- src2 `-- pkg |-- __init__.py `-- spkg2 |-- __init__.py `-- config2.py and main.py is a python script that contains this imports: from pkg.spkg1 import config from pkg.spkg2 import config2 executed in linux whith this: env PYTHONPATH=src:src2 src/pkg/main.py Traceback (most recent call last): File src/pkg/main.py, line 4, in ? from pkg.spkg2 import config2 ImportError: No module named spkg2 changing the order of the python path only inverts the problem, is there any way to solve this without changing the directory structure? Nope. When Python goes to look for a package called pkg, it starts at the beginning of PYTHONPATH and stops as soon as it finds one. You either need to use different names for the two packages (pkg1, pkg2), or use a symbolic link to link spkg2 into the src directory. -- - Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Software licenses and releasing Python programs for review
Mike Meyer wrote: Steve Holden [EMAIL PROTECTED] writes: But this would only be a restriction if the code were to be redistributed, of course. It's stil perfectly legal to use it internaly without making the modified source available. I've heard people argue otherwise on this case. In particular, if you allow an employee to use your GPL'ed-but-not-distributed software, they are the end user, and have all the rights granted by the GPL. So they can distribute the software - possibly to your competitors. Employment contracts can't prohibit this, because the GPL specifically disallows distribution (allowing your employee to use the software) under licenses that restrict the rights granted by the GPL. I don't know whether this would hold water in court. I'd certainly hate to be the one responsible for a company finding out the hard way. Well, the FSF at least thinks that internal use within an organization does not constitute distribution. http://www.gnu.org/licenses/gpl-faq.html#GPLRequireSourcePostedPublic Does the GPL require that source code of modified versions be posted to the public? The GPL does not require you to release your modified version. You are free to make modifications and use them privately, without ever releasing them. This applies to organizations (including companies), too; an organization can make a modified version and use it internally without ever releasing it outside the organization. But if you release the modified version to the public in some way, the GPL requires you to make the modified source code available to the program's users, under the GPL. Thus, the GPL gives permission to release the modified program in certain ways, and not in other ways; but the decision of whether to release it is up to you. -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
Re: Why Eric3 does not have any documentation or FAQ?
Hsuan-Yeh Chang wrote: Dear All, Does anyone know why? HYC Because nobody has written it yet. Any volunteers? Detlev -- Detlev Offenbach [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: method = Klass.othermethod considered PITA
Steven Bethard wrote: John J. Lee wrote: It seems nice to do this class Klass: def _makeLoudNoise(self, *blah): ... woof = _makeLoudNoise Out of curiosity, why do you want to do this? I have occasionally seen this usage where it made sense. I vaguely remember cases where the same function/method met two demands that required two different names. An example would be a __special__ method also exposed publicly as 'special' ( something) without the underscores. Or some other interface required a different name. A related usage is a true specialization in which one or more parameters is given a default or constant value. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Q: functional/equational language, smells a little of Python
John J. Lee wrote: Saw this on LWN: http://q-lang.sourceforge.net/ Looks interesting, and reminiscent of symbolic algebra systems like Mathematica. Also, the website mentions dynamic typing and Batteries Included, which made me think of Python. Damned silly name, though (perhaps pre-Google?). Anybody here used it? Snippet from the FAQ: 2. Yet another Haskell for the poor? Not quite. Even though the syntax and some of the stuff in the standard library looks superficially similar, Q is different in a number of ways: * First and foremost, Q is an equational rather than just a functional language, meaning that it is based on general term rewriting instead of the lambda calculus (which is just one, and very special, rewriting system). In particular, Q has no a priori distinction between constructors and defined function symbols, and argument patterns are not restricted to constructor terms. This allows you to have symbolic evaluation rules like the following distributivity rule: X*(Y+Z) = X*Y+X*Z. Such rules are not allowed in ML and Haskell because they violate the constructor discipline. Moreover, the Q interpreter also happily reduces expressions involving variables, so that you can try your definitions with symbolic inputs (e.g., map F [X,Y] will evaluate to [F X,F Y]), which is quite useful for debugging purposes. * While other functional languages are either eager or lazy, Q tries to give you the best of both worlds: It uses eager (call-by-value) evaluation by default (which lends itself to an efficient implementation), but also allows you to define your own special forms, which can be used to implement both call-by-name functions and lazy data constructors. Using special forms you can also define your own meta functions which manipulate arbitrary (not necessarily irreducible) expressions as literal terms. This gives you full control over the reduction strategy, where this is desired, as well as a kind of macros and self-modifying programs, since constructs like lambda abstractions can be analyzed, transformed and constructed in many ways before they are actually evaluated. * Q uses dynamic typing. This has become a rare feature in contemporary functional languages, which usually employ a Hindley/Milner type system which offers more safety at the expense of restricting polymorphism. Q gives you back the flexibility of good old Lisp-style ad-hoc polymorphism and even allows you to extend the definition of existing operations (including built-in functions and operators) to your own data types. Moreover, Q has a Smalltalk-like object-oriented type system which supports data encapsulation and (single) inheritance. This makes it possible to manage complex, polymorphic data with ease. * Q takes the pragmatic route in that it provides (monad-free) imperative programming features such as imperative I/O and mutable data cells, similar to the corresponding facilities in ML. While one may argue about these, they certainly make life easier when programming complex I/O stuff such as graphical user interfaces. * Last but not least, the Q programming system comes with batteries included. There are quite a few add-on modules interfacing to third-party libraries which, while not as comprehensive as the facilities provided by traditional scripting languages like Perl and Python, allow you to tackle most practical programming problems with ease. In particular, multimedia and computer music is an area where Q shines, providing facilities to handle graphics, digital audio and MIDI in a convenient and efficient manner (efficient enough for soft realtime applications), which go well beyond what is currently being offered for other functional languages. Some of Q's flexibility comes at a price. In particular, Q's symbolic evaluation capabilities as a term rewriting language dictate that the language is essentially exception-free. This means that an ill-formed expression (such as division by zero or, more generally, the application of a function to data for which there is no corresponding definition) does not, by default, raise an exception, but instead the expression is already in normal form, i.e., it evaluates to itself. As a remedy, Q provides facilities to add explicit error rules which raise exceptions, and to handle exceptions in a suitable manner. Another limitation is that Q does not allow you to have arbitrary local definitions in the style of Haskell and ML's let and where clauses. In Q, where clauses are limited to variable definitions (similar to Haskell's pattern bindings), but local rewriting rules
Re: error in usin list with boost
Am Sonntag, 5. Juni 2005 08:13 schrieb GujuBoy: static list retrieval_as_list(SplitText self, int position, int retrieveLength) { list result; If I'm not completely mistaken: you know that this usage should (at least under all sensible terms) allocate a list on the stack and thus local to the function and not on the heap, unless boost does some mumbo jumbo that I know nothing of like starting the list with refcount=2? I don't think that's what you want... But for your boost usage, I have absolutely no idea! Why not write the Python wrapper directly in C? Just as easy, probably. And from what my experience is with using SWIG and SIP: much less errorprone... -- --- Heiko. see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/ pgpOADU4KnOsi.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: executing a command
Thanks, I solved it. The problem depended on IDLE. If I invoke a file from command line with os.exec* everything works perfectly.- Best -a- On 5 Jun 2005, at 01:07, Tiago Stürmer Daitx wrote: Hello, When you use one of the os.exec*p functions python looks for the specified file in the directories refered by os.environ['PATH']. If and _only_ if your os.enviroment['PATH'] isn't set then it looks in os.defpath - you can check this at http://www.python.org/doc/current/lib/os-path.html#l2h-1557 So, my advice is that you first try printing your os.environ['PATH'] to check wheter it includes the program that you are calling or not (and then you will have to include it). In the case that it isn't set, then check os.defpath. Also, when you use one of the functions os.exec that requires a path variable to be passed (ie. the ones that doesn't have 'p' in their names) the path can be relative or absolute, but it must include the file name (and not only the dir where the file is). And for each one of these os.exec* functions the first argument will always be used as the program name (argv[0]), so unless you a reason to do otherwise, pass the same name as the file that you are calling. Regards, Tiago S Daitx On 6/4/05, andrea valle [EMAIL PROTECTED] wrote: Hi to all, I need to run a program from inside python (substantially, algorithmic batch processing). I'm on mac osx 10.3.8 with python 2.3 framework and macpython. Trying to use exec*, I checked references, Brueck Tanner, and then grab this code from effbot: program = python def run(program, *args): os.execvp(program, (program,) + args) print ok run(python, /Users/apple/Desktop/prova.py) Traceback (most recent call last): File pyshell#50, line 1, in -toplevel- run(python, /Users/apple/Desktop/prova.py) File pyshell#49, line 2, in run os.execvp(program, (program,) + args) File /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/os.py, line 336, in execvp _execvpe(file, args) File /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/os.py, line 374, in _execvpe func(fullname, *argrest) OSError: [Errno 45] Operation not supported This OSError seems to be consistend with all exec family. What does it mean and how to use exec? I also tried with. os.system. It works if I invoke python, but it fails (in a way I don't know) when I invoke other programs. For example: command = python /Users/apple/Desktop/test.py os.system(command) 0 (test.py write a string in a file. It works) But with lilypond or with latex I have no output (and in fact it doesn't give 0 as result): command = lilypond /Users/apple/Desktop/test.ly os.system(command) 32512 command = latex /Users/apple/Desktop/test.tex os.system(command) 32512 Any help is much appreciated Thanks a lot -a- -- http://mail.python.org/mailman/listinfo/python-list Andrea Valle Laboratorio multimediale G. Quazza Facoltà di Scienze della Formazione Università degli Studi di Torino [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Scope
Steven Bethard [EMAIL PROTECTED] writes: Peter Dembinski wrote: AFAIK inc is builtin function. And builtin functions doesn't have to be real functions, they can be just aliases to Python's VM bytecodes or sets of bytecodes. Wrong on both counts. ;) Yup. My mistake. [snap] And while builtin functions may not have to be real *functions*, they do have to be real *callables*: Yes. I discovered it yesterday. [snap] Note that both type 'builtin_function_or_method' and type 'type' have a __call__ method, which means they are callable objects. They're not just bytecodes; they're real objects, just like everything else in Python. =) Yup. True. -- http://www.peter.dembinski.prv.pl -- http://mail.python.org/mailman/listinfo/python-list
Re: any macro-like construct/technique/trick?
Mike Meyer wrote: I've never tried it with python, but the C preprocessor is available as 'cpp' on most Unix systesm. Using it on languages other than C has been worthwhile on a few occasions. It would certainly seem to directly meet the OP's needs. Wouldn't that prohibit using #comments in the macro-Python code? I suppose they could be made with strings, as in here is a comment do_something() but it's ... strange. Andrew [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: any macro-like construct/technique/trick?
Mac [EMAIL PROTECTED] wrote: Is there a way to mimic the behaviour of C/C++'s preprocessor for macros? [...] * using def debug_emit(obj): if debug: emit_dbg_obj(obj) is a poor solution, because it *always* instantiates DbgObj*, even when not needed; I want to avoid such unnecessary waste How about using assert statements? When you run with optimization turned on, they don't even get compiled. Try something like this: class Debug: def __init__ (self, message): print debug (%s) % message print foo assert (Debug (bar)) which produces: Roy-Smiths-Computer:play$ python x.py foo debug (bar) Roy-Smiths-Computer:play$ python -O x.py foo Notice that the Debug() object doesn't even get created when optimization is turned on. It's a little funky, but at least anybody who knows python will understand your code. I agree with Andrew Dalke when he says of preprocessors: It's typically a bad idea because you're in essence creating a new language that is similar to but not Python, making it harder for people to understand what's going on. -- http://mail.python.org/mailman/listinfo/python-list
Re: csv and iterator protocol
Thanks Kent, I had a bug in my test program: it works fine with strings Philippe Kent Johnson wrote: Philippe C. Martin wrote: Can I initialize csv with input data stored in RAM (ex: a string) ? - so far I cannot get that to work. Or to rephrase the question, what Python RAM structure supports the iterator protocol ? Many, including strings, lists and dicts. For your needs, a list of strings will work, or a cStringIO initialized from your data. Kent -- http://mail.python.org/mailman/listinfo/python-list
XML help
I'm 4 months new to python and 4 hours new to XML. I've been trying to understand and use the DOM tree walk sample shown at this site: http://www.rexx.com/~dkuhlman/pyxmlfaq.html to walk through an xml file from which I need to extract data for subsequent plotting. I've repeated the functions from the site that I'm using here: import sys, string from xml.dom import minidom, Node def walkTree(node): if node.nodeType == Node.ELEMENT_NODE: yield node for child in node.childNodes: for n1 in walkTree(child): yield n1 def test(inFileName): outFile = sys.stdout doc = minidom.parse(inFileName) rootNode = doc.documentElement level = 0 for node in walkTree(rootNode): my_processing(node, outFile) A piece of the XML file I want to process is here: XMLDocument !-- ** -- !-- ** -- !--File Name: C:\Temp\slit_coarse_isowall_velocity.xml-- !-- ** -- !-- ** -- HEADER NAME Simulation Results XML Writer/NAME Version 1.00/Version /HEADER Dataset Name=Velocity ID=1555 DataType ELDT(Element data)/DataType DeptVar Name=Velocity Unit=m/s/ NumberOfComponents 1/NumberOfComponents NumberOfIndpVariables 2/NumberOfIndpVariables IndpVar Name=Time Unit=s/ IndpVar Name=Normalized thickness Unit=/ Blocks NumberOfBlocks 231/NumberOfBlocks Block Index=1 IndpVar Name=Time Value=0.065320 Unit=s/ IndpVar Name=Normalized thickness Value=0.00 Unit=/ NumberOfDependentVariables 32/NumberOfDependentVariables Data ElementData ID=1 DeptValues 1.5098e+000/DeptValues /ElementData ElementData ID=2 DeptValues 1.4991e+000/DeptValues /ElementData ElementData ID=7 DeptValues 1.4744e+000/DeptValues .. /Data /Block Block Index=2 As can be seen data is represented by blocks within which a datapoint exists for finite element IDs. Number of entries in each block vary and Element IDs are not necessarily contiguous. I've managed to test for specific elements and extract values. I want to place the reults in arrays with array index equal to element ID. So as I walk the tree I temporarily store IDs and DeptValues in lists. I'm ok so far. I then intend to create an array of size determined by the maximum value of ID. So in the sample above the array size will be 8 even though only three entries exist. At this point I'm stuck because I want to do this latter array creation and processing when I see the /Block end of block tag. However I can't figure out how to do that. Obviously I'm not understanding something about XML DOM trees and Elements because when I try to print all elements I never see an end tag for any. I'm obviously approaching this from a readline and process point of view which is probably half the problem. So how can I initiate array processing at the end of each block prior to reaching the next block. Of course I'm open to simpler ways too ;) tia for any advice. -- http://mail.python.org/mailman/listinfo/python-list
Socket Speed
Hi All I'm busy writing a python p2p program and would like some advice. I'm pushing about 300k/s and would like to know if there are any python tricks I could pull to speed things up. I'm thinking about unrolling some of the loops and recuding calls to my custom socket class and just calling recv and send directly. What is the overhead for using try and exception blocks ? any recomendations for recv/send sizes ? On the server side I'm using SocketServer. I was planning to use twisted but I don't have the time just get to get into it, SocketServer does the job. I'll post some code soon. Regs M -- http://mail.python.org/mailman/listinfo/python-list
Re: Socket Speed
300KB/s sounds dreadfully low. I simply ran python /usr/lib/python2.3/SimpleHTTPServer.py , then wget -O /dev/null http://0.0.0.0:8000/70megfile;. On the best of 4 runs (when the file was cached) wget measured 225.20MB/s. The hardware is a Pentium-M laptop with 768MB RAM runnng at 1.5GHz. The OS is Fedora Core 2, kernel 2.6.12-rc5, Python 2.3. Jeff pgpqnaSsnl0tn.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Grand Challenge Pegasus Team: Programming Pegasus Bridge 1 ?
Thank you Alex for your feedback. What I am really proposing is for others to test their software on our vehicle for the very reason that there are a lot of unknowns that I cannot believe can directly modeled into an ODE type of engine (as you call it.) Several reasons for this: - one piece of data is the images taken from the vehicle, since we do not use ranging system like lidar, data fusion using imagery and IMU data is at the center of devising a good algorithm for an autonomous vehicle. Unless one were to create a world with different illumination, shadowing (something that would be quite an undertaking on its own), it would not be a perfect fit to try out a new algorithm. Another data stream is sound as recorded in the vehicle, I am not sure on how to generate this type of information. - an ODE engine would mean that the dynamics of the vehicle and the terrain would be known in advance. This is rarely the case. - Our software is being tested on that vehicle already and the vehicle is ready, it would cost us less to try it out on the vehicle directly. Thanks for the pointer on PyODE. Igor. -- http://mail.python.org/mailman/listinfo/python-list
Re: What are OOP's Jargons and Complexities?
Andrea Griffini wrote: Of course it is a language, just not a standardized one (if you include Borland's extensions that make it practical). The history of runtime error 200 and its handling from borland is a clear example of what I mean with a product. Hmm, I had to google this up... Quite embarrassing, but it's a runtime bug and got nothing to do with the language per se. And it certainly manifests itself after the hey-days of Turbo Pascal (when Borland seems to have lost interest in maintaining it.) mkb. -- http://mail.python.org/mailman/listinfo/python-list
Re: any macro-like construct/technique/trick?
Mac wrote: Is there a way to mimic the behaviour of C/C++'s preprocessor for macros? The problem: a lot of code like this: def foo(): # do some stuff if debug: emit_dbg_obj(DbgObjFoo(a,b,c)) # do more stuff if debug: emit_dbg_obj(DbgObjBar(d,e)) # ... and so on ... Notes: * the two-lines of debug conditional tend to really break up the flow of the surrounding code * in C you could wrap them with a macro so you could do DEBUG_EMIT(DbgObjFoo(a,b,c)), etc, with the macro only instantiating the object and processing it if the debug flag was set. The one-liner is MUCH less disruptive visually when reading code Make emit_dbg_obj() a class to create one-liners: class Emit_dbg_obj: debug = True def __init__(self, algo): self.algo = algo def call_if_debug(self): if self.debug: return self.algo def foo2(): # do some stuff Emit_dbg_obj(DbgObjFoo(a,b,c)).call_if_debug() # do more stuff Emit_dbg_obj(DbgObjFoo(c,d)).call_if_debug() Ciao, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: XML help
I've managed to test for specific elements and extract values. I want to place the reults in arrays with array index equal to element ID. So as I walk the tree I temporarily store IDs and DeptValues in lists. I'm ok so far. I then intend to create an array of size determined by the maximum value of ID. So in the sample above the array size will be 8 even though only three entries exist. That sounds wrong. If what you want is a mapping between keys (your IDs) and values, you need to use a dcitionary. Like this: mapping[myid] = value At this point I'm stuck because I want to do this latter array creation and processing when I see the /Block end of block tag. However I can't figure out how to do that. Obviously I'm not understanding something about XML DOM trees and Elements because when I try to print all elements I never see an end tag for any. I'm obviously approaching this from a readline and process point of view which is probably half the problem. Your misunderstanding the nature of nodes in dom: a node in dom _is_ the start and end-tag. If you have a dom-tree that you serialize, a node in there will either be serialized as name/ if it has no childs, or as name ... /name if it has childs. So the other way round, for a well-formed xml document parsed to a dom, you end up with one node for all pairs of opening/closing tags. If a end-tag is what you're after, you migth want to look into the event-driven XML api, SAX. But then you'll have other tradeoffs compared to dom': all statekeeping has to be done by yourself. It's up to you to chose. Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Q: functional/equational language, smells a little of Python
Kay Schluehr [EMAIL PROTECTED] writes: [...] I'm curious why do you think that it smells like Python? Because of batteries included? Partly that and the mention of dynamic typing, plus harder-to-pin down things. I didn't mean to say that it was close kin to Python, just that on first impression it has some similarities. Are dotNET and Java Python-like because they come up with a fast object library? [...] What's a fast object library? John -- http://mail.python.org/mailman/listinfo/python-list
Re: any macro-like construct/technique/trick?
Kay Schluehr wrote: Mac wrote: Is there a way to mimic the behaviour of C/C++'s preprocessor for macros? The problem: a lot of code like this: def foo(): # do some stuff if debug: emit_dbg_obj(DbgObjFoo(a,b,c)) # do more stuff if debug: emit_dbg_obj(DbgObjBar(d,e)) # ... and so on ... Notes: * the two-lines of debug conditional tend to really break up the flow of the surrounding code * in C you could wrap them with a macro so you could do DEBUG_EMIT(DbgObjFoo(a,b,c)), etc, with the macro only instantiating the object and processing it if the debug flag was set. The one-liner is MUCH less disruptive visually when reading code Make emit_dbg_obj() a class to create one-liners: class Emit_dbg_obj: debug = True def __init__(self, algo): self.algo = algo def call_if_debug(self): if self.debug: return self.algo def foo2(): # do some stuff Emit_dbg_obj(DbgObjFoo(a,b,c)).call_if_debug() # do more stuff Emit_dbg_obj(DbgObjFoo(c,d)).call_if_debug() Ciao, Kay Hmmm... this won't work as expected. class Emit_dbg_obj: debug = True def __init__(self, algo, args): self.algo = algo self.args = args def call_if_debug(self): if self.debug: self.algo(*self.args) def foo2(): # do some stuff Emit_dbg_obj(DbgObjFoo,(a,b,c)).call_if_debug() # do more stuff Emit_dbg_obj(DbgObjFoo,(c,d)).call_if_debug() Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: Q: functional/equational language, smells a little of Python
John J. Lee wrote: What's a fast object library? ferrarilib :) -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: Q: functional/equational language, smells a little of Python
John J. Lee wrote: Kay Schluehr [EMAIL PROTECTED] writes: [...] I'm curious why do you think that it smells like Python? Because of batteries included? Partly that and the mention of dynamic typing, plus harder-to-pin down things. I didn't mean to say that it was close kin to Python, just that on first impression it has some similarities. O.K. Are dotNET and Java Python-like because they come up with a fast object library? [...] What's a fast object library? Sorry. 'Fast' was nonsense. Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: method = Klass.othermethod considered PITA
Jeff Epler [EMAIL PROTECTED] writes: On Sat, Jun 04, 2005 at 10:43:39PM +, John J. Lee wrote: 1. In derived classes, inheritance doesn't work right: Did you expect it to print 'moo'? I'd have been surprised, and expected the behavior you got. Me too. It's at the time of *writing* the code, before the subclass even exists, that the problem can arise, if you're not thinking about derivation. Sure, if you're not thinking about derivation, you have many other problems when somebody starts deriving from you, but, well, here's another issue to remember. Fine once you've noted this particular wrinkle, I suppose. And, looking again at another use case (in urllib2, the http_error_30* methods) I guess it's true that there are cases where methods are really distinct but merely happen to have the same implementation, so that method2 = method1 is actually what you want, hence better than a trivial method definition. 2. At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do this. In all the versions of Python I've used, classes are pickled by name. This example you wrote doesn't pose any special problem when pickling. pickle.dumps(A) 'c__main__\nA\np0\n.' pickle.dumps(B) 'c__main__\nB\np0\n.' I meant class instances. John -- http://mail.python.org/mailman/listinfo/python-list
Re: method = Klass.othermethod considered PITA
John J. Lee wrote: Steven Bethard [EMAIL PROTECTED] writes: In Python 2.4: py class A(object): ... def foo(self): ... print 'foo' ... bar = foo ... py import pickle py pickle.loads(pickle.dumps(A)).bar unbound method A.foo py pickle.loads(pickle.dumps(A())).bar() foo I meant class instances. Look closer. The second example pickles and unpickles an instance of class A. STeVe -- http://mail.python.org/mailman/listinfo/python-list
Re: Socket Speed
[EMAIL PROTECTED] wrote: Hi All I'm busy writing a python p2p program and would like some advice. I'm pushing about 300k/s and would like to know if there are any python tricks I could pull to speed things up. I'm thinking about unrolling some of the loops and recuding calls to my custom socket class and just calling recv and send directly. What is the overhead for using try and exception blocks ? any recomendations for recv/send sizes ? On the server side I'm using SocketServer. I was planning to use twisted but I don't have the time just get to get into it, SocketServer does the job. I'll post some code soon. Yeah - do post some code as 300k/s is probably *way* below the potential. In one project I'm working on, I do simple file transfers over a single socket with Python on both ends and I routinely get above 500Mbps (often into the high 700's/low 800's - pretty close to what I could hope for for gig over copper with TCP/IP) and the CPU utilization is way low - I assume disk on one end or the other of the connection is a bottleneck now. I use 64k send/receive buffers - above that it doesn't seem to help much for what I'm doing. In any case, before you make any local optimizations (loop unrolling, etc.), I'd do some more investigation to find the problem because something major is broken, and fixing it will probably do way more to improve performance than any optimization tricks. -Dave -- http://mail.python.org/mailman/listinfo/python-list
Re: how to get name of function from within function?
Steven Bethard wrote: Christopher J. Bottaro wrote: Kent Johnson wrote: class C(object): @in_try def func_a(self): print func_a @in_try def func_b(self): print func_b raise Exception You could probably create a metaclass to apply the wrappers automatically but I like having it explicit as above. Another good solution, thank you. Maybe a reason to upgrade to 2.4...=) If you can't upgrade, you can write Kent's code like: class C(object): def func_a(self): print func_a func_a = in_try(func_a) def func_b(self): print func_b raise Exception func_b = in_try(func_b) Yup, @ is shorthand for rebinding the function after applying the arg(s). I actually know this stuff, I wonder why I can't think of it on my own...ugh. Guess I gotta practice my knowledge more often. STeVe Thanks for the tip, -- C -- http://mail.python.org/mailman/listinfo/python-list
Iterate through a list calling functions
Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each validator using validateField method to gather my results. It works but it ugly and inefficient. Can someone advise whether there is a better way of doing this. I realize that the validator variable in my iteration is only a string so question is how can I make the validator string reference a function so I may be able to shorten validateField to something similar to this (instead of my long list of ifs which I am not very happy with): for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: results[name] = result Many thanks David My current situation below: # A large list of validators def isDecimal(name, value): Test whether numeric value is a decimal result = validateRegex(name, value, r'^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$', errmsg='is not a decimal number.', ignore=None) return result def isZipCode(name, value): Tests if field value is a US Zip Code result = validateRegex(name, value, r'^(\d{5}|\d{9})$', errmsg='is not a valid zip code.', ignore=None) return result ... more validators # Iterating over validators to gather field errors def validateField(name, value, validators_list, range=None, valid_values=None): Validates field input results={} for validator in validators_list: if validator == 'isContainedIn': result = isContainedIn(name, value) if type (result) in StringTypes: more... if validator == 'isDate': result = isDate(name, value) if type (result) in StringTypes: more... if validator == 'isDecimal': result = isDecimal(name, value) if type (result) in StringTypes: more... more validators ... -- http://mail.python.org/mailman/listinfo/python-list
maybe a bug in python
a = {1: (a)} a[1] 'a' why not ('a')? when a = {1: (((a)))} a[1] 'a' the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem. -- [http://www.flyaflya.com/] -- http://mail.python.org/mailman/listinfo/python-list
Announce: Python for .NET 1.0 RC2 released
Hi all - I'm happy to announce the release of Python for .NET 1.0 RC2. You can download it from: http://www.zope.org/Members/Brian/PythonNet Highlights of this release: - Changed some uses of Finalize as a static method name that confused the Mono compiler and people reading the code. Note that this may be a breaking change if anyone was calling PythonEngine.Finalize(). If so, you should now use PythonEngine.Shutdown(). - Tweaked assembly lookup to ensure that assemblies can be found in the current working directory, even after changing directories using things like os.chdir() from Python. - Fixed some incorrect finalizers (thanks to Greg Chapman for the report) that may have caused some threading oddities. - Tweaked support for out and ref parameters. If a method has a return type of void and a single ref or out parameter, that parameter will be returned as the result of the method. This matches the current behavior of IronPython and makes it more likely that code can be moved between Python for .NET and IP in the future. - Refactored part of the assembly manager to remove a potential case of thread-deadlock in multi-threaded applications. - Added a __str__ method to managed exceptions that returns the Message attribute of the exception and the StackTrace (if available). Thanks to all who have sent in issue reports, patches and suggestions for this and past releases. Enjoy! ;) Brian Lloyd[EMAIL PROTECTED] V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements
Steven Bethard wrote: Can you do the same thing for your proposal? As I understand it you want some sort of implicitly-defined BLOCK that starts the line after the with statement and runs to the end of the current block... Yes. I totally agree with the syntax in the PEP, it provides a necessary feature. I'm just suggesting to make the indentation *optional*, because most of the time it is not necessary. Do you think the benefit of less indentation outweighs the added complexity of explaining the construct? I still can't think of a good way of explaining the semantics you want. If you could provide an explanation that's simple and as explicit as Guido's explanation in PEP 343, I think that would help your case a lot. Since the current syntax would be there, the no-indentation syntax can be explained in terms of the indentation syntax: To avoid over-indentation, a with-statement can avoid defining a new indentation block. In that case, the end of the with block is the end of the current indentation block. with EXPR as VAR REST OF BLOCK is equivalent to with EXPR as VAR: BLOCK What do you think? I fail to see the complexity... P.S. I think it's a great sign that people are mainly squabbling about syntax here. More likely than not, Guido's already made his mind up about the syntax. So, since no one seems to have any real problems with the semantics, I'm hopeful that we'll get a direct implementation of PEP 343 in the next Python release. =) It's important to note that nobody is against the PEP syntax. We are only talking about adding things to it (optional indentation, or multiple-as as with import). All these changes can also be made later, so no proposition should slow down the implementation of the PEP. Regards, Nicolas -- http://mail.python.org/mailman/listinfo/python-list
Re: maybe a bug in python
flyaflya wrote: a = {1: (a)} a[1] 'a' why not ('a')? when a = {1: (((a)))} a[1] 'a' the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem. (a) is just a simple expression. You need to add a comma so that Python knows you want a tuple. Thusly... (a,) Will McGugan -- http://www.willmcgugan.com .join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in jvyy*jvyyzpthtna^pbz) -- http://mail.python.org/mailman/listinfo/python-list
Re: maybe a bug in python
Hallchen! flyaflya [EMAIL PROTECTED] writes: a = {1: (a)} a[1] 'a' why not ('a')? (a) is not a tuple, but (a,) is. Tsch, Torsten. -- Torsten Bronger, aquisgrana, europa vetus -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements
Nicolas Fleury [EMAIL PROTECTED] wrote: It's important to note that nobody is against the PEP syntax. We are only talking about adding things to it In think the above is a contradiction in terms. -- http://mail.python.org/mailman/listinfo/python-list
Re: maybe a bug in python
flyaflya wrote: a = {1: (a)} a[1] 'a' why not ('a')? when a = {1: (((a)))} a[1] 'a' the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem. To define a tuple literal with one member, you must place a comma after the first element like this: a = {1: (a,)} I read this somewhere in the python docs, so I know its there somewhere. The comma eliminates ambiguity as to the meaning of the brackets, which without the comma are simply enclosing and precedence controlling brackets. Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
David Pratt wrote: Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each validator using validateField method to gather my results. It works but it ugly and inefficient. Can someone advise whether there is a better way of doing this. I realize that the validator variable in my iteration is only a string so question is how can I make the validator string reference a function so I may be able to shorten validateField to something similar to this (instead of my long list of ifs which I am not very happy with): for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: results[name] = result Actually you can do exactly that by putting references to the validator functions in your list instead of (string) name. For example if you have validators = [ 'isDecimal', 'isFoo', 'isBar' ] just change it to validators = [ isDecimal, isFoo, isBar ] and your loop above will work. Python makes data-driven programming easy :-) Kent Many thanks David My current situation below: # A large list of validators def isDecimal(name, value): Test whether numeric value is a decimal result = validateRegex(name, value, r'^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$', errmsg='is not a decimal number.', ignore=None) return result def isZipCode(name, value): Tests if field value is a US Zip Code result = validateRegex(name, value, r'^(\d{5}|\d{9})$', errmsg='is not a valid zip code.', ignore=None) return result ... more validators # Iterating over validators to gather field errors def validateField(name, value, validators_list, range=None, valid_values=None): Validates field input results={} for validator in validators_list: if validator == 'isContainedIn': result = isContainedIn(name, value) if type (result) in StringTypes: more... if validator == 'isDate': result = isDate(name, value) if type (result) in StringTypes: more... if validator == 'isDecimal': result = isDecimal(name, value) if type (result) in StringTypes: more... more validators ... -- http://mail.python.org/mailman/listinfo/python-list
Re: If - Or statements
I'm sorry if this mail (also) sidetracks the primary theme of this thread. But, it was a moment of shock and awe seeing the use of list for checking among multiple options ... which is usually done using a name=opt1 or name=op2 etc., I started as a C programmer and hence, that style of thinking has stuck with me for this particular case( and now, i feel like banging my head on the wall for times i have not used the list like multiple option when possible(bang, bang)). It just reminds me that the most important thing about learning a language is also to learn its style and paradigm and not just its syntax and semantics. Or one might end up wrenching in C-like-thinking into a python program where it might not look necessarily pretty. Also, I strongly feel that one can get acquainted to the style and paradigm of a language only by reading the works of better coders. -- http://mail.python.org/mailman/listinfo/python-list
Re: maybe a bug in python
Just as everyone said, use ('a',) instead of ('a'). As Steve said there are lots of documentation about it. Check the Library Reference at http://www.python.org/doc/current/lib/typesseq.html#l2h-155 or to make things more clear you could read the tuples section in the tutorial at http://docs.python.org/tut/node7.html#SECTION00730 my 2 cents Regards, Tiago S Daitx On 6/5/05, flyaflya [EMAIL PROTECTED] wrote: a = {1: (a)} a[1]'a'why not ('a')? when a = {1: (((a)))} a[1]'a'the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem.--[http://www.flyaflya.com/]-- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: maybe a bug in python: NOW Pythonic Gotchas
Hi All-- This little gotcha ought to be number one on The Official List of Pythonic Gotchas, which should be required reading for everyone. What? There isn't one? Why not? Send me your tired, your poor, your huddled gotchas yearning to breathe free. I'll whup 'em into shape and make a doc page. The gods of documentation (as opposed to the gods _in_ documentation) can transfer it to the Official Documentation Homeland, or not, as they see fit. Metta, Ivan Tiago Stürmer Daitx wrote: Just as everyone said, use ('a',) instead of ('a'). As Steve said there are lots of documentation about it. Check the Library Reference at http://www.python.org/doc/current/lib/typesseq.html#l2h-155 or to make things more clear you could read the tuples section in the tutorial at http://docs.python.org/tut/node7.html#SECTION00730 my 2 cents Regards, Tiago S Daitx On 6/5/05, flyaflya [EMAIL PROTECTED] wrote: a = {1: (a)} a[1] 'a' why not ('a')? when a = {1: (((a)))} a[1] 'a' the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem. -- [http://www.flyaflya.com/] -- http://mail.python.org/mailman/listinfo/python-list --- -- http://mail.python.org/mailman/listinfo/python-list -- -- Ivan Van Laningham God N Locomotive Works http://www.pauahtun.org/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list
How many threads are too many?
This may be a stupid question, but here goes: When designing a threaded application, is there a pratical limit on the number of threads that one should use or is there a way to set it up so that the OS handles the number of threads automatically? I am developing on 32-bit x86 Intel systems with python 2.4.1. The OS will be Linux and Windows. I have an older app that used to work fine (254 threads) on early 2.3 Pythons, but now, I get this error with 2.4.1 and 2.3.5: Traceback (most recent call last): File net_queue_and_threads.py, line 124, in ? thread.start() File /usr/lib/python2.3/threading.py, line 416, in start _start_new_thread(self.__bootstrap, ()) thread.error: can't start new thread -- http://mail.python.org/mailman/listinfo/python-list
Re: method = Klass.othermethod considered PITA
Steven Bethard wrote: Well if you want these to work with subclasses that change verb_hello to do something else, one option is to write a simple decorator, and then your lines above become something like: Note I was just giving a use case for the general construct, not necessarily a use case for the pseudofeature the original poster was requesting. In my particular case, there isn't much need to make sure things are properly overridden in subclasses, since functionality tends to get added, rather than modified. (The Why would you want to do that? question was asked before he went on to show what wasn't working for him.) -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM erikmaxfrancis To understand is to forgive, even oneself. -- Alexander Chase -- http://mail.python.org/mailman/listinfo/python-list
how can delay be caused in tcp connection
sir, i am new to python. plz tell me how to cause delayin sending data through tcp connection. If can be implemented in python then plz let me know. waiting for reply from anyone thanx a lot.. its abhishek Discover Yahoo! Get on-the-go sports scores, stock quotes, news & more. Check it out!-- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
David Pratt wrote: Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each validator using validateField method to gather my results. It works but it ugly and inefficient. Can someone advise whether there is a better way of doing this. I realize that the validator variable in my iteration is only a string so question is how can I make the validator string reference a function so I may be able to shorten validateField to something similar to this (instead of my long list of ifs which I am not very happy with): for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: results[name] = result Many thanks David My current situation below: # A large list of validators def isDecimal(name, value): Test whether numeric value is a decimal result = validateRegex(name, value, r'^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$', errmsg='is not a decimal number.', ignore=None) return result def isZipCode(name, value): Tests if field value is a US Zip Code result = validateRegex(name, value, r'^(\d{5}|\d{9})$', errmsg='is not a valid zip code.', ignore=None) return result ... more validators # Iterating over validators to gather field errors def validateField(name, value, validators_list, range=None, valid_values=None): Validates field input results={} for validator in validators_list: if validator == 'isContainedIn': result = isContainedIn(name, value) if type (result) in StringTypes: more... if validator == 'isDate': result = isDate(name, value) if type (result) in StringTypes: more... if validator == 'isDecimal': result = isDecimal(name, value) if type (result) in StringTypes: more... more validators ... That's a typical case for using an OO approach; just make a class for each validator and have a single polymorphic validate method (I would make validators __call__able instead of naming the method 'validate'): # Abstract Validator class; not strictly necessary but good for documentation class Validator(object): def __call__(self,field,value): '''Validate a value for this field. Return a string representation of value on success, or None on failure. ''' raise NotImplementedError(Abstract method) class DecimalValidator(Validator): def __call__(self,name,value): '''Test whether numeric value is a decimal.''' class ZipCodeValidator(Validator): def __call__(self,name,value): '''Test if value is a US Zip Code.''' def validateField(name, value, validators): Validates field input results = {} for validate in validators: result = validate(name,value) if result is not None: results[name] = result # XXX: if more than one validators succeed, # all but the last result will be overwritten return results # test validators = [DecimalValidator(), ZipCodeValidator()] print validateField(home ZIP, 94303, validators) Regards, George -- http://mail.python.org/mailman/listinfo/python-list
Re: If - Or statements
venkata subramanian [EMAIL PROTECTED] wrote: It just reminds me that the most important thing about learning a language is also to learn its style and paradigm and not just its syntax and semantics. Or one might end up wrenching in C-like-thinking into a python program where it might not look necessarily pretty. Exactly! One sure sign of somebody trying to write C in Python is when they loop over a list by doing for i in range (len (myList)): doSomethingWith (myList[i]) or when they laboriously check for every possible error condition before performing an operation instead of just doing it and catching the exception. -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
Hi Kent. Thank you for your reply. I gave this a go but get the following traceback: ... result = validator(name, value) TypeError: 'str' object is not callable Have put validators in list and iterate over it as in following: validator_list = [isContainedIn,isDate,isDecimal,isEmail,isEmpty,isInteger... more validators] results={} for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: # do some stuff... return results Regards, David On Sunday, June 5, 2005, at 02:03 PM, Kent Johnson wrote: David Pratt wrote: Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each validator using validateField method to gather my results. It works but it ugly and inefficient. Can someone advise whether there is a better way of doing this. I realize that the validator variable in my iteration is only a string so question is how can I make the validator string reference a function so I may be able to shorten validateField to something similar to this (instead of my long list of ifs which I am not very happy with): for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: results[name] = result Actually you can do exactly that by putting references to the validator functions in your list instead of (string) name. For example if you have validators = [ 'isDecimal', 'isFoo', 'isBar' ] just change it to validators = [ isDecimal, isFoo, isBar ] and your loop above will work. Python makes data-driven programming easy :-) Kent Many thanks David My current situation below: # A large list of validators def isDecimal(name, value): Test whether numeric value is a decimal result = validateRegex(name, value, r'^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$', errmsg='is not a decimal number.', ignore=None) return result def isZipCode(name, value): Tests if field value is a US Zip Code result = validateRegex(name, value, r'^(\d{5}|\d{9})$', errmsg='is not a valid zip code.', ignore=None) return result ... more validators # Iterating over validators to gather field errors def validateField(name, value, validators_list, range=None, valid_values=None): Validates field input results={} for validator in validators_list: if validator == 'isContainedIn': result = isContainedIn(name, value) if type (result) in StringTypes: more... if validator == 'isDate': result = isDate(name, value) if type (result) in StringTypes: more... if validator == 'isDecimal': result = isDecimal(name, value) if type (result) in StringTypes: more... more validators ... -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
Cool! Many thanks George. Yes this is the way to go - objects. Much better :-) On Sunday, June 5, 2005, at 02:49 PM, George Sakkis wrote: David Pratt wrote: Hi. I am creating methods for form validation. Each validator has its own method and there quite a number of these. For each field, I want to evaluate errors using one or more validators so I want to execute the appropriate validator methods from those available. I am iterating over each validator using validateField method to gather my results. It works but it ugly and inefficient. Can someone advise whether there is a better way of doing this. I realize that the validator variable in my iteration is only a string so question is how can I make the validator string reference a function so I may be able to shorten validateField to something similar to this (instead of my long list of ifs which I am not very happy with): for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: results[name] = result Many thanks David My current situation below: # A large list of validators def isDecimal(name, value): Test whether numeric value is a decimal result = validateRegex(name, value, r'^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$', errmsg='is not a decimal number.', ignore=None) return result def isZipCode(name, value): Tests if field value is a US Zip Code result = validateRegex(name, value, r'^(\d{5}|\d{9})$', errmsg='is not a valid zip code.', ignore=None) return result ... more validators # Iterating over validators to gather field errors def validateField(name, value, validators_list, range=None, valid_values=None): Validates field input results={} for validator in validators_list: if validator == 'isContainedIn': result = isContainedIn(name, value) if type (result) in StringTypes: more... if validator == 'isDate': result = isDate(name, value) if type (result) in StringTypes: more... if validator == 'isDecimal': result = isDecimal(name, value) if type (result) in StringTypes: more... more validators ... That's a typical case for using an OO approach; just make a class for each validator and have a single polymorphic validate method (I would make validators __call__able instead of naming the method 'validate'): # Abstract Validator class; not strictly necessary but good for documentation class Validator(object): def __call__(self,field,value): '''Validate a value for this field. Return a string representation of value on success, or None on failure. ''' raise NotImplementedError(Abstract method) class DecimalValidator(Validator): def __call__(self,name,value): '''Test whether numeric value is a decimal.''' class ZipCodeValidator(Validator): def __call__(self,name,value): '''Test if value is a US Zip Code.''' def validateField(name, value, validators): Validates field input results = {} for validate in validators: result = validate(name,value) if result is not None: results[name] = result # XXX: if more than one validators succeed, # all but the last result will be overwritten return results # test validators = [DecimalValidator(), ZipCodeValidator()] print validateField(home ZIP, 94303, validators) Regards, George -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter, option_add, entry field trouble
I think you have to spell it Root.option_add(*Entry*highlightThickness, 2) Root.option_add(*Entry*highlightColor, green) When you're not sure of the capitalization, do something like this interactively: e.configure('highlightcolor') ('highlightcolor', 'highlightColor', 'HighlightColor', 'SystemWindowFrame', 'green') When you use 'configure' this way, the *second* string has the correct capitalization for use in option_add. The fourth is the system default before taking into account the option database, and the last is the current value. Jeff pgpGoaYJ6P0vY.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter, option_add, entry field trouble
Yahoo! That was it. When is Grayson coming out with a new version of Python and Tkinter Programming? Mine is getting pretty full of pen ink changes. :) Nice tip, too! Thanks! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I think you have to spell it Root.option_add(*Entry*highlightThickness, 2) Root.option_add(*Entry*highlightColor, green) When you're not sure of the capitalization, do something like this interactively: e.configure('highlightcolor') ('highlightcolor', 'highlightColor', 'HighlightColor', 'SystemWindowFrame', 'green') When you use 'configure' this way, the *second* string has the correct capitalization for use in option_add. The fourth is the system default before taking into account the option database, and the last is the current value. Jeff -- http://mail.python.org/mailman/listinfo/python-list
GUI builders considered harmful (Was: anygui,anydb, any opinions?)
Thomas Bartkus [EMAIL PROTECTED] writes: Paul Rubin http://[EMAIL PROTECTED] wrote in message Are we talking about a drag-and-drop GUI builder? I am! [...] I happen to be one - and I *know* I'm not alone - who thinks that building user interfaces is way too difficult and way too important. It is particularly frustrating in that we do seem to be moving backwards in this department. What GUI builder should I use, or similar, is a common question on c.l.python. I'm a curmudgeon, and don't like GUI builders - so I avoid them. While normally that wouldn't cause me to encourage others to avoid GUI builders, I think they have a worse problem: they encourage the delivery of applications without flexible, robust user interfaces. In short, the help produce inferior applications. While this isn't strictly a python issue, c.l.python is where I run into it - so I'm bringing it up here. Now, I'm not an expert on GUIs, GUI toolkits, or GUI builders. I've used some of each, and draw my conclusions from that admittedly small sampling. Possibly there are other samples that don't have the problems I describe. Part of the point of posting this is to expose these thoughts to others, and find out what I've overlooked. I'll return to these points where appropriate. What the user deserves. I'm going to take a side trip into what constitutes a robust, flexible user interface - which is what I believe the user deserves. Please bear with me. By robust, I mean the user interface should adopt to the environment it's being run in. Windows that don't fit on the screen are simply unacceptable - but all to common if you use a very small screen resolution. By flexible, I man the user should be able to adjust the UI to suit their viewing conditions - the DPI on the screen, the viewing distance, and their possibly aging eyesight. I use two systems with graphical interfaces, and both are a bit out of the ordinary. You might even call them extreme. One is a 1600x1200 desktop on a 21 monitor viewed from about 18 away. The other is a 640x480 desktop on a 53 monitor viewed from about 10' away. Even those these are on opposite sides of normal users systems, they both suffer from the same problem - out of the box applications have UI elements that are unreadably small. The obvious solution would be for the system to detect all these environmental factors, and scale the applications accordingly. However, things like viewing distance and the quality of my eyesight are hard to detect automatically, and it would be a pain to have to enter all those things manually. Since the end result of all these is a single factor - a UI scale factor - a system wide knob to scale applications would seem to be the solution. Note that this is *not* an easy thing to do. Anyone who's tried scaling bit-mapped fonts will tell you you can't simply scale something and expect it to look good. Scalable fonts have hints and other goodies in them so they look good as you scale the fonts up/down. This may be why, but most windowing systems don't seem to do provide a global UI scale knob. X certainly doesn't. Windows has a limited capability to scale fonts system-wide, but it doesn't work very well. OSX seems to have a system-wide display DPI setting one can play with, but it's not clear how well that works. NeWS and NeXT could probably do this, but would seem to have a negligible to nonexistent user bases. rio seems capable, but the typical rio UI is ugly even by my admittedly low standards. Failing the single system-wide knob, a flexible application should have allow the user to scale the application with a single knob. This is hard to do with modern GUI toolkits. I do it by using text for imagery in the UI, and having a scaling factor that is applied to the font sizes. While I prefer text to graphics for UI elements, that's a rant for a different time. I'll concede that such an interface is probably unacceptable on a modern commercial application - users now expect graphics. But how many GUI toolkits let you use a scalable graphics format (SVG, PS, etc) for images in the UI? My predilections have kept me from looking closely, but I certainly don't recall seeing any in the GUI toolkits I've looked at. I claim it's obvious from this what's wrong with GUI builders. But I want to look at what I, as a developer, want from GUI development tools before going into details. What the developer wants. Ok, what I mean is what *I* want. But I don't think I'm that unusual, so I'm going to generalize to other developers as well. I'll point out what has to be different for this generalization to fail. First, I'm not a graphics designer. While I've studied page layout and typographical design, and read Tufte's books on design, I'm a *long* way from being a good graphics designer. I know even less about the field of human-computer interactions. Hopefully, a good GUI library will have had people on the development team who do know something about these fields. In this - the
Re: couple of new python articles on onlamp
Jeremy Jones zanesdad at bellsouth.net writes: Python Standard Logging http://www.onlamp.com/pub/a/python/2005/06/02/logging.html To echo Thomas Heller's comment - nice article on logging. I'll update the docs so that the stuff about the 4-byte length is a little clearer. Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list
what can happen if Python wents commercial ;-) ...
don't click the following link if you are not at least 18 years old (or don't like sexual related content): http://www.python.com/ Claudio -- http://mail.python.org/mailman/listinfo/python-list
Killing threads during development.
I've been developing with external multi-threaded libraries recently. I find it difficult to use the Python prompt to experiment with these libraries because there isn't any way to just shutdown all threads and try things again. If I try to exit the prompt with background threads running, then Python hangs and I have to kill the process to exit. Ctrl C won't do it. Is there some way to brutally kill all background threads? Just for development purposes? Note: This isn't an insurmountable problem. If I write test scripts and run them from the command line I can still kill them easily. I just find it frustrating not be to able to explore interactively while working with a new library. -- http://mail.python.org/mailman/listinfo/python-list
mix up a string
What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI builders considered harmful
Mike Meyer [EMAIL PROTECTED] writes: [...] The first, and most obvious, thing that GUI builders do is force the developer to specify an exact position - if not size - for the graphical elements of the UI. They do? I don't remember them doing that. I just downloaded SpecTcl (a oldish example) just to check, and that doesn't. I presume more recent ones work no less well? I seem to remember that the GUI builder in Visual Studio didn't seem to be particularly sane (I couldn't seem to work out how to get a dialog to resize appropriately to accommodate different font sizes, for example), but I assumed that was just me failing to understand something. [...] -- http://mail.python.org/mailman/listinfo/python-list
Re: mix up a string
rbt mix = random.shuffle('dog') Try: lst = list('dog') random.shuffle(lst) print .join(lst) Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: mix up a string
rbt wrote: What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? py def shuffled(s): ... l = list(s) ... random.shuffle(l) ... return ''.join(l) Reinhold -- http://mail.python.org/mailman/listinfo/python-list
Re: mix up a string
Reinhold Birkenfeld wrote: rbt wrote: What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? py def shuffled(s): ... l = list(s) ... random.shuffle(l) ... return ''.join(l) Reinhold Thanks guys, this works great. I forgot that shuffle needs a sequence... duh ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: error in usin list with boost
GujuBoy: i have created a cpp file which has the followin code and when i try to compile it..it does not know what list is..it says its undefined..i also tried using #include boost/python/list.hpp I would have expected this (except the cstdint.h line which may not be needed but it was in the code I copied from) to already be in your code if you are using Boost Python: #include boost/python.hpp #include boost/cstdint.hpp using namespace boost::python; Have you read the Tutorial Introduction? http://www.boost.org/libs/python/doc/tutorial/doc/html/index.html Neil -- http://mail.python.org/mailman/listinfo/python-list
Opposite of splitting?
Hello all, I have a list of integers: q = [ 1, 2, 4, 7, 9 ] which I would like to convert to a string: 1,2,4,7,9 This is *very* easy to do with a simple while loop.. But I suspect that there is a more elegant way to do it in Python. Is there? If so: How? -- http://mail.python.org/mailman/listinfo/python-list
Re: Opposite of splitting?
Jan Danielsson [EMAIL PROTECTED] writes: I have a list of integers: q = [ 1, 2, 4, 7, 9 ] which I would like to convert to a string: 1,2,4,7,9 s = ','.join([str(n) for n in q]) Alternatively, just repr(q) gives you '[1, 2, 4, 7, 9]' (with the brackets and spaces). -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements
Nicolas Fleury wrote: Since the current syntax would be there, the no-indentation syntax can be explained in terms of the indentation syntax: To avoid over-indentation, a with-statement can avoid defining a new indentation block. In that case, the end of the with block is the end of the current indentation block. with EXPR as VAR REST OF BLOCK is equivalent to with EXPR as VAR: BLOCK What do you think? I fail to see the complexity... I guess my only real qualm about this is that I think it makes it harder to see where __exit__() methods are called. When I compare: def func(arg, baz): foo = bar(arg) with x as foo(baz) x.frobble() with y as x.bop() return frabble(x, y) with: def func(arg, baz): foo = bar(arg) with x as foo(baz): x.frobble() with y as x.bop(): return frabble(x, y) I find it much easier to identify in the second one that __exit__() methods will be called right before the function returns (after the return statement). YMMV. BTW, if you really like the optional-indentation idea, you should post it to the Wiki page (http://wiki.python.org/moin/WithStatement) -- Guido's been pretty quick to respond to any comments made there, so you could get some feedback much more useful than I can give you. ;) STeVe -- http://mail.python.org/mailman/listinfo/python-list
Re: What are OOP's Jargons and Complexities?
On Sun, 05 Jun 2005 16:30:18 +0200, Matthias Buelow [EMAIL PROTECTED] wrote: Quite embarrassing, but it's a runtime bug and got nothing to do with the language per se. And it certainly manifests itself after the hey-days of Turbo Pascal (when Borland seems to have lost interest in maintaining it.) The point is not the bug, of course, but how borland handled it. It appeared when the user community of borland pascal was well alive and kicking, but borland didn't even invest 5 seconds for the issue. The users had to fix the library themselves (possible because at that time with Borland Pascal you were getting the whole source code of the library; but note that it was a 100% genuine bug due to misprogramming, fixing it even on a dead product would have been the a nice move from borland). The user community went even further, as so many executables were written witn borland pascal that a special tool for binary patching executables was built (actually a few of them, as being unofficial it wasn't that simple to get to know that such a tool existed, so different people independently resorted to the same solution). Andrea -- http://mail.python.org/mailman/listinfo/python-list
PyArg_ParseTuple and dict
I'm trying to write an extension for python 2.4, and I can't seem to get PyArg_ParseTuple to work with a dict. I've tried all sorts of things, but the most simple thing that fails is: [...] if (!PyArg_ParseTuple(args, O, file)) { return NULL; } [...] If I call the function from python with an int, or a string, etc it works fine. If I pass in a dict I get: SystemError: new style getargs format but argument is not a tuple even though a call to: PyObject_TypeCheck(args, PyTuple_Type) tells me that args is a tuple. PyObject_Print(args, stdout, NULL) even produces: ({'foo': 1},) Can anyone give me a minimal example of a C function that takes a dict and parses it out with PyArg_ParseTuple? -Seth -- http://mail.python.org/mailman/listinfo/python-list
RE: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements
Nicolas Fleury wrote: def getFirstLine(filename): with opening(filename) as file return file.readline() Your tastes definitely disagree with the majority of Python programmers then, including Guido. Scoping is defined in Python by indentation. If you want the above sort of thing, you're going to have to write a new PEP, and I'd be very surprised to see it accepted. But there's nothing stopping you from doing so. def getFirstLine(filename): with opening(filename) as file: return file.readline() This is beautiful and explicit. What else could you want? The syntax: with EXPR1 as VAR1, EXPR2 as VAR2: ... was discussed on python-dev. It wasn't explicitly rejected, but the feeling seemed to be that it was an unnecessary complication as far as PEP 343 is concerned. There's nothing stopping another PEP proposing this as an extension to PEP 343, and there's nothing stopping that being in Python 2.5 if it's accepted. PEP 343 was originally PEP 340 (and several other things) and was quite complicated at one point (it originally contained PEP 342 as well). The PEP in its current state represents 2 months of discussion, complication and (finally) simplification. Its semantics are clear and unambiguous. And (as Guido states) it will obsolete 4(?) other PEPs. Be sure to read the referenced PEPs (and the ones referenced from them) - they contain a lot of history. Also read PEP 346 for a competing PEP to PEPs 340 and 343 that gradually converged to PEP 343 - most importantly, it contains the rejected options (that seem to have been lost from PEPs 340 and 343). Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements
Paul Rubin http://[EMAIL PROTECTED] writes: Delaney, Timothy C (Timothy) [EMAIL PROTECTED] writes: Be sure to read the referenced PEPs (and the ones referenced from them) - they contain a lot of history. Also read PEP 346 for a competing PEP to PEPs 340 and 343 that gradually converged to PEP 343 - most importantly, it contains the rejected options (that seem to have been lost from PEPs 340 and 343). There was an interesting proposal (later rejected) from Raymond Hettinger a while back, that allowed passing arguments into a suspended generator, where they could be seen by the yield statement. I don't remember specifics and it doesn't seem to be in any of those PEP's. Anyone remember more? I wonder whether 343 could somehow resurrect the good parts of that. It sounds like you're remembering PEP 342. 343 references that, but doesn't include much of it. mike -- Mike Meyer [EMAIL PROTECTED] http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list
random module question
Can I rely on the random.py module to produce the same series of numbers for future/past versions of Python, given the same seed? Can I rely on it across different architectures and operating systems? I looked at the docs and couldn't find this stated anywhere. My feeling is yes, but it's a fairly big claim so I want to make sure. R -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI builders considered harmful
Bruce Stephens [EMAIL PROTECTED] writes: Mike Meyer [EMAIL PROTECTED] writes: [...] The first, and most obvious, thing that GUI builders do is force the developer to specify an exact position - if not size - for the graphical elements of the UI. They do? I don't remember them doing that. I just downloaded SpecTcl (a oldish example) just to check, and that doesn't. I presume more recent ones work no less well? I seem to remember that the GUI builder in Visual Studio didn't seem to be particularly sane (I couldn't seem to work out how to get a dialog to resize appropriately to accommodate different font sizes, for example), but I assumed that was just me failing to understand something. In my experience, they do. But as noted, my experience is limited. mike -- Mike Meyer [EMAIL PROTECTED] http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list
Destructive Windows Script
How easy or difficult would it be for a computer forensics expert to recover data that is overwritten in this manner? This is a bit off-topic for comp.lang.python, but I thought some here would have some insight into this. Warning: **This code is destructive**. Do not run it unless you fully understand what you're doing!!! os.chdir('/temp') for root, dirs, files in os.walk('.'): for f in files: try: print f data = ['0', 'a', '1', 'b', '2', 'c',\ '3', 'd', '4', 'e', '5', 'f',\ '6', 'g', '7', 'h', '8', 'i',\ '9', 'j', '~', '!', '@', '#',\ '$', '%', '^', '', '*', ';'] fp = file(os.path.join(root,f), 'w') random.shuffle(data) garble = ''.join(data) fp.write(garble) fp.close() fs = os.popen(del /f /q /s *) fs.read() fs.close() except Exception, e: print e time.sleep(1) continue -- http://mail.python.org/mailman/listinfo/python-list
Re: The need to put self in every method
In article [EMAIL PROTECTED], Piet van Oostrum [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Aahz) (A) wrote: Any objection to swiping this for the FAQ? (Probably with some minor edits.) No. The global/local stuff needs a bit more nuance (assignments in the method being the criterium). Done! Thanks for prodding the update. -- Aahz ([EMAIL PROTECTED]) * http://www.pythoncraft.com/ f u cn rd ths, u cn gt a gd jb n nx prgrmmng. -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements
Delaney, Timothy C (Timothy) [EMAIL PROTECTED] writes: Be sure to read the referenced PEPs (and the ones referenced from them) - they contain a lot of history. Also read PEP 346 for a competing PEP to PEPs 340 and 343 that gradually converged to PEP 343 - most importantly, it contains the rejected options (that seem to have been lost from PEPs 340 and 343). There was an interesting proposal (later rejected) from Raymond Hettinger a while back, that allowed passing arguments into a suspended generator, where they could be seen by the yield statement. I don't remember specifics and it doesn't seem to be in any of those PEP's. Anyone remember more? I wonder whether 343 could somehow resurrect the good parts of that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic Gotchas
Ivan Van Laningham wrote: This little gotcha ought to be number one on The Official List of Pythonic Gotchas, which should be required reading for everyone. What? There isn't one? Why not? There's at least one active Python Gotchas page out there: http://www.ferg.org/projects/python_gotchas.html The last update was in April. -alex23 -- http://mail.python.org/mailman/listinfo/python-list
Re: PyArg_ParseTuple and dict
[EMAIL PROTECTED] wrote: I'm trying to write an extension for python 2.4, and I can't seem to get PyArg_ParseTuple to work with a dict. I've tried all sorts of things, but the most simple thing that fails is: [...] if (!PyArg_ParseTuple(args, O, file)) { return NULL; } [...] If I call the function from python with an int, or a string, etc it works fine. If I pass in a dict I get: SystemError: new style getargs format but argument is not a tuple even though a call to: PyObject_TypeCheck(args, PyTuple_Type) tells me that args is a tuple. PyObject_Print(args, stdout, NULL) even produces: ({'foo': 1},) Can anyone give me a minimal example of a C function that takes a dict and parses it out with PyArg_ParseTuple? 1. On the surface, there appears to be a bug. In the interests of finding out where the bug is, perhaps it would be better if you posted your minimal compilable runnable example of what *doesn't* work. 2. To get you off the ground: *if* there is only one argument and it can only be described in general terms like O (i.e. you still need to check the type) then there is little point in using PyArg_ParseTuple; describe the function as using METH_O instead of METH_VARARGS, and access the arg directly. 3. What is your platform? Which C compiler? What warnings does it give, [or would it give if allowed free speech]? Are you running Python 2.4 or 2.4.1? 4. Do you get the same symptoms when you pass in a list instead of a dict? What about a minimal user-created object? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if they are using a journaling file system like NTFS, which Windows XP does. If you are honestly trying to destroy your own data, go out and download a free program that will do it right. If you're trying to write some kind of trojan, well you've got a lot of learning to do. :) R rbt wrote: How easy or difficult would it be for a computer forensics expert to recover data that is overwritten in this manner? This is a bit off-topic for comp.lang.python, but I thought some here would have some insight into this. Warning: **This code is destructive**. Do not run it unless you fully understand what you're doing!!! os.chdir('/temp') for root, dirs, files in os.walk('.'): for f in files: try: print f data = ['0', 'a', '1', 'b', '2', 'c',\ '3', 'd', '4', 'e', '5', 'f',\ '6', 'g', '7', 'h', '8', 'i',\ '9', 'j', '~', '!', '@', '#',\ '$', '%', '^', '', '*', ';'] fp = file(os.path.join(root,f), 'w') random.shuffle(data) garble = ''.join(data) fp.write(garble) fp.close() fs = os.popen(del /f /q /s *) fs.read() fs.close() except Exception, e: print e time.sleep(1) continue -- http://mail.python.org/mailman/listinfo/python-list
Re: random module question
Roose [EMAIL PROTECTED] writes: Can I rely on the random.py module to produce the same series of numbers for future/past versions of Python, given the same seed? Can I rely on it across different architectures and operating systems? I looked at the docs and couldn't find this stated anywhere. My feeling is yes, but it's a fairly big claim so I want to make sure. I do not think you should rely on this. It uses a very specific algorithm (Mersenne Twister) which is written in C and is nonstandard, and future Python implementers shouldn't be expected to implement the exact same algorithm. It's probably already unavailable in Jython. See SF bug 917055 for some further discussion. -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
Roose wrote: My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if they are using a journaling file system like NTFS, which Windows XP does. If you are honestly trying to destroy your own data, go out and download a free program that will do it right. If you're trying to write some kind of trojan, well you've got a lot of learning to do. :) Thanks for the opinion... I don't do malware. Just interested in speeding up file wiping (if possible) for old computers that will be auctioned. The boot programs that you allude to (killdisk, autoclave) work well, but are slow and tedious. If this can be done *properly* in Python, I'd like to have a go at it. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyArg_ParseTuple and dict
1. On the surface, there appears to be a bug. In the interests of finding out where the bug is, perhaps it would be better if you posted your minimal compilable runnable example of what *doesn't* work. I'll post it later tonight. 2. To get you off the ground: *if* there is only one argument and it can only be described in general terms like O (i.e. you still need to check the type) then there is little point in using PyArg_ParseTuple; describe the function as using METH_O instead of METH_VARARGS, and access the arg directly. So, I started out using iO! and having PyArgParseTuple do the type checking for me (passing in an PyDict_Type). 3. What is your platform? Which C compiler? What warnings does it give, [or would it give if allowed free speech]? Are you running Python 2.4 or 2.4.1? Python 2.4 (#1, Mar 10 2005, 16:54:23) [C] on sunos5 Solaris 9 x86, forte 6.2 4. Do you get the same symptoms when you pass in a list instead of a dict? What about a minimal user-created object? A list works fine, as does a 1 element tuple with a dict in it. I'm not sure what you mean by minimal user-created object. -Seth -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)
I think you missed looking at several GUI builders. I have not used a GUI builder in 5 years that had you nail down positions. Swing(for Java), GTK, Qt, and wxWidgets(to a lesser degree) all use a sizer metaphore. You lay out he sizers and put your widgets in various sizer layouts. This means that the scaling you speak of above, just works for you. Accordingly GUI builders for these toolkits work within that model(look at Glade for GTK and wxGlade for wxWidgets). I think you need to step out of the age of Motif and MFCs and look at what modern toolkits and GUI designers have to offer before you start in on a rant. -Chris On 6/5/05, Mike Meyer [EMAIL PROTECTED] wrote: Thomas Bartkus [EMAIL PROTECTED] writes: Paul Rubin http://[EMAIL PROTECTED] wrote in message Are we talking about a drag-and-drop GUI builder? I am! [...] I happen to be one - and I *know* I'm not alone - who thinks that building user interfaces is way too difficult and way too important. It is particularly frustrating in that we do seem to be moving backwards in this department. What GUI builder should I use, or similar, is a common question on c.l.python. I'm a curmudgeon, and don't like GUI builders - so I avoid them. While normally that wouldn't cause me to encourage others to avoid GUI builders, I think they have a worse problem: they encourage the delivery of applications without flexible, robust user interfaces. In short, the help produce inferior applications. While this isn't strictly a python issue, c.l.python is where I run into it - so I'm bringing it up here. Now, I'm not an expert on GUIs, GUI toolkits, or GUI builders. I've used some of each, and draw my conclusions from that admittedly small sampling. Possibly there are other samples that don't have the problems I describe. Part of the point of posting this is to expose these thoughts to others, and find out what I've overlooked. I'll return to these points where appropriate. What the user deserves. I'm going to take a side trip into what constitutes a robust, flexible user interface - which is what I believe the user deserves. Please bear with me. By robust, I mean the user interface should adopt to the environment it's being run in. Windows that don't fit on the screen are simply unacceptable - but all to common if you use a very small screen resolution. By flexible, I man the user should be able to adjust the UI to suit their viewing conditions - the DPI on the screen, the viewing distance, and their possibly aging eyesight. I use two systems with graphical interfaces, and both are a bit out of the ordinary. You might even call them extreme. One is a 1600x1200 desktop on a 21 monitor viewed from about 18 away. The other is a 640x480 desktop on a 53 monitor viewed from about 10' away. Even those these are on opposite sides of normal users systems, they both suffer from the same problem - out of the box applications have UI elements that are unreadably small. The obvious solution would be for the system to detect all these environmental factors, and scale the applications accordingly. However, things like viewing distance and the quality of my eyesight are hard to detect automatically, and it would be a pain to have to enter all those things manually. Since the end result of all these is a single factor - a UI scale factor - a system wide knob to scale applications would seem to be the solution. Note that this is *not* an easy thing to do. Anyone who's tried scaling bit-mapped fonts will tell you you can't simply scale something and expect it to look good. Scalable fonts have hints and other goodies in them so they look good as you scale the fonts up/down. This may be why, but most windowing systems don't seem to do provide a global UI scale knob. X certainly doesn't. Windows has a limited capability to scale fonts system-wide, but it doesn't work very well. OSX seems to have a system-wide display DPI setting one can play with, but it's not clear how well that works. NeWS and NeXT could probably do this, but would seem to have a negligible to nonexistent user bases. rio seems capable, but the typical rio UI is ugly even by my admittedly low standards. Failing the single system-wide knob, a flexible application should have allow the user to scale the application with a single knob. This is hard to do with modern GUI toolkits. I do it by using text for imagery in the UI, and having a scaling factor that is applied to the font sizes. While I prefer text to graphics for UI elements, that's a rant for a different time. I'll concede that such an interface is probably unacceptable on a modern commercial application - users now expect graphics. But how many GUI toolkits let you use a scalable graphics format (SVG, PS, etc) for images in the UI? My predilections have kept me from looking closely, but I certainly don't recall seeing any in the GUI toolkits I've looked at. I claim
Re: Destructive Windows Script
The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. -Chris On 6/5/05, rbt [EMAIL PROTECTED] wrote: Roose wrote: My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if they are using a journaling file system like NTFS, which Windows XP does. If you are honestly trying to destroy your own data, go out and download a free program that will do it right. If you're trying to write some kind of trojan, well you've got a lot of learning to do. :) Thanks for the opinion... I don't do malware. Just interested in speeding up file wiping (if possible) for old computers that will be auctioned. The boot programs that you allude to (killdisk, autoclave) work well, but are slow and tedious. If this can be done *properly* in Python, I'd like to have a go at it. -- http://mail.python.org/mailman/listinfo/python-list -- Christopher Lambacher [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
Chris Lambacher wrote: The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. OK, I accept that, but if you have a HDD that's 8GB total and it has 1GB of files, why must every byte be written to? Why not just overwrite the used portion? -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)
Chris Lambacher [EMAIL PROTECTED] writes: I think you need to step out of the age of Motif and MFCs and look at what modern toolkits and GUI designers have to offer before you start in on a rant. Yeah, pretty much every fancy web page designer these days uses graphic tools like Dreamweaver or whatever. It's completely reasonable to expect something similar for GUI's. I've played around with Glade for a few minutes and it seems pretty nice, though I haven't done anything serious with it since my own apps have (so far) been ok with slapdash-looking tkinter gui's. -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
rbt wrote: Chris Lambacher wrote: The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. OK, I accept that, but if you have a HDD that's 8GB total and it has 1GB of files, why must every byte be written to? Why not just overwrite the used portion? What do you think is in the unused space, given that much of it likely had files at some time in the past, maybe even older copies of some of the files that are currently live? If you haven't wiped all those files previously, their data is still quite accessible. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Question about Object Oriented + functions/global vars?
ok, so to my knowledge, object oriented means splitting something into the simplest number of parts and going from there. But the question is- when is it enough? For example I have the following code: #def put_file(file_id, delete=False): # Function to put the file on the FTP Server # #print [+file_id+] FTP for this file started #print [ + file_id + ] Connecting to machine + global_addr #ftp_pool = FTP_pool(file_id,1,40,global_uid,global_pwd) #print 'in put_file' #try: #ftp = ftplib.FTP(global_addr) #ftp.login(global_uid, global_pwd) #print ftp.getwelcome() +'\n' #ftp.cwd(global_ftp_loc) #ext = os.path.splitext(file_id)[1] #if ext not in (.sc4, .snpickle): #ftp.storlines(STOR + file_id, open(file_id)) #else: #ftp.storbinary(STOR + file_id, open(file_id, rb), 1024) #ftp.quit() #ftp_pool.close_all() #except: #ftp_pool.close_all() #print [ + file_id + ]Unable to access FTP location #print [ + file_id + ]Error: + str(sys.exc_info()[0]) + + str(sys.exc_info()[1]) #upload_status[file_id] = FAILED #raise #else: #print [ + file_id + ] FTP for file completed #upload_status[file_id] = SUCCESS would the lines with '#' best be split up into a seperate function, for example: #def upload(ftp, file): #ext = os.path.splitext(file)[1] #if ext in (.txt, .htm, .html): #ftp.storlines(STOR + file, open(file)) #else: #ftp.storbinary(STOR + file, open(file, rb), 1024) and then doing the call 'upload(file_id)', or is it a better practice to leave things the way they were? I'm confused. Finally, is it considered 'un-object-oriented' in python to have functions inside a module that are called by objects (ie the upload function above) and/or use global variables in combination? -thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: PyArg_ParseTuple and dict
[EMAIL PROTECTED] wrote: 3. What is your platform? Which C compiler? What warnings does it give, [or would it give if allowed free speech]? Are you running Python 2.4 or 2.4.1? Python 2.4 (#1, Mar 10 2005, 16:54:23) [C] on sunos5 Solaris 9 x86, forte 6.2 warnings? 4. Do you get the same symptoms when you pass in a list instead of a dict? What about a minimal user-created object? A list works fine, as does a 1 element tuple with a dict in it. I'm not sure what you mean by minimal user-created object. class Muco: pass my_extension_func(42) # good my_extension_func(xyzzy) # good my_extension_func([]) # good my_extension_func({}) # bad my_extension_func(Muco()) # dunno yet -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
George Sakkis wrote: That's a typical case for using an OO approach; just make a class for each validator and have a single polymorphic validate method (I would make validators __call__able instead of naming the method 'validate'): # Abstract Validator class; not strictly necessary but good for documentation class Validator(object): def __call__(self,field,value): '''Validate a value for this field. Return a string representation of value on success, or None on failure. ''' raise NotImplementedError(Abstract method) class DecimalValidator(Validator): def __call__(self,name,value): '''Test whether numeric value is a decimal.''' Why is this better than an isDecimal function? def isDecimal(name, value): ''' Test whether numeric value is a decimal.''' seems simpler and more straightforward to me. def validateField(name, value, validators): Validates field input results = {} for validate in validators: result = validate(name,value) if result is not None: results[name] = result # XXX: if more than one validators succeed, # all but the last result will be overwritten return results No change needed in the loop above... # test validators = [DecimalValidator(), ZipCodeValidator()] validators = [ isDecimal, isZipCode ] Kent -- http://mail.python.org/mailman/listinfo/python-list
Re: Iterate through a list calling functions
David Pratt wrote: Hi Kent. Thank you for your reply. I gave this a go but get the following traceback: ... result = validator(name, value) TypeError: 'str' object is not callable Have put validators in list and iterate over it as in following: validator_list = [isContainedIn,isDate,isDecimal,isEmail,isEmpty,isInteger... more validators] results={} for validator in validators_list: result = validator(name, value) if type (result) in StringTypes: # do some stuff... return results Are you sure you don't have quoted strings in your validator list? That is what the error message indicates. Can you post a small complete example of the code that fails? or put print repr(validator) before the line that calls validator so you can see exactly what you are trying to call. Kent -- http://mail.python.org/mailman/listinfo/python-list
Re: PyArg_ParseTuple and dict
I tried to recreate the problem based on what you described in your message. I was unable to recreate the problem. I wrote the following file sjh.c: #include Python.h PyObject *f(PyObject *self, PyObject *args) { PyObject *ob = NULL; if(!PyArg_ParseTuple(args, O, ob)) return NULL; Py_INCREF(Py_None); return Py_None; } PyMethodDef methods[] = { {f, (PyCFunction)f, METH_VARARGS, test function}, {NULL} }; void initsjh() { Py_InitModule3(sjh, methods, test module); } I compiled it for Python 2.3: $ gcc sjh.c -I/usr/include/python2.3 -L/usr/lib/python2.3/config -lpython2.3 -shared -o sjh.so and I tested it: $ python -c 'import sjh; print sjh.f(1)' None $ python -c 'import sjh; print sjh.f({})' None $ python -c 'import sjh; print sjh.f({None: None})' None Jeff pgpRD35L3o7hY.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI builders considered harmful (Was: anygui, anydb, any opinions?)
Mike Meyer: The obvious solution would be for the system to detect all these environmental factors, and scale the applications accordingly. However, things like viewing distance and the quality of my eyesight are hard to detect automatically, and it would be a pain to have to enter all those things manually. Since the end result of all these is a single factor - a UI scale factor - a system wide knob to scale applications would seem to be the solution. Treating scalability as a matter of magnification is problematic. User interfaces consist of a mixture of smoothly magnifiable and discrete aspects. Pixels are discrete (well, almost) and sometimes, such as at the edge of a button, you need to be able to control whole pixels to ensure that you get a visible transition rather than a blur. Text is often unreadable under a certain size so that places a lower bound under magnification. Often when scaling down, you want to remove elements or move them onto extra pages or pop-ups. This sort of change generally requires human intelligence. The toolkit I am most familiar that does try to be magnifiable is Windows.Forms and it is also my least favourite currently having particularly ugly text. To achieve resolution independence Windows.Forms (and the underlying GDI+) uses sub-pixel positioning as do other recent rendering libraries. This leads to the possibility of each render of a particular character being different. For example, in a text editor, if the font height is 10.5 pixels then two assignment lines x = 1 y = 0 may display the first '=' legibly with one black line, one white line and another black line but the second line, offset by .5 pixels will show a 4 pixel high grey rectangle. Forcing the '=' onto the pixel grid will distort the text appearance. Neil -- http://mail.python.org/mailman/listinfo/python-list
urllib2 pinger : insight as to use, cause of hang-up?
Hello patient and tolerant Pythonistas, Iterating through a long list of arbitrary (and possibly syntactically flawed) urls with a urllib2 pinging function I get a hang up. No exception is raised, however (according to Windows Task Manager) python.exe stops using any CPU time, neither increasing nor decreasing the memory it uses, and the script does not progress (permanently stalled, it seems). As an example, the below function has been stuck on url number 364 for ~40 minutes. Does this simply indicate the need for a time-out function, or could there be something else going on (error in my usage) I've overlooked? If it requires a time-out control, is there a way to implement that without using separate threads? Any best practice recommendations? Here's my function: -- def testLinks2(urlList=[]): import urllib2 goodLinks=[] badLinks=[] user_agent = 'mySpider Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' print len(urlList), links to test count=0 for url in urlList: count+=1 print count, try: request = urllib2.Request(url) request.add_header('User-Agent', user_agent) handle = urllib2.urlopen(request) goodLinks.append(url) except urllib2.HTTPError, e: badLinks.append({url:e.code}) print e.code,: ,url except: print unknown error: ,url badLinks.append({url:unknown error}) print len(goodLinks), working links found return goodLinks, badLinks good, bad=testLinks2(linkList) -- Thannks in advance for your thoughts. Eric Pederson -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib2 pinger : insight as to use, cause of hang-up?
Timing it out will probably solve it. -- http://mail.python.org/mailman/listinfo/python-list
default values of function parameters
Alan Isaac wrote: Default parameter values are evaluated once when the function definition is executed. Where are they stored? ... Where is this documented? Forgive any poor phrasing: I'm not a computer science type. At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read: The execution of a function introduces a new symbol table used for the local variables of the function. More precisely, all variable assignments in a function store the value in the local symbol table; whereas variable references first look in the local symbol table, then in the global symbol table, and then in the table of built-in names. But the default values of function parameters seem rather like a static attributes of a class. Is that a good way to think of them? If so, are they somehow accessible? How? Under what name? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements
Delaney, Timothy C (Timothy) wrote: Nicolas Fleury wrote: def getFirstLine(filename): with opening(filename) as file return file.readline() Your tastes definitely disagree with the majority of Python programmers then, including Guido. Scoping is defined in Python by indentation. I'm very happy to met someone who can speak for the majority of Python programmers, I should have chat with you in the first place;) But you're right, that would make a precedent in Python, and that is probably what makes my proposal so bad. Someone could argue that this should be allowed too: with locking(lock) if condition with opening(filename) as file for line in file ... And that's horrible IMO (and a no-no to me). About the majority of Python programmers, a lot of newcomers come from languages where you don't have to make a new block for an acquire/release pattern. Also, the following syntax: decorate staticmethod: def foo(): ... have been rejected for decorators. All this to say that over-indentation can be an issue. If you want the above sort of thing, you're going to have to write a new PEP, and I'd be very surprised to see it accepted. But there's nothing stopping you from doing so. def getFirstLine(filename): with opening(filename) as file: return file.readline() This is beautiful and explicit. What else could you want? Did you deliberately keep that example instead of the other one in the message? with locking(lock): if condition: with opening(filename) as file: for line in file: ... It is definately explicit, but beautiful? Add to that the indentation of the class, of the method, a few more with-statements and you end up with something that makes it difficult to respect PEP008 (4 spaces indentation and lines than 80). Compare that with the += like operators. It is not beautiful, but very usable. The same can be said for @decorators. The syntax: with EXPR1 as VAR1, EXPR2 as VAR2: ... That syntax doesn't help in the previous example. was discussed on python-dev. It wasn't explicitly rejected, but the feeling seemed to be that it was an unnecessary complication as far as PEP 343 is concerned. There's nothing stopping another PEP proposing this as an extension to PEP 343, and there's nothing stopping that being in Python 2.5 if it's accepted. I totally agree. I don't want to change PEP343, but keeping the door open for a no-indentation syntax is a good idea. PEP 343 was originally PEP 340 (and several other things) and was quite complicated at one point (it originally contained PEP 342 as well). The PEP in its current state represents 2 months of discussion, complication and (finally) simplification. Its semantics are clear and unambiguous. And (as Guido states) it will obsolete 4(?) other PEPs. I know, and I followed these discussions even in vacation. I'm very happy with the result. I'm just pointing that it will result in over-indented code. In some situations indentation is necessary anyway, so the PEP syntax is fine. Will I write a PEP for that? Maybe. I think the first step is to just use with-statements in real-life code and see how it comes. But I will not be surprised if it is added someday. Regards, Nicolas -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
Chris Lambacher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. I would expect programs called killdisk, autoclave, etc to not only write every byte multiple times, but to also work at the lowest level to try to manipulate track alignment to wipe out any residual signals off the current tracks. That is *really* slow. (Note: the ultimate security is to shread or incenerate the disk platters. I believe this is now standard practice in super security areas.) OP: if you merely want to wipe the data enough to protect against a casual user, using casual access thru normal open and read, and not the FBI disk forensics/recovery lab (;-), one write would be enough. On *nix, one could open '/dev/rawdisk' (actual name depends on the *nix build) and write a tracks worth of garbage for as many tracks as there are. I don't how to programmaticly get the track size and number (if there is a standard way at all). For Windows, you would need the appropriate low-level system call, but I have no idea what it is or if it is the same for different versions. Same for other non *nix systems. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list
Tkinter: How can I update an image display?
I've got a small batch image-processing program (it adds the time a digital photo was taken to the lower right of the image), and as a feature, I wanted to show a thumbnail of each image it was being processed. I can't get the image to update, though. I trimmed it down to a basic app indicating the problem and the code is at the end of this message. It should display the three listed sample images, one after another. The thing is, if I uncomment the raw_input call, it works. But I don't want to have to hit ENTER after each image. At first I wondered whether maybe the image data was bad, but that doesn't explain why it works fine with the raw_input call in place. I've hardly played with Tkinter, so I'm probably missing something obvious. I tried adding pack() calls for F2 and ImageLabel, and that made no difference. Ideas? Here's the code: == import Tkinter as Tk import os, sys, time import Image, ImageTk class MyApp: def __init__(self, root): initializer for Tkinter-based application self.root=root F1 = Tk.Frame(self.root) F1.pack() SelButton = Tk.Button(F1, text=Go, command=self.go) SelButton.pack(side=left) QuitButton = Tk.Button(F1, text=Quit, command=F1.quit) QuitButton.pack(side=left) F2 = Tk.Frame(self.root) F2.pack() self.ImageLabel = Tk.Label(F2) self.ImageLabel.pack() self.FilenameLabel = Tk.Label(F2) self.FilenameLabel.pack() def go(self): filenames = [DSCN0184.JPG, DSCN0185.JPG, DSCN0186.JPG] for name in filenames: im=Image.open(name) im.thumbnail((100,75)) Tkimage = ImageTk.PhotoImage(im) self.ImageLabel.config(image=Tkimage) self.FilenameLabel.config(text=name) time.sleep(2) raw_input(Press ENTER for next...) root = Tk.Tk() myapp = MyApp(root) root.mainloop() == -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: How can I update an image display?
On Sun, 05 Jun 2005 20:39:04 -0700, Terry Carroll [EMAIL PROTECTED] wrote: The thing is, if I uncomment the raw_input call, it works. But I don't want to have to hit ENTER after each image. And the, just to be confusing, I posted the uncommented version. To make my example more consistent with my post, I should have said that, when the raw_input call is commented out, it no longer works. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: How can I update an image display?
Terry Carroll [EMAIL PROTECTED] writes: I trimmed it down to a basic app indicating the problem and the code is at the end of this message. It should display the three listed sample images, one after another. The thing is, if I uncomment the raw_input call, it works. But I don't want to have to hit ENTER after each image. Try using root.update()? -- http://mail.python.org/mailman/listinfo/python-list
Re: Destructive Windows Script
rbt [EMAIL PROTECTED] writes: Thanks for the opinion... I don't do malware. Just interested in speeding up file wiping (if possible) for old computers that will be auctioned. The boot programs that you allude to (killdisk, autoclave) work well, but are slow and tedious. Yes, you have to overwrite all the bytes on the disk, which can be slow. If the drive has ultra-sensitive data on it though, you should not auction it no matter what wiping software you've used. Think of bad sector forwarding that might have happened while the drive was in service. The drive firmware might have copied some sector that had recoverable errors to a new sector sometime in the past, and transparently mapped the new sector to the old location, so that normal I/O operations will never find the old sector to erase it. But suitable forensic methods might still be able to get it back. The only way to be 100% sure the data is gone from a drive, is basically to melt the drive. However, if your data is that sensitive, you shouldn't ever write it to a hard drive in the clear anyway. -- http://mail.python.org/mailman/listinfo/python-list
Re: default values of function parameters
David Isaac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] But the default values of function parameters seem rather like a static attributes of a class. Is that a good way to think of them? If you think of a function as defining a subclass of execution instances, with __init__ inherited from the superclass, then that is a possible way to think of them. Goodness depends on your meaning of goodness ;-). Does it help you write and use Python functions acurately? If so, are they somehow accessible? How? Under what name? This is implementation specific. For CPython, the interactive interpreter is your friend. Learn to use it! def f(): pass ... dir(f) ['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__get__', '__ge tattribute__', '__hash__', '__init__', '__name__', '__new__', '__reduce__', '__r epr__', '__setattr__', '__str__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name'] Now give f some parameters with defaults and print f.func_defaults. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list
Building Python with gdbm support
I am trying to use a Perl script which requires a Database module other than dbm to be the default Mod. So, what the script is checking is import anydbm if (anydbm._defaultmod.__name__ == 'dumbdbm' or anydbm._defaultmod.__name__ == 'dbm'): First of, I'm doing this on a Sparc/Solaris 8 box. So, I'm trying to get gdbm to be the default mod. I've downloaded and built gdbm-1.8.3. It has not been build to /usr (I don't have root access). I've built this fine. When I build Python 2.4.1, it at first doesn't pick up on the gdbm module (dbm is still the default module, and Modules directory in the Python source doesn'thave a .o file for the gdbmmodule file). I've nosed around, and found the a line commented out Modules/Setup file, regarding building the gdbm module. I uncommented it (being sure that the approrpiate directories for the .h and lib files are provided), and it looked like it built the module. But when I attempt to start python, I get an error: ld.so.1: python: fatal: libgdbm.so.3: open failed: No such file or directory Killed Look, the bottom line is I don't know what the correct steps are to get the gdbm module built in as part of the Python installation (as well as setting it as the default database module). I've tried to piece together bits and pieces of various newsgroup messages, as I haven't found a decent spot for any doco. Can anyone point me in the right direction, in regards to how to get my Python installation set up the way I want? Is it correct to edit the Modules/Setup file? I would have thought that the configure approach would support these types of isses, rather than manually editing a file? Should I be using the setup.py script? I have no idea what that does, or where I would call it, but the name of it sounds like it should be included? Thanks for any help, Ed -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: How can I update an image display?
On 05 Jun 2005 21:04:40 -0700, Paul Rubin http://[EMAIL PROTECTED] wrote: Try using root.update()? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Building Python with gdbm support
I've actually sorted myself out. I updated Modules/Setup.dist, so that it has the following line... gdbm gdbmmodule.c -I/ct/ctapp/gnu/bin/gdbm-1.8.3/include -L/ct/ctapp/gnu/bin/gdbm-1.8.3/lib -lgdbm Rebuilt everything in Python. I also had to ensure that my environment using the newly-built Python contained the gdbm/lib directory in it's LD_LIBRARY_PATH (the same value as what's passed to -L in the above line). I'm assuming this is alright. I guess if I change anything, I have to remember to update Setup.dist. If I'm missing a step, or if there's an easier way, I'm all ears... :) Thanks, Ed -- http://mail.python.org/mailman/listinfo/python-list