Re: Microsoft lessening commitment to IronPython and IronRuby

2010-08-09 Thread Lawrence D'Oliveiro
In message <7fr16650meigqgmj8rh0n3a66q9r4j4...@4ax.com>, Tim Roberts wrote: > The .NET Common Language Runtime is a vast and very useful class library, > including two complete GUI systems. Used only by corporate code-cutter drones. Go on, name one creative thing which was ever done in Dotnet. -

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Stefan Behnel
Christian Heimes, 10.08.2010 01:39: Am 10.08.2010 01:20, schrieb Aahz: The docs say, "Parses an XML section into an element tree incrementally". Sure sounds like it retains the entire parsed tree in RAM. Not good. Again, how do you parse an XML file larger than your available memory using somet

Re: mailbox.mbox not locking mbox properly

2010-08-09 Thread Tim Roberts
tinn...@isbd.co.uk wrote: > >I'm using the python mailbox class in a script that processes incoming >mail and delivers it to various mbox format mailboxes. It appears >that, although I am calling the lock method on the destination before >writing to the mbox and calling unlock afterwards the locki

Re: Microsoft lessening commitment to IronPython and IronRuby

2010-08-09 Thread Tim Roberts
Lawrence D'Oliveiro wrote: > >Frankly I never understood the point of IronPython and IronRuby. They seemed >like a desperate attempt to keep Dotnet relevant in the modern world of >dynamic languages. Looks like it was a failure. Yawn. I'm not sure that's really fair. The .NET Common Language Run

Re: Using the print command in Python3

2010-08-09 Thread Navkirat Singh
On 10-Aug-2010, at 11:04 AM, Benjamin Kaplan wrote: > On Mon, Aug 9, 2010 at 10:17 PM, Grady Knotts wrote: >> In earlier versions of Python I can do: >>print 'A', >>print 'B' >> to print everything on the same line: 'A B' >> >> But I don't know how to do this with Python3 >> I'v

Re: favicon.ico problem

2010-08-09 Thread Navkirat Singh
On 10-Aug-2010, at 10:57 AM, Xia, Zhen wrote: > On Tue, 10 Aug 2010 10:02:49 +0530 > Navkirat Singh wrote: > >> Hi guys, >> >> I am having this strange problem. I have programmed a very basic >> multiprocessing webserver using low level sockets. Each time the server >> receives a request it

Re: Using the print command in Python3

