why __repr__ affected after __getattr__ overloaded?
Now I have to design a class that overload __getattr__, but after that, I found the __repr__ have been affected. This is a simple example model: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] t = test() print t.x print t.y print type(t) T = t print T.x print t So far, I want the operation print t still return test instance at ..., but the reuslt is: sh$ python test.py 1 inexistent type 'instance' 1 Traceback (most recent call last): File testtree.py, line 23, in ? print t TypeError: 'str' object is not callable I also tried to overload __repr__ itself: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] def __repr__(self): return 'test.__repr__' t = test() print t.x print t.y print type(t) T = t print T.x print t But the result remains: Traceback (most recent call last): File testtree.py, line 23, in ? print t TypeError: 'str' object is not callable So why? What is the principles? -- http://mail.python.org/mailman/listinfo/python-list
why __repr__ affected after __getattr__ overloaded?
Now I have to design a class that overload __getattr__, but after that, I found the __repr__ have been affected. This is a simple example model: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] t = test() print t.x print t.y print type(t) T = t print T.x print t So far, I want the operation print t still return test instance at ..., but the reuslt is: sh$ python test.py 1 inexistent type 'instance' 1 Traceback (most recent call last): File testtree.py, line 23, in ? print t TypeError: 'str' object is not callable I also tried to overload __repr__ itself: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] def __repr__(self): return 'test.__repr__' t = test() print t.x print t.y print type(t) T = t print T.x print t But the result remains: Traceback (most recent call last): File testtree.py, line 23, in ? print t TypeError: 'str' object is not callable So why? What is the principles? -- http://mail.python.org/mailman/listinfo/python-list
Re: comparing two lists and returning position
On 2007-06-22, hiro [EMAIL PROTECTED] wrote: Hi there, I have a 2 lists.. for simplicities sake lets say the are: l1 = [ 'abc' 'ghi' 'mno' ] l2 = [ 'abc' 'def' 'ghi' 'jkl 'mno' 'pqr'] what I need to do is compare l1 against l2 and return the position of where each object in l1 is in l2 ie: pos = 0, 2, 4 Thanks in advance, -h Come, come! You can try harder than that. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
gettext and __doc__ for class methods?
from gettext import gettext as _ __doc__ = _(module docstrings) class test: __doc__ = _(class docstrings) def __setattr__(self, attr_name, value): _(class method docstrings) But I found when the module and class docstrings take effect(must use __doc__ to specify it), the class-method gettext docstrings takes no effect, only: def __setattr__(self, attr_name, value): class method only english docstrings has effect. So any suggestions? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Type of __builtins__ changes from module import to execution?
I've noticed some unexpected behavior with __builtins__ during module import. It seems that during module import __builtins__ is a dict but at all other times it is a module. For example, if the file testmod.py has these contents: print type(__builtins__) print has str attr, hasattr(__builtins__, 'str') The output differs depending on how it is run: $ python ~/testmod.py type 'module' has str True vs. $ python -c 'import testmod' type 'dict' has str False Anyone know if there a reason for this behavior?Is it a bug? I've seen this in 2.4 and 3.0. -Adam -- http://mail.python.org/mailman/listinfo/python-list
Re: Issues with nonfunctioning VTK under python 2.5
Eric Carlson wrote: Any suggestions would be greatly appreciated. Please bring these bug reports to [EMAIL PROTECTED] and possibly make a ticket on our Trac. https://mail.enthought.com/mailman/listinfo/enthought-dev https://svn.enthought.com/enthought Thanks. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.popen question
On Jun 21, 1:22 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 20 Jun 2007 22:28:06 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: On Jun 20, 7:50 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 20 Jun 2007 20:02:52 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: On Jun 20, 1:46 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: cmd = [gawk, -f, altertime.awk, -v, time_offset=4, -v, outfile=testdat.sco, i1.sco] Now, what do you want to do with the output? Printing it line by line? output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] lines = output.splitlines() for line in lines: print line C:\dex_tracker\pipe1.py Traceback (most recent call last): File C:\dex_tracker\pipe1.py, line 14, in last_line = subprocess.Popen([cmd], stdout=subprocess.PIPE).communicate()[0] File C:\Python25\lib\subprocess.py, line 593, in __init__ errread, errwrite) File C:\Python25\lib\subprocess.py, line 793, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified Script terminated. I can write it out as a batch file and then run it but that is a messy hack.. If cmd is a list of arguments, like the example above, you should use subprocess.Popen(cmd,...) (like the example above, too). I had cut and pasted the example in to get that error... could it be a problem with ms windows??? (I am at a library computer befour work so that ended my testing) Note the call to subprocess.Popen- is the first argument [cmd] or cmd? What do you get with print repr(cmd)? Do you have gawk installed on that machine too? -- Gabriel Genellina- Hide quoted text - - Show quoted text - gawk is installed.. I do fine when I just call gawk I get all the options to use with it but the minute I try to use the options with it I have problems. I have done it with batch files but then I would have to write out a batch file and then run the batch file. seems like more work than I should have to do to use options with a command line program.. I have done this in other cases with os.startfile and other cases and would like to fix it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Changing the names of python keywords and functions
koristiti OS- (THIS IS MY IMAGINARY EXAMPLE OF KEYWORD), my program must write this code in some user file, but my program must read this command like: import os.How can I do something like that?? The keywords are listed in Grammar/Grammar. You need to edit this file, then recompile. To clarify, are you suggesting changing the source code of the Python implementation and recompiling it? Correct. If the keywords are changed in the Python executable, won't that break the import of any Python module written for the standard keywords -- such as many of those in the standard library? Most certainly, yes. My understanding of the original poster's requirement was that the keywords should be additional to, not replacement for, the existing Python keywords. So he should make them additional in the grammar, too. It is entirely beyond me *why* the OP wants to do that, but changing the compiler would be the proper way of implementing that change. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: comparing two lists and returning position
hiro [EMAIL PROTECTED] writes: what I need to do is compare l1 against l2 and return the position of where each object in l1 is in l2 ie: pos = 0, 2, 4 Is it September already? from itertools import izip pos = map(dict(izip(l2, count())).__getitem__, l1) Heh heh heh. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to Encode Parameters into an HTML Parsing Script
En Thu, 21 Jun 2007 23:37:07 -0300, [EMAIL PROTECTED] escribió: So for example if I wanted to navigate to an encoded url http://online.investools.com/landing.iedu?signedin=true rather than just http://online.investools.com/landing.iedu How would I do this? How can I modify the script to urlencode these parameters: {signedin:true} and to associate them with a specific url from the urlList If you want to use GET, append '?' plus the encoded parameters to the desired url: py data = {'signedin':'true', 'another':42} py print urlencode(data) signedin=trueanother=42 Do not use the data argument to urlopen. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: why __repr__ affected after __getattr__ overloaded?
En Fri, 22 Jun 2007 00:30:43 -0300, Roc Zhou [EMAIL PROTECTED] escribió: Now I have to design a class that overload __getattr__, but after that, I found the __repr__ have been affected. This is a simple example model: You are creating many attributes with value inexistent, even special methods. Put a print statement and see what happens: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: print Now creating:,attr_name self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
Stephen R Laniel [EMAIL PROTECTED] writes: Granted, in a dynamic language we won't always (maybe won't often) have a situation where the types are known this well at compile time. But sometimes we will. And it would be nice to catch these before the program even runs. So my question is: would bolting on static type checking when we can, no type checking when we can't be too much to ask? Common Lisp allows the programmer to optionally provide type declarations to improve readability or performance. Certain implementations of Common Lisp, such as cmucl and sbcl, check type declarations at compile time, employ type interence to generate efficient machine code, and insert run time checks when the compiler can't prove at compile time that variables have their declared types. -- http://mail.python.org/mailman/listinfo/python-list
Re: Google breaks international charset messages
Evan Klitzke [EMAIL PROTECTED] writes: Ironically, you're sending out us-ascii encoded emails as well. Yes, because I was (a) replying to a message already in that encoding, and (b) that encoding was sufficient to encode all the characters in my message. Where the original poster's message says that he posted a message with Chinese characters, and the message was munged by Google to the us-ascii charset. -- \ It is seldom that liberty of any kind is lost all at once. | `\ -- David Hume | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.popen question
En Fri, 22 Jun 2007 01:05:36 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: cmd = [gawk, -f, altertime.awk, -v, time_offset=4, -v, outfile=testdat.sco, i1.sco] output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] lines = output.splitlines() for line in lines: print line C:\dex_tracker\pipe1.py Traceback (most recent call last): File C:\dex_tracker\pipe1.py, line 14, in last_line = subprocess.Popen([cmd], stdout=subprocess.PIPE).communicate()[0] File C:\Python25\lib\subprocess.py, line 593, in __init__ errread, errwrite) File C:\Python25\lib\subprocess.py, line 793, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified Script terminated. I can write it out as a batch file and then run it but that is a messy hack.. If cmd is a list of arguments, like the example above, you should use subprocess.Popen(cmd,...) (like the example above, too). I had cut and pasted the example in to get that error... could it be a problem with ms windows??? (I am at a library computer befour work so that ended my testing) Note the call to subprocess.Popen- is the first argument [cmd] or cmd? What do you get with print repr(cmd)? Do you have gawk installed on that machine too? gawk is installed.. I do fine when I just call gawk I get all the options to use with it but the minute I try to use the options with it I have problems. I have done it with batch files but then I would have to write out a batch file and then run the batch file. seems like more work than I should have to do to use options with a command line program.. I have done this in other cases with os.startfile and other cases and would like to fix it. Ok, but please check *what* are the arguments to Popen. If cmd is a *list* as shown on the first quoted line on this message, you should call subprocess.Popen(cmd, ...) as shown on the third line on this message, but your traceback shows that you are using Popen([cmd], ...) Can you see the difference? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's only one way to do it philosophy isn't good?
Neil Cerutti [EMAIL PROTECTED] writes: On 2007-06-21, Douglas Alan [EMAIL PROTECTED] wrote: A prime example of this is how CLOS, the Common Lisp Object System was implemented completely as a loadable library (with the help of many macros) into Common Lisp, which was not an OO language prior to the adoption of CLOS. Is there a second example? ;) There are many useful macro packages that syntactically extend Common Lisp. Here are a few representative examples. compan implementation of list comprehensions http://rali.iro.umontreal.ca/Publications/urls/LapalmeLispComp.pdf iterate a domain specific language for expressing complex iteration http://common-lisp.net/project/iterate/ screamersupport for nondeterministic programming http://www.cis.upenn.edu/~screamer-tools/screamer-intro.html cl-who a domain specific language for HTML generation http://weitz.de/cl-who/ parenscript a domain specific language for JavaScript generation http://common-lisp.net/project/parenscript/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Internationalised email subjects
[EMAIL PROTECTED] schrieb: That's really strange. The chinese characters I am inputing into the post are not being displayed. Basically, what I am doing is this: h = Header('(Some Chinese characters inserted here', 'GB2312') What encoding do Some Chinese characters have at that point? 1. Don't try this at the interactive prompt. It will completely confuse you. Instead, use IDLE. 2. In IDLE, put # -*- coding: utf-8 -*- into the top of the source code file. 3. Write the header as a Unicode string, i.e. with a u prefix 4. Explicitly encode it, such as h = Header(u'(Some Chinese characters inserted here'.encode('GB2312'), 'GB2312') If you are *not* inserting the characters from the Python source code directly, go back to my original question: What are the characters encoded in? HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list
assert annoyance
So I have some assert statements in my code to verify the absence of some impossible conditions. They were useful in debugging and of course I left them in place for real runs of the program. Umpteen hours into a run, an assertion failed, and of course since failure was impossible, I didn't catch the exception so the whole program crashed. I don't know what I'd have done with the exception anyway, since it would have had to be caught at an outer scope where the data I cared about was no longer around, or else I'd have had to predict in advance what I needed to examine and pass that as a an arg to the assert statement. What I really want is for any assertion failure, anywhere in the program, to trap to the debugger WITHOUT blowing out of the scope where the failure happened, so I can examine the local frame. That just seems natural, but I don't see an obvious way to do it. Am I missing something? I guess I could replace all the assertions with function calls that launch pdb, but why bother having an assert statement? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's only one way to do it philosophy isn't good?
Terry Reedy [EMAIL PROTECTED] writes: | It allows the community to develop language features in a modular way | without having to sully the code base for the language itself. [etc] Some of the strongest opposition to adding macros to Python comes from people like Alex Martelli who have had experience with them in *multi-person production* projects. He claimed in various posts that the net effect was to reduce productivity. So convince us (and Guido!) that he is wrong ;-) I'm not convinced that Guido is wrong because I know that he has at least occasionally mused that he might someday consider a macro facility for Python. Alex Martelli, on the other hand, although an extremely smart guy, seems to me to often be over-opinionated and dismissive. Regarding being on a project where people used macros poorly, I've also been on projects where people did a poor job of OO design, and a non-OO design would have been better than the crappy OO design that was ultimately used. Does that mean that we should remove the OO features from Python? Paul Graham made it rich implementing Yahoo Stores in Lisp, and claims that heavy use of macros is one of the reasons that he was able to stay well-ahead of all the competition. So, maybe Paul and Alex can duke it out. Personally, I like Paul's style better. And he's made a lot more money using his theory of software design. But I would prefer you somehow try to help make usable multi-arg and predicate dispatch a reality. Alas, I can't stand programming in C, so there's no way I'm going to dive that deeply into the CPython code base. If I could help implement it in Python itself, using a good macro facility, sign me up! |oug -- http://mail.python.org/mailman/listinfo/python-list
Re: comparing two lists and returning position
Paul Rubin wrote: from itertools import izip pos = map(dict(izip(l2, count())).__getitem__, l1) or probably less efficiently ... l1 = [ 'abc', 'ghi', 'mno' ] l2 = [ 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr'] pos = [ l2.index(i) for i in l1 ] print pos [0, 2, 4] Charles -- http://mail.python.org/mailman/listinfo/python-list
Re: why __repr__ affected after __getattr__ overloaded?
I know what's wrong. Thank you. And I think try: return self.__dict__[attr_name] is unnecessary, because python will do it itself for us. So now I have to overload __str__, but how can I make self.__str__ print as builtin str(): at here, I want get the result like: test instance at 0xb7bbb90c ? On 6 22 , 12 55 , Gabriel Genellina [EMAIL PROTECTED] wrote: En Fri, 22 Jun 2007 00:30:43 -0300, Roc Zhou [EMAIL PROTECTED] escribió: Now I have to design a class that overload __getattr__, but after that, I found the __repr__ have been affected. This is a simple example model: You are creating many attributes with value inexistent, even special methods. Put a print statement and see what happens: #!/usr/bin/env python class test: def __init__(self): self.x = 1 def __getattr__(self, attr_name): try: return self.__dict__[attr_name] except KeyError: print Now creating:,attr_name self.__dict__[attr_name] = 'inexistent' return self.__dict__[attr_name] -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with using ConfigParser.py
On 6/22/07, shridhar kurhade [EMAIL PROTECTED] wrote: Hi, Thanks for your reply. I tried changing the ownership and it looks as below: # ls -l /home/ast/ast-linux.conf -rw-r--r-- 1 ast ast 7936 Jun 21 11:11 /home/ast/ast-linux.conf But when I try to read through browser, it gives permission denied error: [Errno 13] Permission denied: '/home/ast/ast-linux.conf' targetsandbox Also other files in the /home/ast/ have ast:ast as ownership. Can you please tell me if there any other problem with this? That looks OK, but as I said before, you need to check the permissions on the /home/ast directory. What's the output of ls -ld /home/ast? It needs to grant execute permissions to the user or group that the script is running as. If that looks OK, you might want to try calling os.getuid() and os.getgid() from your script, to make sure it's running under the same UID/GID you think it is. -- David P.S. When using Gmail, it's better to use Reply to All instead of Reply; that way your messages continue to go to the mailing list, and other people can help you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python live environment on web-site?
On Jun 21, 1:18 am, [EMAIL PROTECTED] (Thomas Lenarz) wrote: Hi all, I was wondering if there was a python-live-environment available on a public web-site similar to the ruby-live-tutorial on http://tryruby.hobix.com/ I would prefer something which allows to paste small scripts into a text-field, to run them on the server, and to be able to read the produced output of the script. I searched using google but didn't come across such a site. However, I imagine there must be at least one Thanks for any hint, Thomas Crunchy. -- http://mail.python.org/mailman/listinfo/python-list
Re: python website
On Jun 21, 12:53 am, Martin Skou [EMAIL PROTECTED] wrote: The Daily Python-URLhttp://www.pythonware.com/daily/ pythonpapers.org :) -T -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.popen question
En Wed, 20 Jun 2007 22:28:06 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: On Jun 20, 7:50 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 20 Jun 2007 20:02:52 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: On Jun 20, 1:46 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: cmd = [gawk, -f, altertime.awk, -v, time_offset=4, -v, outfile=testdat.sco, i1.sco] Now, what do you want to do with the output? Printing it line by line? output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] lines = output.splitlines() for line in lines: print line C:\dex_tracker\pipe1.py Traceback (most recent call last): File C:\dex_tracker\pipe1.py, line 14, in last_line = subprocess.Popen([cmd], stdout=subprocess.PIPE).communicate()[0] File C:\Python25\lib\subprocess.py, line 593, in __init__ errread, errwrite) File C:\Python25\lib\subprocess.py, line 793, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified Script terminated. I can write it out as a batch file and then run it but that is a messy hack.. If cmd is a list of arguments, like the example above, you should use subprocess.Popen(cmd,...) (like the example above, too). I had cut and pasted the example in to get that error... could it be a problem with ms windows??? (I am at a library computer befour work so that ended my testing) Note the call to subprocess.Popen - is the first argument [cmd] or cmd? What do you get with print repr(cmd)? Do you have gawk installed on that machine too? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Split file into several and reformat
Hi, I want to take read an input file (sels.txt) that looks like: Begin sels sel1 = {1001, 1002, 1003, ... ... 1099} sel2 = {1001, 1008, 1009 ... ... 1299} End sels And turn it into an output file for each of the sels in the input file, i.e sel1.txt: L1001 L1002 L1003 ... L1099 and sel2.txt: L1001 L1008 L1009 ... L1299 And so on. Many thanks, Wayne -- http://mail.python.org/mailman/listinfo/python-list
Re: Python live environment on web-site?
I was wondering if there was a python-live-environment available on a public web-site similar to the ruby-live-tutorial on http://tryruby.hobix.com/ I would prefer something which allows to paste small scripts into a text-field, to run them on the server, and to be able to read the produced output of the script. I searched using google but didn't come across such a site. However, I imagine there must be at least one Crunchy. As far as I remember the pypy people also put together a publicly available python console in javascript. Actually it's a whole xterm I think and one can start python in there. HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: string formatter %x and a class instance with __int__ or __long__ cannot handle long
En Thu, 21 Jun 2007 00:24:28 -0300, Kenji Noguchi [EMAIL PROTECTED] escribió: Example2 -- pass an instance of a class with __int__() class X: ... def __init__(self, v): ... self.v = v ... def __int__(self): ... return self.v ... y = X(0x8000) %08x % y Traceback (most recent call last): File stdin, line 1, in ? TypeError: int argument required The behavior looks inconsistent. By the way __int__ actually returned a long type value in the Example2. The %08x allows either int or long in the Example1, however it accepts int only in the Example2. Is this a bug or expected? It is a bug, at least for me, and I have half of a patch addressing it. As a workaround, convert explicitely to long before formatting. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Twisted [EMAIL PROTECTED] writes: On Jun 20, 12:39 pm, [EMAIL PROTECTED] (Joel J. Adamson) wrote: The point is that the responsibility to customize is on the user. Given that in its out-of-the-box configuration it's well-nigh unusable without a printed-out cheat sheet of some kind, of the sort that were supposed to have died out in the 80s, getting it customized poses something of a catch-22 for anyone trying to get started using it. Catch 22 is the right phrase here: just catch Emacs 22 and get started. Its out-of-the-box configuration is quite sensible. What was the last version you said you actually tried out? -- David Kastrup -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs: terminology buffer and keybinding
Twisted [EMAIL PROTECTED] writes: On Jun 20, 5:37 pm, David Kastrup [EMAIL PROTECTED] wrote: ...spewing...babbling... I won't dignify your insulting twaddle and random ad-hominem verbiage with any more responses after this one. Something with actual logical argumentation to rebut may be another matter of course. One more GG issue: those stupid star ratings. So potentially prejudicial. So easy to game, as evidenced by your managing to somehow vote 82 times(!) against one of my posts in a matter of minutes. It has not occured to you that actually thousands of people read those postings? And they are heavily crossposted to boot (redirecting followup to comp.emacs, I would suggest everybody else do the same). And you have really nothing worthwhile to contribute. So if there is some rating system (I don't use Google Groups so can't tell) in place, your postings would certainly be good candidates for downrating. Not that this posting of mine is much better, and actually the followup-to comp.emacs would indicate that this is about Emacs. However, you have still not given any information about what, if any, version of Emacs your very vaguely expressed experiences are supposed to have come from. So far I've found a less-impressive method to game them -- it's not hard to get throwaway accounts elsewhere, send yourself there a gmail invite, and create many GG accounts. And you wonder that people don't find it worthwhile reading you... Handy to get around their onerous posting limits. Handy for stuffing the star-vote ballot boxes with multiple votes, too, but there's no way I can see to generate 82 of them that fast by that method, and that much logging in and out in that short a time using different accounts but from just one IP address is sure to come up on Google's radar somehow, with unpredictable but probably bad results. Uh, is there some monetary compensation for star ratings? Or what's the deal? Really, if somebody can come up with a better group for followups, feel free to direct there. How did you do it? I'm guessing they stop the link for voting appearing as a usable link on the page for a) your own posts and b) the ones you've voted for, but the link's URL still works, so if you use a script to keep fetching the appropriate URL ... What a crazy obsession. -- David Kastrup -- http://mail.python.org/mailman/listinfo/python-list
Emacs topic
Hi guys, I kindly ask you to stop this topic. Though I see the importance to have a good editor for programming, this is outside of the focus of a Python mailing list. The open source world offers a lot of very good tools to edit source files, even for cross-platform development. Emacs is one of them, and IMHO could be set as an efficiency/proficiency standard. But if it does not fit to your fingers or working style, do not use it. I am open to personal debate outside of this list, Gabor -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
Stephen R Laniel a écrit : On Wed, Jun 20, 2007 at 12:59:28PM -0700, [EMAIL PROTECTED] wrote: Then you should use another language. This is what I meant about knowing how Internet discussions go. Please let not forget the context. You said: I'm new to Python, and then : if I *want* strong static type-checking, why shouldn't I be able to get it? You obviously don't know Python enough to understand why static typechecking doesn't belong to Python. Trying to explain would be a waste of time, because you have to experiment it in real-life situation to fully understand. So to put things briefly, Python with static typechecking would not be Python anymore - it would be another language. Which implies that if you want static typechecking, you'll have to use another language one way or another. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
kaens schrieb: On 6/20/07, Diez B. Roggisch [EMAIL PROTECTED] wrote: That is exactly the problem - there is no some more static typing. There is static typing - or not. You can't have it just a bit. Couldn't a language be made so that if you declared a variable like, say: string foo = I'm a string it would be a string, and always a string, and if you declared a variable like foo = i'm a dynamic variable it would be considered dynamic? This doesn't seem like it would be too hard to add in to a language that already had dynamic typing (But then again, I am inexperienced - although interested in - language design). It isn't too hard. All it needs is a bucket at a name that contains a type reference. But what you DO with that is the hard thing. Just enforcing types at runtime is easy. Making JIT-compilation for such code and then put guarding statements around it - somewhat harder, but easier than full type inference. But the OP wanted compile-time static typing checks. And _thats_ virtually impossible unless _everything_ is statically typed. And even if it is, the ClassCastExceptions of Java prove that. Take this classic example from the java-world that is statically correct, but will fail at runtime class A class B extends A B[] bs = new B[100]; A[] as = bs; as[0] = new A(); The problem here is that the as-array has less type information, and because of polymorphism rules is allowed to actually hold an B-array. But that can't allow mere A-objects to be assigned to it! So the JVM introduces a runtime type check here. Mixing static and dynamic type information like proposed will only make this problem more severe, as you know even less about your types. Thus the whole purpose of static checking vanishes, and the whole thing shifts to a purely runtime checking. It seems to me like this could be really useful, but I'm not aware of any language implementing something like this. Which _might_ be a hint... :) Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
Stephen R Laniel a écrit : On Wed, Jun 20, 2007 at 09:41:09PM +0100, Michael Hoffman wrote: If you asked Java programmers why you couldn't turn *off* Java's static type checking if you wanted to, you'd probably get a similar response. Perhaps it would help for me to explain what I'd like. Under both Perl and Python, I've found myself having/wanting to write things like so: def my_func( int_arg, str_arg ): try: int_arg = int( int_arg ) str_arg = str( str_arg ) except ValueError: sys.stderr.write( Args are not of the right type\n ) sys.exit(1) Just a question : what will happen if you get rid of the try/except block ?-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Split file into several and reformat
[EMAIL PROTECTED] a écrit : Hi, I want to take read an input file (sels.txt) that looks like: (snip) And turn it into an output file for each of the sels in the input file, i.e sel1.txt: (snip) and sel2.txt: (snip) And so on. Yes, fine. All this is documented here: http://www.catb.org/~esr/faqs/smart-questions.html#before Many thanks, You're welcome. -- http://mail.python.org/mailman/listinfo/python-list
Re: visual gui ides for python/jythpn
Thanks, I'll take a look at these. Kromakey On 20 Jun, 22:10, Peter Decker [EMAIL PROTECTED] wrote: On 6/20/07, kromakey [EMAIL PROTECTED] wrote: Hi, Are there any free visual GUI IDE's available for python/jython, which have a drag and drop form designer similar to Visual Studio or Delphi ? Watch these screencasts, and then check out Dabo: http://leafe.com/screencasts/dataenvironment1.htmlhttp://leafe.com/screencasts/dataenvironment2.html Dabo's site ishttp://dabodev.com. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help With Better Design
[EMAIL PROTECTED] a écrit : (snip) I would like to be able to get a good hold of the concept state machines ? Well both state machines and classes (objects). That may be a bit of a tall order to take on all at once but the concepts seem to be quite related. They are, since OO was born from the use of state machines for simulation (the Simula language). But you can do state machines with a database and a procedural language too, and FWIW, the state machine aspect of OO is more often very informal and ad hoc. I already have a great deal of material on Classes so good to go there. Don't confuse classes with OO. The OO in OOP means object-oriented, not class-oriented, and nothing in the most basics definitions of OO [1] requires nor even imply the notion of class. This notion is mostly an artifact for easing the definition of a family of objects having similar implementation, and some 00 languages managed to get by without classes (look for prototype-based languages - the most known being javascript). wrt/ Python, classes are actually objects too, and instances have a reference to their class. Since one can dynamically modify the instance object - class object relation at runtime, we're quite close to prototype-based languages !-) [1] an object is defined by an identity, a state and a behaviour. -- http://mail.python.org/mailman/listinfo/python-list
Making decimal default datatype for floats during runtime
Hi, I was wondering if there are any tricks around to do some sort of changing types, float in particular. I do many operations like summing etc on lots of floats and always have to do some extra checks where results are heading 0.0, like round(n,10) for example. My idea was to tell python in some way not to take the type float but decimal in an implicit fassion. It that possible ? And, is it still true for python 2.4/2.5 that one needs to do a = Decimal(str(aFloat)) instead of a = Decimal(aFloat) as it is in python 2.3 ? And, at least, has some tried to link (lib)python against tc_malloc and benchmarked it ? Thx in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
Hi! Given that one can add/replace/remove methods and attributes dynamically either on a per-class or per-instance basis, and even dynamically change the class of an object, I fail to see how static typechecking could be meaningfull. Et toc ! -- http://mail.python.org/mailman/listinfo/python-list
Re: Invisible processes in Win2K
Hi! When you lock (the cpu), interactive mode is off. You can try to use services, who run independently of sessions. But... -- http://mail.python.org/mailman/listinfo/python-list
Re: DFW Pythoneers Meeting THIS Saturday
OK. Not my intention to start a flame war, but as DFW did not mean a thing to me (other than being my late father in law's initials) I was a bit peeved about the assumption that everybody would understand it. I think posts which are essentially local should make this clear to all in the title. I hope the meeting goes well. -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
E M A C S i e n o w g g d n a h a t p t b i p y n i t o n e u g s s l o y f m e m o r y -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Windows text editors are not normal: most are devoid of all but the most primitive functions and are further hampered by having an interface that required frequent time wasting hand transfers from keyboard to mouse because, if they provide keyboard equivalents at all, these are remarkably unmemorable and/or undocumented. well ultra-edit, textpad, source-insight etc. pp are better than that (and run on windows) -- http://mail.python.org/mailman/listinfo/python-list
For Python programmers in Egypt
Dear Pythonistas My company, Silverkey, is going to hold a demo day on 07/07/2007. We are going to make a comparison between static languages and dynamic languages. I'm going to represent the dynamic languages side. If you are in Egypt, we will be happy to meet you. http://www.demoday.us/ Thanks Mohammad Tayseer http://spellcoder.com/blogs/tayseer - It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar.-- http://mail.python.org/mailman/listinfo/python-list
Looking to embed python into html like mason
Does something like that exist? TIA -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Invisible processes in Win2K
[EMAIL PROTECTED] wrote: I'm running a Python program on M$ Windows 2000 as a test monitor. The program should close various processes, mostly Application error-windows, as they are created. This works fine until the screensaver gets active or until I press Ctrl-Alt-Del and choose Lock my computer. At that point, my Python program cannot see any change when a Application error pops up. Without locked computer, it can identify these windows and close them, but I want it to do this with the computer locked as well. I have no chance of checking this out the moment, but ISTR that when a computer is locked, the desktop is actually the desktop of a different (special screensaver) session. Exactly what effect this will have on your program I'm not sure; it presumably depends on the interaction between the session/desktop and the various .Enumxxx routines. TJG -- http://mail.python.org/mailman/listinfo/python-list
Error while installing Python2.5.1
I use red hat 9 which comes with python2.2 installed in it. Wanting to use the latest version, i downloaded python 2.5.1 from the official python website. After downloading, i performed the following steps, but there is some error during the configuration process and hence i'm not able to run the make command after this. Following is the sequence of events that happened in my terminal: [EMAIL PROTECTED] root]# tar xfz Python-2.5.1.tgz [EMAIL PROTECTED] root]# cd Python-2.5.1 [EMAIL PROTECTED] Python-2.5.1]# ./configure checking MACHDEP... linux2 checking EXTRAPLATDIR... checking for --without-gcc... no checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. [EMAIL PROTECTED] Python-2.5.1]# make make: *** No targets specified and no makefile found. Stop. If anybody can help... Thanx! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and (n)curses
You could write your own little console interface, tailored to your needs, which is implemented using curses on Unix, and the effbot's 'console' on Windows. Indeed, that's basically what I have done. Just can't help thinking how much simpler (and so less error prone) it would have been had there been some pre-existing crossplatform module. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking to embed python into html like mason
Steven W. Orr wrote: Does something like that exist? Many of them, as usual :) http://wiki.python.org/moin/WebProgramming Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Error while installing Python2.5.1
On Thu, 21 Jun 2007 10:03:43 +0200, [EMAIL PROTECTED] wrote: checking for --without-gcc... no checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. It appears you have no C compiler installed. You should be able to get one of those from your distribution's repositories. If you can't, upgrade to something debian-based. /pavel -- http://mail.python.org/mailman/listinfo/python-list
Re: string formatter %x and a class instance with __int__ cannot handle long
2007/6/20, [EMAIL PROTECTED] [EMAIL PROTECTED]: In your second example y is an instance of class X...not an int. y.v is an int. Are you hoping it will cast it to an int as needed using your method? If so, I think you need to do so explicitly...ie %08x % int(y) ~Sean I confirmed that %08x % int(y) works. And yes, I'm hoping so. It actually works that way if the v is less than or equal to 0x7. Please try the test script. It's essentially the same test with some more print statements. All but test d-3 appears to be ok. 2007/6/20, Gabriel Genellina [EMAIL PROTECTED]: It is a bug, at least for me, and I have half of a patch addressing it. As a workaround, convert explicitely to long before formatting. I'm interested in your patch. What's the other half still missing? Thanks, Kenji Noguchi ---88---8--- #!/usr/bin/env python class X: def __init__(self, v): self.v = v def __int__(self): print Hey! I'm waken up! return self.v def test(arg): print 1,type(int(arg)) print 2,%08x % int(arg) print 3,%08x % arg a = 0x7fff b = X(0x7fff) c = 0x8000 d = X(0x8000) print test a ; test(a) print test b ; test(b) print test c ; test(c) print test d ; test(d) ---88---8--- And here is the result test a 1 type 'int' 2 7fff 3 7fff test b 1 Hey! I'm waken up! type 'int' 2 Hey! I'm waken up! 7fff 3 Hey! I'm waken up! 7fff test c 1 type 'long' 2 8000 3 8000 test d 1 Hey! I'm waken up! type 'long' 2 Hey! I'm waken up! 8000 3 Hey! I'm waken up! Traceback (most recent call last): File stdin, line 23, in ? File stdin, line 13, in test TypeError: int argument required -- http://mail.python.org/mailman/listinfo/python-list
Indenting in Emacs
Hello, Does anyone know how to make python-mode correctly indent nested lists and dictionaries. I hate indenting Django url patterns and Zope Archetypes schemas by hand, because python-mode indents them in incorrect and ugly way. Here's how it should be: StringField('reference', widget=StringWidget( description='Position reference' )), Here's how python-mode indents this code: schema = BaseSchema.copy() + Schema(( StringField('reference', widget=StringWidget( description='Position reference' )), I can provide examples of how ugly it indents nested dictionaries/ lists/tuples, but I think that everyone using emacs already have seen that. py-version is 4.78 Are we doomed to manually indent python lists in Emacs? I didn't find any patches fixing indentation in python-mode. Eugene -- http://mail.python.org/mailman/listinfo/python-list
Re: SimplePrograms challenge
Steve Howell [EMAIL PROTECTED] writes: The BankAccount example is about as small of a complete class example that I could come up with, even though it's complete only a basic level. It would be good to have a larger class example that fleshes out the concept a bit more, even if it's just BankAccount revisited. I have some free time next time, I'll try my hand at it. I guess I didn't put enough smilies in my post. Your example is simple and small which is correct for the context of the SimplePrograms page. Classes should precede unittest as the latter uses a new style class. Perhaps the thing to do is to add links to the tutorial for those seeking further enlightenment. If your page gets much bigger it will lose its original attraction. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http://petef.port5.com -./\.- WesternGeco. -- http://mail.python.org/mailman/listinfo/python-list
Re: SimplePrograms challenge
*** New Thread #5 has been bothering me. def greet(name): print 'hello', name greet('Jack') greet('Jill') greet('Bob') Using greet() three times is cheating and doesn't teach much and doesn't have any real world use that #1 can't fulfill. I offer this replacement: def greet(name): This function prints an email signature#optional doc string highly recommended print name + can be reached at,#comma prevents newline from being printed print '@'.join([name, google.com]) greet('Jill') I think it's important to teach new pythonistas about good documentation from the start. A few new print options are introduced. And as far as functionality goes, at least it does something. -- http://mail.python.org/mailman/listinfo/python-list
Can python access windows clipboard
Can I use python to copy something(like a string) to the clipboard, so that I can paste it somewhere else. Is there a way to do this? Thanks very much! -- http://mail.python.org/mailman/listinfo/python-list
Re: Indenting in Emacs
[EMAIL PROTECTED] wrote: Hello, Does anyone know how to make python-mode correctly indent nested lists and dictionaries. I hate indenting Django url patterns and Zope Archetypes schemas by hand, because python-mode indents them in incorrect and ugly way. Here's how it should be: StringField('reference', widget=StringWidget( description='Position reference' )), Here's how python-mode indents this code: schema = BaseSchema.copy() + Schema(( StringField('reference', widget=StringWidget( description='Position reference' )), I get: schema = BaseSchema.copy() + Schema(( StringField('reference', widget=StringWidget( description='Position reference' )), I'm using py-version $Revision$. Oops! Anyway, try to install the latest python-mode, whatever that is, if it isn't 4.78. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list
Re: Internationalised email subjects
Seems some characters are missing from my last post. The line that says: h = Header(' ', 'GB2312') should say: h = Header(' ', 'GB2312') -- http://mail.python.org/mailman/listinfo/python-list
Re: SimplePrograms challenge
And while I'm at it... Although Guido's tutorial was a great place to start when I first came to python I would have learned more and faster had SimplePrograms existed. My only complaint with the python documentation is the dearth of examples. The PHP documentation is chock full. Steve, You introduced this as a challenge. Why not make it so? JUST FOR FUN I propose that blank lines and comments not be counted. There should probably be an upper and lower limit on new concepts introduced. There should be an emphasis on common, real world functionality. The standard library should be used freely (although limited to the most common modules). I don't mean to turn this game into something too formal and serious, but it's obvious from the enthusiasm shown on this thread that pythonistas take their fun seriously. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can python access windows clipboard
On Jun 21, 9:59 am, MaHL [EMAIL PROTECTED] wrote: Can I use python to copy something(like a string) to the clipboard, so that I can paste it somewhere else. Is there a way to do this? The following requires Mark Hammond's win32all package (http:// sourceforge.net/projects/pywin32/): import win32clipboard, win32con, random text = Some text to stick on the clipboard win32clipboard.OpenClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, text) win32clipboard.CloseClipboard() -- Ant... http://antroy.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Internationalised email subjects
That's really strange. The chinese characters I am inputing into the post are not being displayed. Basically, what I am doing is this: h = Header('(Some Chinese characters inserted here', 'GB2312') And when I run this code, I receive the following error message: UnicodeDecodeError: 'gb2312' codec can't decode bytes in position 2-3: illegal multibyte sequence Any idea what I may be doing wrong? How do I convert Chinese characters into something like p\xf6stal in the original code posted by Martin? Can someone point me in the right direction? I'm not even sure what class/method to look into for this. -- http://mail.python.org/mailman/listinfo/python-list
Re: metaclasses and performance
Lenard Lindstrom [EMAIL PROTECTED] wrote: I don't know if C asserts are active in release Python, but for new-style classes one thing that happens during attribute lookup is that an object's class is asserted to be an instance of type. Thank's for the explanation. My Linux distribution does not set NDEBUG when compiling the python package so asserts are still in place. A self compiled python does not use the asserts and is 20% faster in my micro benchmark. Mirko -- http://mail.python.org/mailman/listinfo/python-list
Re: Can python access windows clipboard
En Thu, 21 Jun 2007 05:59:06 -0300, MaHL [EMAIL PROTECTED] escribió: Can I use python to copy something(like a string) to the clipboard, so that I can paste it somewhere else. Is there a way to do this? Yes, using the pywin32 extensions that you can download from Sourceforge py from win32clipboard import * py OpenClipboard() py EmptyClipboard() py SetClipboardText(Hello from Python!) 11272196 py CloseClipboard() Ctrl-v: Hello from Python! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Can python access windows clipboard
MaHL wrote: Can I use python to copy something(like a string) to the clipboard, so that I can paste it somewhere else. Is there a way to do this? If you're using Cygwin Python you can just open /dev/clipboard and work on that. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Dave Hansen [EMAIL PROTECTED] wrote in comp.lang.perl.misc: Speaking of which, vi is a piece of wombat do. ;-) You can have Emacs when you pry it from my cold hypertrophied escape-pressing pinky! Anno -- http://mail.python.org/mailman/listinfo/python-list
Re: Can python access windows clipboard
thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list
Re: Split file into several and reformat
On Jun 20, 10:45 pm, [EMAIL PROTECTED] wrote: Hi, I want to take read an input file (sels.txt) that looks like: Begin sels sel1 = {1001, 1002, 1003, ... ... 1099} sel2 = {1001, 1008, 1009 ... ... 1299} End sels And turn it into an output file for each of the sels in the input file, i.e sel1.txt: L1001 L1002 L1003 ... L1099 and sel2.txt: L1001 L1008 L1009 ... L1299 And so on. Many thanks, Wayne hehe... After Bruno's suggested read, go here: http://docs.python.org/tut/ Look at the string module.. specifically .strip() and .split(,) Also look at reading files and perhaps lists. for line in open(filename.txt, 'r').readlines(): handle_the_line() Good Luck. ~Sean -- http://mail.python.org/mailman/listinfo/python-list
install paramiko on AIX (ActiveState)
I need help installing paramiko on ActiveState python on AIX 5 I am new to python so need info on how to download and install paramiko AIX box does not have internet connection so presume cannot use ez_setup.py? Can anyone help? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's only one way to do it philosophy isn't good?
On Wed, 20 Jun 2007 17:23:42 -0400, Douglas Alan wrote: But Scheme has macros isn't a justification for why Python should have them. No one ever gave that justification. The justification is that they are *good*. Macros are a way to abstract syntax the way that objects are used to abstract data types and that iterators and generators abstract control, etc. But why is the ability to abstract syntax good? One criticism of operator overloading is that when you see X + Y you have no real idea of whether it is adding X and Y together, or doing something bizarre. Now allow syntax to be over-ridden as well, and not only can't you tell what X + Y does, but you can't even tell what it *means*. Maybe its a for- loop, calling the function Y X times. The usual response is That's insane, no sane programmer would do that!, and that's true as far as it goes (except for the programmers who are just too clever for their own good). Nevertheless there is a real issue there. When I program in Python, I always know what the syntax means, because there is no possible way it can be changed. That's one less thing I have to keep in my head, one less thing to worry about. Sometimes, more freedom is not better. If you had a language that let you redefine the literal 1 to mean the integer zero, wouldn't that make it much harder to understand what even basic arithmetic meant? If I wanted a bondage-and-discipline language, I'd use something with static typing and declared variables and a compiler that made sure my shoelaces were tied correctly before I did anything. But I don't, I use Python, and I appreciate the dynamic typing and runtime errors and the relatively few compiler checks. But that doesn't mean I want a language where anything goes -- there's a balance between too little freedom and too much. If Python became the sort of language where I had to think about every module imported, every function called, just to be sure that 1+1 would equal 2, I'd have to reconsider whether Python was the language for me. There would have to be some serious advantages before I'd be comfortable. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python live environment on web-site?
On Jun 21, 3:00 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jun 21, 1:18 am, [EMAIL PROTECTED] (Thomas Lenarz) wrote: Hi all, I was wondering if there was a python-live-environment available on a public web-site similar to the ruby-live-tutorial on http://tryruby.hobix.com/ I would prefer something which allows to paste small scripts into a text-field, to run them on the server, and to be able to read the produced output of the script. I searched using google but didn't come across such a site. However, I imagine there must be at least one Thanks for any hint, Thomas Crunchy. Unfortunately, as far as I know, Crunchy is not (yet) hosted on any publicly accessible server. Here are two try Python sites: http://www.datamech.com/devan/trypython/trypython.py http://www.mired.org/home/mwm/try_python/ If you want to know more about Crunchy, the latest version is located at code.google.com/p/crunchy André -- http://mail.python.org/mailman/listinfo/python-list
Re: Internationalised email subjects
En Thu, 21 Jun 2007 06:23:43 -0300, [EMAIL PROTECTED] escribió: That's really strange. The chinese characters I am inputing into the post are not being displayed. Basically, what I am doing is this: h = Header('(Some Chinese characters inserted here', 'GB2312') And when I run this code, I receive the following error message: UnicodeDecodeError: 'gb2312' codec can't decode bytes in position 2-3: illegal multibyte sequence If you execute: print some chinese characters, do you get the right results? Are you sure your system is using gb2312? In case you don't know and don't trust autodetection, try something like this: py from unicodedata import * py name(á.decode(latin-1)) 'NO-BREAK SPACE' py name(á.decode(cp850)) 'LATIN SMALL LETTER A WITH ACUTE' The first attempt shows the wrong name, so my console *cannot* be using latin-1. With cp850 I got the right results, so it *might* be cp850 (it may also be another encoding that happens to match this single character). Further tests may reveal that it is actually cp850. You should try with some chinese characters and see if your encoding is actually gb2312. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: something similar to shutil.copytree that can overwrite?
On 20 Jun, 11:40, Justin Ezequiel [EMAIL PROTECTED] wrote: On Jun 20, 5:30 pm, Ben Sizer [EMAIL PROTECTED] wrote: I need to copy directories from one place to another, but it needs to overwrite individual files and directories rather than just exiting if a destination file already exists. What version of Python do you have? Nothing in the source would make it exit if a target file exists. (Unless perhaps you have sym-links or the like.) I have 2.5, and I believe the behaviour I saw was that it exits if a directory already exists and it skips any files that already exist. It certainly wouldn't overwrite anything. -- Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list
Globals in nested functions
def f(): a = 12 def g(): global a if a 14: a=13 g() return a print f() This function raises an error. Is there any way to access the a in f() from inside g(). I could find few past discussions on this subject, I could not find the simple answer whether it is possible to do this reference. - Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: How to hide a program?
Hi all, thanks very much! it was indeed how i compiled to .exe After using the windows= , my issue was solved. Thanks to all who took the time on helping me. Jeroen -- http://mail.python.org/mailman/listinfo/python-list
Re: fetching text from the screen
Gabriel Genellina schrieb: En Mon, 18 Jun 2007 09:13:16 -0300, Juergen Kareta [EMAIL PROTECTED] escribió: I'm thinking about a python script which fetch some text from the screen independent of what application provides the text on the screen. In this regard it should be similar to the babylon software: www.babylon.com Here my thoughts: 1) getting the mouse position 2) calculate a adequate rectangle around the mouse position 3) fetch the screen content in this rectangle 4) use a OCR library to get the text out of 3) 5) do something usefull with it. On Windows, I'd try first using WindowFromPoint to get a window handle, and the sending it a WM_GETTEXT message. This should work for all windowed controls that contain text of some kind. I'd use your generic approach when this doesn't work. Hi Gabriel, thanks for your interesting suggestions. I'll try that to figure out, how it works in different situations. Jürgen -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
On 17 Jun., 17:13, Xah Lee [EMAIL PROTECTED] wrote: Yaawn! Xah [EMAIL PROTECTED] ∑http://xahlee.org/ Hmm I just had to think about the C64/Amiga etc. game California Games... The game displayed a comment when the player broke his neck the 13th time when BMXing: Geek of the week! Karsten -- http://mail.python.org/mailman/listinfo/python-list
Re: visual gui ides for python/jythpn
If Qt/PyQt is an option, I'd recommend the Qt designer. There is the odd dual license that they have, though. On 6/21/07, kromakey [EMAIL PROTECTED] wrote: Thanks, I'll take a look at these. Kromakey On 20 Jun, 22:10, Peter Decker [EMAIL PROTECTED] wrote: On 6/20/07, kromakey [EMAIL PROTECTED] wrote: Hi, Are there any free visual GUI IDE's available for python/jython, which have a drag and drop form designer similar to Visual Studio or Delphi ? Watch these screencasts, and then check out Dabo: http://leafe.com/screencasts/dataenvironment1.htmlhttp://leafe.com/screencasts/dataenvironment2.html Dabo's site ishttp://dabodev.com. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list -- Kelvie -- http://mail.python.org/mailman/listinfo/python-list
Re: Globals in nested functions
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: def f(): a = 12 def g(): global a if a 14: a=13 g() return a print f() This function raises an error. Is there any way to access the a in f() from inside g(). I could find few past discussions on this subject, I could not find the simple answer whether it is possible to do this reference. 'global' means global to the module, it prevents the lookup happening in current or nested scopes. Simple answer: You can access an object referenced by a nested scope variable and you can mutate the object accessed in that way, but you cannot rebind the name to a different object without resorting to hackery. To get the effect you want, simply use a mutable object: def f(): class v: a = 12 def g(): if v.a 14: v.a=13 g() return v.a f() 13 and as soon as the code starts looking at all complex, refactor that so the class is the thing you interact with: class F(object): def g(self): if self.a 14: self.a = 13 def __call__(self): self.a = 12 self.g() return self.a f = F() f() 13 -- http://mail.python.org/mailman/listinfo/python-list
Re: Split file into several and reformat
On 2007-06-21, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I want to take read an input file (sels.txt) that looks like: Begin sels sel1 = {1001, 1002, 1003, ... ... 1099} sel2 = {1001, 1008, 1009 ... ... 1299} End sels And turn it into an output file for each of the sels in the input file, i.e sel1.txt: L1001 L1002 L1003 ... L1099 and sel2.txt: L1001 L1008 L1009 ... L1299 And so on. Many thanks, I think I'd put together a simple grammar and then write a recursive descent parser that spit out my output files. But that's just because I find that kind of thing fun. ;) -- Neil Cerutti I'm tired of hearing about money, money, money, money, money. I just want to play the game, drink Pepsi, wear Reebok. --Shaquille O'Neal -- http://mail.python.org/mailman/listinfo/python-list
Re: Indenting in Emacs
On Thursday, Jun 21st 2007 at 10:11 +0100, quoth Michael Hoffman: =[EMAIL PROTECTED] wrote: = Hello, = Does anyone know how to make python-mode correctly indent nested lists = and dictionaries. I hate indenting Django url patterns and Zope = Archetypes schemas by hand, because python-mode indents them in = incorrect and ugly way. = = Here's how it should be: = StringField('reference', = widget=StringWidget( =description='Position reference' = )), = = Here's how python-mode indents this code: = schema = BaseSchema.copy() + Schema(( = StringField('reference', = widget=StringWidget( = description='Position reference' = )), = =I get: = =schema = BaseSchema.copy() + Schema(( = StringField('reference', = widget=StringWidget( = description='Position reference' = )), = =I'm using py-version $Revision$. Oops! Anyway, try to install the =latest python-mode, whatever that is, if it isn't 4.78. Ok. I'm not stupid but I do not see a 4.78 anywhere even though I see refs from google. I have 4.75 The SVN tree doesn't seem to even have that. I checked the latest copy out from sourceforge and that was 4.75 too. Can someone please tell me where to find the latest? -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Downloading from a clean url
Evan Klitzke wrote: On 6/20/07, D.Hering [EMAIL PROTECTED] wrote: General: How do I download a page's data from a clean url. Specific: I'm using PyQt's QHttp and QUrl classes for requests and acquiring the response, but I can't figure out how to access a page's data without knowing the file of the url's path. For instance http://kde.org If the page is omitted, as in your example of http://kde.org, the page is / Right, but so far I'm not able to get a response unless I actually provide the actual page and it's extension in the path of the url. For instance /page.html or /this/path/to/page.html ...etc. -- Evan Klitzke [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
On 2007-06-21, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You can have Emacs when you pry it from my cold hypertrophied escape-pressing pinky! LOL! nb -- http://mail.python.org/mailman/listinfo/python-list
Re: Split file into several and reformat
On 6/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I want to take read an input file (sels.txt) that looks like: Begin sels sel1 = {1001, 1002, 1003, ... ... 1099} sel2 = {1001, 1008, 1009 ... ... 1299} End sels And turn it into an output file for each of the sels in the input file, i.e sel1.txt: snip Once you have read Bruno's pointers ! Have a look at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 cheers, Amit Khemka -- Co-founder: OnYoMo website: www.onyomo.com wap-site: www.owap.in Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading multiline values using ConfigParser
On Thu, 2007-06-21 at 02:51 +, Phoe6 wrote: On Jun 20, 10:35 pm, John Krukoff [EMAIL PROTECTED] wrote: Is there anyway, I can include multi-line value in the configfile? I Following the link to RFC 822 (http://www.faqs.org/rfcs/rfc822.html) indicates that you can spread values out over multiple lines as long as there is a space or tab character imeediately after the CRLF. Thanks for the response. It did work! config = ConfigParser() config.read(Testcases.txt) ['Testcases.txt'] output = config.get(Information, Testcases) print output tct123 tct124 tct125 output '\ntct123\ntct124\ntct125' However, as I am going to provide Testcases.txt to be user editable, I cannot assume or ask users to provide value testcases surronded by spaces. I got to figure out a workaround here. Since you don't actually need a multi-line entry but rather a list of single-line entries, you could ask your users to enter something like this: TestcaseCount=3 Testcase1=tct123 Testcase2=tct124 Testcase3=tct125 HTH, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Sascha Bohnenkamp wrote: Windows text editors are not normal: most are devoid of all but the most primitive functions and are further hampered by having an interface that required frequent time wasting hand transfers from keyboard to mouse because, if they provide keyboard equivalents at all, these are remarkably unmemorable and/or undocumented. well ultra-edit, textpad, source-insight etc. pp are better than that (and run on windows) I said MOST, not all! To your list I'd add PFE and a Windows port of microEmacs, which has almost nothing in common with EMACS except some key bindings. But to return to your point: how many Windows users actually install the editors we've listed? I bet most never get past Wordpad. I've even found people using Word, of all things, to edit BAT files and program source. I'd give long odds that Windows users who use editors other than Wordpad are using the one that came with whatever IDE they've installed, simply because integrated editors are much more common in Windows-only IDEs that they are on *nixen. My guess is that this is because the standard editors (Wordpad, edlin) are so bad. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | -- http://mail.python.org/mailman/listinfo/python-list
Re: Making decimal default datatype for floats during runtime
On Thu, 2007-06-21 at 09:34 +0200, Stefan Sonnenberg-Carstens wrote: Hi, I was wondering if there are any tricks around to do some sort of changing types, float in particular. I do many operations like summing etc on lots of floats and always have to do some extra checks where results are heading 0.0, like round(n,10) for example. My idea was to tell python in some way not to take the type float but decimal in an implicit fassion. It that possible ? No. Explicit is better than implicit. And, is it still true for python 2.4/2.5 that one needs to do a = Decimal(str(aFloat)) instead of a = Decimal(aFloat) as it is in python 2.3 ? Of course: 0.1 0.10001 Should Decimal(0.1) be Decimal(0.1) or Decimal(0.10001)? Until Python can read your mind, you'll have to specify which one you want by passing in a string containing all the digits you want to keep. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
strip() 2.4.4
strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria' 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa' Code: f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].strip('), Output: Afghanistan' Albania' Algeria' American Samoa' Why is there a apostrophe still at the end? Thanks in advance. Nick -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
On Thu, Jun 21, 2007 at 06:23:01AM -0700, Nick wrote: Why is there a apostrophe still at the end? Is it possible that you actually have whitespace at the end of the line? So then strip() is looking for an apostrophe at the end of the line, not finding it, and therefore not stripping it? -- Stephen R. Laniel [EMAIL PROTECTED] Cell: +(617) 308-5571 http://laniels.org/ PGP key: http://laniels.org/slaniel.key -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
Stephen R Laniel a écrit : On Thu, Jun 21, 2007 at 06:23:01AM -0700, Nick wrote: Why is there a apostrophe still at the end? Is it possible that you actually have whitespace at the end of the line? So then strip() is looking for an apostrophe at the end of the line, not finding it, and therefore not stripping it? that should work for you ? f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].rstrip().strip('), maybe you got some \n \r at the end of each line -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
In article [EMAIL PROTECTED], Nick [EMAIL PROTECTED] wrote: strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria' 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa' Code: f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].strip('), Output: Afghanistan' Albania' Algeria' American Samoa' Why is there a apostrophe still at the end? No clue, I can't reproduce it, but here's some ideas to try. 1) It helps to give more information. Exactly what version of python are you using? Cut-and-paste what python prints out when you start it up interactively, i.e.: Python 2.4 (#1, Jan 17 2005, 14:59:14) [GCC 3.3.3 (NetBSD nb3 20040520)] on netbsd2 More than likely, just saying 2.4 would tell people all they need to know, but it never hurts to give more info. 2) Try to isolate what's happening. Is the trailing quote really in the string, or is print adding it? Do something like: temp = line.rsplit(':')[4].strip(') print repr (temp[0]) and see what happens. 3) Are you sure the argument you're giving to strip() is the same character that's in the file? Is it possible the file has non-ascii characters, such as smart quotes? Try printing ord(temp[0]) and ord(temp(')) and see if they give you the same value. -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
On Thu, Jun 21, 2007 at 01:42:03PM +, linuxprog wrote: that should work for you ? I reproduced the original poster's problem by adding one extra space after the final ' on each line. I'd vote that that's the problem. -- Stephen R. Laniel [EMAIL PROTECTED] Cell: +(617) 308-5571 http://laniels.org/ PGP key: http://laniels.org/slaniel.key -- http://mail.python.org/mailman/listinfo/python-list
Re: Globals in nested functions
[EMAIL PROTECTED] wrote: def f(): a = 12 def g(): global a if a 14: a=13 g() return a print f() This function raises an error. Is there any way to access the a in f() from inside g(). Yes. Pass it to g when calling the latter and let g return the result. def f(): a = 12 def g(parm): if parm 14: return 13 else: return a a = g(a) return a print f() Strange refactoring though. Regards, Björn -- BOFH excuse #400: We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature. -- http://mail.python.org/mailman/listinfo/python-list
newbie question: parsing street name from address
P: I am working on a project that requires geocoding, and have written a very simple geocoder that uses the Google service. I would like to be able to extract the name of the street from the addresses in my data, however they vary significantly. Here a some examples: 25 Main St 2500 14th St 12 Bennet Pkwy Pearl St Bennet Rd and Main st 19th St As you can see, sometimes I have the house number, and sometimes I do not. Sometimes the street name is a number. Sometimes I simply have the names of intersecting streets. I would like to be able to parse the above into the following: Main St 14th St Bennet Pkwy Pearl St Bennet Rd Main St 19th St How might I approach this complex parsing problem? -CJL -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
In article [EMAIL PROTECTED], David Kastrup [EMAIL PROTECTED] wrote: Kaldrenon [EMAIL PROTECTED] writes: I'm very, very new to emacs. I used it a little this past year in college, but I didn't try at all to delve into its features. I'm starting that process now, and frankly, the thought of it changing - already- upsets me. I don't feel like the program ought to change in order to accommodate me. Actually, the E in Emacs stands for extensible. Part of the appeal of Emacs is that you can change it to accommodate you. Actually, the E in Emacs stands for Editor. And the macs part stands for Macros. As in Editor Macros. It started out as a bunch of macros written in TECO. -- http://mail.python.org/mailman/listinfo/python-list
Conceptualizing Threading
I have a multi-access problem that I'm pretty sure needs to be solved with threading, but I'm not sure how to do it. This will be my first foray into threading, so I'm a little confused by all of the new landscape. So, I'm going to lay out the problem I'm facing and if someone could point me towards a good example of what I need to do, that would be great. I read THE tutorial, and while it made since to me in an esoteric sense, I'm not sure how to implement it. I have a program which will be logging who took what orders. These orders need to have sequential order numbers. SR001001, SR001002, SR001003, etc. Problem is I'm not sure how many people will be accessing this program at the same time. I thought about separating the order number into its own file and the having a function open it, read it, increment it, write it, and close it really quick to limit the chance of two people pulling the same number. Then I heard found threading. So this sounds like a consumer/producer problem, right? So I think I need to use a Queue to crank out quote numbers and have the users connect to the queue to get their number. Does that mean I'm looking at two separate programs, a server and a client? Where do I separate the programs? I was just about to give up and have quote number assignment be manual (with error checking), but I thought I should check here first and see if someone could help me wrap my brain around this problem. You'll never learn if you never try, right? -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
On 2007-06-21, Nick [EMAIL PROTECTED] wrote: strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria' 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa' Code: f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].strip('), Output: Afghanistan' Albania' Algeria' American Samoa' Why is there a apostrophe still at the end? Most likely it's the newline at the end of each record that's getting in your way. You can double-strip it. for line in f1: print line.strip().rsplit(':')[4].strip(') -- Neil Cerutti The world is more like it is now than it ever has been before. --Dwight Eisenhower -- http://mail.python.org/mailman/listinfo/python-list
Re: The Modernization of Emacs
Roy Smith [EMAIL PROTECTED] writes: In article [EMAIL PROTECTED], David Kastrup [EMAIL PROTECTED] wrote: Kaldrenon [EMAIL PROTECTED] writes: I'm very, very new to emacs. I used it a little this past year in college, but I didn't try at all to delve into its features. I'm starting that process now, and frankly, the thought of it changing - already- upsets me. I don't feel like the program ought to change in order to accommodate me. Actually, the E in Emacs stands for extensible. Part of the appeal of Emacs is that you can change it to accommodate you. Actually, the E in Emacs stands for Editor. And the macs part stands for Macros. As in Editor Macros. It started out as a bunch of macros written in TECO. It's not like I did not know this. Don't ask me what got into my head here. -- David Kastrup -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
Stephen R Laniel wrote: On Wed, Jun 20, 2007 at 12:59:28PM -0700, [EMAIL PROTECTED] wrote: Then you should use another language. This is what I meant about knowing how Internet discussions go. I agree. I also notice that (rather newbie-) OPs with not-so-simple questions are easily offended by technical answers. I'd love to know why. Regards, Björn -- BOFH excuse #39: terrorist activities -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
Nick wrote: strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria' 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa' Code: f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].strip('), Output: Afghanistan' Albania' Algeria' American Samoa' Why is there a apostrophe still at the end? As others have already guessed, the problem is trailing whitespace, namely the newline that you should have stripped for line in f1: line = line.rstrip(\n) print line.rsplit(:, 1)[-1].strip(') instead of suppressing it with the trailing comma in the print statement. Here is another approach that might work: import csv for row in csv.reader(f1, delimiter=:, quotechar='): print row[-1] that should work, too. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: strip() 2.4.4
On 21 Jun, 14:53, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-06-21, Nick [EMAIL PROTECTED] wrote: strip() isn't working as i expect, am i doing something wrong - Sample data in file in.txt: 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan' 'AL':'ALB':'008':'ALBANIA':'Albania' 'DZ':'DZA':'012':'ALGERIA':'Algeria' 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa' Code: f1 = open('in.txt', 'r') for line in f1: print line.rsplit(':')[4].strip('), Output: Afghanistan' Albania' Algeria' American Samoa' Why is there a apostrophe still at the end? Most likely it's the newline at the end of each record that's getting in your way. You can double-strip it. for line in f1: print line.strip().rsplit(':')[4].strip(') -- Neil Cerutti The world is more like it is now than it ever has been before. --Dwight Eisenhower Thank you all very much for your input, the above solved the problem as most of you had already pointed out. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
On Thu, Jun 21, 2007 at 03:55:48PM +0200, Bjoern Schliessmann wrote: I agree. I also notice that (rather newbie-) OPs with not-so-simple questions are easily offended by technical answers. I'd love to know why. One doesn't like to get meta on such things, as so often happens, so I'll be brief. The way I read my original post was like so: I know lots of people have probably had a similar question, so please point me to a canonical answer is there is one. So here's the question To me, an appropriate answer there is, That's a good question, and many people have asked it. Here's why it's unlikely that static type-checking makes sense in the context of Python, and why it couldn't just be added in pieces. We got there eventually, but only after what seemed to me to be a bout of rudeness. Now, maybe my own followup clarified something that I should have included in the original. Use another language is not a technical answer. Python could not adopt static typing without substantially changing the language and destroying what everyone loves about it, and here are examples of where the problem shows up is. But I've just gone meta, so I'll stop. -- Stephen R. Laniel [EMAIL PROTECTED] Cell: +(617) 308-5571 http://laniels.org/ PGP key: http://laniels.org/slaniel.key -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 3107 and stronger typing (note: probably a newbie question)
On 6/21/07, Bjoern Schliessmann [EMAIL PROTECTED] wrote: Stephen R Laniel wrote: On Wed, Jun 20, 2007 at 12:59:28PM -0700, [EMAIL PROTECTED] wrote: Then you should use another language. This is what I meant about knowing how Internet discussions go. I agree. I also notice that (rather newbie-) OPs with not-so-simple questions are easily offended by technical answers. I'd love to know why. Oh, c'mon. The OP was asking for an explanation, and got an indignant response. There is a world of difference between explaining *why* Python is the way it is, and getting the equivalent of a 4-year-old's Because! as a reply. To someone who admits that he is largely unfamiliar with the language, it would seem obvious that Python is lacking something that is important in other languages. An explanation as to why this would be Bad Thing for Python would be a helful response. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list