Re: 64 bit memory usage

2010-12-08 Thread Ian Kelly
On 12/8/2010 11:42 PM, Dennis Lee Bieber wrote: The page file can be larger than physical memory because it contains memory "images" for multiple processes. However, all those "images" have to map into the physically addressable memory -- so a process is likely limited to physical memory,

Re: completely implicit interpolation based on a frame object

2010-12-08 Thread Edward Peschko
>> Any ideas would be great on this, including pitfalls that people see >> in implementing it. >> > http://docs.python.org/library/string.html#template-strings > > regards >  Steve Steve, Thanks for the tip, I did look at templates and decided that they weren't quite completely what I was looking

trace cmd line args

2010-12-08 Thread rusi
I am unable to get trace to not trace system modules. I tried: $ python -m trace --listfuncs tt.py --ignore-module 'bdb' > tracefile $ python -m trace --listfuncs --ignore-dir /usr/lib/python2.6 tt.py > tracefile and many other combinations But anyhow my tracefile contains lines like this: file

Re: RCX using python serial help

2010-12-08 Thread Astan Chee
Thanks for that help. I really appriciate it. My next question is how do I code or what is the checksum? The sum of opcode and arguments in hex and then mod 256? Does it include the compliment opcode and arguments as well? Is the checksum compliment equal to the sum of the opcode (and arguments) co

Re: Comparisons of incompatible types

2010-12-08 Thread John Nagle
On 12/8/2010 7:56 PM, geremy condra wrote: On Wed, Dec 8, 2010 at 1:01 PM, John Nagle wrote: On 12/7/2010 3:59 PM, Mark Wooding wrote: Exactly one of a > b a = b a < b is true, or an type exception must be raised. Here's an example where this issue produces inva

win32 design pattern: COM localserver?

2010-12-08 Thread kirby.ur...@gmail.com
Greetings gurus. I'm faced with the challenge of having a single-threaded proprietary Win32 language wanting to do multiple calls against a Python COM object. Something like... loObj = CREATEOBJECT("map_maker") loObj.report( params, filename) do while .True. yadda yadda enddo RETURN I.e. th

Re: Comparisons of incompatible types

2010-12-08 Thread geremy condra
On Wed, Dec 8, 2010 at 1:01 PM, John Nagle wrote: > On 12/7/2010 3:59 PM, Mark Wooding wrote: >>> >>> Exactly one of >>> > >>> >       a>  b >>> >       a = b >>> >       a<  b >>> > >>> >  is true, or an type exception must be raised. >> >> This will get the numerical people screaming.  Non-signa

Re: Comparisons of incompatible types

2010-12-08 Thread Steven D'Aprano
On Wed, 08 Dec 2010 13:01:28 -0800, John Nagle wrote: > On 12/7/2010 3:59 PM, Mark Wooding wrote: >>> Exactly one of >>> > >>> > a> b >>> > a = b >>> > a< b >>> > >>> > is true, or an type exception must be raised. >> This will get the numerical people screaming. Non-signalling NaNs are

Re: Can't deepcopy bytes-derived class

2010-12-08 Thread Terry Reedy
On 12/8/2010 7:11 PM, Ned Deily wrote: In article, Terry Reedy wrote: On 12/8/2010 2:42 PM, Dan wrote: I have a simple type derived from bytes... class atom(bytes): pass ... that I cannot deepcopy(). The session below demonstrates how deepcopy() of "bytes" works fine, but deepcopy() of "ato

Automating a shell session question

2010-12-08 Thread chad
I manually log into a remote shell and so some stuff. After I do some stuff, I want the rest of the session to be automated. I've tried pexpect using the interact() function. However, I don't see any way to go into non-interactive mode going this route. Ideas? -- http://mail.python.org/mailman/lis

Re: is py2exe still active ?

2010-12-08 Thread Philip Semanchuk
On Dec 8, 2010, at 5:09 AM, Octavian Rasnita wrote: > Hi Steve, > > I may put some stupid questions because I am very new to Python, but... I > heard about pypi/pip. Aren't all these Python libraries (like cxFreeze) > provided on a central archive where we can get them and also report the bugs

Re: Can't deepcopy bytes-derived class

2010-12-08 Thread Ned Deily
In article , Terry Reedy wrote: > On 12/8/2010 2:42 PM, Dan wrote: > > I have a simple type derived from bytes... > > > > class atom(bytes): > > pass > > > > ... that I cannot deepcopy(). The session below demonstrates how > > deepcopy() of "bytes" works fine, but deepcopy() of "atom" does n

