[ANN] markup.py 1.8

2012-02-18 Thread Daniel Nogradi
A new release of markup.py is available at http://markup.sourceforge.net/ This new release is compatible with both python 2 and 3. What is markup.py? Markup.py is an intuitive, light weight, easy-to-use, customizable and pythonic HTML/XML generator. The only goal is quickly writing HTML/XML

python autoconf macro for building ming extension

2007-10-03 Thread Daniel Nogradi
It might be slightly off topic here but couldn't find a more suitable place for this question: I'm trying to build the python binding for ming -- http://ming.sf.net -- but for some reason the python macro for autoconf -- python.m4 -- doesn't seem to detect my python installation correctly. The

Re: first, second, etc line of text file

2007-07-26 Thread Daniel Nogradi
A very simple question: I currently use a cumbersome-looking way of getting the first, second, etc. line of a text file: for i, line in enumerate( open( textfile ) ): if i == 0: print 'First line is: ' + line elif i == 1: print 'Second line is: ' + line

Re: Tix.Tk() on Mac Intel

2007-07-26 Thread Daniel Nogradi
On 7/26/07, Alan [EMAIL PROTECTED] wrote: Hi List! I have I Macbook Pro Intel running OSX 10.4.10. I downloaded Python 2.5 and tried TclTkAquaBI-8.4.10.0.dmg, but I got: Traceback (most recent call last): File stdin, line 1, in module File

Re: first, second, etc line of text file

2007-07-25 Thread Daniel Nogradi
Thanks all! I think I will stick to my original method because the files can be quite large and without reading the whole file into memory probably enumerate( open( textfile ) ) is the only way to access an arbitrary Nth line. -- http://mail.python.org/mailman/listinfo/python-list

first, second, etc line of text file

2007-07-25 Thread Daniel Nogradi
A very simple question: I currently use a cumbersome-looking way of getting the first, second, etc. line of a text file: for i, line in enumerate( open( textfile ) ): if i == 0: print 'First line is: ' + line elif i == 1: print 'Second line is: ' + line ...

Re: standalone module

2007-07-15 Thread Daniel Nogradi
I want to create a standalone program ( an exe file ) from my python files which works on Windows and Linux. Could you please tell me how to do that? The same executable should work on both linux and windows? Not possible. But see:

Re: how to install pygame package?

2007-07-14 Thread Daniel Nogradi
There seems to be some problem. For the tar version, initial steps execute OK, but after typing: [EMAIL PROTECTED] pygame-1.7.1release]# ./configure bash: ./configure: No such file or directory So i don't hav a configure file? What should i do now? Sorry, instead of ./configure do this:

Re: how to call bluebit...

2007-07-13 Thread Daniel Nogradi
how to import bluebit matrik calculator that result of singular value decomposition (SVD) in python programming.. I'm not really sure I understand you but you might want to check out scipy: http://scipy.org/ HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: how to install pygame package?

2007-07-13 Thread Daniel Nogradi
Im working in red hat linux 9.0. I've downloaded the pygame package but i dont know how to install it. If anybody has the time to detail the steps sequentially... thanx! P.S. I've downloaded both the tar and the rpm packages... First you can try the rpm package: su (give the root password)

Re: Dynamic method

2007-07-11 Thread Daniel Nogradi
I have an issue I think Python could handle. But I do not have the knowledge to do it. Suppose I have a class 'myClass' and instance 'var'. There is function 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or the instance. Any help, info or point of

Re: standalone executables

2007-07-10 Thread Daniel Nogradi
I need a reference to get all the programs which used to package Python programs into standalone executables files. Would you help me? windows: http://www.py2exe.org/ mac: http://cheeseshop.python.org/pypi/py2app/ linux: http://wiki.python.org/moin/Freeze linux/windows:

Re: Dynamic method

2007-07-10 Thread Daniel Nogradi
I have an issue I think Python could handle. But I do not have the knowledge to do it. Suppose I have a class 'myClass' and instance 'var'. There is function 'myFunc(..)'. I have to add (or bind) somehow the function to the class, or the instance. Any help, info or point of reference is

Re: 15 Exercises to Know A Programming Language

2007-07-03 Thread Daniel Nogradi
Write a program that takes as its first argument one of the words 'sum,' 'product,' 'mean,' or 'sqrt' and for further arguments a series of numbers. The program applies the appropriate function to the series. My solution so far is this: http://dpaste.com/13469/ I would

Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question

