Memory usage of an 'empty' python interpreter

2006-08-15 Thread neokosmos
I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me. However, when I check the size of my Python executabl

Re: using python at the bash shell?

2006-08-15 Thread cga2000
On Tue, Aug 15, 2006 at 06:45:33PM EDT, Simon Forman wrote: > cga2000 wrote: [..] > Why do you write "most commands" .. what type of command might not be > > run by "putting '!' before them?" > > Well, I wrote that just to hedge my bets, but here's an example: I set > up lesspipe and source-high

Re: Abstracts - Leipzig Python Workshop

2006-08-15 Thread david_wahler
I'll be out of the office until approximately August 20th. If you have any questions, please email [EMAIL PROTECTED] -- David Wahler -- http://mail.python.org/mailman/listinfo/python-list

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 15)

2006-08-15 Thread david_wahler
I'll be out of the office until approximately August 20th. If you have any questions, please email [EMAIL PROTECTED] -- David Wahler -- http://mail.python.org/mailman/listinfo/python-list

"wxmsw26uh_vc.dll not found" when using wxAgg backend

2006-08-15 Thread Sam
Hello, I've installed matplotlib recently because I want to add graphing functionality to a GUI that i'm making. I decided to try using the wxAgg backend instead of plain old wx because: a) I hear it's quicker, and b) when i use the wx backend, the axis labels don't seem to work properly - i can't

Re: programming with Python 3000 in mind

2006-08-15 Thread Kay Schluehr
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > The current beta version of Python is 2.5 . How can a Python programmer > > minimize the number of changes that will be needed to run his code in > > Python 3000? > > by ignoring it, until it exists. > > And why not ignoring it, when it come

Re: Printing n elements per line in a list

2006-08-15 Thread John Machin
Dan Sommers wrote: > On 15 Aug 2006 18:33:51 -0700, > "John Machin" <[EMAIL PROTECTED]> wrote: > > ... ctr = (ctr + 1) % n > > I'm old enough to remember the days when we avoided division like the > plague. Remember those zippy 1MHz (yes, that's an M and not a G) CPUs > with less than a

Re: sending mailing list with smtplib

2006-08-15 Thread 3KWA
Filip Salomonsson wrote: > > You can reuse your message object, but you need to delete the old > header before setting a new one: > > Thanks! I am only an occasional Python programmer (love it though). I guess it is the first time I

Re: programming with Python 3000 in mind

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 13:16:27 -0700, beliavsky wrote: > The current beta version of Python is 2.5 . How can a Python programmer > minimize the number of changes that will be needed to run his code in > Python 3000? In general, he should know what is being removed from > Python 3000 and if possible

Re: hide python code !

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 09:00:16 -0700, Ben Sizer wrote: > Yes, in much the same way that there is no point ever locking your > doors or installing burglar alarms, as a determined thief will > eventually steal your belongings. That's an utterly pointless and foolish analogy. (1) If a thief breaks in

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread NevilleDNZ
Steven D'Aprano wrote: > Basically, when you access a variable name on the left hand side of an > assignment (e.g. "a = 1") ANYWHERE in a function, that name is local to > that function UNLESS it has been declared global. ThanX Steven, I am still getting used to python scoping rules. I didn't real

Re: inheritance?

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 19:35:11 -0700, KraftDiner wrote: > I have two classes: > > class implicitClass: >def __init__(self): >def isIVR(self): #This is a class private method. The convention is to flag classes as "private" with a leading underscore: def _isIVR(self): or double unders