Re: Comparisons of incompatible types

2010-12-08 Thread John Nagle
On 12/8/2010 1:47 AM, Steven D'Aprano wrote: On Wed, 08 Dec 2010 11:58:03 +1100, Ben Finney wrote: Carl Banks writes: On Dec 6, 4:17 pm, Steven D'Aprano wrote: Nevertheless, I agree that in hindsight, the ability to sort such lists is not as important as the consistency of comparisons. I

Re: Can't deepcopy bytes-derived class

2010-12-08 Thread Terry Reedy
On 12/8/2010 2:42 PM, Dan wrote: I have a simple type derived from bytes... class atom(bytes): pass ... that I cannot deepcopy(). The session below demonstrates how deepcopy() of "bytes" works fine, but deepcopy() of "atom" does not. What's going wrong? Thanks, Dan. Python 3.1.2 (r312:7

Re: Comparisons of incompatible types

2010-12-08 Thread John Nagle
On 12/7/2010 3:59 PM, Mark Wooding wrote: Exactly one of > >a> b >a = b >a< b > > is true, or an type exception must be raised. This will get the numerical people screaming. Non-signalling NaNs are useful, and they don't obey these axioms. As a sometime numerical person, I'v

Re: Comparison with False - something I don't understand

2010-12-08 Thread Mark Wooding
"OKB (not okblacke)" writes: > This is an interesting setup, but I'm not sure I see why you need > it. If you know that, in a particular context, you want toy(x, 0) to > result in 42 instead of ZeroDivisionError, ... and that's the point. You don't know whether you'll need it at the c

Re: Comparison with False - something I don't understand

2010-12-08 Thread OKB (not okblacke)
Mark Wooding wrote: > Any code called from within the `with handler' context will (unless > overridden) cause a call `toy(x, 0)' to return 42. Even if the `with > handler' block calls other functions and so on. Note also that the > expression of this is dynamically further from where the error is

Re: Replacing globals in exec by custom class

2010-12-08 Thread Terry Reedy
On 12/8/2010 8:01 AM, Jonathan S wrote: class Global(dict): def __init__(self): pass def __getitem__(self, key): import __builtin__ if key == 'xx': return 'xx' if hasattr(__builtin__, key): return getattr(__builtin__, key)

Can't deepcopy bytes-derived class

2010-12-08 Thread Dan
I have a simple type derived from bytes... class atom(bytes): pass ... that I cannot deepcopy(). The session below demonstrates how deepcopy() of "bytes" works fine, but deepcopy() of "atom" does not. What's going wrong? Thanks, Dan. Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.

Re: email discovering code

2010-12-08 Thread Sudheer Satyanarayana
On 12/08/2010 11:53 PM, Tracubik wrote: Hi all, i remember i've found somewhere (i think here but i'm not sure) a signature of a user with a strange python code that, if runned on terminal, reveal the email of the contact Can anyone help me finding it? thanks Nico import base64 encoded = b

Re: del operator and global namespace