2007-07-03 Thread Daniel Nogradi
Hi I'm considering learning Python...but with the python 3000 comming very soon, is it worth waiting for?? I know that the old style of coding python will run parallel with the new, but I mean, its going to come to an end eventually. What do you think?? Chris 99% of what you would learn

Re: Memory leak in PyQt application

2007-07-01 Thread Daniel Nogradi
Python 2.5.1 Boost.Python Qt 4.2.2 SIP 4.6 PyQt 4.2 WinXp I've a memory leak in a PyQt application and no idea how to find it. What happens in the application ? From QWindow a QDialog is called on a button pressed() signal, that instantiate a QThread and waits for it. If the thread

Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
Hi list, Well, the short question is: what are they? I've read Guido's python 3000 status report on http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he mentions ABC's but don't quite understand what the whole story is about. Anyone has good use cases? Daniel --

Re: Voluntary Abstract Base Classes

2007-06-29 Thread Daniel Nogradi
Well, the short question is: what are they? I've read Guido's python 3000 status report on http://www.artima.com/weblogs/viewpost.jsp?thread=208549 where he mentions ABC's but don't quite understand what the whole story is about. The story is at PEP 3119:

Re: Python live environment on web-site?

2007-06-21 Thread Daniel Nogradi
I was wondering if there was a python-live-environment available on a public web-site similar to the ruby-live-tutorial on http://tryruby.hobix.com/ I would prefer something which allows to paste small scripts into a text-field, to run them on the server, and to be able to read the

Re: Dive into Python 5.5

2007-06-13 Thread Daniel Nogradi
class UserDict: def __init__(self, dict=None): self.data = {} if dict is not None: self.update(dict) I just don't understant this code, as it is not also mention in the book. the update is a method of a dict right? in my understanding the last statement should be

Re: Goto

2007-06-13 Thread Daniel Nogradi
How does one effect a goto in python? I only want to use it for debug. I dasn't slap an if clause around the portion to dummy out, the indentation police will nab me. http://entrian.com/goto/ -- http://mail.python.org/mailman/listinfo/python-list

Re: google maps api for py?

2007-05-30 Thread Daniel Nogradi
I see that the weapon of choice for google maps is javascript... Is there anything for python? I wrote the following for finding the latitude/longitude of a location. You need to set the variable 'key' to the actual key you got from google. (Indentation might get mixed up on the way.)

Re: Resize image NO PIL!!

2007-05-29 Thread Daniel Nogradi
I have created an image hosting site and when a user uploads an image, I want a service to run on the server to create a few thumbnails while the user does other things. My stupid host (pair.com) doesn't have PIL installed and I'm too much of a stupid newbie to figure out how to get it to

Re: model browser

2007-05-23 Thread Daniel Nogradi
Are there other options I overlooked? Daniel There is a CRUD template for TG: http://docs.turbogears.org/1.0/CRUDTemplate Might be what you're looking for. I was looking for something that is not based on a framework such as django or tg (and not on sqlalchemy either, but on

model browser

2007-05-20 Thread Daniel Nogradi
Hi list, I'm looking for an sqlobject based model browser with a web interface (is this the thing called CRUD these days?). Searching all over the place turned up of course django's automatic admin interface and turbogears' catwalk but I wouldn't want to buy into any of these two frameworks

Re: model browser

2007-05-20 Thread Daniel Nogradi
And before you ask, yes, I did read http://mail.python.org/pipermail/python-list/2007-May/440337.html but there was nothing beyond django/tg :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
For example, it HAS been published elsewhere that YouTube uses lighttpd, not Apache: http://trac.lighttpd.net/trac/wiki/PoweredByLighttpd. How do you explain these, then: http://www.youtube.com/results.xxx http://www.youtube.com/results.php http://www.youtube.com/results.py Just wondering,

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
For example, it HAS been published elsewhere that YouTube uses lighttpd, not Apache: http://trac.lighttpd.net/trac/wiki/PoweredByLighttpd. How do you explain these, then: http://www.youtube.com/results.xxx http://www.youtube.com/results.php http://www.youtube.com/results.py

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
For example, it HAS been published elsewhere that YouTube uses lighttpd, not Apache: http://trac.lighttpd.net/trac/wiki/PoweredByLighttpd. How do you explain these, then: http://www.youtube.com/results.xxx http://www.youtube.com/results.php http://www.youtube.com/results.py

