Expandable 2D Dictionaries?

2007-07-06 Thread Robert Dailey
Hi, I am interested in creating an expandable (dynamic) 2D dictionary. For example: myvar["cat"]["paw"] = "Some String" The above example assumes "myvar" is declared. In order for this to work, I have to know ahead of time the contents of the dictionary. For the above to work, my declaration mus

Re: Expandable 2D Dictionaries?

2007-07-06 Thread Robert Dailey
On Jul 6, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Fri, 06 Jul 2007 15:43:55 -0000, Robert Dailey <[EMAIL PROTECTED]> wrote: > >Hi, > > >I am interested in creating an expandable (dynamic) 2D dictionary. For > >example: > > >myvar

Re: Expandable 2D Dictionaries?

2007-07-06 Thread Robert Dailey
On Jul 6, 10:54 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Robert Dailey wrote: > > Hi, > > > I am interested in creating an expandable (dynamic) 2D dictionary. For > > example: > > > myvar["cat"]["paw"] = "Some

Re: Expandable 2D Dictionaries?

2007-07-06 Thread Robert Dailey
Thank you all very much for your valuable replies. I wasn't aware that tuples were valid keys in a dictionary object. This is actually the solution I was looking for. Thank you all once again. -- http://mail.python.org/mailman/listinfo/python-list

ImportError: "No Module named xxx"