2010-12-08 Thread Dan Stromberg
Please try adding "global x" to the beginning of f(). On Wed, Dec 8, 2010 at 10:06 AM, alust wrote: > Hello, > > Can somebody explain this strange (to me) effect please. > > In this program it is impossible to access a global variable within a > function: > > $ cat /tmp/test.py > x='xxx' > def f(

RE: PEP8 compliance and exception messages ?

2010-12-08 Thread Gerald Britton
I'm a bit late to the discussion, but remembering that raise takes an expression, I can break it up like this: >>> raise ( ... Exception ( ... "Long " ... "exception " ... "text." ... ) ... ) Traceback (most recent call last): File "", line 3, in Exception: Long exception text Then, you can in

Re: del operator and global namespace

2010-12-08 Thread MRAB
On 08/12/2010 18:06, alust wrote: Hello, Can somebody explain this strange (to me) effect please. In this program it is impossible to access a global variable within a function: $ cat /tmp/test.py x='xxx' def f(): print x del x f() $ python /tmp/test.py Traceback (most recent cal

Re: Python creates "locked" temp dir

2010-12-08 Thread Christian Heimes
Am 08.12.2010 10:31, schrieb Alex Willmer: > 2. When you say "I am unable to access". Do you mean another script/ > process is unable to access? If so, that is the point of mkdtemp() - > to make a temporary directory that _only_ the creating process can > access. If you want to share it then tempfi

Re: class browser

2010-12-08 Thread Adam Tauno Williams
On Wed, 2010-12-08 at 13:18 +0530, Rustom Mody wrote: > If I have a medium to large python code base to browse/study, what are > the class browsers available? Monodevelop has good Python support which includes a working Python class browser for Python projects & solutions.

email discovering code

2010-12-08 Thread Tracubik
Hi all, i remember i've found somewhere (i think here but i'm not sure) a signature of a user with a strange python code that, if runned on terminal, reveal the email of the contact Can anyone help me finding it? thanks Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Python creates "locked" temp dir

2010-12-08 Thread Christian Heimes
Am 08.12.2010 19:05, schrieb astar: > Hi, > > I recently got caught on tempfiles with respect to > urllib.urlretrieve, which can create a tmpfile. Ah, but the file > simply could not be found on the file system, even as root. But > within the program that created the tmpfile, you could do usefu

del operator and global namespace

2010-12-08 Thread alust
Hello, Can somebody explain this strange (to me) effect please. In this program it is impossible to access a global variable within a function: $ cat /tmp/test.py x='xxx' def f(): print x del x f() $ python /tmp/test.py Traceback (most recent call last): File "/tmp/test.py", line

Re: Python creates "locked" temp dir

2010-12-08 Thread astar
Hi, I recently got caught on tempfiles with respect to urllib.urlretrieve, which can create a tmpfile. Ah, but the file simply could not be found on the file system, even as root. But within the program that created the tmpfile, you could do useful things with the tmpfile. So the discussion in

Re: Replacing globals in exec by custom class

2010-12-08 Thread DevPlayer
Shouldn't return 'xx' be return self['xx' I don't know why precisely you're using a class as a global namespace, not that I personally find fault with it. But here are some other things you can do. Idea one: == class NS(object): """plac

Re: Replacing globals in exec by custom class

2010-12-08 Thread DevPlayer
Shouldn't return 'xx' be return self['xx'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Replacing globals in exec by custom class

2010-12-08 Thread DevPlayer
Couple of things: I don't think this is what you want: def __getitem__(self, key): import __builtin__ if key == 'xx': return 'xx' I won't return a KeyError for any string you give g[] It will return 'xx' only if you supply key='xx' and ignore every other key=??? Wit

Re: Calling FORTAN dll functions from Python

2010-12-08 Thread Katie T
On Tue, Dec 7, 2010 at 11:11 AM, Alex van der Spek wrote: > Does anyone know how to call functions from FORTRAN dlls in Python? Is it > even possible? I browsed the documentation for Python 2.6.1 and the Python/C > API comes close to what I would like to do but it is strictly limited to C. > > Un

Re: Wanted: slow regexes

2010-12-08 Thread MRAB
On 08/12/2010 12:42, Alexander Gattin wrote: Hello, On Mon, Dec 06, 2010 at 04:08:16AM +, MRAB wrote: I'm looking for examples of regexes which are slow (especially those which seem never to finish) but whose results are known. does it have anything to do with http://swtch.com/~rsc/regexp

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread nn
On Dec 7, 10:52 am, gst wrote: > Hi, > > I met a situation where I was passing an object created in/with an > upper level module class to a lower level module class' instance in > one of its __init__ argument and saving a ref of the upper object in > that lower level class' new instance. > > But i

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread Jean-Michel Pichavant
quoting eclipse page: "Pydev [...] uses advanced type inference techniques to provide features such code completion and code analysis" I don't know exactly what's hidden behind this marketing stuff. Did you try to document your method with a markup language supported by Eclipse (if there is an

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread gst
On 8 déc, 16:20, gst wrote: > even with the "assert(self is _self)" in the "if _self:" condition in > the new and/or  init methods of the class1 ? damn : in the init method only of course.. -- http://mail.python.org/mailman/listinfo/python-list

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread gst
On 8 déc, 16:20, gst wrote: > On 8 déc, 15:51, Jean-Michel Pichavant wrote: > > Hi, > > > gst wrote: > > > nb: so this "hack" is only relevant during dev ; once the project > > > would be finished the "hack" could be removed (i.e : in class2 init I > > > would directly do : self.object1 = object1

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread gst
On 8 déc, 15:51, Jean-Michel Pichavant wrote: Hi, > gst wrote: > > nb: so this "hack" is only relevant during dev ; once the project > > would be finished the "hack" could be removed (i.e : in class2 init I > > would directly do : self.object1 = object1) > > Expect some bugs then on the 'releas

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread Jean-Michel Pichavant
gst wrote: greg. nb: so this "hack" is only relevant during dev ; once the project would be finished the "hack" could be removed (i.e : in class2 init I would directly do : self.object1 = object1) Expect some bugs then on the 'release' version. I'm not sure I understood everything you menti

64 bit memory usage

2010-12-08 Thread Rob Randall
I am trying to understand how much memory is available to a 64 bit python process running under Windows XP 64 bit. When I run tests just creating a series of large dictionaries containing string keys and float values I do not seem to be able to grow the process beyond the amount of RAM present. F

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread gst
On 8 déc, 14:09, Steve Holden wrote: > > If you'd told us which IDE you were using we might have offered better > advice, but you seem to want to keep that a secret ("my IDE" tells us > nothing). > sorry it was totally bottom of my first message : > note: I'm using Eclipse 3.5.2 with pydev so (I

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread Steve Holden
On 12/8/2010 1:01 PM, gst wrote: > As I told I try to have some kind of "ultimate" autocompletion, always > working for this kind of case (I know exactly that a certain member of > a certain class' instance will always have the same type but my IDE > doesn't seem to guess/know it.. ; I guess the be

Re: Python creates "locked" temp dir

2010-12-08 Thread utabintarbo
Thanks for the reply. The relevant function (in a module) is as follows: def createWorkDir(pathdir="k:\\"): import tempfile, os if os.name == 'posix': pathdir = os.path.join(config.get('paths', 'MOUNTPOINT'), 'subdir1') else: pathdir = os.path.normpath(r"\\windowsmoun

Replacing globals in exec by custom class

2010-12-08 Thread Jonathan S
Hi all, I wonder if anyone can explain some weird behaviour in Python. What I'm trying to do is to execute a string of python code through the 'exec' statement. I pass an instance of my Global class, which acts like a dict. By overriding the __getitem__ method, the Global should pretend that a glo

Re: Wanted: slow regexes

2010-12-08 Thread Alexander Gattin
Hello, On Mon, Dec 06, 2010 at 04:08:16AM +, MRAB wrote: > I'm looking for examples of regexes which are > slow (especially those which seem never to > finish) but whose results are known. does it have anything to do with http://swtch.com/~rsc/regexp/regexp1.html? -- With best regards, xrgt

Re: Comparisons of incompatible types

2010-12-08 Thread Tim Chase
On 12/08/2010 03:47 AM, Steven D'Aprano wrote: Or a list that needs to be presented to a human reader in some arbitrary but consistent order. Or a doctest that needs to show the keys in a dict: >>> d = myfunction() >>> sorted(d.keys()) ['ham', 'spam', 42, None] [snip] Agree

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread gst
On 8 déc, 11:45, Steven D'Aprano wrote: > On Tue, 07 Dec 2010 07:52:06 -0800, gst wrote: > > Hi, > > > But in my IDE I want the completion to also work from within the lower > > level module when it's refering to the object passed from the upper > > level: > > "The completion"? What do you mean?

Re: Case Sensitive Section names configparser

2010-12-08 Thread Jon Clements
On Dec 8, 10:32 am, RedBaron wrote: > Is there any way by which configParser's get() function can be made > case insensitive? I would probably subclass dict to create a string specific, case insensitive version, and supply it as the dict_type. See http://docs.python.org/library/configparser.html#

Re: class browser

2010-12-08 Thread Jean-Michel Pichavant
Rustom Mody wrote: If I have a medium to large python code base to browse/study, what are the class browsers available? vim + ctags is one of them. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Case Sensitive Section names configparser

2010-12-08 Thread Francesco Bochicchio
On 8 Dic, 11:32, RedBaron wrote: > Is there any way by which configParser's get() function can be made > case insensitive? If you don't care about the case of the config parameter values, you could pre-convert the input to configParser all in UPPER or lower letter with a file-like object like thi

Re: use of __new__ to permit "dynamic" completion within (any?) IDE ?

2010-12-08 Thread Steven D'Aprano
On Tue, 07 Dec 2010 07:52:06 -0800, gst wrote: > Hi, > > I met a situation where I was passing an object created in/with an upper > level module class to a lower level module class' instance in one of its > __init__ argument and saving a ref of the upper object in that lower > level class' new in

Re: is py2exe still active ?

2010-12-08 Thread Jonathan Hartley
On Dec 8, 10:09 am, "Octavian Rasnita" wrote: > Hi Steve, > > I may put some stupid questions because I am very new to Python, but... I > heard about pypi/pip. Aren't all these Python libraries (like cxFreeze) > provided on a central archive where we can get them and also report the bugs > usin

Re: is py2exe still active ?

2010-12-08 Thread Jonathan Hartley
On Dec 8, 10:09 am, "Octavian Rasnita" wrote: > Hi Steve, > > I may put some stupid questions because I am very new to Python, but... I > heard about pypi/pip. Aren't all these Python libraries (like cxFreeze) > provided on a central archive where we can get them and also report the bugs > usin

Re: Calling FORTAN dll functions from Python

2010-12-08 Thread Carl Banks
On Dec 7, 3:11 am, "Alex van der Spek" wrote: > Does anyone know how to call functions from FORTRAN dlls in Python? Is it > even possible? I browsed the documentation for Python 2.6.1 and the Python/C > API comes close to what I would like to do but it is strictly limited to C. > > Unfortunately t

Case Sensitive Section names configparser

2010-12-08 Thread RedBaron
Is there any way by which configParser's get() function can be made case insensitive? -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparisons of incompatible types

2010-12-08 Thread Steven D'Aprano
On Tue, 07 Dec 2010 15:08:23 -0800, John Nagle wrote: > If you're thinking hard about this, I recommend viewing Alexander > Stepanov's talk at Stanford last month: > > http://www.stanford.edu/class/ee380/Abstracts/101103.html > > He makes the point that, for generic programs to work righ

Re: group 0 in the re module

2010-12-08 Thread J. Gerlach
Am 08.12.2010 03:23, schrieb Yingjie Lan: > Hi, > > According to the doc, group(0) is the entire match. > m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist") m.group(0) # The entire match 'Isaac Newton' > > But if you do this: import re re.sub(r'(\d{3})(\d{3})', r'\0 t

Re: is py2exe still active ?

2010-12-08 Thread Octavian Rasnita
Hi Steve, I may put some stupid questions because I am very new to Python, but... I heard about pypi/pip. Aren't all these Python libraries (like cxFreeze) provided on a central archive where we can get them and also report the bugs using a single request/issue tracker? Octavian - Origina

Re: Perceived inconsistency in py3k documentation

2010-12-08 Thread Steven D'Aprano
On Wed, 08 Dec 2010 00:47:37 +0100, Steve Holden wrote: > On 12/6/2010 8:00 PM, Antoine Pitrou wrote: >> On Sun, 05 Dec 2010 14:47:38 -0500 >> Terry Reedy wrote: >>> On 12/5/2010 3:31 AM, Greg wrote: >>> >>> For future reference, >>> 1) At http://docs.python.org/py3k/reference/datamodel.html

Re: Comparisons of incompatible types

2010-12-08 Thread Steven D'Aprano
On Wed, 08 Dec 2010 11:58:03 +1100, Ben Finney wrote: > Carl Banks writes: > >> On Dec 6, 4:17 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: >> > Nevertheless, I agree that in hindsight, the ability to sort such >> > lists is not as important as the consistency of comparisons. >>

Re: Python creates "locked" temp dir

2010-12-08 Thread Alex Willmer
On Dec 7, 9:03 pm, utabintarbo wrote: > I am using tempfile.mkdtemp() to create a working directory on a > remote *nix system through a Samba share. When I use this on a Windows > box, it works, and I have full access to the created dir. When used on > a Linux box (through the same Samba share), t

class browser

2010-12-08 Thread Rustom Mody
If I have a medium to large python code base to browse/study, what are the class browsers available? -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling FORTAN dll functions from Python

2010-12-08 Thread Daniel da Silva
I don't know much about fortran+python, but I work with someone who does, and he absolutely loves this tool: http://cens.ioc.ee/projects/f2py2e/ Daniel On Tue, Dec 7, 2010 at 10:19 PM, Dennis Lee Bieber wrote: > On Tue, 07 Dec 2010 12:52:54 +0100, Stefan Behn