Re: Sending a JavaScript array to Python script?

2007-05-17 Thread Daniel Nogradi
Just wondering if there is any way of sending a JavaScript array to a Python cgi script? A quick Google search didn't turn up anything useful. Simplejson is what you want: http://cheeseshop.python.org/pypi/simplejson HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

[ANN] markup.py 1.7

2007-05-17 Thread Daniel Nogradi
A new release is available for markup.py, a module for generating HTML/XML output painlessly and practically without any learning curve. The goal of markup.py is to be able to quickly put together documents in an ad hoc basis so if you need anything for production look for something else, e.g.

Re: How do I count the number of spaces at the left end of a string?

2007-05-16 Thread Daniel Nogradi
I don't know exactly what the first non-space character is. I know the first non-space character will be * or an alphanumeric character. How about: mystring = 'ksjfkfjkfjds ' print len( mystring ) - len( mystring.lstrip( ) ) 4 HTH, Daniel --

Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Daniel Nogradi
I've found the following strange behavior of cPickle. Do you think it's a bug, or is it by design? Best regards, Victor. from pickle import dumps from cPickle import dumps as cdumps print dumps('1001799')==dumps(str(1001799)) print cdumps('1001799')==cdumps(str(1001799))

Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Daniel Nogradi
I've found the following strange behavior of cPickle. Do you think it's a bug, or is it by design? Best regards, Victor. from pickle import dumps from cPickle import dumps as cdumps print dumps('1001799')==dumps(str(1001799)) print

Re: Asyncore Help?

2007-05-14 Thread Daniel Nogradi
I am working on the networking code for a small Multiplayer RPG I'm working on. I currently have some basic code using threads, but it seems like asyncore would be far better suited for my needs. However, I have trouble finding a solid example for what I need. Python.org and other sites

elementtree and entities

2007-05-13 Thread Daniel Nogradi
Hi list, How does one prevent elementtree converting to amp; (and similarly for other entities)? from xml.etree import ElementTree as et x = et.Element( 'test' ) x.text = '' et.tostring( x ) 'testamp;/test' Sometimes I would like to have the output 'test/test' Daniel --

Re: elementtree and entities

2007-05-13 Thread Daniel Nogradi
How does one prevent elementtree converting to amp; (and similarly for other entities)? from xml.etree import ElementTree as et x = et.Element( 'test' ) x.text = '' et.tostring( x ) 'testamp;/test' Sometimes I would like to have the output 'test/test' elementtree is for

Re: Dynamic subclassing ?

2007-05-12 Thread Daniel Nogradi
I've got an instance of a class, ex : b=gtk.Button() I'd like to add methods and attributes to my instance b. I know it's possible by hacking b with setattr() methods. But i'd like to do it with inheritance, a kind of dynamic subclassing, without subclassing the class, only this instance b

Re: Dynamic subclassing ?

2007-05-12 Thread Daniel Nogradi
I've got an instance of a class, ex : b=gtk.Button() I'd like to add methods and attributes to my instance b. I know it's possible by hacking b with setattr() methods. But i'd like to do it with inheritance, a kind of dynamic subclassing, without subclassing the class, only

Re: [Newbie] design question

2007-05-12 Thread Daniel Nogradi
Suppose I have class ShoppingCart which has one method called buy(), and class Buyer who has one reference to ShoppingCart... Can I also have method buy() in class Buyer, which will then called ShoppingCard.buy(), and also do some other stuff? Is this legal design pattern, have methods with

Re: File modes

2007-05-10 Thread Daniel Nogradi
After reading a file is it possible to write to it without first closing it? I tried opening with 'rw' access and re-winding. This does not seem to work unless comments are removed. Also, does close force a flush? Thanks, jh #~~ f =

Re: Mod Python Question

2007-05-08 Thread Daniel Nogradi
I am very new to Python and Mod_Python and I am running into what looks like a caching problem. I have the following code: --- from mod_python import apache from folder import Messenger def handler(req): msg = Messenger(req): # using req.write

Re: __getattr__ and __getattribute__

2007-05-08 Thread Daniel Nogradi
i find it difficult to understand the difference between the magic methods __getattr__ and __getattribute__ and so donot know when to use former or later. From the docs: __getattr__(self, name) Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an