Re: Printing n elements per line in a list

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 19:49:17 -0700, John Machin wrote: > Ugliness is in the eye of the beholder. > It is more blessed to add than to multiply. > Gaze upon this alternative: > > def printitems2(sequence, count=5): > """Print count items of sequence per line.""" > for pos in range(0, len(se

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 20:28:34 -0700, NevilleDNZ wrote: > > Steve Holden wrote: >> No. It's too horrible to contemplate without getting mild feelings of >> nausea. What exactly is it you are tring to achieve here (since I assume >> your goal wasn't to make me feel sick :-)? > > It is part of an al

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 18:38:49 -0700, NevilleDNZ wrote: > UnboundLocalError: local variable 'x2' referenced before assignment > > I guess it is something to do with the scoping of duck typing. Er, no. Scoping and duck typing are completely different concepts. Scoping refers to the idea of where a

Re: inheritance?

2006-08-15 Thread John Henry
Is this what you're looking for? class baseClass: def __init__(self): def fromfile(self, fileObj, byteOrder=None): def getVR(self): def getGroup(self): def getElement(self): def getSize(self): def getData(self): class implicitClass(baseClass): def __init__(self): bas

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread NevilleDNZ
Steve Holden wrote: > No. It's too horrible to contemplate without getting mild feelings of > nausea. What exactly is it you are tring to achieve here (since I assume > your goal wasn't to make me feel sick :-)? It is part of an algorithum: #!/usr/bin/env python def A(k, x1, x2, x3, x4, x5): de

Re: Printing n elements per line in a list

2006-08-15 Thread Dan Sommers
On 15 Aug 2006 18:33:51 -0700, "John Machin" <[EMAIL PROTECTED]> wrote: > Dan Sommers wrote: >> >> counter = 0 >> for an_element in the_list: >> print an_element, >> counter = counter + 1 >> if counter == n: >> print >> counter = 0 >> > Yes, often simple old-fashioned ways are the best. A litt

Re: Printing n elements per line in a list

2006-08-15 Thread Simon Forman
John Machin wrote: > Steven D'Aprano wrote: > > I think it's possible to > > > hack it up using while loops and some ugly slicing, but hopefully I'm > > > missing something > > > > I don't see why you think that's an ugly hack. > > > > def printitems(sequence, count=5): > > """Print count items

Re: Printing n elements per line in a list

2006-08-15 Thread John Machin
Steven D'Aprano wrote: > I think it's possible to > > hack it up using while loops and some ugly slicing, but hopefully I'm > > missing something > > I don't see why you think that's an ugly hack. > > def printitems(sequence, count=5): > """Print count items of sequence per line.""" > numr

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread Steve Holden
NevilleDNZ wrote: > I inserted x1,x2 into A to force a wider scope and it works. > > #!/usr/bin/env python > def A(): > print "begin A:" > A.x1=123; > A.x2=456; > def B(): > print "begin B:",A.x1,A.x2 > A.x2 = A.x2 + 210; # problem gone. > print "end B:",A.x1,A.x2 > print "pr

inheritance?

2006-08-15 Thread KraftDiner
I have two classes: class implicitClass: def __init__(self): def isIVR(self): #This is a class private method. def fromfile(self, fileObj, byteOrder): def getVR(self): def getGroup(self): def getElement(self): def getSize(self): def getData(self): class explicitClass:

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread NevilleDNZ
I inserted x1,x2 into A to force a wider scope and it works. #!/usr/bin/env python def A(): print "begin A:" A.x1=123; A.x2=456; def B(): print "begin B:",A.x1,A.x2 A.x2 = A.x2 + 210; # problem gone. print "end B:",A.x1,A.x2 print "pre B:",A.x1,A.x2 B() print "end A:",A.x

Re: Instantiate all objects in a module?

2006-08-15 Thread John Machin
Donald Westfield wrote: > I have my own module, called mystuff.py, which is to be imported for an > app. > > The number of classes in the module will vary, so I need a subroutine that > will instantiate all of them as objects, and assign a variable to each, > regardless of what names the classes ar

Re: Global Objects...

2006-08-15 Thread Erik Max Francis
KraftDiner wrote: > myGlobalDictionary doesn't seem to be visible to my someClass methods. > Why? What should I do? Specify more clearly what is happening, what you wanted it to do, and why you think it's wrong? You haven't given enough information. -- Erik Max Francis && [EMAIL PROTECTED] &

Re: hide python code !

2006-08-15 Thread danielx
Fuzzyman wrote: > Bayazee wrote: > > hi > > can we hide a python code ? > > if i want to write a commercial software can i hide my source code from > > users access ? > > we can conver it to pyc but this file can decompiled ... so ...!! > > do you have any idea about this ...? > > > > -

