Re: urgent requirement

2010-08-09 Thread Carl Banks
On Aug 8, 9:25 pm, sushma wrote: >   We have an urgent requirement for people who are having experience > in python.  If you are interested for this position forward your > updated resume to the sush...@millenniumsoft.com with the details > mention below; > > current ctc: > expected ctc: > notice

Re: Python Portability

2010-08-09 Thread Lawrence D'Oliveiro
In message , W. eWatson wrote: > Believe me I had no intent of expanding this thread beyond looking for a > straight and simple insight to Python distribution (portability, > whatever) and how to get my partner squared away. The general issue > seems to drifted off on its own accord. “Drifted off

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

2010-08-09 Thread Νίκος
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'): # get abs path to filename

Re: Python Portability

2010-08-09 Thread geremy condra
On Sun, Aug 8, 2010 at 11:57 PM, Lawrence D'Oliveiro wrote: > In message , W. eWatson wrote: > >> Believe me I had no intent of expanding this thread beyond looking for a >> straight and simple insight to Python distribution (portability, >> whatever) and how to get my partner squared away. The ge

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

2010-08-09 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano wrote: > In Ruby they decided to be more general, so you can define whatever > heredoc you need to quote whatever literal string you need. That's not > bone-headed. Devils Advocate! PS: Man you're irb main was so full of cobweb i could barley see the code... h

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

2010-08-09 Thread Peter Otten
Νίκος wrote: > Now the code looks as follows: > for currdir, files, dirs in os.walk('test'): > > for f in files: > > if f.endswith('php'): > > # get abs path to filename > src_f = join(currdir, f) > I just tried to test i

Re: Python Portability

2010-08-09 Thread rantingrick
On Aug 8, 8:03 am, "W. eWatson" wrote: > I'm done here. Well thats just great, now how will we ever know what the one char change was. Hmm. >>> a = 'somestring' >>> -a Traceback (most recent call last): File "", line 1, in -a TypeError: bad operand type for unary -: 'str' Go figure! -

Re: os.unlink on Windows

2010-08-09 Thread Lawrence D'Oliveiro
In message , Shambhu wrote: > It is working now after using double backslash in pathname. Might be simpler to use slashes. -- http://mail.python.org/mailman/listinfo/python-list

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

2010-08-09 Thread Steven D'Aprano
On Mon, 09 Aug 2010 00:29:19 -0700, rantingrick wrote: > On Aug 8, 8:15 pm, Steven D'Aprano cybersource.com.au> wrote: > >> In Ruby they decided to be more general, so you can define whatever >> heredoc you need to quote whatever literal string you need. That's not >> bone-headed. > > Devils Ad

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

2010-08-09 Thread Νίκος
On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote: > Νίκος wrote: > > Now the code looks as follows: > > for currdir, files, dirs in os.walk('test'): > > >         for f in files: > > >                 if f.endswith('php'): > > >                         # get abs path to filename > >          

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

2010-08-09 Thread Peter Otten
Νίκος wrote: > On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote: >> Νίκος wrote: >> > Now the code looks as follows: >> > for currdir, files, dirs in os.walk('test'): >> >> > for f in files: >> >> > if f.endswith('php'): >> >> > # get abs path to filename >> > src_f = join(currdir, f) >> > I

avoiding top posts in gmail [was easy question on parsing python: "is not None"]

2010-08-09 Thread Cameron Simpson
On 05Aug2010 12:07, wheres pythonmonks wrote: | P.S. Sorry for the top-post -- is there a way to not do top posts from | gmail? I haven't used usenet since tin. The standard way is with attitude: view having your cursor at the top not as forcing you to top post but as an opportunity to start pru

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

2010-08-09 Thread Bruno Desthuilliers
Gregory Ewing a écrit : Ethan Furman wrote: Instead of using 'is' use '=='. Maybe not as cute, but definitely more robust! It's also just as efficient if you use strings that resemble identifiers, because they will be interned, Remember : this IS an implementation detail. -- http://mail.p

Re: Smith-Waterman Algorithm in Python

2010-08-09 Thread Daniel Fetchinson
>>> Every one of the first 20 entries is either the OP questions or your >>> reply. >> >> And you think it was there before the OP sent his message? >> Oh wait, did you just invent a time machine? :) >> >>> Daniel - you are no help at all, and no funny. >> >> Actually, I'm damn funny! :) > > I have

how to change a string into dictionary