Re: sqlite for mac?

2007-05-03 Thread Daniel Nogradi
Does sqlite come in a mac version? The interface (pysqlite) is part of the python 2.5 standard library but you need to install sqlite itself separately (as far as I remember) fromwww.sqlite.org http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_Techno... I

Re: What do people use for code analysis.

2007-05-02 Thread Daniel Nogradi
Lots of code, calls to, calls by, inheritance, multiple tasks, etc. What do people use to figure out what's happening? This is a pretty cool project just for that: http://codeinvestigator.googlepages.com/codeinvestigator HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
Does sqlite come in a mac version? The interface (pysqlite) is part of the python 2.5 standard library but you need to install sqlite itself separately (as far as I remember) from www.sqlite.org Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile: grabbing whole directories

2007-05-01 Thread Daniel Nogradi
The built in zipfile.write doesn't seem to like taking a directory instead of a filename. for example: for each in listofdir: archive.write(each) blows up when one of the items listed in listofdir is a subdirectory. File /usr/local/lib/python2.4/zipfile.py, line 405,

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
I'm using python 2.4.4 because the download said there were more mac modules available for 2.4.4. than 2.5, and I can't seem to locate a place to download sqlite for mac. I it comes on OS X Tiger, and possibly earlier versions as well (it's used as an index for Mail.app).. You just

Re: sqlite for mac?

2007-05-01 Thread Daniel Nogradi
Does sqlite come in a mac version? The interface (pysqlite) is part of the python 2.5 standard library but you need to install sqlite itself separately (as far as I remember) fromwww.sqlite.org Daniel I'm using python 2.4.4 because the download said there were more mac modules

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
I am parsing an XML file and sending the output to two files.The code asks the user to enter the input file,something like: file_input = raw_input(Enter The ODX File Path:) input_xml = open(file_input,'r') Now suppose the user enters the path as : C:\Projects\ODX Import\Sample

Re: I/O Operations .....

2007-04-30 Thread Daniel Nogradi
I am parsing an XML file and sending the output to two files.The code asks the user to enter the input file,something like: file_input = raw_input(Enter The ODX File Path:) input_xml = open(file_input,'r') Now suppose the user enters the path as : C:\Projects\ODX

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
I made a C/S network program, the client receive the zip file from the server, and read the data into a variable. how could I process the zipfile directly without saving it into file. In the document of the zipfile module, I note that it mentions the file-like object? what does it mean?

Re: Could zipfile module process the zip data in memory?

2007-04-29 Thread Daniel Nogradi
I made a C/S network program, the client receive the zip file from the server, and read the data into a variable. how could I process the zipfile directly without saving it into file. In the document of the zipfile module, I note that it mentions the file-like object? what does it

Re: if __name__ == 'main': passing an arg to a class objec

2007-04-27 Thread Daniel Nogradi
The lines if __name__ == 'main': someClass().fn() appear at the end of many examples I see. Is this to cause a .class file to be generated? Python doesn't generate .class files, and the example you mean is probably more like if __name__ == '__main__': .whatever

Re: Re-ocurring Events

2007-04-26 Thread Daniel Nogradi
A bit more of a complex one this time, and I thought I'd get your opinions on the best way to achieve this. Basically I'm looking for a way to describe a re-occurring event, like a calendar event or appointment I guess. I'm likely to use an XML file for the definition of the events, but

Re: If Dict Contains...

2007-04-25 Thread Daniel Nogradi
Looking to build a quick if/else statement that checks a dictionary for a key like follows. If myDict contains ThisKey: Do this... Else Do that... Thats the best way of doing this? if key in myDict: Do this. else: Do that HTH,

Re: Now()

2007-04-25 Thread Daniel Nogradi
I'm using the following function 'str (now)' to place a date time stamp into a log file, which works fine, however it writes the stamp like this. 2007-04-25 11:06:53.873029 But I need to expel those extra decimal places as they're causing problems with the application that parses the log

Re: Would You Write Python Articles or Screencasts for Money?

2007-04-24 Thread Daniel Nogradi
[Alex] When cash is involved, it's important to avoid even the slightest hint of a suggestion of a suspicion of a conflict of interest I propose the non-PSF sponsored Grand Prize For Successfully Squeezing 4 Of's In A Single Sentence should be received by Alex Martelli this month :) --