Global Objects...

2006-08-15 Thread KraftDiner
I have a question.. myGlobalDictionary = dictionary() class someClass: def __init__(self): self.x = 0; def getValue(self, v) myGlobalDictionary.getVal(v) myGlobalDictionary doesn't seem to be visible to my someClass methods. Why? What should I do? -- http://mail.python.org

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread Steve Holden
NevilleDNZ wrote: > Steve Holden wrote: > >>Hardly surprising. This statement is an assignment to x2, which >>therefore becomes local to the function. Since no previous value has >>been assigned to this local, the exception occurs. > > > But: In this case the assignment is never reached eg..

Re: Printing n elements per line in a list

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 16:51:29 -0700, unexpected wrote: > If have a list from 1 to 100, what's the easiest, most elegant way to > print them out, so that there are only n elements per line. > > So if n=5, the printed list would look like: > > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 > etc. > > My

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread NevilleDNZ
Steve Holden wrote: > Hardly surprising. This statement is an assignment to x2, which > therefore becomes local to the function. Since no previous value has > been assigned to this local, the exception occurs. But: In this case the assignment is never reached eg.. #!/usr/bin/env python def A(

Re: Printing n elements per line in a list

2006-08-15 Thread John Machin
Dan Sommers wrote: > > counter = 0 > for an_element in the_list: > print an_element, > counter = counter + 1 > if counter == n: > print > counter = 0 > Yes, often simple old-fashioned ways are the best. A little verbose, though. And I'd do

Re: hide python code !

2006-08-15 Thread Alex Martelli
Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-08-15 12:04:18, Alex Martelli wrote: > > > It just isn't worth Microsoft's while to take the public-relations hit > > of such a fight: much cheaper for them to re-implement your ideas than > > to copy your GPL'd code. > > Exactly. So by publis

Re: Printing n elements per line in a list

2006-08-15 Thread Simon Forman
unexpected wrote: > If have a list from 1 to 100, what's the easiest, most elegant way to > print them out, so that there are only n elements per line. > > So if n=5, the printed list would look like: > > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 > etc. > > My search through the previous posts yields

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread Steven D'Aprano
On Tue, 15 Aug 2006 16:04:12 -0700, tobiah wrote: > Suppose I do: > > > myfoo = Foo('grapes', 'oranges') > > And in the __init__() of Foo, there is > a real problem with the consumption of fruit. > Is there a clean way to ensure that myfoo > will be None after the call? I don't believe so. Ge

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread John Machin
Simon Forman wrote: > > |>> class f: > ... def __init__(self): > ... del self Of course nothing happens. Args are local variables. 'self' is is a vanilla arg of a vanilla function. > ... > |>> e = f() > |>> e > <__main__.f instance at 0xb7dd91ec> > > > |>> class f: > ... def

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread Steve Holden
tobiah wrote: > Suppose I do: > > > myfoo = Foo('grapes', 'oranges') > > And in the __init__() of Foo, there is > a real problem with the consumption of fruit. > Is there a clean way to ensure that myfoo > will be None after the call? Would the > __init__() just do del(self), or is there > a be

Re: proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread Steve Holden
NevilleDNZ wrote: > Can anyone explain why "begin B: 123" prints, but 456 doesn't? > > $ /usr/bin/python2.3 x1x2.py > begin A: > Pre B: 123 456 > begin B: 123 > Traceback (most recent call last): > File "x1x2.py", line 13, in ? > A() > File "x1x2.py", line 11, in A > B() > File "x1x

Re: Printing n elements per line in a list

2006-08-15 Thread Dan Sommers
On 15 Aug 2006 16:51:29 -0700, "unexpected" <[EMAIL PROTECTED]> wrote: > If have a list from 1 to 100, what's the easiest, most elegant way to > print them out, so that there are only n elements per line. > So if n=5, the printed list would look like: > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 >

Re: Printing n elements per line in a list