2007-07-06 Thread Robert Dailey
I created a basic python file and made an attempt to execute it from the command line, however it gives me a weird error after the python file has been executed: Traceback (most recent call last): File "C:\Python25\lib\runpy.py", line 87, in run_module raise ImportError("No module named " +

Re: ImportError: "No Module named xxx"

2007-07-06 Thread Robert Dailey
Never mind, I found the problem. I was doing: python -m compile.py I really should have been doing: python compile.py The description of -m is confusing in the documentation, what does it really do? -- http://mail.python.org/mailman/listinfo/python-list

C++ Modules for python: How to?

2007-07-06 Thread Robert Dailey
Hi, I'm interested in making a C++ library of mine usable through python. Python does a similar thing with Expat (the non-validating XML parser). I notice that with Expat, python is importing a C++ header file into a PY file and the interface is available to python. I've read through the python do

Re: ImportError: "No Module named xxx"

2007-07-06 Thread Robert Dailey
On Jul 6, 4:04 pm, Bjoern Schliessmann wrote: > Robert Dailey wrote: > > The description of -m is confusing in the documentation, what does > > it really do? > > IMHO, it's quite clear. What's unclear with this description: > > -m module-nameSearches s

Re: C++ Modules for python: How to?

2007-07-06 Thread Robert Dailey
On Jul 6, 3:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Robert Dailey schrieb: > > > Hi, > > > I'm interested in making a C++ library of mine usable through python. > > Python does a similar thing with Expat (the non-validating XML

Distributing python apps

2007-07-09 Thread Robert Dailey
Hi, I'm creating a set of command-line tools using Python. These tools manage resources for a game I'm working on. However, many people that will be using these tools will not want to install Python on their machines. This would be a very tedious process (for first time users of my tools). Ideall

Re: Distributing python apps

2007-07-09 Thread Robert Dailey
Thanks a ton guys. You both gave me the exact answers I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

PyXML not installing?

2007-07-09 Thread Robert Dailey
Hi, I downloaded the PyXML library and I'm attempting to install it by following the README file on Windows XP. I currently have Visual Studio 2005 installed. >From the command line I type: C:\PyXML-0.8.4>python setup.py build running build running build_py running build_ext error: Python was bu

How to create new files?

2007-07-12 Thread Robert Dailey
Hi, I'm trying to create a Python equivalent of the C++ "ifstream" class, with slight behavior changes. Basically, I want to have a "filestream" object that will allow you to overload the '<<' and '>>' operators to stream out and stream in data, respectively. So far this is what I have: class fi

Function parameter type safety?

2007-07-12 Thread Robert Dailey
Hi, Is there a way to force a specific parameter in a function to be a specific type? For example, say the first parameter in a function of mine is required to be a string. If the user passes in an integer, I want to notify them that they should pass in a string, not an integer. -- http://mail.p

Re: Function parameter type safety?

2007-07-13 Thread Robert Dailey
Good replies. I'm in the process of learning Python. I'm a native C++ programmer, so you can see how the question relates. There's a lot of cool things C++ allowed you to do with type-checking, such as function overloading. With templates + type checking, I can create a STD version of ifstream/ of

Re: How to create new files?

2007-07-13 Thread Robert Dailey
On Jul 13, 3:04 am, Bruno Desthuilliers wrote: > Robert Dailey a écrit : > > > Hi, > > > I'm trying to create a Python equivalent of the C++ "ifstream" class, > > with slight behavior changes. > > > Basically, I want to have a "filestream&

Pass by reference or by value?

2007-07-13 Thread Robert Dailey
Hi, I noticed in Python all function parameters seem to be passed by reference. This means that when I modify the value of a variable of a function, the value of the variable externally from the function is also modified. Sometimes I wish to work with "copies", in that when I pass in an integer v

Re: Pass by reference or by value?

2007-07-13 Thread Robert Dailey
On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the functi

The ** operator ambiguous?

2007-07-16 Thread Robert Dailey
I noticed that the ** operator is used as the power operator, however I've seen it used when passing variables into a function. For example, I was researching a way to combine dictionaries. I found that if you do this: a = {"t1":"a", "t2":"b"} b = {"t3":"c"} dict( a, **b ) This combines the two

Confused with csv.reader copies

2007-07-23 Thread Robert Dailey
First, take a look at my example code: - import csv def pass1( reader ): print reader.next() print reader.next() def pass2( reader ): print reader.next() print reader.next() reader = csv.reader( open( "C:/IT/Meth

wxPython - How to add sorting to a ListCtrl?

2007-07-24 Thread Robert Dailey
Hi, I have 3 columns in my list control, each with a different "type" of data (for example, one column has names, the other has dates, etc). Can anyone reference a tutorial for solving this issue? I've done my share of googling to no avail. I need the user to be able to click any of the column hea

datetime.time() class - How to pass it a time string?

2007-07-24 Thread Robert Dailey
Hi, I have a string in the following format: "00:00:25.886411" I would like to pass this string into the datetime.time() class and have it parse the string and use the values. However, the __init__() method only takes integers (which means I'd be forced to parse the string myself). Does anyone k

128 or 96 bit integer types?

2007-07-27 Thread Robert Dailey
Hi, Is there build-in or third party support for large integer types, such as 96 or 128 bits in size? I require such large sizes for precision issues (nanoseconds). Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ Modules for python: How to?

2007-07-27 Thread Robert Dailey
On Jul 6, 7:39 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 7, 9:26 am,RobertDailey<[EMAIL PROTECTED]> wrote: > > > > > On Jul 6, 3:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > >RobertDaileyschrieb: > > > > > Hi, > > > > > I'm interested in making a C++ library of mine usable t

Re: C++ Modules for python: How to?

2007-07-27 Thread Robert Dailey
Okay I've actually got it compiling now, however it is saying it can't find "stdio.h" (No such file or directory). This means it doesn't know where the include directories are. How do I specify include directories? -- http://mail.python.org/mailman/listinfo/python-list

Iteration over strings

2007-07-31 Thread Robert Dailey
Hi, I have the following code: str = "C:/somepath/folder/file.txt" for char in str: if char == "\\": char = "/" The above doesn't modify the variable 'str' directly. I'm still pretty new to Python so if someone could explain to me why this isn't working and what I can do to achieve

Re: Iteration over strings

2007-07-31 Thread Robert Dailey
7;t able to find the 'replace()' function you guys are talking about. It's actually the perfect solution for the problem. I appreciate your time. On 7/31/07, Hexamorph <[EMAIL PROTECTED]> wrote: > > Jay Loden schrieb: > > Robert Dailey wrote: > >>

Re: Wing IDE for Python v. 3.0 beta1 released

2007-07-31 Thread Robert Dailey
Too bad it's not free. I'll stick with PSPad & IPython On 7/31/07, Wingware <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm happy to announce the first beta release of Wing IDE 3.0. It is > available from http://wingware.com/wingide/beta > > Wing IDE is a commercial IDE designed specifically for Pytho

Time object?

2007-08-01 Thread Robert Dailey
Hi, I'm well aware of the datetime module, however it is really inconsistent and useless to me. In order to do any arithmetic on time objects, I have to use the 'timedelta' class, which doesn't even allow me to do all the math I want to do. For example, I want to do "1 / timeobj", where timeobj m

Checking object types

2007-08-01 Thread Robert Dailey
Hi, I'm currently interested in creating an __add__() operator for one of my classes. This class handles both integers and objects its own type, however I don't know how I can perform special add operations depending on which is passed in. Since I haven't seen any evidence of function overloading,

Re: Wing IDE for Python v. 3.0 beta1 released

2007-08-01 Thread Robert Dailey
He's secretly an employee of Wing IDE in disguise!!! On 8/1/07, Joshua J. Kugler <[EMAIL PROTECTED]> wrote: > > On Wednesday 01 August 2007 13:28, John K Masters wrote: > > > On 15:34 Tue 31 Jul , Wingware wrote: > >> Hi, > >> > >> I'm happy to announce the first beta release of Wing IDE 3.0.

Re: XML Processing

2007-08-02 Thread Robert Dailey
Both strings in your example are exactly the same, unless I'm missing something. On 8/2/07, Roman <[EMAIL PROTECTED]> wrote: > > Is there a package that converts a string that contains special > characters in xml to to literal value. For instance, converts string > http://myhome/¶m to http://myho

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-08-11 Thread Robert Dailey
I had this very same problem with the doxygen mailing list... doxygen is such a great tool but full of assholes in their mailing list. On 8/2/07, Jamie <[EMAIL PROTECTED]> wrote: > > In <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] mentions: > >Python is a better language, with php support, anyway, but

Binary, Hex, and Decimal string conversions

2007-08-11 Thread Robert Dailey
Hi, I was wondering if there is a built in module that supports conversion in any direction between Binary, Hex, and Decimal strings? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-08-12 Thread Robert Dailey
pure stupidity. On 8/11/07, Greg Donald <[EMAIL PROTECTED]> wrote: > > On 8/11/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > I had this very same problem with the doxygen mailing list... doxygen is > > such a great tool but full of assholes in their mailing list.

Re: Binary, Hex, and Decimal string conversions

2007-08-12 Thread Robert Dailey
Well, I decided to implement my own way of doing this. I've attached the source. You're all welcome :) On 8/12/07, Michael Bentley <[EMAIL PROTECTED]> wrote: > > Hi Robert, > On Aug 11, 2007, at 3:59 PM, Robert Dailey wrote: > > Hi, I was wondering if there is

Python script for mobile platforms -- suggested?

2007-08-12 Thread Robert Dailey
Hi, I'm currently developing a game for a cell phone. The game has a GUI system that's currently using XML to define the individual menus. Basically this means that for every single menu the user goes to, it loads and parses an XML file. Would using Python Script instead of XML be a reasonable rep

Re: Binary, Hex, and Decimal string conversions

2007-08-13 Thread Robert Dailey
Just curious Dick, why are you making your own to_base method? Doesn't the source I provided in my earlier email give you all that you need? I was hoping my source might be useful to a few people, even though it's pretty trivial code. On 8/12/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 07:04

Problem with Thread.join()

2007-08-13 Thread Robert Dailey
Hi, I have a class that derives from threading.Thread. To signal the thread to exit its infinite loop, I set an Event. Once the thread checks Event.isSet() and it is true, it proceeds to break out of the loop and exit the function. In the main thread, right after calling Event.set(), I call Thread

Re: Python script for mobile platforms -- suggested?

2007-08-13 Thread Robert Dailey
*bump* On 8/12/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm currently developing a game for a cell phone. The game has a GUI > system that's currently using XML to define the individual menus. Basically > this means that for every single menu the

Re: Python script for mobile platforms -- suggested?

2007-08-14 Thread Robert Dailey
he game to create the menu and other important things. I hope I've given enough examples and details. If I haven't, please let me know and I'll answer any questions you may have. Thanks for following up. On 8/13/07, Jay Loden <[EMAIL PROTECTED]> wrote: > > Robert Daile

Pass by reference or by value?

2007-08-16 Thread Robert Dailey
Hi, I previously created a topic named "Pass by reference or by value" where I inquired on how python's function parameters work. I received a lot of nice responses, however I'm still confused on the topic. Note that I come from a C++ background to Python, so any comparisons to C++ would be very h

Re: Pass by reference or by value?

2007-08-16 Thread Robert Dailey
an object of type class Integer would allow me to modify the value from inside the function? On 8/16/07, Steve Holden <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > Hi, > > > > I previously created a topic named "Pass by reference or by value" where

Re: Pass by reference or by value?

2007-08-16 Thread Robert Dailey
( 5 ) def change_me( var ): var.set( 6 ) Of course, I'd probably use overloaded operators in a more realized example. On 8/16/07, Steve Holden <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > So immutable objects cannot be modified directly? I guess this

Re: Problem with directory recursion!

2007-08-17 Thread Robert Dailey
older. The output is consistent with the 'print' statements you will see in the function I posted earlier. On 8/17/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > I've created a function that is used to recurse a directory tree in > Windows XP using os.

Problem with directory recursion!

2007-08-17 Thread Robert Dailey
Hi, I've created a function that is used to recurse a directory tree in Windows XP using os.walk(). For the most part it works, however in some instances the data is incorrect and I'm getting invalid sub-directory paths. Here's the function: def __doSearch( root_dir, sub_path, restype, ext ):

Re: Problem with directory recursion!

2007-08-17 Thread Robert Dailey
I figured it out. I was doing a recursive function call when I didn't have to. The walk() method already walks into every possible sub-directory for you! On 8/17/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Here's part of the output that's incorre

Question about 'for' loop

2007-08-17 Thread Robert Dailey
Hi, I noticed that the 'for' loop can be used inline with a list definition. For example: print [i for i in mylist] My first question is what is the name for this? I couldn't find this usage in the python docs; I only managed to learn about it through code samples on the internet. Secondly, I'm

str().join() isn't working

2007-08-20 Thread Robert Dailey
Hi, First have a look at the following code: In main.py: --- space = " " includes = space.join( system._user_includes ) + " " + space.join( system._system_includes ) In system.py: -

Re: Problem with Thread.join()

2007-08-20 Thread Robert Dailey
exiting! > > > On 8/20/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Mon, 13 Aug 2007 20:10:53 -0300, Robert Dailey <[EMAIL PROTECTED]> > > escribi�: > > > > > I have a class that derives from threading.Thread. To signal the thread >

Re: str().join() isn't working

2007-08-20 Thread Robert Dailey
./../Symbian/9.1/NGAGE_SDK_1.1/EPOC32/include", "../../../../../../Symbian/9.1/NGAGE_SDK_1.1/EPOC32/include/osextensions/rga", "../../../../../../Symbian/9.1/NGAGE_SDK_1.1/EPOC32/include/osextensions/stdapis", "../../../../../../Symbian/9.1/NG

Re: str().join() isn't working

2007-08-20 Thread Robert Dailey
Hi all, Thanks for your response. I figured out the issue. I was using list.append() to append another list, when I should have been using expand(). Sorry for the confusion. On 8/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Aug 20, 1:16 pm, "Robert Dailey" <[E

optparse - required options

2007-08-20 Thread Robert Dailey
Hi, I've been reading through the python documentation on the optparse module and I was unable to find out how to specify if an option is optional or required. The documentation vaguely states that actions can be used to do this, however I was not able to figure out how. If anyone could help I'd g

Re: optparse - required options

2007-08-20 Thread Robert Dailey
e it convenient. It would definitely help on code duplication. Thanks for your response. On 8/20/07, Jay Loden <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > Hi, > > > > I've been reading through the python documentation on the optparse > > module and I was

Re: datetime in microseconds

2007-08-20 Thread Robert Dailey
A small off topic question. Why use divmod() instead of the modulus operator? On 8/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Aug 20, 4:17 pm, [EMAIL PROTECTED] wrote: > > On Aug 20, 3:15 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Aug 20, 9:52 pm, [EMAIL PROTEC

Re: str().join() isn't working

2007-08-20 Thread Robert Dailey
Yeah! That's it lol. Sorry, I wasn't looking at the documentation. At least you got the point! Thanks again guys. On 8/20/07, Terry Reedy <[EMAIL PROTECTED]> wrote: > > > "Robert Dailey" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >

Python is removing my quotes!

2007-08-21 Thread Robert Dailey
Hi, Note: I'm using Python on Windows I have an application that allows a user to submit a password as a command line parameter. The password of choice may contain any characters the user wishes, including quotes. If I do the following: python password.py ""MyPassword The resulting output w

Re: Python is removing my quotes!

2007-08-21 Thread Robert Dailey
Thank you for your response. The back slashes work! It's a bit annoying; but I have Microsoft to thank for that. On 8/21/07, Gary Herron <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > Hi, > > > > Note: I'm using Python on Windows > > > >

Tokenizer for python?

2007-08-21 Thread Robert Dailey
Hi, I am looking for a sort of "tokenizer" for python. I've taken a look at the tokenize module, but that seems to parse python code from what I read. I want a tokenizer that works a little like boost::tokenizer, however for python. Basically I want to be able to pass in an arbitrary string (or li

Re: Latest models of Gibson guitars

2007-08-21 Thread Robert Dailey
lol... On 8/21/07, Tony <[EMAIL PROTECTED]> wrote: > > I don't who is posting here stupid shit about guitars > who ever is do self fever hang your self with one of strings > > > "kaldrenon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Aug 20, 8:54 pm, Twisted <[EMAIL PROTEC

Class destruction

2007-08-22 Thread Robert Dailey
Hi, I'm wondering where the most appropriate location is to cleanup class objects. For example, i have a file handle as an instance attribute in one of my classes and I need to call f.close() on it when the class object falls out of scope. Any ideas? I've tried __del__() but I don't remember this

Re: Class destruction

2007-08-22 Thread Robert Dailey
Thanks; I'll give it a try. On 8/22/07, Nils Oliver Kröger <[EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Robert Dailey schrieb: > > Hi, > > > > I'm wondering where the most appropriate location is to cleanup cla

Re: optparse - required options

2007-08-24 Thread Robert Dailey
Thank you VERY much for mentioning argparse- this is EXACTLY what I needed! Thank you! On 8/23/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Omari Norman wrote: > > On Mon, Aug 20, 2007 at 05:31:00PM -0400, Jay Loden wrote: > >> Robert Dailey wrote: > >>>

Rendering API for python?

2007-09-04 Thread Robert Dailey
Hi, I'm developing a quick python script to test an algorithm of mine. I would like to be able to plot the algorithm results to a diagram (much like you can do in Matlab). I was wondering if there's an API around that would allow me to quickly do this? Perhaps some sort of rendering API or plottin

Re: Rendering API for python?

2007-09-04 Thread Robert Dailey
Well, I guess I wrote too soon. I found this: http://matplotlib.sourceforge.net/ I'm going to try it out and see if it is what I'm looking for, however I'm pretty confident! On 9/4/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm developing a qu

Python script to optimize XML text

2007-09-24 Thread Robert Dailey
Hi, I'm currently seeking a python script that provides a way of optimizing out useless characters in an XML document to provide the optimal size for the file. For example, assume the following XML script: By running this through an XML optimizer, the file would appear as: N

Regular Expressions: Can't quite figure this problem out

2007-09-24 Thread Robert Dailey
Hi, I'm attempting to create a regular expression that removes redundancy in empty XML elements. For example: The regular expression would convert the XML above into: And another complex example: would be: So far I've been unsuccessful in creating a regular expression to do this. Belo

Re: Regular Expressions: Can't quite figure this problem out

2007-09-24 Thread Robert Dailey
Thanks. Any easier way to do a 'replace' then using start(), end(), and slicing operations? I'm currently doing it manually. On 9/24/07, Miles <[EMAIL PROTECTED]> wrote: > > On 9/24/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > > >

Re: Regular Expressions: Can't quite figure this problem out

2007-09-24 Thread Robert Dailey
On 9/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > Yes: forget about regular expressions. ElementTree does that for free: > That's not an option. -- http://mail.python.org/mailman/listinfo/python-list

re: Confused about 'positive lookbehind assertion'

2007-09-24 Thread Robert Dailey
Hi, I've been reading the python documentation on 'positive lookbehind assertion' and I don't understand at all how it works. The python docs give the following example: "**(?<=abc)def will find a match in "abcdef", since the lookbehind will back up 3 characters and check if the contained pattern

Re: Regular Expressions: Can't quite figure this problem out

2007-09-24 Thread Robert Dailey
What I meant was that it's not an option because I'm trying to learn regular expressions. RE is just as built in as anything else. On 9/24/07, Steve Holden <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > > > > > On 9/24/07, *Gabriel Genellin

Re: Python script to optimize XML text

2007-09-25 Thread Robert Dailey
the ideas mentioned here concerning using the XML parser to do the job for me. Thanks again everyone, I think I'll be going with the XML parser to do what I need. Have a good day everyone. On 9/25/07, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > Gabriel Genellina wrote: > > En Mon, 2

Re: Confused about 'positive lookbehind assertion'

2007-09-25 Thread Robert Dailey
I think I get it... it's really just a way (so it seems) to make characters get added to the found groups as they're matched. Thanks for your help. On 9/25/07, Andrew Durdin <[EMAIL PROTECTED]> wrote: > > On 9/25/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > >

Re: Regular Expressions: Can't quite figure this problem out

2007-09-25 Thread Robert Dailey
ially true with regular expressions). They're very useful, but again I believe it should be a last resort. Thanks again for your help. On 9/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Mon, 24 Sep 2007 23:51:57 -0300, Robert Dailey <[EMAIL PROTECTED]> > escribi�

Re: Regular Expressions: Can't quite figure this problem out

2007-09-25 Thread Robert Dailey
Fortunately I don't have any XML that complex, however you make a good point. On 9/25/07, Paul McGuire <[EMAIL PROTECTED]> wrote: > > On Sep 24, 11:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > En Mon, 24 Sep 2007 23:51:57 -0300, Rob

Invoking python through C++: How to?

2007-09-25 Thread Robert Dailey
Hi, I have a python script that I would like to invoke through my C++ application. Does anyone know of a trivial way of doing this? Right now the only idea I can come up with is using system("python myscript.py") in C++. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions: Can't quite figure this problem out

2007-09-25 Thread Robert Dailey
One thing I noticed is that it is placing an arbitrary space between " and />. For example: Notice that there's a space between "image" and /> Any way to fix this? Thanks. On 9/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Mon, 24 Sep 2007

Re: Regular Expressions: Can't quite figure this problem out

2007-09-25 Thread Robert Dailey
Hmm, ElementTree.tostring() also adds a space between the last character of the element name and the />. Not sure why it is doing this. Something like will become after the tostring(). On 9/25/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > One thing I noticed is that i

Missing documentation for ElementTree?

2007-09-25 Thread Robert Dailey
Hi, for the _ElementInterface class, there is no documentation for most of the members of this class such as .tail and .text. There's a brief description of these things on the front page of the ElementTree docs but nothing helpful. I have no idea what Tail is vs Text and I wanted to figure this o

Re: Regular Expressions: Can't quite figure this problem out

2007-09-25 Thread Robert Dailey
On 9/25/07, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Robert Dailey top posted: > > Hmm, ElementTree.tostring() also adds a space between the last > > character of the element name and the />

Re: Invoking python through C++: How to?

2007-09-25 Thread Robert Dailey
On 9/25/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > If you don't want to "share" objects between Python and C++, that's the > simplest way. > Or, look at the document "Extending and Embedding the Python Interpreter" > > > -- > Gabriel Genellina Thank

Re: Missing documentation for ElementTree?

2007-09-26 Thread Robert Dailey
. On 9/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Sep 26, 4:00 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > En Tue, 25 Sep 2007 19:39:33 -0300, Robert Dailey <[EMAIL PROTECTED]> > > escribi?: > > > > > for

Re: Regular Expressions: Can't quite figure this problem out

2007-09-26 Thread Robert Dailey
Even better! Now I can drop the regular expression that did the same thing :) Thanks! On 9/26/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > > Hmm, ElementTree.tostring() also adds a space between the last character > > of the element name

RegEx question

2007-10-04 Thread Robert Dailey
Hi, The following regex (Not including the end quotes): "@param\[in|out\] \w+ " Should match any of the following: @param[in] variable @param[out] state @param[in] foo @param[out] bar Correct? (Note the trailing whitespace in the regex as well as in the examples) -- http://mail.python.org/ma

Re: RegEx question

2007-10-04 Thread Robert Dailey
It should also match: @param[out] state Some description of this variable On 10/4/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > The following regex (Not including the end quotes): > > "@param\[in|out\] \w+ " > > Should match any of the followi

Re: RegEx question

2007-10-04 Thread Robert Dailey
On 10/4/07, Adam Lanier <[EMAIL PROTECTED]> wrote: > > > try @param\[(in|out)\] \w+ > This didn't work either :( The tool using this regular expression (Comment Reflower for VS2005) May be broken... -- http://mail.python.org/mailman/listinfo/python-list

Re: RegEx question

2007-10-04 Thread Robert Dailey
On 10/4/07, J. Clifford Dyer <[EMAIL PROTECTED]> wrote: > > You *are* talking about python regular expressions, right? There are a > number of different dialects. Also, there could be issues with the quoting > method (are you using raw strings?) > > The more specific you can get, the more we can

Off Topic: Gmail hates newsgroups!!!

2007-10-04 Thread Robert Dailey
I don't know how many other people subscribe to the python mailing list and use the mailing list using the web-based interface for Gmail, but I do. I use it mainly because Gmail doesn't support IMAP and I use my email from multiple locations. Gmail web based works fine except that it starts your ca

Re: RegEx question

2007-10-04 Thread Robert Dailey
I am not a regex expert, I simply assumed regex was standardized to follow specific guidelines. I also made the assumption that this was a good place to pose the question since regular expressions are a feature of Python. The question concerned regular expressions in general, not really the applica

csv module and Unicode

2007-10-05 Thread Robert Dailey
Hi, According to the Python 2.5 documentation, Unicode is not supported through the CSV module. Is there some third-party CSV module I can use that has Unicode support? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: csv module and Unicode

2007-10-08 Thread Robert Dailey
Wow; I guess this is a REAL problem! I would have thought that something as common as Unicode CSV would have been supported by SOMEONE. On 10/5/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > According to the Python 2.5 documentation, Unicode is not supported > throu

for loop question

2007-10-10 Thread Robert Dailey
Hi, I'm currently writing my own CSV parser since the built in one doesn't support Unicode. I'm wondering if there's a way to iterate over the characters in a unicode string and have access to both the 'current' and the 'next' characters each iteration. For example: test = u"Hello World" for cur

Re: for loop question

2007-10-10 Thread Robert Dailey
All the ideas presented here are workable. I definitely have a lot of solutions to choose from. Thanks everyone for your help. I wasn't sure if there was some sort of language feature to naturally do this, so I had to post on the mailing list to make sure. -- http://mail.python.org/mailman/listinf

Re: for loop question

2007-10-10 Thread Robert Dailey
ng isnt' in the range of range(128) or something (Not really an expert on Unicode so I'm not sure of the meaning). I would use CSV if I could! On 10/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-10-10 at 15:27 -0500, Robert Dailey wrote: > > I'm u

Re: for loop question

2007-10-10 Thread Robert Dailey
On 10/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > Instead of passing the file object directly to the csv parser, pass in a > generator that reads from the file and explicitly encodes the strings > into UTF-8, along these lines: > > def encode_to_utf8(f): > for line in f: > yield

How to "dereference" an iterator?

2007-10-10 Thread Robert Dailey
Hi, Suppose I wanted to manually iterate over a container, for example: mylist = [1,2,3,4,5,6] it = iter(mylist) while True: print it it.next() In the example above, the print doesn't print the VALUE that the iterator currently represents, it prints the iterator itself. How can I get th

Problems with struct.pack()

2007-10-10 Thread Robert Dailey
Hi, I have opened a unicode file for writing: import codecs file = codecs.open( "somefile.dat", "wb", "utf-16" ) and I attempt to do this: file.write( struct.pack( "I", 5000 ) ) However, this won't work because the encoding of the string returned by "pack" isn't unicode. I'm a bit confused rig

Re: Problems with struct.pack()

2007-10-10 Thread Robert Dailey
details. On 10/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-10-10 at 19:00 -0500, Robert Dailey wrote: > > Hi, > > > > I have opened a unicode file for writing: > > > > import codecs > > file = codecs.open( "somefile.dat",

Re: How to "dereference" an iterator?

2007-10-10 Thread Robert Dailey
it to solve this problem as well. Sorry for lack of details. Thanks for everyone's help. On 10/10/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > The original post seems to have been eaten, so I'm replying via a reply. > Sorry for breaking threading. > > &g

Re: How to "dereference" an iterator?

2007-10-10 Thread Robert Dailey
Thanks! Yellow is my favorite color! On 10/10/07, Pablo Ziliani <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > (...) > > What I was actually trying to accomplish was to iterate over 2 > > iterators using 1 for loop, however I found that the zip() function

  1   2   >