Re: Socket exceptions aren't in the standard exception hierarchy

2007-04-23 Thread Daniel Nogradi
2. File D:\Python24\lib\socket.py, line 295, in read data = self._sock.recv(recv_size) error: (10054, 'Connection reset by peer') That looks like M$ Windows version of UNIX/Linux error number 54 (pretty much all Windows socket errors are UNIX number+1) Errors coming

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
This may be pretty obvious for most of you: When I have an object (an instance of a class Foo) I can access attributes via dot notation: aFoo.bar however when I have a dictionary aDict = {bar:something} I have to write aDict[bar] What if I

Re: Dictionaries and dot notation

2007-04-22 Thread Daniel Nogradi
This may be pretty obvious for most of you: When I have an object (an instance of a class Foo) I can access attributes via dot notation: aFoo.bar however when I have a dictionary aDict = {bar:something} I have to write aDict[bar] What if I

Re: serializable object references

2007-04-22 Thread Daniel Nogradi
Is it possible to convert an object into a string that identifies the object in a way, so it can later be looked up by this string. Technically this should be possible, because things like __main__.Foo instance at 0xb7cfb6ac say everything about an object. But how can I look up the real

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
I'm running a program of mine from Linux bash script and it currently outputs status messages to the command prompt, but they all look a little boring to say the least, it'll be like this. [snip] And perhaps have the word 'success' in green, or red for 'failed' and things like that, just to

Re: Styled Output

2007-04-21 Thread Daniel Nogradi
I'm running a program of mine from Linux bash script and it currently outputs status messages to the command prompt, but they all look a little boring to say the least, it'll be like this. [snip] And perhaps have the word 'success' in green, or red for 'failed' and things like that,

Re: Python Threads -

2007-04-19 Thread Daniel Nogradi
Can you please suggest a technique in Python where we can spawn few number of worker threads and later map them to a function/s to execute individual Jobs. Have a look at the threading module: http://docs.python.org/lib/module-threading.html HTH, Daniel --

Re: Python un-plugging the Interpreter

2007-04-19 Thread Daniel Nogradi
Hi All, I was thinking about the feasbility of adjusting Python as a compiled language. Being said that I feel these are the following advantages of doing so -- 1) Using the powerful easy-to -use feature of Python programming language constructs. 2) Making the program to run at

Re: array{uint32}

2007-04-18 Thread Daniel Nogradi
I have a function that returns a array{uint32}, is there any way to output that to screen in a more user friendly format? At the moment when I print it by itself it appears as [65541L], which isn't much used to anyone. I'm not sure I understand your question precisely but this might help:

Re: Deleting or Empty a File

2007-04-17 Thread Daniel Nogradi
I'm looking to clear those log files we were discussing earlier chaps, What the best method to do this? Delete the file completely? Or just empty its content? If you just want to delete the content of a file but keep it with 0 length you can do: f = open( 'myfile', 'w' )# or open(

string methods of a str subclass

2007-04-16 Thread Daniel Nogradi
I am probably misunderstanding some basic issue here but this behaviour is not what I would expect: Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type help, copyright, credits or license for more information. class mystr( str ): ... pass

Re: string methods of a str subclass

2007-04-16 Thread Daniel Nogradi
Why is the strip( ) method returning something that is not a mystr instance? I would expect all methods operating on a string instance and returning another string instance to correctly operate on a mystr instance and return a mystr instance. Why would you expect that? Would you expect

Re: Lists and Tuples and Much More

2007-04-12 Thread Daniel Nogradi
And the last example brings up another question. What's the deal with a tupple that has a list in it such as: my_tupple = (1, 2, 3, 4, 5, [6, 7, 8, 9]) Now I read somewhere that you could change the list inside that tupple. But I can't find any documentation that describes HOW to do it.

Re: Binary To File

2007-04-12 Thread Daniel Nogradi
Is there an easy way to take binary data and build it into a file? Generally this will be BLOB data drawn from a database, the data will be for jpg images, I want to take the blob data and build it into a physical .jpg file. Is there a simple function for doing this in python? Like

Re: Parsing Problems

2007-04-03 Thread Daniel Nogradi
I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as given below: [Services]

Re: ISO programming projects