2006-08-15 Thread Paul Rubin
Paul Rubin writes: >for x,y in itertools.groupby(a, lambda n: n//5): >print ' '.join(str(k) for k in y) > > I hope I got that right. Of course I meant to say >for x,y in itertools.groupby(enumerate(a), lambda (n,x): n//5): >print ' '.join(str(k)

Re: programming with Python 3000 in mind

2006-08-15 Thread Simon Forman
[EMAIL PROTECTED] wrote: > Some basic syntax such as > > print "hello world" > > is going away to make print look like a function. IMO, fixing what is > not broken because of the aesthetic tastes of the BDFL is a bad idea. > His reasoning is at > http://mail.python.org/pipermail/python-dev/2005-Sep

Re: Printing n elements per line in a list

2006-08-15 Thread Paul Rubin
"unexpected" <[EMAIL PROTECTED]> writes: > If have a list from 1 to 100, what's the easiest, most elegant way to > print them out, so that there are only n elements per line. > > So if n=5, the printed list would look like: > > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 > etc. > > My search throug

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread Ben Finney
tobiah <[EMAIL PROTECTED]> writes: > myfoo = Foo('grapes', 'oranges') > > And in the __init__() of Foo, there is a real problem with the > consumption of fruit. Is there a clean way to ensure that myfoo > will be None after the call? Would the __init__() just do > del(self), or is there a bette

Re: yEnc

2006-08-15 Thread Simon Forman
Kairo Matthias wrote: > How can i encode with yEnc? What's yEnc? :-) Seriously though, did you try googling for "yEnc python"? Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread John Machin
tobiah wrote: > I should have made it more clear that Foo is a class: > > > class Foo: > > def __init__(self, *args): > > for arg in args: > if is_fruit(arg): > del(self) > > > > tobiah wrote: > > Suppose I do: > > > > -*> > m

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread jojoba
Once again, Thanks to all I did not expect to receive such a response. Very very helpful indeed, jojoba o(-_-)o -- http://mail.python.org/mailman/listinfo/python-list

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread Simon Forman
tobiah wrote: > I should have made it more clear that Foo is a class: > > > class Foo: > > def __init__(self, *args): > > for arg in args: > if is_fruit(arg): > del(self) > > > > tobiah wrote: > > Suppose I do: > > > > > > myfo

Instantiate all objects in a module?

2006-08-15 Thread Donald Westfield
I have my own module, called mystuff.py, which is to be imported for an app. The number of classes in the module will vary, so I need a subroutine that will instantiate all of them as objects, and assign a variable to each, regardless of what names the classes are. Then I need to be able to delet

Re: include a python class in another python script.

2006-08-15 Thread danielx
KraftDiner wrote: > I have a class that is defined in a file called MyClass.py > > How do I use that class in another python script.. > import MyClass ? (Does it need to be in a specific location?) MyClass.py has to be on your "python path". Your python path is a list of directories python will

Printing n elements per line in a list

2006-08-15 Thread unexpected
If have a list from 1 to 100, what's the easiest, most elegant way to print them out, so that there are only n elements per line. So if n=5, the printed list would look like: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 etc. My search through the previous posts yields methods to print all the values of t

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread tobiah
I should have made it more clear that Foo is a class: class Foo: def __init__(self, *args): for arg in args: if is_fruit(arg): del(self) tobiah wrote: > Suppose I do: > > > myfoo = Foo('grapes',

proc A def/calls proc B: variable scoping rules.

2006-08-15 Thread NevilleDNZ
Can anyone explain why "begin B: 123" prints, but 456 doesn't? $ /usr/bin/python2.3 x1x2.py begin A: Pre B: 123 456 begin B: 123 Traceback (most recent call last): File "x1x2.py", line 13, in ? A() File "x1x2.py", line 11, in A B() File "x1x2.py", line 7, in B print "begin B:",x

Re: What would be the best way to run python client in the background

2006-08-15 Thread gel
Tim Golden wrote: > [gel] > > | I have written a python client server app [...] > | I want to run the client end of the app more or less invisibly > | (no console) on the XP clients when ever a users logs on. > > You say "when[]ever a user logs on" but does this app > need to be run on a per-user

Re: Why do I require an "elif" statement here?

2006-08-15 Thread [EMAIL PROTECTED]
John Savage wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > >--- > >whitespace = " " > >old_indent = 3 > >new_indent = 5 > > > >x = " starts with 3 spaces" > > > >x = x.replace(whitespace*old_indent, whitespace*new_indent) > >---

Re: MySQLdb installation error

2006-08-15 Thread hiaips
Yi Xing wrote: > Hi, > > I met the following error when I tried to install MySQLdb. I had no > problem installing numarray, Numeric, Rpy, etc. Does anyone know > what's the problem? Thanks! > > running install > running build > running build_py > creating build > creating build/lib.darwin-7.9.0-P

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread Simon Forman
[EMAIL PROTECTED] wrote: > | would use a recursive approach for this - given that you have a sort > of recursive datastructure: > > py> def SetNewDataParam2(Data, NewData): > ... if type(Data[Data.keys()[0]]) == type(dict()): Note: |>> type(dict()) is dict True "dict" *is* a type... -- ht

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread bearophileHUGS
Like for the list.sort() method, to remind you that this function operate by side effect, maybe it's better if it doesn't return the modified nested dict: def setNested(nest, path, val): nest2 = nest for key in path[:-1]: nest2 = nest2[key] nest2[path[-1]] = val Bye, bearophil

Re: Creating Charts in Excel with pyExcelerator.ExcelMagic

2006-08-15 Thread [EMAIL PROTECTED]
implicate_order wrote: > Greetings, > > I'm new to python and am in the process of writing a script to parse > some CSV data, spread it across multiple Excel worksheets and then > generate charts. I searched the internet to find some place where I > could look up a HOWTO doc/recipe to do that usin

Re: state of SOAP and python?

2006-08-15 Thread Mark Harrison
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Thursday 10/8/2006 03:38, Mark Harrison wrote: > > >So I'm investigating doing some SOAP work... Any concensus on > >what the best python libraries are for doing this? > > > >Too bad, xmlrpc is choking on our long longs. :-( > > Just thinking, if

MySQLdb installation error

2006-08-15 Thread Yi Xing
Hi, I met the following error when I tried to install MySQLdb. I had no problem installing numarray, Numeric, Rpy, etc. Does anyone know what's the problem? Thanks! running install running build running build_py creating build creating build/lib.darwin-7.9.0-Power_Macintosh-2.4 copying _mysql_

Clean way to not get object back from instantiation attempt gone bad

2006-08-15 Thread tobiah
Suppose I do: myfoo = Foo('grapes', 'oranges') And in the __init__() of Foo, there is a real problem with the consumption of fruit. Is there a clean way to ensure that myfoo will be None after the call? Would the __init__() just do del(self), or is there a better way to think about this? Thank

Re: Memory problem

2006-08-15 Thread Yi Xing
I used the array module and loaded all the data into an array. Everything works fine now. On Aug 14, 2006, at 4:01 PM, John Machin wrote: > Yi Xing wrote: >> Thanks! I just found that that I have no problem with >> x=[[10.0]*2560*2560]*500, but x=range(1*2560*2560*30) doesn't work. >> > > range(1

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread bearophileHUGS
[EMAIL PROTECTED] wrote: > py> def SetNewDataParam2(Data, NewData): > ... if type(Data[Data.keys()[0]]) == type(dict()): > ... SetNewDataParam2(Data[Data.keys()[0]], NewData) > ... else: > ... Data[Data.keys()[0]] = NewData > ... > ... return Data > py> Data = {'a':{'b':

Re: using python at the bash shell?

2006-08-15 Thread Simon Forman
cga2000 wrote: > On Tue, Aug 08, 2006 at 12:22:42PM EDT, Simon Forman wrote: > > John Salerno wrote: > > > [EMAIL PROTECTED] wrote: > > > > John> Aside from the normal commands you can use, I was wondering if > > > > John> it's possible to use Python from the terminal instead of the > > > >

Re: what is the keyword "is" for?

2006-08-15 Thread Dan Bishop
Steve Holden wrote: > daniel wrote: > > Martin v. Löwis wrote: > [...] > >>For some objects, "change the object" is impossible. If you have > >> > >>a = b = 3 > >> > >>then there is no way to change the object 3 to become 4 (say); > >>integer objects are "immutable". So for these, to make a change

Re: PIL and solaris

2006-08-15 Thread S.Chang
kepioo wrote: > Hi all, <--snip--> > unable to execute /sgnome/tools/x86-solaris/forte/SOS8/SUNWspro/bin/cc: > No such file or directory > error: command '/sgnome/tools/x86-solaris/forte/SOS8/SUNWspro/bin/cc' here's the reason, you need the Sun C compiler -- http://mail.python.org/mailman/listinf

Re: what is the keyword "is" for?

2006-08-15 Thread Dan Bishop
Sybren Stuvel wrote [on the difference between is and ==]: > Obviously "a is b" implies "a == b", Not necessarily. >>> a = b = 1e1000 / 1e1000 >>> a is b True >>> a == b False -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying __new__ of list subclass

2006-08-15 Thread Ken Schutte
Steven Bethard wrote: > So even though your __new__ method returns the object you want, the > __init__ method is clearing out all the items you've added and then > re-adding them as it normally would. To prove this to yourself, take a > look at what happens when we override __init__:: > Okay,

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread jojoba
hey thank you so much! that should work fantastically i like your method much better more elegant thanks! jojoba =) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to deepcopy a slice object?

2006-08-15 Thread Simon Forman
Duncan Booth wrote: > Simon Forman wrote: > > > Why would you want to [deep]copy a slice object? > > I would guess the original poster actually wanted to copy a data structure > which includes a slice object somewhere within it. That is a perfectly > reasonable albeit somewhat unusual thing to want

Re: programming with Python 3000 in mind

2006-08-15 Thread André
Fredrik Lundh wrote: > André wrote: > > > When it comes to *teaching/learning* Python, it makes much more sense > > to have print() as a function (same with exec) given what it does > > -compared with the purpose of the other keywords. > > that's rubbish, of course, and seems to assume that python

Re: file object and eof

2006-08-15 Thread Fredrik Lundh
KraftDiner wrote: > how about?!: > > def eof(fileobj): >curloc = fileobj.tell() >ofloc = fileobj.seek(0,2) >fileobj.seek(curloc, 0) >if ofloc >= curloc: > return True >return False this doesn't work with text files on platforms that translates line endings, it doesn't

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Fredrik Lundh
Luke Plant wrote: > You should note that, to a nearest equivalent, all variables are > reference variables in Python. The difference is in what assignment > does - += in Python does an assignment of a new object for immutable > objects. For mutable objects like lists, += does an in place > mod

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread [EMAIL PROTECTED]
jojoba wrote: > hello! > > i am trying to come up with a simple way to access my values in my > nested python dictionaries > > here is what i have so far, but i wanted to run it by the geniuses out > there who might see any probems with this... > here is an example: > > +++

Re: Basic Boost.Python Question

2006-08-15 Thread Neil Hodgson
Hoop: > I have never heard of IronPython. Do you know if you can embedd the > Python interpreter ? I think so as I've read of people embedding the console on the mailing list. My experience is in using a C# library within a Python application. Neil -- http://mail.python.org/mailman/li

Re: PIL and solaris

2006-08-15 Thread Fredrik Lundh
kepioo wrote: > I am trying to install PIL with python 2.3 on solaris X86, but I get > this error message : > > building '_imaging' extension > creating build/temp.solaris-2.10-i86pc-2.3 creating > build/temp.solaris-2.10-i86pc-2.3/libImaging > /sgnome/tools/x86-solaris/forte/SOS8/SUNWspro/bin/cc

Re: programming with Python 3000 in mind

2006-08-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > The current beta version of Python is 2.5 . How can a Python programmer > minimize the number of changes that will be needed to run his code in > Python 3000? by ignoring it, until it exists. -- http://mail.python.org/mailman/listinfo/python-list

Re: programming with Python 3000 in mind

2006-08-15 Thread Fredrik Lundh
André wrote: > When it comes to *teaching/learning* Python, it makes much more sense > to have print() as a function (same with exec) given what it does > -compared with the purpose of the other keywords. that's rubbish, of course, and seems to assume that python students, in general, are obsess

Re: how to deepcopy a slice object?

2006-08-15 Thread Simon Forman
Alexandre Guimond wrote: > Here is my reason: > > I have an object that contrains a 2D regular grid (matrix). In this > regular grid, I place points at regular intervals. In essence, i have > something like (my code is obviously more complex, this is just to show > what I want to do) > > obj.grid =

Re: programming with Python 3000 in mind

2006-08-15 Thread André
[EMAIL PROTECTED] wrote: > The current beta version of Python is 2.5 . How can a Python programmer > minimize the number of changes that will be needed to run his code in > Python 3000? In general, he should know what is being removed from > Python 3000 and if possible use the "modern" analogs in

Re: idea on how to get/set nested python dictionary values

2006-08-15 Thread jojoba
... -- http://mail.python.org/mailman/listinfo/python-list

Re: programming with Python 3000 in mind

2006-08-15 Thread Luis M. González
[EMAIL PROTECTED] ha escrito: > At http://www-03.ibm.com/developerworks/blogs/page/davidmertz David > Mertz writes > > "Presumably with 2.7 (and later 2.x versions), there will be a means of > warning developers of constructs that are likely to cause porting > issues [to Python 3000]. In the simp

Re: sending mailing list with smtplib

2006-08-15 Thread Filip Salomonsson
On 15 Aug 2006 13:41:53 -0700, 3KWA <[EMAIL PROTECTED]> wrote: > What would be the best way to go about it then? Instantiate a new msg > in the loop? > > I guess I must read the doc more carefully, thanks for your time (if > you can spare some more I would be grateful). You can reuse your message

Re: include a python class in another python script.

2006-08-15 Thread [EMAIL PROTECTED]
KraftDiner wrote: > I have a class that is defined in a file called MyClass.py > > How do I use that class in another python script.. > import MyClass ? (Does it need to be in a specific location?) Same directory as the script that's importing it, or in the PYTHONPATH. import sys print sys.path

include a python class in another python script.

2006-08-15 Thread KraftDiner
I have a class that is defined in a file called MyClass.py How do I use that class in another python script.. import MyClass ? (Does it need to be in a specific location?) -- http://mail.python.org/mailman/listinfo/python-list

Re: sending mailing list with smtplib

2006-08-15 Thread 3KWA
Steve Holden wrote: > OK, now the problem is that you clearly aren't running the code you > posted, you are running *somethinglike* the code you posted, but that > has (an) error(s) the code you posted didn't. All I did was changed the comments to make them more relevant to my problem but here it

Re: programming with Python 3000 in mind

2006-08-15 Thread skip
>> The current beta version of Python is 2.5 . How can a Python >> programmer minimize the number of changes that will be needed to run >> his code in Python 3000? Since we don't know what Python 3000 will look like yet (it's still in very early development), that is a question that c

Re: using python at the bash shell?

2006-08-15 Thread cga2000
On Tue, Aug 08, 2006 at 12:22:42PM EDT, Simon Forman wrote: > John Salerno wrote: > > [EMAIL PROTECTED] wrote: > > > John> Aside from the normal commands you can use, I was wondering if > > > John> it's possible to use Python from the terminal instead of the > > > John> normal bash comm

Re: file object and eof

2006-08-15 Thread Steve Holden
KraftDiner wrote: [...] > how about?!: > > def eof(fileobj): >curloc = fileobj.tell() >ofloc = fileobj.seek(0,2) >fileobj.seek(curloc, 0) >if ofloc >= curloc: > return True >return False > Ignoring the errors in your file manipulation, think about replacing the last th

Re: X windows and Python?

2006-08-15 Thread Paul Rubin
"David Boddie" <[EMAIL PROTECTED]> writes: > The usual follow-up to "fix" Google's "formatting". Maybe this does > what you need: > > http://python-xlib.sourceforge.net/ Thanks, wow, a complete xlib implementation in Python, so I'd get to do low-level X programming and implement the stuff Grant E

programming with Python 3000 in mind

2006-08-15 Thread beliavsky
At http://www-03.ibm.com/developerworks/blogs/page/davidmertz David Mertz writes "Presumably with 2.7 (and later 2.x versions), there will be a means of warning developers of constructs that are likely to cause porting issues [to Python 3000]. In the simplest case, this will include deprecated fun

Re: file object and eof

2006-08-15 Thread [EMAIL PROTECTED]
KraftDiner wrote: > how about?!: > > def eof(fileobj): >curloc = fileobj.tell() >ofloc = fileobj.seek(0,2) >fileobj.seek(curloc, 0) >if ofloc >= curloc: > return True >return False 1. At least on python 2.3, seek always returns None--did that change in 2.4? I added a tel

Re: file object and eof

2006-08-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, KraftDiner wrote: >> > f.eof() isn't implmented. >> > >> > How can I implement its functionallity? >> >> You don't, generally. >> >> There's probably a better, "more Pythonic" way to accomplish >> your goal, but you're going to have to tell us what it is. >> > > how about?

Re: X windows and Python?

2006-08-15 Thread Grant Edwards
On 2006-08-15, Grant Edwards <[EMAIL PROTECTED]> wrote: >> I'd like to program my Python script to put a string into the >> X windows cut buffer. Can anyone suggest the simplest way to >> do that? > > There isn't a simple way to do that. I forgot to mention, there are actually three different sel

Re: X windows and Python?

2006-08-15 Thread Grant Edwards
On 2006-08-15, Paul Rubin wrote: > I'd like to program my Python script to put a string into the > X windows cut buffer. Can anyone suggest the simplest way to > do that? There isn't a simple way to do that. The basic problem is that there's not really such a thing as "_the_ X windows cut bu

trying to reach kevin smith, author of plastex

2006-08-15 Thread metaperl
Email to Kevin Smith regarding his plastex package failed. I hope he read this group. The tarball that he needs to reproduce the error is here: http://arc.livingcosmos.org/wolfram-fruit2/wolfram-fruit.tar.gz Hi, when attempting to type plastex wolfram-fruit.tex on the attached latex document, I go

Error with: pickle.dumps(numpy.float32)

2006-08-15 Thread Iljya
Hello, I need to pickle the type numpy.float32 but encounter an error when I try to do so. I am able to pickle the array itself, it is specifically the type that I cannot pickle. I am using: Numpy version: 0.9.4 Python version: 2.4.3 Windows XP Here is the code that reproduces the error: ___

Re: Reference Variables In Python Like Those In PHP

2006-08-15 Thread Luke Plant
Chaos wrote: > Is It possible to have reference variables like in PHP ... > Is this available in python? You should note that, to a nearest equivalent, all variables are reference variables in Python. The difference is in what assignment does - += in Python does an assignment of a new object f

yEnc

2006-08-15 Thread Kairo Matthias
How can i encode with yEnc? -- http://mail.python.org/mailman/listinfo/python-list

Re: file object and eof

2006-08-15 Thread KraftDiner
Grant Edwards wrote: > On 2006-08-15, KraftDiner <[EMAIL PROTECTED]> wrote: > > > I open a file in python by > > f = open('filename', mode='rb') > > > > how can I tell if I am at the end of file? > > I don't believe you can unless you try to read from the file. > > > f.eof() isn't implmented. > >

Dr. Dobb's Python-URL! - weekly Python news and links (Aug 15)

2006-08-15 Thread Jack Diederich
QOTW: "Consider changing your business plan: write crappy software, charge heaps for support -- it's not a novel idea" - John Machin "To make it run fast, use psyco. To make it even faster, implement the compare function in C." - Raymond Hettinger A Perl convert gladly announces his convers

  1   2   >