2010-08-09 Thread aimeixu
Hi, I am newbie for python ,Here is my question: a = "{'a':'1','b':'2'}" how to change a into a dictionary ,says, a = {'a':'1','b':'2'} Thanks a lot .Really need help. -- http://mail.python.org/mailman/listinfo/python-list

simple renaming files program

2010-08-09 Thread blur959
Hi, all, I am working on a simple program that renames files based on the directory the user gives, the names the user searched and the names the user want to replace. However, I encounter some problems. When I try running the script, when it gets to the os.rename part, there will be an error. The

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

2010-08-09 Thread Νίκος
On 9 Αύγ, 11:45, Peter Otten <__pete...@web.de> wrote: > Νίκος wrote: > > On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote: > >> Νίκος wrote: > >> > Now the code looks as follows: > >> > for currdir, files, dirs in os.walk('test'): > > >> > for f in files: > > >> > if f.endswith('php'): > > >>

Re: how to change a string into dictionary

2010-08-09 Thread Shashwat Anand
On Mon, Aug 9, 2010 at 3:03 PM, aimeixu wrote: > Hi, > I am newbie for python ,Here is my question: > a = "{'a':'1','b':'2'}" > how to change a into a dictionary ,says, a = {'a':'1','b':'2'} > Thanks a lot .Really need help. > Parse the string and re-create the dictionary. >>> s = "{'a':'1','b'

Re: simple renaming files program

2010-08-09 Thread Chris Rebert
On Mon, Aug 9, 2010 at 2:44 AM, blur959 wrote: > Hi, all, I am working on a simple program that renames files based on > the directory the user gives, the names the user searched and the > names the user want to replace. However, I encounter some problems. > When I try running the script, when it

Re: simple renaming files program

2010-08-09 Thread Shashwat Anand
On Mon, Aug 9, 2010 at 3:14 PM, blur959 wrote: > Hi, all, I am working on a simple program that renames files based on > the directory the user gives, the names the user searched and the > names the user want to replace. However, I encounter some problems. > When I try running the script, when it

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

2010-08-09 Thread Peter Otten
Νίκος wrote: > On 9 Αύγ, 11:45, Peter Otten <__pete...@web.de> wrote: >> Νίκος wrote: >> > On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote: >> >> Νίκος wrote: >> >> > Now the code looks as follows: >> >> > for currdir, files, dirs in os.walk('test'): >> >> >> > for f in files: >> >> >> > if

Re: how to change a string into dictionary

2010-08-09 Thread Chris Rebert
On Mon, Aug 9, 2010 at 2:53 AM, Shashwat Anand wrote: > On Mon, Aug 9, 2010 at 3:03 PM, aimeixu wrote: >> Hi, >> I am newbie for python ,Here is my question: >> a = "{'a':'1','b':'2'}" >> how to change a into a dictionary ,says, a = {'a':'1','b':'2'} >> Thanks a lot .Really need help. > > Parse t

Re: how to change a string into dictionary

2010-08-09 Thread Ulrich Eckhardt
aimeixu wrote: > a = "{'a':'1','b':'2'}" > how to change a into a dictionary ,says, a = {'a':'1','b':'2'} You could evaluate it as regular Python code, using "exec": res = {} exec("a={'a':'1'}", res) print res['a'] However, if this is input from a file or the user, be aware that this opens

Re: simple renaming files program

2010-08-09 Thread Ulrich Eckhardt
blur959 wrote: > Hi, all, I am working on a simple program that renames files based on > the directory the user gives, the names the user searched and the > names the user want to replace. However, I encounter some problems. > When I try running the script, when it gets to the os.rename part, > the

Re: simple renaming files program

2010-08-09 Thread Peter Otten
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") > > for filename in listdir(directory): > path = join(directory, filena

Create child class of Python dict with modified values

2010-08-09 Thread dmitrey
hi all, suppose I have defined a child class of Python dict, currently it constructor looks like that: def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) #(+some more insufficient code) Constructor should be capable of calling with either any way Python d

dumping generator