2007-04-01 Thread Daniel Nogradi
I'm looking for a collection of useful programming projects, at the hobbyist level. My online search did turn up a few collections (isolated projects are less useful to me at the moment), but these projects are either more difficult than what I'm looking for (e.g. code a C compiler) or not

Re: YouTube showing repr() of a tuple

2007-03-29 Thread Daniel Nogradi
Thought this might amuse some of you: http://youtube.com/results?search_query=korect+my+speling I'd heard that YouTube uses Python, but it's fun to see proof of that, even if it comes in the form of a minor bug. But their web frontend is (probably) in php:

Re: Other classes in a module

2007-03-25 Thread Daniel Nogradi
Can an instance of a class in a module, in any simple way find out which other classes that exists in said module ? # module x ## class c1: pass class c2: pass ### Python 2.5 (r25:51908, Nov 1 2006, 11:42:37) [GCC 3.4.2 20041017 (Red Hat

Re: On text processing

2007-03-24 Thread Daniel Nogradi
I'm in a process of rewriting a bash/awk/sed script -- that grew to big -- in python. I can rewrite it in a simple line-by-line way but that results in ugly python code and I'm sure there is a simple pythonic way. The bash script processed text files of the form:

Re: Join strings - very simple Q.

2007-03-23 Thread Daniel Nogradi
I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way: l=['a','b','c'] jl=string.join(l,',') New way? Dunno if it's the new way, but you can do: ''.join(l) The OP

On text processing

2007-03-23 Thread Daniel Nogradi
Hi list, I'm in a process of rewriting a bash/awk/sed script -- that grew to big -- in python. I can rewrite it in a simple line-by-line way but that results in ugly python code and I'm sure there is a simple pythonic way. The bash script processed text files of the form:

Re: On text processing

2007-03-23 Thread Daniel Nogradi
This is my first try: ddata = {} inside_matrix = False for row in file(data.txt): if row.strip(): fields = row.split() if len(fields) == 2: inside_matrix = False ddata[fields[0]] = [fields[1]] lastkey = fields[0] else:

Re: Documentation for str() could use some adjustment.

2007-03-19 Thread Daniel Nogradi
The Python documentation for str says str([object]) : Return a string containing a nicely printable representation of an object. However, there's no mention of the fact that str of a Unicode string with non-ASCII characters will raise a conversion exception. The documentation (and

from maple to python + numpy/scipy

2007-03-19 Thread Daniel Nogradi
I'm just getting started with numpy/scipy and first would like to get a view of what it can do and what it can't. The main idea is to move from maple to python and the first thing that poped up is the fact that maple is very convenient for both formal manipulations and exact integer calculations.

Re: list comprehension help

2007-03-18 Thread Daniel Nogradi
I need to process a really huge text file (4GB) and this is what i need to do. It takes for ever to complete this. I read some where that list comprehension can fast up things. Can you point out how to do it in this case? thanks a lot! f = open('file.txt','r') for line in f:

Re: list comprehension help

2007-03-18 Thread Daniel Nogradi
I need to process a really huge text file (4GB) and this is what i list comprehension can fast up things. Can you point out how to do f = open('file.txt','r') for line in f: db[line.split(' ')[0]] = line.split(' ')[-1] db.sync() What is db here? Looks like a

Re: list-like behaviour of etree.Element

2007-03-05 Thread Daniel Nogradi
The etree.Element (or ElementTree.Element) supports a number of list-like methods: append, insert, remove. Any special reason why it doesn't support pop and extend (and maybe count)? Those methods would not be hard to add. Perhaps, submit a feature request to Fredrik Lundh on

Re: Where I could find older python releases ?

2007-03-04 Thread Daniel Nogradi
Sorry jumped the gun a little there. Is this what you are looking for? http://codespeak.net/download/py/py-0.9.0.zip Probably not, the OP is looking for a python distribution, what you are posting is a third party package *for* python and is actually a part of the pypy project. --

list-like behaviour of etree.Element

2007-03-04 Thread Daniel Nogradi
The etree.Element (or ElementTree.Element) supports a number of list-like methods: append, insert, remove. Any special reason why it doesn't support pop and extend (and maybe count)? -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing an interpreter for language similar to python!!

2007-03-02 Thread Daniel Nogradi
I am new to python and working on a project that involves designing a new language. The grammar of the language is very much inspired from python as in is supports nearly all the statements and expressions that are supported by python. Since my project is in initial stage, so I think it would