2010-08-09 Thread Benjamin Kaplan
On Mon, Aug 9, 2010 at 10:17 PM, Grady Knotts wrote: > In earlier versions of Python I can do: >        print 'A', >        print 'B' > to print everything on the same line: 'A B' > > But I don't know how to do this with Python3 > I've been trying things like: >        print('A',) >        print('

Re: favicon.ico problem

2010-08-09 Thread Xia, Zhen
On Tue, 10 Aug 2010 10:02:49 +0530 Navkirat Singh wrote: > Hi guys, > > I am having this strange problem. I have programmed a very basic > multiprocessing webserver using low level sockets. Each time the server > receives a request it spawns a new process to handle the request. Now when > thr

Using the print command in Python3

2010-08-09 Thread Grady Knotts
In earlier versions of Python I can do: print 'A', print 'B' to print everything on the same line: 'A B' But I don't know how to do this with Python3 I've been trying things like: print('A',) print('B') and it prints two different lines. So, do I get two different

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 10 Αύγ, 01:43, MRAB wrote: > Íßêïò wrote: > > D:\>convert.py > >   File "D:\convert.py", line 34 > > SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line > > 34, but no > >  encoding declared; seehttp://www.python.org/peps/pep-0263.htmlfor > > details > > > D:\> > > > What does

Re: File Manager in Tkinter

2010-08-09 Thread Chris Rebert
On Mon, Aug 9, 2010 at 9:53 PM, wrote: > As a learning exercise in Tkinter I htought about making a very simple > and basic file manager for my own use. I tried searching google for > any sample project and could not find anything. Not exactly  sure how > to start I tought I could ask here? > > I

Re: [Python] favicon.ico problem

2010-08-09 Thread Chris Gonnerman
On 08/09/2010 11:32 PM, Navkirat Singh wrote: I am having this strange problem. I have programmed a very basic multiprocessing webserver using low level sockets. Each time the server receives a request it spawns a new process to handle the request. Now when through a web browser I type http://

File Manager in Tkinter

2010-08-09 Thread John
As a learning exercise in Tkinter I htought about making a very simple and basic file manager for my own use. I tried searching google for any sample project and could not find anything. Not exactly sure how to start I tought I could ask here? I thought about making two listboxes one to list fol

Re: favicon.ico problem

2010-08-09 Thread Ned Deily
In article <9f21f146-a43a-4108-962b-4dfa14e43...@gmail.com>, Navkirat Singh wrote: > I am having this strange problem. I have programmed a very basic > multiprocessing webserver using low level sockets. Each time the server > receives a request it spawns a new process to handle the request. Now

favicon.ico problem

2010-08-09 Thread Navkirat Singh
Hi guys, I am having this strange problem. I have programmed a very basic multiprocessing webserver using low level sockets. Each time the server receives a request it spawns a new process to handle the request. Now when through a web browser I type http://localhost:8001/ it automatically creat

Re: iter

2010-08-09 Thread Steven D'Aprano
On Mon, 09 Aug 2010 09:11:37 -0700, daryn wrote: > I'm just playing around with the iter function and I realize that I can > use the iterator returned by it long after the original object has any > name bound to it. Yes, the same as everything else in Python. Iterators aren't unique here. >>> a

Re: GUI automation tool (windows)

2010-08-09 Thread alex23
Alex Barna wrote: > So what happens to this field (Windows GUI automation) ? Either someone cares enough to do something about it, or everyone just defaults to using AutoIT-like tools. Which Python implementation are you planning on contributing to? -- http://mail.python.org/mailman/listinfo/py

how to let shell.SendKeys use unicode on windows in python

2010-08-09 Thread oyster
I want to use python to do some automatical operation on windows. the following is the code, which try to open a file with unicode characters in its filename in msword but I can't get it work correctly. Can anybody help me? if that is the shortcoming of WScript, is there any other way to do so in

Re: need a json representation of all members of any type of object, list or hashtable (php's var_dump)

2010-08-09 Thread MRAB
Rene Veerman wrote: hi. for 2 open source components of mine that are used in debugging, i would like to capture the output generated by print for any variable. i'm new to python, so please excuse my noobishness. i don't know if objects can be json-ed as easy as lists and hash tables are by pri

Re: need a json representation of all members of any type of object, list or hashtable (php's var_dump)

2010-08-09 Thread Benjamin Kaplan
On Mon, Aug 9, 2010 at 7:18 PM, Rene Veerman wrote: > hi. > > for 2 open source components of mine that are used in debugging, i > would like to capture the output generated by print for any variable. > i'm new to python, so please excuse my noobishness. > > i don't know if objects can be json-ed

need a json representation of all members of any type of object, list or hashtable (php's var_dump)

2010-08-09 Thread Rene Veerman
hi. for 2 open source components of mine that are used in debugging, i would like to capture the output generated by print for any variable. i'm new to python, so please excuse my noobishness. i don't know if objects can be json-ed as easy as lists and hash tables are by print. and i couldn't fin

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Robert Kern
On 8/9/10 4:43 PM, Stefan Schwarzer wrote: Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: On 2010-08-09 06:42 , Stefan Schwarzer wrote: Unfortunatey, when I enter In [2]: %paste at the prompt it gives me (before I pasted anything) In [2]: %paste -

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread sturlamolden
On 9 Aug, 10:21, Steven D'Aprano wrote: > And that it's quite finicky about blank lines between methods and inside > functions. Makes it hard to paste code directly into the interpreter. The combination of editor, debugger and interpreter is what I miss most from Matlab. In Matlab we can have a

Re: I need a starter ptr writing python embedded in html.

2010-08-09 Thread alex23
"Steven W. Orr" wrote: > I'm ok in python but I haven't done too much with web pages. I have a web page > that is hand written in html that has about 1000 entries in a table and I want > to convert the table [into html] Is the data coming from somewhere like a file or db? If so, I'd just use some

Re: Image histogram

2010-08-09 Thread Gary Herron
On 08/09/2010 05:02 PM, Paul Rubin wrote: Gary Herron writes: This is a Python newsgroup, not an image processing news group. If you are asking for an algorithm to modify an image I saw it as a question of how to do something using PIL. Seems ok to me. A quote from the OP:

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Ben Finney
"saeed.gnu" writes: > "x is y" means "id(y) == id(y)" > "x is not y" means "id(x) != id(x)" > "x is not None" means "id(x) != id(None)" No, the meanings are different. The behaviour might, or might not, be the same. The operators are different *because* the meanings are dif

Re: Need mentor

2010-08-09 Thread Ranjith Kumar
Hi Carey, -- Forwarded message -- From: Carey Tilden To: python-list@python.org Date: Mon, 9 Aug 2010 11:27:40 -0700 Subject: Re: Need mentor On Sun, Aug 8, 2010 at 11:31 PM, Ranjith Kumar wrote: > I have described the theme of my project here, >>It appears all you did was descr

Re: Decorators without function

2010-08-09 Thread Gregory Ewing
Vedran wrote: @plot_decorator(fig_params1) def plt(): pylab.plot(..first graph data...) pylab.plot(..second graph data..) plt() You could do something like def call(f): f() @call @plot_decorator(fig_params1) def plt(): pylab.plot(..first graph data...)

Re: Python-list Digest, Vol 83, Issue 103

2010-08-09 Thread Ranjith Kumar
Hi Terry, > -- Forwarded message -- > From: Terry Reedy > To: python-list@python.org > Date: Mon, 09 Aug 2010 13:15:24 -0400 > Subject: Re: Need mentor > On 8/9/2010 2:31 AM, Ranjith Kumar wrote: > >> I have described the theme of my project here, >> > > Is this a class assignment

Re: Image histogram

2010-08-09 Thread Paul Rubin
Gary Herron writes: > This is a Python newsgroup, not an image processing news group. > If you are asking for an algorithm to modify an image I saw it as a question of how to do something using PIL. Seems ok to me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Image histogram

2010-08-09 Thread Gary Herron
On 08/09/2010 04:27 PM, Anahita Yazdi wrote: Hi, I was just wondering how would I be able to get some extra help regarding editing an image's histogram using python's module? I have modified a histogram of an image however I dont know how to apply the new histogram to the image and basically r

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Christian Heimes
Am 10.08.2010 01:20, schrieb Aahz: > The docs say, "Parses an XML section into an element tree incrementally". > Sure sounds like it retains the entire parsed tree in RAM. Not good. > Again, how do you parse an XML file larger than your available memory > using something other than SAX? The docum

Image histogram

2010-08-09 Thread Anahita Yazdi
Hi, I was just wondering how would I be able to get some extra help regarding editing an image's histogram using python's module? I have modified a histogram of an image however I dont know how to apply the new histogram to the image and basically reload the image based on its new modified histogra

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Aahz
In article , Stefan Behnel wrote: >Aahz, 09.08.2010 18:52: >> In article, >> Stefan Behnel wrote: >>> >>> First of all: don't use SAX. Use ElementTree's iterparse() function. That >>> will shrink you code down to a simple loop in a few lines. >> >> Unless I'm missing something, that only helps if

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread MRAB
Νίκος wrote: D:\>convert.py File "D:\convert.py", line 34 SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line 34, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details D:\> What does it refering too? what character cannot be identified? Line 34

Re: I need a starter ptr writing python embedded in html.

2010-08-09 Thread Miki
> >> I'm ok in python but I haven't done too much with web pages. I have a web > >> page > >> that is hand written in html that has about 1000 entries in a table and I > >> want > >> to convert the table from entries like this > > >>     > >>       Some Date String > >>       SomeTag > >>  

Re: Regular expression issue

2010-08-09 Thread genxtech
I have it now. Had to beat my head over it a couple times. Thanks everybody. -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread MRAB
Νίκος wrote: On 9 Αύγ, 23:17, MRAB wrote: Νίκος wrote: On 9 Αύγ, 21:05, Thomas Jollans wrote: On Monday 09 August 2010, it occurred to Νίκος to exclaim: On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: Νίκος wrote: Please tell me that no matter what weird charhs has inside ic an sti

mailbox.mbox not locking mbox properly

2010-08-09 Thread tinnews
I'm using the python mailbox class in a script that processes incoming mail and delivers it to various mbox format mailboxes. It appears that, although I am calling the lock method on the destination before writing to the mbox and calling unlock afterwards the locking isn't working correctly. I a

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
On 2010-08-09 23:43, Stefan Schwarzer wrote: > I got that traceback as soon as I typed in "%paste" and > pressed enter, without pasting anything in the terminal. > I had assumed it works like :paste in Vim, activating a I meant ":set paste" of course. Stefan -- http://mail.python.org/mailman/lis

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: > On 2010-08-09 06:42 , Stefan Schwarzer wrote: >> Unfortunatey, when I enter >> >>In [2]: %paste >> >> at the prompt it gives me (before I pasted anything) >> >>In [2]: %paste >>

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
D:\>convert.py File "D:\convert.py", line 34 SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line 34, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details D:\> What does it refering too? what character cannot be identified? Line 34 is: src_data

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Michael Torrie
On 08/09/2010 06:11 AM, saeed.gnu wrote: > On Aug 9, 3:41 pm, "saeed.gnu" wrote: >> "x is y" means "id(y) == id(y)" >> "x is not y" means "id(x) != id(x)" >> "x is not None" means "id(x) != id(None)" >> >> "x is not None" is a really silly statement!! because id(None) and id

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 23:28, MRAB wrote: > Íßêïò wrote: > > On 9 Áýã, 10:07, Íßêïò wrote: > >> Now the code looks as follows: > > >> = > >> #!/usr/bin/python > > >> import re, os, sys > > >> id = 0  # unique page_id > > >> for currdir, files, dirs in os.walk('test'): > > >>      

Re: Python "why" questions

2010-08-09 Thread Bartc
"Nobody" wrote in message news:pan.2010.08.07.15.23.59.515...@nowhere.com... > On Sat, 07 Aug 2010 13:48:32 +0200, News123 wrote: > >>> "Common sense" is wrong. There are many compelling advantages to >>> numbering from zero instead of one: >>> >>> http://lambda-the-ultimate.org/node/1950 >> >

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 23:17, MRAB wrote: > Νίκος wrote: > > On 9 Αύγ, 21:05, Thomas Jollans wrote: > >> On Monday 09 August 2010, it occurred to Νίκος to exclaim: > > >>> On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: > Νίκος wrote: > > Please tell me that no matter what weird charhs has ins

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread MRAB
Νίκος wrote: On 9 Αύγ, 10:07, Νίκος wrote: Now the code looks as follows: = #!/usr/bin/python import re, os, sys id = 0 # unique page_id for currdir, files, dirs in os.walk('test'): for f in files: if f.endswith('php'): [snip] I jus

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Robert Kern
On 2010-08-09 06:42 , Stefan Schwarzer wrote: Hi Steven, On 2010-08-09 10:21, Steven D'Aprano wrote: And that it's quite finicky about blank lines between methods and inside functions. Makes it hard to paste code directly into the interpreter. And that pasting doesn't strip out any leading pro

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread MRAB
Νίκος wrote: On 9 Αύγ, 21:05, Thomas Jollans wrote: On Monday 09 August 2010, it occurred to Νίκος to exclaim: On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: Νίκος wrote: Please tell me that no matter what weird charhs has inside ic an still open thosie fiels and make the neccessary

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Gabriel Genellina
En Mon, 09 Aug 2010 08:41:23 -0300, saeed.gnu escribió: "x is y" means "id(y) == id(y)" "x is not y" means "id(x) != id(x)" No; consider this: py> id([])==id([]) True py> [] is [] False Comparing id's is the same as using the is operator only if you can guarantee that

Re: simple renaming files program

2010-08-09 Thread Peter Otten
Chris Rebert wrote: > On Mon, Aug 9, 2010 at 3:19 AM, Peter Otten <__pete...@web.de> wrote: >> Warning: I don't remember how Windows handles this, but unix will happily >> perform os.rename("alpha/alpha.txt", "beta/beta.txt") and overwrite >> beta/beta.txt with alpha/alpha.txt. >> >> I'd rather m

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 10:07, Νίκος wrote: > Now the code looks as follows: > > = > #!/usr/bin/python > > import re, os, sys > > id = 0  # unique page_id > > for currdir, files, dirs in os.walk('test'): > >         for f in files: > >                 if f.endswith('php'): > >      

Re: Circular imports (again)

2010-08-09 Thread Michael Torrie
On Aug 9, 6:19 am, "Frank Millman" wrote: > It has just happened again. I have organised my code into three modules, > each representing a fairly cohesive functional area of the overall > application. However, there really are times when Module A wants to invoke > something from Module B, ditto fo

Re: simple renaming files program

2010-08-09 Thread Chris Rebert
On Mon, Aug 9, 2010 at 3:19 AM, Peter Otten <__pete...@web.de> wrote: > Chris Rebert wrote: > >> Hence (untested): >> from os import listdir, rename >> from os.path import isdir, join >> directory = raw_input("input file directory") >> s = raw_input("search for name") >> r = raw_input("replace name

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 21:05, Thomas Jollans wrote: > On Monday 09 August 2010, it occurred to Νίκος to exclaim: > > > > > > > On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: > > > Νίκος wrote: > > > > Please tell me that no matter what weird charhs has inside ic an still > > > > open thosie fiels and m

Re: Sequential Object Store

2010-08-09 Thread GZ
Hi Alex, On Aug 7, 6:54 pm, Alex Willmer wrote: > On Aug 7, 5:26 pm, GZ wrote: > > > I am wondering if there is a module that can persist a stream of > > objects without having to load everything into memory. (For this > > reason, I think Pickle is out, too, because it needs everything to be > >

Re: dumping generator

2010-08-09 Thread Rob Williscroft
targetsmart wrote in news:cd83533b-f51e-4955-96c5-f8a10185bef1 @i18g2000pro.googlegroups.com in gmane.comp.python.general: > Right now if I want to dump the contents of a generator object I use , > a snip from a bigger block of code.. > > try: > while gen: print gen.next() > except StopIteratio

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 8 Αύγ, 20:29, John S wrote: > When replacing text in an HTML document with re.sub, you want to use > the re.S (singleline) option; otherwise your pattern won't match when > the opening tag is on one line and the closing is on another. Thats exactly the problem iam facing now with this stateme

EARN FROM HOME... ITS REAL....

2010-08-09 Thread SAKEERA
EARN FROM HOME... ITS REAL http://www.kamaraja.com/howitworks.htm?aff=naagaarjuna ...AND.. http://www.hyaffiliates.com?pid=d629b730 EARN FROM HOME... ITS REAL http://www.kamaraja.com/howitworks.htm?aff=naagaarjuna ...AND.. http://www.hyaffiliates.com?pid=d629b730 -

Re: Python "why" questions

2010-08-09 Thread Bartc
"D'Arcy J.M. Cain" wrote in message news:mailman.1735.1281185722.1673.python-l...@python.org... > On Sat, 07 Aug 2010 13:48:32 +0200 > News123 wrote: >> It makes sense in assembly language and even in many byte code languages. >> It makes sense if you look at the internal representation of unsi

Re: Circular imports (again)

2010-08-09 Thread Carl Banks
On Aug 9, 6:19 am, "Frank Millman" wrote: > It has just happened again. I have organised my code into three modules, > each representing a fairly cohesive functional area of the overall > application. However, there really are times when Module A wants to invoke > something from Module B, ditto fo

Re: Need mentor

2010-08-09 Thread Carey Tilden
On Sun, Aug 8, 2010 at 11:31 PM, Ranjith Kumar wrote: > I have described the theme of my project here, It appears all you did was describe your project. Did you ask a question or seek any specific guidance? Did I miss something? Carey -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-09 Thread Christian Heimes
> I highly doubt the Python source would build with a C++ compiler. > > C++ is "'mostly' 'backwards' compatible" with C insofar as you can > pretty easily write C code that is also legal (and semantically > equivalent) C++. But if you don't actively try to write code that is > compatible with bot

Re: Why is python not written in C++ ?

2010-08-09 Thread Carl Banks
On Aug 9, 6:39 am, Ulrich Eckhardt wrote: > candide wrote: > > Python is an object oriented langage (OOL). The Python main > > implementation is written in pure and "old" C90. Is it for historical > > reasons? > > The fact that Python is OOP doesn't mean that the implementation of it has > to be w

Re: Python "why" questions

2010-08-09 Thread Grant Edwards
On 2010-08-09, Terry Reedy wrote: > On 8/9/2010 11:16 AM, Grant Edwards wrote: > >> IOW, the "Ugly American". > [snip hate rant] > > Stereotypically bashing "Americans" I wasn't bashing "Americans". I was making light of a certain type of American tourist commonly denoted by the phrase "ugly ame

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Thomas Jollans
On Monday 09 August 2010, it occurred to Νίκος to exclaim: > On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: > > Νίκος wrote: > > > Please tell me that no matter what weird charhs has inside ic an still > > > open thosie fiels and make the neccessary replacements. > > > > Go back to 2.6 for

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote: > Νίκος wrote: > > Please tell me that no matter what weird charhs has inside ic an still > > open thosie fiels and make the neccessary replacements. > > Go back to 2.6 for the moment and defer learning about unicode until you're > done with th

Re: Circular imports (again)

2010-08-09 Thread Ethan Furman
Frank Millman wrote: Hi all I know the problems related to circular imports... > It has just happened again. I have organised my code into three modules, each representing a fairly cohesive functional area of the overall application. However, there really are times when Module A wants to inv

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Stefan Behnel
Aahz, 09.08.2010 18:52: In article, Stefan Behnel wrote: First of all: don't use SAX. Use ElementTree's iterparse() function. That will shrink you code down to a simple loop in a few lines. Unless I'm missing something, that only helps if the final tree fits into memory. What do you suggest

Re: Python "why" questions

2010-08-09 Thread Terry Reedy
On 8/9/2010 11:16 AM, Grant Edwards wrote: IOW, the "Ugly American". [snip hate rant] Stereotypically bashing "Americans" is as ugly and obnoxious as bashing any other ethnic group. I have traveled the world and Americans are no worse, but are pretty much the same mix of good and bad. It is

Re: Need mentor

2010-08-09 Thread Terry Reedy
On 8/9/2010 2:31 AM, Ranjith Kumar wrote: I have described the theme of my project here, Is this a class assignment or paid work? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: iter

2010-08-09 Thread Terry Reedy
On 8/9/2010 12:11 PM, daryn wrote: I'm just playing around with the iter function and I realize that I can use the iterator returned by it long after the original object has any name bound to it. Example: a=[1,2,3,4] b=iter(a) b.next() 1 a[1]=99 Changing a list while iterating through it i

Re: how to change a string into dictionary

2010-08-09 Thread Daniel Urban
> a = "{'a':'1','b':'2'}" > how to change a into a dictionary ,says, a = {'a':'1','b':'2'} See also the ast.literal_eval function: http://docs.python.org/py3k/library/ast.html#ast.literal_eval Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: xmlrpc and processes

2010-08-09 Thread Martin P. Hellwig
On 08/09/10 07:50, iu2 wrote: Hi, I have a SimpleXMLRPCServer running on one PC. I need several ServerProxy-s talking to it, each one running on a different PC. That is, I run on each PC a client application, that talks to the one server using xml-rpc. Is the xml-rpc designed to work like this?

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Aahz
In article , Stefan Behnel wrote: > >First of all: don't use SAX. Use ElementTree's iterparse() function. That >will shrink you code down to a simple loop in a few lines. Unless I'm missing something, that only helps if the final tree fits into memory. What do you suggest other than SAX if you

Re: xmlrpc and processes

2010-08-09 Thread bobicanprogram
On Aug 9, 2:50 am, iu2 wrote: > Hi, > > I have a SimpleXMLRPCServer running on one PC. > I need several ServerProxy-s talking to it, each one running on a > different PC. That is, I run on each PC a client application, that > talks to the one server using xml-rpc. > > Is the xml-rpc designed to wo

Re: iter

2010-08-09 Thread Peter Otten
daryn wrote: > I'm just playing around with the iter function and I realize that I > can use the iterator returned by it long after the original object has > any name bound to it. Example: > a=[1,2,3,4] b=iter(a) b.next() > 1 a[1]=99 a[3]=101 del a b.next() > 99 b

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Terry Reedy
On 8/9/2010 7:41 AM, saeed.gnu wrote: "x is y" means "id(y) == id(y)" "x is not y" means "id(x) != id(x)" "x is not None" means "id(x) != id(None)" "x is not None" is a really silly statement!! Wrong. It is exactly right when that is what one means and is the STANDARD I

ANN: python-ldap-2.3.12

2010-08-09 Thread Michael Ströder
Find a new release of python-ldap: http://pypi.python.org/pypi/python-ldap/2.3.12 python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related st

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Peter Otten
Νίκος wrote: > Please tell me that no matter what weird charhs has inside ic an still > open thosie fiels and make the neccessary replacements. Go back to 2.6 for the moment and defer learning about unicode until you're done with the conversion job. -- http://mail.python.org/mailman/listinfo/py

iter

2010-08-09 Thread daryn
I'm just playing around with the iter function and I realize that I can use the iterator returned by it long after the original object has any name bound to it. Example: >>>a=[1,2,3,4] >>>b=iter(a) >>>b.next() 1 >>>a[1]=99 >>>a[3]=101 >>>del a >>>b.next() 99 >>>b.next() 3 >>>b.next() 101 it seem

Subprocess Problem (Wait and while)

2010-08-09 Thread Alban Nona
Hi, I have some problem with my actual code. In fact, the script is done to work within nuke from the foundry which is a compositing software. Homever, I have some code difficulties as I quite new in the area. Here the deal: Im using subprocess command to copy some files into local directory, lik

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
Please tell me that no matter what weird charhs has inside ic an still open thosie fiels and make the neccessary replacements. -- http://mail.python.org/mailman/listinfo/python-list

EARN FROM HOME...EAZY... TRY THIS.####

2010-08-09 Thread SAKEERA
EARN FROM HOME...EAZY... TRY THIS. http://www.hymarkets.com/servlet/track?campaignID=7012000AS5B&a_aid=d629b730 EARN FROM HOME...EAZY... TRY THIS. http://www.hymarkets.com/servlet/track?campaignID=7012000AS5B&a_aid=d629b730 EARN FROM HOME...EAZY... TRY THIS. http://www.hyma

Re: Using dicts and lists as default arguments of functions

2010-08-09 Thread Bruno Desthuilliers
Johan a écrit : Dear all, Considering this test program: def tst(a={}): Stop here, we already know what will follow !-) And yes, it's one of Python's most (in)famous gotchas : default arguments values are computed only once, at function definition time (that is, when the def statement is e

Re: Using dicts and lists as default arguments of functions

2010-08-09 Thread MRAB
Johan wrote: Dear all, Considering this test program: def tst(a={}): print 1, a a['1'] = 1 print 2, a del a def tstb(a=[]): print 1, a a.append(1) print 2, a del a [snip] Do this instead: def tst(a=None): if a is None: a = {} print 1, a a[

Re: Using dicts and lists as default arguments of functions

2010-08-09 Thread Mel
Johan wrote: > Dear all, > > Considering this test program: > > def tst(a={}): > print 1, a > a['1'] = 1 > print 2, a > del a The idiom to use is def tst (a=None): if a is None: a = {} # ... and so on. This means that every call to tst with unspecified a

Using dicts and lists as default arguments of functions

2010-08-09 Thread Johan
Dear all, Considering this test program: def tst(a={}): print 1, a a['1'] = 1 print 2, a del a def tstb(a=[]): print 1, a a.append(1) print 2, a del a tst() tst() tstb() tstb() With output: t...@tnjx:~/tst> python tt.py 1 {} 2 {'1': 1} 1 {'1': 1} 2 {'1': 1}

Re: Python "why" questions

2010-08-09 Thread Grant Edwards
On 2010-08-07, Hexamorph wrote: > Lurking for long enough to know your style. Looking at your Unicode > rant, combined with some other comments and your general "I am right > and you are wrong because you disagree with me." style, I came to > the conclusion, that you are either a faschist or t

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread MRAB
Νίκος wrote: On 9 Αύγ, 16:52, MRAB wrote: Νίκος wrote: On 8 Αύγ, 17:59, Thomas Jollans wrote: Two problems here: str.replace doesn't use regular expressions. You'll have to use the re module to use regexps. (the re.sub function to be precise) '.' matches a single character. Any character, b

Re: Creating a custom UI inside Maya with python

2010-08-09 Thread MRAB
blur959 wrote: Hi, all, I wonder if my post is relevant here, but i will still post it anyway. I am working on creating a custom UI inside Maya and I encountered some problems. Firstly, I am trying to create a textfield button that creates a locator-shaped curve based on the coordinates the user

Re: Regular expression issue

2010-08-09 Thread nn
On Aug 9, 9:18 am, genxtech wrote: > On Aug 8, 7:34 pm, Tim Chase wrote: > > > > > On 08/08/10 17:20, genxtech wrote: > > > > if re.search(search_string, in_string) != None: > > > While the other responses have addressed some of the big issues, > > it's also good to use > > >    if thing_to_test

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Nobody
On Mon, 09 Aug 2010 04:41:23 -0700, saeed.gnu wrote: > "x is not None" is a really silly statement!! because id(None) and id > of any constant object is not predictable! I don't know whay people > use "is" instead of "==". you should write "if x!=None" instead of "x > is not None" No, you should

Re: simple renaming files program

2010-08-09 Thread Dave Angel
MRAB wrote: from os.path import isdir, join Have a look at the imports, Dave. :-) Oops. I should have noticed that it was a function call, not a method. And there's no built-in called join(). I just usually avoid using this kind of alias, unless performance requires. thanks for ke

Creating a custom UI inside Maya with python

2010-08-09 Thread blur959
Hi, all, I wonder if my post is relevant here, but i will still post it anyway. I am working on creating a custom UI inside Maya and I encountered some problems. Firstly, I am trying to create a textfield button that creates a locator-shaped curve based on the coordinates the user keyed into the te

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 16:52, MRAB wrote: > Νίκος wrote: > > On 8 Αύγ, 17:59, Thomas Jollans wrote: > > >> Two problems here: > > >> str.replace doesn't use regular expressions. You'll have to use the re > >> module to use regexps. (the re.sub function to be precise) > > >> '.'  matches a single character. An

Re: easy question on parsing python: "is not None"

2010-08-09 Thread Dave Angel
saeed.gnu wrote: On Aug 9, 3:41 pm, "saeed.gnu" wrote: "x is y" means "id(y) =id(y)" "x is not y" means "id(x) !=d(x)" "x is not None" means "id(x) !=d(None)" "x is not None" is a really silly statement!! because id(None) and id of any constant object is not predictab

Re: Replace and inserting strings within .txt files with the use of regex

2010-08-09 Thread Νίκος
On 9 Αύγ, 13:47, Peter Otten <__pete...@web.de> wrote: > Νίκος wrote: > > On 9 Αύγ, 13:06, Peter Otten <__pete...@web.de> wrote: > > >> > So since its utf-8 what the problem of opening it? > > >> Python says it's not, and I tend to believe it. > > > You are right! > > > I tried to do the same exact

Re: simple renaming files program

2010-08-09 Thread MRAB
Dave Angel wrote: blur959 wrote: On Aug 9, 6:01 pm, Chris Rebert wrote: os.rename() takes paths that are absolute (or possibly relative to the cwd), not paths that are relative to some arbitrary directory (as returned by os.listdir()). Also, never name a variable "file"; it shadows the name

Re: Regular expression issue

2010-08-09 Thread MRAB
genxtech wrote: On Aug 8, 7:34 pm, Tim Chase wrote: On 08/08/10 17:20, genxtech wrote: if re.search(search_string, in_string) != None: While the other responses have addressed some of the big issues, it's also good to use if thing_to_test is None: or if thing_to_test is not None: i

  1   2   >