2010-08-09 Thread targetsmart
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 StopIteration: print "Done" else: raise is there a much simpler way ? like for printing list we do list = range(10) print list would print [0, 1

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

2010-08-09 Thread Νίκος
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 openign via IDLE enviroment and i goth the encoding of the file from there! >>> open("d:\

Re: Create child class of Python dict with modified values

2010-08-09 Thread Peter Otten
dmitrey wrote: > hi all, > suppose I have defined a child class of Python dict, currently it > constructor looks like that: > def __init__(self, *args, **kwargs): > dict.__init__(self, *args, **kwargs) > #(+some more insufficient code) > > Constructor should be capable of call

Re: dumping generator

2010-08-09 Thread Peter Otten
targetsmart wrote: > 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 StopIteration: > print "Done" > else: > raise > > is there a much simpler way ? Indeed there is: for item in ge

Re: Create child class of Python dict with modified values

2010-08-09 Thread dmitrey
On Aug 9, 1:38 pm, Peter Otten <__pete...@web.de> wrote: > dmitrey wrote: > > hi all, > > suppose I have defined a child class of Python dict, currently it > > constructor looks like that: > >     def __init__(self, *args, **kwargs): > >         dict.__init__(self, *args, **kwargs) > >         #(+s

Re: simple renaming files program

2010-08-09 Thread blur959
On Aug 9, 6:01 pm, Chris Rebert wrote: > On Mon, Aug 9, 2010 at 2:44 AM, blur959 wrote: > > Hi, all, I am working on a simple program that renames files based on > > the directory the user gives, the names the user searched and the > > names the user want to replace. However, I encounter some pro

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

2010-08-09 Thread Peter Otten
Νίκος 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 openign via IDLE enviroment and i goth > the encoding of the

Re: dumping generator

2010-08-09 Thread Ulrich Eckhardt
targetsmart wrote: > 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 StopIteration: > print "Done" > else: > raise > > is there a much simpler way ? Why not something like this: f

Decorators without function

2010-08-09 Thread Vedran
Hello! Is it possible to apply a decorator on a block of code, without defining a function that decorator is applied to. I have to generate a lot of similar graphs. For that reason I use plot_decorator to perform usual figure setup(outfile, legend, x_label, y_label and so on), and pylab.plot

Re: Decorators without function

2010-08-09 Thread Peter Otten
Vedran wrote: > Hello! > > Is it possible to apply a decorator on a block of code, without defining > a function that decorator is applied to. You can only decorate functions or classes. > I have to generate a lot of similar graphs. For that reason I use > plot_decorator to perform usual figur

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

2010-08-09 Thread saeed.gnu
"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 of any constant object is not predictable! I don't know whay people use "is" instead of "==". y

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

2010-08-09 Thread Stefan Schwarzer
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 prompts. It needs a good > doctest mode.

GUI automation tool (windows)

2010-08-09 Thread Alex Barna
I know that this question has been asked for several times, but it surprises that there is no tool under very active development and the community activities are very low (mailing list posts). All the tools listed in: http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy#GUITestingTools Compar

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

2010-08-09 Thread saeed.gnu
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 > of any constant object is not predictable! I

Re: Python "why" questions

2010-08-09 Thread saeed.gnu
> > 1)  Why do Python lists start with element [0], instead of element > > [1]?  "Common sense" would seem to suggest that lists should start > > with [1].   Because Zero is the neutral element of addition operation. And indexes (and all adresses in computing) involve with addition much more than

Circular imports (again)

2010-08-09 Thread Frank Millman
Hi all I know the problems related to circular imports, and I know some of the techniques to get around them. However, I find that I bump my head into them from time to time, which means, I guess, that I have not fully understood how to organise my code so that I avoid them in the first place.

Re: Regular expression issue

2010-08-09 Thread genxtech
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: >

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

2010-08-09 Thread Mike Kent
On Aug 8, 8:43 pm, rantingrick wrote: > Hello folks, > > You all know i been forced to use Ruby and i am not happy about that. ***Blablabla cut long rant*** Xah, this is really you, isn't it. Come on, confess. -- http://mail.python.org/mailman/listinfo/python-list

HELP! build python error with message: "unable to load the file system codec"

2010-08-09 Thread Wang Lei
Hi, developers! I get python3k from the svn repository. The revision is 83889. When building it, i encounter this error. gcc -pthread -Xlinker -export-dynamic -o python Modules/python.o libpython3.2.a -lpthread -ldl -lutil -lm XXX lineno: 1098, opcode: 32 Unable to get t

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

2010-08-09 Thread Ulrich Eckhardt
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 written using an OOP language. Other than that, I'm actu

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

2010-08-09 Thread MRAB
Νίκος 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, but only one. '.*' matches as many characte

Re: simple renaming files program

2010-08-09 Thread Dave Angel
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 of the built-in t

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

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: 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: 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 Αύγ, 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

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: 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

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: 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: 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: 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: 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

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: 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

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 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

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: 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

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

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

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

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: 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

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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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

  1   2   >