Fwd: gmpy moving to code.google.com

2007-03-01 Thread Daniel Nogradi
Could you please tell me, on that 64-bit build, what happens with: importgmpy, sys, operator sys.maxint ??? gmpy.mpz(sys.maxint) ??? operator.index(gmpy.mpz(sys.maxint)) ??? sys.maxint+1 ??? gmpy.mpz(sys.maxint+1) ??? operator.index(gmpy.mpz(sys.maxint)+1) ???

Re: Curious UnboundLocalError Behavior

2007-02-28 Thread Daniel Nogradi
I'm probably fundamentally misunderstanding the way the interpreter works with regard to scope, but is this the intended behavior... [] SOMEGLOBAL: Traceback (most recent call last): File unboundlocal.py, line 15, in ? foo() File unboundlocal.py, line 11, in foo print

Re: gmpy moving to code.google.com

2007-02-28 Thread Daniel Nogradi
Could you please tell me, on that 64-bit build, what happens with: import gmpy, sys, operator sys.maxint ??? gmpy.mpz(sys.maxint) ??? operator.index(gmpy.mpz(sys.maxint)) ??? sys.maxint+1 ??? gmpy.mpz(sys.maxint+1) ??? operator.index(gmpy.mpz(sys.maxint)+1) ??? i.e., what

Re: gmpy moving to code.google.com

2007-02-27 Thread Daniel Nogradi
Hi Alex, I did another test, this time with python 2.4 on suse and things are worse than in the previous case (which was python 2.5 on fedora 3), ouput of 'python gmp_test.py' follows: Unit tests for gmpy 1.02 release candidate on Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117

Re: gmpy moving to code.google.com

2007-02-27 Thread Daniel Nogradi
Hi Alex, I did another test, this time with python 2.4 on suse and things are worse than in the previous case (which was python 2.5 on fedora 3), ouput of 'python gmp_test.py' follows: Interesting! gmpy interacts with decimal.Decimal by monkey- patching that class on the fly; clearly

[OT] python notation in new NVIDIA architecture

2007-02-26 Thread Daniel Nogradi
Something funny: The new programming model of NVIDIA GPU's is called CUDA and I've noticed that they use the same __special__ notation for certain things as does python. For instance their modified C language has identifiers such as __device__, __global__, __shared__, etc. Is it a coincidence?

Re: [OT] python notation in new NVIDIA architecture

2007-02-26 Thread Daniel Nogradi
Something funny: The new programming model of NVIDIA GPU's is called CUDA and I've noticed that they use the same __special__ notation for certain things as does python. For instance their modified C language has identifiers such as __device__, __global__, __shared__, etc. Is it a

Re: I don't quite understand this error...

2007-02-26 Thread Daniel Nogradi
Thus far, everything works fine unless I'm trying the Deposit or Withdrawal functions. (I know they're different, but both give roughly the same error.) Whenever I attempt one of these functions I get the following error message: Exception in Tkinter callback Traceback (most recent call

Re: gmpy moving to code.google.com

2007-02-26 Thread Daniel Nogradi
If you're interested in gmpy (the Python wrapper of GMP, for unlimited-precision arithmetic, rationals, random number generation, number-theoretical functions, etc), please DO check out http://code.google.com/p/gmpy/ -- gmpy 1.02 is there (as far as I can tell) in a workable state. Source on

Re: Help on Dict

2007-02-25 Thread Daniel Nogradi
Can any body tell how Dict is implemented in python... plz tell what datastructure that uses Please see http://svn.python.org/view/python/trunk/Objects/dictnotes.txt?rev=53782view=markup for general notes and

Re: JIT (just-in-tme accelerator) for Python - exists or no?

2007-02-22 Thread Daniel Nogradi
Or is any progress going on now? The JIT in MATLAB or Java seems to be very effective. This document describes the JIT situation in pypy: http://codespeak.net/pypy/dist/pypy/doc/jit.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: conver string to dictionary

2007-02-18 Thread Daniel Nogradi
I want to convert string to dictionary .what is the best solution for this? for example string is like this: '{SalutationID:[primarykey,8388607,0,None],CompanyID:[0,8388607,0,index], SalutationName:[,255,0,None],isDefault:[tinyint,1,1,None]}' and I want to convert this string to

  1   2   3   >