Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
o run linked together in a shared address space" ; the link between the framework and the scripts is certainly much tighter than between a web server and a CGI script Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
ython if LGPL is a problem) Turbogears : MIT + licence of the components Twisted : LGPL Webware : Python licence Zope : ZPL (Zope Public Licence) There doesn't seem to be an obvious choice, but the GPL isn't used much here Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python web framework is most like Ruby on Rails?

2005-12-27 Thread Pierre Quentel
Yes, there is a clear winner : "python zope" = 3.950.000 Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: reading specific lines of a file

2006-07-15 Thread Pierre Quentel
If the line number of the first line is 0 : source=open('afile.txt') for i,line in enumerate(source): if i == line_num: break print line Pierre -- http://mail.python.org/mailman/listinfo/python-list

Using iterators to write in the structure being iterated through?

2006-07-26 Thread Pierre Thibault
tion: how could I do that and retain enough generallity? Thanks! Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Using iterators to write in the structure being iterated through?

2006-07-26 Thread Pierre Thibault
On Wed, 26 Jul 2006 18:54:39 +0200, Peter Otten wrote: > Pierre Thibault wrote: > >> Hello! >> >> I am currently trying to port a C++ code to python, and I think I am stuck >> because of the very different behavior of STL iterators vs python >> iter

Re: Using iterators to write in the structure being iterated through?

2006-07-27 Thread Pierre Thibault
On Wed, 26 Jul 2006 16:11:48 -0700, Paddy wrote: > > Paddy wrote: >> Pierre Thibault wrote: >> > Hello! >> > >> > I am currently trying to port a C++ code to python, and I think I am stuck >> > because of the very different behavior of STL iterator

Re: Using iterators to write in the structure being iterated through?

2006-07-27 Thread Pierre Thibault
On Wed, 26 Jul 2006 20:59:12 +0200, Peter Otten wrote: > Pierre Thibault wrote: > >> Hum, this example seems like a special case not really appropriate for my >> needs. Let me make my problem a little more precise. The objects I'll want >> to iterate through will alw

Re: modify element of a list.

2006-08-17 Thread Pierre Quentel
Hi, The most simple is to use the index of the element in the list : def setAttribute(self, desc, value): n = anObject(desc, value) for i,o in enumerate(self.Objects): if o.getDescription() == desc: self.Objects[i] = n return self.Objects.append(n) Pierre

Re: key not found in dictionary

2006-08-22 Thread Pierre Quentel
Depending on what you want to do if the key doesn't exist, you might want to use the dictionary method get() : value = some_dict.get(key,default) sets value to some_dict[key] if the key exists, and to default otherwise Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
rds) if xlat.get(f,None) ] if not result: return None if len(result) == 1: return result[0] return result Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
7;d':int,'i':int} result = [ xlat[f](w) for f,w in zip(format,line.split()) if xlat.get(f,None) ] if len(result) == 0: return None if len(result) == 1: return result[0] return result Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: atexit.register does not return the registered function. IMHO, it should.

2006-11-16 Thread Pierre Rouleau
ry. > Done: http://sourceforge.net/tracker/index.php?func=detail&aid=1597824&group_id=5470&atid=105470 I select Python 2.5 as the category. It affects all versions but most likely to cause a problem in Python 2.4 and after. -- Pierre R. -- http://mail.python.org/mailman/listinfo/python-list

Re: Search substring in a string and get index of all occurances

2006-06-21 Thread Pierre Quentel
mystring = 'John has a really nice powerbook.' substr = ' ' # space pos = 0 indices = [] while True: i = mystring.find(substr,pos) if i==-1: break indices.append(i) pos = i+1 print indices > [4, 8, 10, 17, 22] Pierre -- http://mail.python.org/

Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> states = [] >>> x = [0] >>> for i in range(10): ... x[0] = i ... states.append(x) ... >>>

Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
idea? > > Thanks, > > Gokce. > In your original post you said you wanted to store local variables, but it seems that you need to store more information than this : could you specify which ones ? Since you can't copy the stack frame, maybe you can copy only the attributes you

Re: Re-loading updated modules

2006-06-27 Thread Pierre Quentel
you have edited the module source file using an external editor and want to try out the new version without leaving the Python interpreter. The return value is the module object (the same as the module argument). " Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: a class variable question

2006-06-27 Thread Pierre Quentel
Similarly, in getvarValue : def getvarValue(self): return self._var1 Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: a class variable question

2006-06-28 Thread Pierre Quentel
(self): return self._var1 a = A3() print a.getvarValue() >>> 0 A3.func1() # change class attribute print a.getvarValue() >>> 1 b = A3() print b.getvarValue() >>> 1 Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating multiple lists from one list

2006-07-05 Thread Pierre Quentel
in elts['d']: >print [item0,item1,item2,item3] # execute this code exec p_code >['a.1', 'b.3', 'c.2', 'd.3'] >['a.1', 'b.3', 'c.6', 'd.3'] >['a.1', 'b.4', 'c.2',

Re: best small database?

2006-09-11 Thread Pierre Quentel
: persons.age[20] = list of the records where age = 20 Other pure-Python databases : ZODB (probably overkill for a small database) and Durus (I didn't test it) As said in others answers, the inclusion of SQLite in the standard distribution might make pure-Python solutions less attractive

Re: best small database?

2006-09-13 Thread Pierre Quentel
don't know its name. Bot rhyme with "hell" ; a and r like in French, g like in goat Now you know 3 words of Breton ! Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Python blogging software

2006-09-13 Thread Pierre Quentel
Hi, There is a blog demo in Karrigell : http://karrigell.sourceforge.net There is a project called KarriBlog aiming to offer a more complete application, it's still beta but you can see it working on this site (in French) : http://www.salvatore.exolia.net/site Regards, Pierre --

Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-30 Thread Pierre Quentel
y disagree on an issue, but usually discussion remains civil" This should apply to anyone, from the newbie to the most valuable contributor to Python Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

python html rendering

2006-10-03 Thread Pierre Imbaud
Hi, Im looking for a way to display some python code in html: with correct indentation, possibly syntax hiliting, dealing correctly with multi-line comment, and... generating valid html code if the python code itself deals with html (hence manipulates tag litterals. Thanks for your help! -- htt

Re: python html rendering

2006-10-03 Thread Pierre Imbaud
hanumizzle wrote: > On 10/3/06, Colin J. Williams <[EMAIL PROTECTED]> wrote: > > >>Another approach is to use PyScripter (an editor and IDE). One can >>generate documentation and then save the generated html doc. >> >>Also PyDoc can be used directly. > > > And if you want to go the traditional

Re: python html rendering

2006-10-03 Thread Pierre Imbaud
Colin J. Williams wrote: > Josh Bloom wrote: > >>Hey Pierre, >> >>I'm using this plug-in for wordpress to display Python code. >>http://blog.igeek.info/wp-plugins/igsyntax-hiliter/ >>It works pretty well and can display a lot of other languages as wel

tempfile.NamedTemporaryFile wont work

2006-11-19 Thread Imbaud Pierre
On suse 9.3, tempfile.NamedTemporaryFile() doesnt work as expected. (I found a permanent workaround, so I dont ask for help) I expected to write to a file, and access it thru a shell command. This code, in a loop: tf = tempfile.NamedTemporaryFile() tfName = tf.name

Re: tempfile.NamedTemporaryFile wont work

2006-11-19 Thread Imbaud Pierre
Steven D'Aprano a écrit : > On Sun, 19 Nov 2006 13:18:39 +0100, Bjoern Schliessmann wrote: > > >>Imbaud Pierre wrote: >> >> >>> tf = tempfile.NamedTemporaryFile() >>> tfName = tf.name >>>[...] >>>

Re: tempfile.NamedTemporaryFile wont work

2006-11-19 Thread Imbaud Pierre
Peter Otten a écrit : > Steven D'Aprano wrote: > > >>On Sun, 19 Nov 2006 13:11:13 +0100, Imbaud Pierre wrote: >> >> >>>On suse 9.3, tempfile.NamedTemporaryFile() doesnt work as expected. >> >>[snip] >> >> >>>Symptom: the

Python 2.4 does not marshal infinity floating point properly under Win32

2006-11-30 Thread Pierre Rouleau
\dev\python\test>t_marshal Nan: 0x67 0x0 0x0 0x0 0x0 0x0 0x0 0xf8 0xff : g Infinity : 0x67 0x0 0x0 0x0 0x0 0x0 0x0 0xf0 0x7f : g...¦ Infinity : 0x67 0x0 0x0 0x0 0x0 0x0 0x0 0xf0 0x7f : g...¦ Infinity : 0x67 0x0 0x0 0x0 0x0 0x0 0x0 0xf0 0x7f : g.

rdf, xmp

2006-12-02 Thread Imbaud Pierre
I have to add access to some XMP data to an existing python application. XMP is built on RDF, RDF is built on XML. I try to reuse as much of possible of existing code. btw, dont mistake XMP (http://www.adobe.com/products/xmp/) with XMPP (http://www.faqs.org/rfcs/rfc3920.html), backed by PyXMPP (htt

Re: rdf, xmp

2006-12-02 Thread Imbaud Pierre
Andy Dingley a écrit : > Imbaud Pierre wrote: > >>I have to add access to some XMP data to an existing python >>application. >>XMP is built on RDF, RDF is built on XML. > > > RDF is _NOT_ built on top of XML. Thinking that it is causes a lot of > trouble in

os.popen3 hangs in Windows XP SP1, SP2. Python 2.5 & 2.4. Consistent test case.

2006-12-11 Thread Pierre Rouleau
nt '- CMD 1 , stdout print : HANGS ---' stdout, stderr_lines, pgm_exit_code = popen3(cmd1, print_stream, list) print 'stderr_lines: ', stderr_lines print 'program exit code : ', pgm_exit_code # - -- Pierre Rouleau -- http://mail.python.org/mailman/listinfo/python-list

Re: os.popen3 hangs in Windows XP SP1, SP2. Python 2.5 & 2.4. Consistent test case.

2006-12-12 Thread Pierre Rouleau
On Dec 12, 10:11 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Pierre Rouleau wrote: > > Hi all, > > > I have a consistent test case where os.popen3() hangs in Windows. The > > system hangs when retrieving the lines from the child process stdout. > > I kno

xml bug?

2006-12-28 Thread Imbaud Pierre
I am using the standard xml library to create another library able to read, and maybe write, xmp files. Then an xml library bug popped out: xml.dom.minidom was unable to parse an xml file that came from an example provided by an official organism.(http://www.iptc.org/IPTC4XMP) The parsed file was

Re: xml bug?

2006-12-28 Thread Imbaud Pierre
Erik Johnson a écrit : > "Imbaud Pierre" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Now my points are: >>- how do I spot the version of a given library? There is a __version__ >> attribute of the module, is that it? &

Re: xml bug?

2006-12-30 Thread Imbaud Pierre
Martin v. Löwis a écrit : > Imbaud Pierre schrieb: > >>- how do I spot the version of a given library? There is a __version__ >> attribute of the module, is that it? > > > Contrary to what others have said: for modules included in the standard > library (and if us

closed issue

2007-01-08 Thread Imbaud Pierre
SOME xml rule, ideally the exception should show the rule, and the faulty piece of data. But I know this has a cost, both runtime cost and developper-s time cost. Imbaud Pierre a écrit : > I am using the standard xml library to create another library able to > read, and maybe write, >

Re: Server side newbie

2006-01-29 Thread Pierre Quentel
rameworks for Python, Karrigell is probably the easiest to get started with You can check out a recent review on devshed : http://www.devshed.com/c/a/Python/Karrigell-for-Python/ It says : "Python novices won't find any obstacles when working with Karrigell, and Python experts won't

Re: Too Many if Statements?

2006-02-07 Thread Pierre Quentel
This is because Python has a hidden mechanism to detect programs generated by Perl scripts, and make them crash with no explanation Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython or PyQT to make a simulink clone ?

2005-06-02 Thread Pierre Schnizer
d on the simulation stuff. This uses wxPython for the graphical interface. That could be perhaps a starting point if you want to do something on your own. In my belief you would have to make it far more eyecandy ... Hope that helps a bit. Pierre -- Remove the nospam for direct re

Re: wxpython or PyQT to make a simulink clone ?

2005-06-02 Thread Pierre Schnizer
Pierre Schnizer <[EMAIL PROTECTED]> writes: There was an old discussion on comp.lang.python: http://groups.google.de/group/comp.lang.python/browse_thread/thread/9ce44f40011016ec/a2e52b824de9bfb1?q=simulink&rnum=6&hl=de#a2e52b824de9bfb1 I have seen the later code of Eric Lech

Re: Python Memory Leak using SWIG

2007-06-05 Thread Pierre Sangouard
Object*) out,i),(PyObject*) > output); > > // zero the CpxNumMat for this scale & angle, hand ownership to > numpy > g[i][j]._data = NULL; > g[i][j]._m = 0; > g[i][j]._n = 0; > output->flags = output->flags | NPY_OWNDATA; > } > } > > return (PyObject*) out; I think %newobject swig directive is a solution to your problem. Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL cutting off letters

2007-06-16 Thread Pierre Hanser
t characters ones. There are fonts with caracters far higher than these conventionnal lines (try Liorah.ttf or any swashed font for exemple)! I don't remember for sure but may be there is the same problem horizontally. -- Pierre -- http://mail.python.org/mailman/listinfo/python-list

PEP 3131: Ascii-English is like coca-cola!

2007-05-14 Thread Pierre Hanser
TIME. and this pep is a glorious occasion to get free from it. [disclaimer: coca is used here as the generic name it became, and no real offense is intended] -- Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread Pierre Hanser
René Fleschenberg a écrit : > IMO, the burden of proof is on you. If this PEP has the potential to > introduce another hindrance for code-sharing, the supporters of this PEP > should be required to provide a "damn good reason" for doing so. So far, > you have failed to do that, in my opinion. All

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread Pierre Hanser
o please you? -- Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread Pierre Hanser
, ... nowdays we make chinese, corean, japanese talking phones. because we can do it, because graphics are cheaper than they were, because it augments our market. (also because some markets require it) see the analogy? of course, +1 for the pep -- Pierre -- http://mail.python.org

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-15 Thread Pierre Hanser
eally cannot understand. it's a problem of everyday, for million people! and yes sometimes i publish code (rarely), even if it uses french identifiers, because someone looking after a real solution *does* prefer an existing solution than nothing. -- Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread Pierre Quentel
bove you can use a "generator expression" entries = dict( (int(d.date.strftime('%m')),d.id) for d in links ) Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-09-01 Thread Pierre Hanser
Carl Banks a écrit : > > This is starting to sound silly, people. Critical is a relative term, > and one project's critical may be anothers mundane. Sure a flaw in your > flagship product is a critical problem *for your company*, but are you > really trying to say that the criticalness of a b

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Pierre Quentel
Hi, > Therefore, how do I build the tuple of Falses to reflect the length of my t > tuple? Yet another solution : d = dict(zip(t,[False]*len(t))) Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI handler: Retrieving POST and GET at the same time

2007-03-10 Thread Pierre Quentel
eved by : os.environ["QUERY_STRING"] To get the key-value dictionary : cgi.parse_qs(os.environ["QUERY_STRING"]) Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension returning subclassed list type?

2007-03-24 Thread Pierre Quentel
static method in > ZList which takes a plain list of Z objects and returns a ZList. > > Anyway, my question is whether or not this can be done more elegantly > via list comprehension? Hello, A list comprehension will give you a list. But you can use a generator expression : z_lis

Re: help with dates

2007-03-31 Thread Pierre Quentel
dinal(_date)-date.toordinal(start)) % 4 print group(date(2007,4,15)) Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: how to build a forum in Python?

2007-04-05 Thread Pierre Quentel
Hi, I think you should take a look at Karrigell : http://karrigell.sourceforge.net It's a Python web framework and the package includes a forum application Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: File DB instead of real database?

2007-04-13 Thread Pierre Quentel
>>> db.insert('Employment','Kaiser Chiefs') 2 >>> print [ r['title'] for r in db ] ['Ok Computer', 'Night On Earth', 'Employment'] >>> print [ r['artist'] for r in db if r['artist

Processing drag & drop on the desktop

2007-09-16 Thread Pierre Quentel
ould propose to tag the document with keywords taken from a database Is it possible to do this with a Python script, and how ? Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Processing drag & drop on the desktop

2007-09-18 Thread Pierre Quentel
On 17 sep, 17:08, Larry Bates <[EMAIL PROTECTED]> wrote: > Pierre Quentel wrote: > > Hi all, > > > I would like to create an application on a Windows machine, such that > > when a document is dragged and dropped on the application icon on the > > deskt

Re: Processing drag & drop on the desktop

2007-09-21 Thread Pierre Quentel
Thanks for the explanation Gabriel, it works fine now Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: List of objects X Database

2007-10-03 Thread Pierre Quentel
DbLite db = PyDbLite.Base("dummy") db.create("record,"artist","released") # fields are untyped db.insert("Closer","Joy Division",1980) db.insert("Different Class","Pulp",1996) db.commit() # save to disk print [ r for r

module file

2007-01-12 Thread Imbaud Pierre
I am willing to retrieve the file an imported module came from; module.__file__, or inspect.getfile(module) only gives me the relative file name. How do I determine the path? Its obviously possible from python: ipython displays the information (interactively: *module?*). Python 2.4 on Suse 9.3 (clu

module file

2007-01-13 Thread Imbaud Pierre
I am willing to retrieve the file an imported module came from module.__file__, or inspect.getfile(module) only gives me the relative file name. How do I determine the path? Its obviously possible from python: ipython displays the information (interactively: *module?*). NB: I saw the discussion abo

closed: module file

2007-01-13 Thread Imbaud Pierre
Imbaud Pierre a écrit : > I am willing to retrieve the file an imported module came from; > module.__file__, or inspect.getfile(module) only gives me the > relative file name. How do I determine the path? > Its obviously possible from python: ipython displays the information >

data design

2007-01-30 Thread Imbaud Pierre
The applications I write are made of, lets say, algorithms and data. I mean constant data, dicts, tables, etc: to keep algorithms simple, describe what is peculiar, data dependent, as data rather than "case statements". These could be called configuration data. The lazy way to do this: have module

Re: data design

2007-01-30 Thread Imbaud Pierre
Szabolcs Nagy a écrit : >>The lazy way to do this: have modules that initialize bunches of >>objects, attributes holding the data: the object is somehow the row of >>the "table", attribute names being the column. This is the way I >>proceeded up to now. >>Data input this way are almost "configurati

Re: data design

2007-01-30 Thread Imbaud Pierre
Larry Bates a écrit : > Imbaud Pierre wrote: > >>The applications I write are made of, lets say, algorithms and data. >>I mean constant data, dicts, tables, etc: to keep algorithms simple, >>describe what is peculiar, data dependent, as data rather than "case >>

Re: data design

2007-01-30 Thread Imbaud Pierre
Paddy a écrit : > > On Jan 30, 2:34 pm, Imbaud Pierre <[EMAIL PROTECTED]> wrote: > >>The applications I write are made of, lets say, algorithms and data. >>I mean constant data, dicts, tables, etc: to keep algorithms simple, >>describe what is peculiar, data dep

Re: data design

2007-01-31 Thread Imbaud Pierre
rmation? Have a look at the link Szabolcs Nagy <[EMAIL PROTECTED]> gives: http://www.scottsweeney.com/projects/slip/ Ill further dig yaml, with 2 questions: - how do I translate to python? - how do I express and/or enforce rules the data should follow? (avoid the classic: configuration data error raise some obscure exception). Big thanks to Szabolcs Nagy (hungarian, my friend? I love this country), although I seem to disagree, your statements are pretty clear and helpful, and... maybe U are right, and I am a fool... Pierre -- http://mail.python.org/mailman/listinfo/python-list

pyYaml community

2007-02-03 Thread Imbaud Pierre
I began using pyYaml. I found no place where pyYaml users exchange ideas, know-how, etc (as here for python). There is a wiki, a bug tracker, documentation, but such a place (mailing list, newsgroup, forum, or even IRC) is a must (IMHO) to smooth the learning curve. Does someone know better? My c

Re: what is wrong with my python code?

2007-02-07 Thread Pierre GM
On Wednesday 07 February 2007 12:43:34 Dongsheng Ruan wrote: > I got feed back saying" list object is not callable". But I can't figure > out what is wrong with my code. > for i in range(l): > print A(i) You're calling A, when you want to access one of its elements: use the straight bracket

iso 8601, quality criteria

2007-02-08 Thread Imbaud Pierre
for each library/module or even application, a note in [0:10] in front of every quality criterium. criteria?: completeness robustness how well tested? simplicity documentation maintenance team responsiveness usage: how many developpers picked it up and still use it? ho

Re: iso 8601, quality criteria

2007-02-08 Thread Imbaud Pierre
Imbaud Pierre a écrit : cutnpaste error in this posting, here is the complete message: Context: I am writing an application that accesses XMP-coded files. Some fields contain dates, and comply to iso 8601. I installed the iso8601 python module (http://cheeseshop.python.org/pypi/iso8601), it

Calculate an age

2007-12-06 Thread Pierre Quentel
is there such a function somewhere ? If not, for what reason, since it's a rather usual task Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Calculate an age

2007-12-07 Thread Pierre Quentel
us what we mean by "I am X years, Y months and Z days" ? Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Calculate an age

2007-12-08 Thread Pierre Quentel
the 30th of January is not valid) Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Pierre Rouleau
pass ... >>> a = Object() >>> a.data = 1 >>> print "a.data = ", a.data a.data = 1 >>> >>> class Object2(object): ... pass ... >>> b = Object2() >>> b.data = 2 >>> b.data 2 I also tried with Python 2.4.3 with the same results. Being able to do it would seem a natural way of declaring namespaces. -- Pierre Rouleau -- http://mail.python.org/mailman/listinfo/python-list

Re: Can we create an_object = object() and add attribute like for a class?

2006-04-29 Thread Pierre Rouleau
Alex Martelli wrote: > Pierre Rouleau <[EMAIL PROTECTED]> wrote: > > >>Hi all, >> >>Is there any reason that under Python you cannot instantiate the object >>class and create any attributes like you would be able for a normal class? > > > Yep:

Re: Can we create an_object = object() and add attribute like fora class?

2006-04-29 Thread Pierre Rouleau
Fredrik Lundh wrote: > Pierre Rouleau wrote: > > >>I can understand the design decision not to give object a __dict__, but >>I wonder if i'd be a good idea to have a class that derives from object >>and has a __dict__ to be in the standard library. > > &g

Mutable String

2006-05-03 Thread Pierre Thibault
I would like to know if there are modules offering a mutable version of strings in Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutable String

2006-05-04 Thread Pierre Thibault
Ok, That will do the job. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Unable to use py2app

2006-05-04 Thread Pierre Thibault
Hello, I am unable to use py2app. I have an error when I try to import it: ImportError: No module named py2app I have installed pyobjc-1.3.7. I am on Mac OS 10.4.6. It does not work. It does not work with python 2.4 and it does not work with python 2.3. Is it working with someone else? -- ht

Re: Is the only way to connect Python and Lua through a C interface?

2006-05-16 Thread Pierre Rouleau
Casey Hawthorne wrote: > Is the only way to connect Python and Lua through a C interface? Take a look at Lunatic Python (http://labix.org/lunatic-python) -- Pierre Rouleau -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple List division problem

2008-01-14 Thread Pierre Quentel
On 12 jan, 19:37, marcstuart <[EMAIL PROTECTED]> wrote: > How do I divide a list into a set group of sublist's- if the list is > not evenly dividable ? > consider this example: > > x = [1,2,3,4,5,6,7,8,9,10] > y = 3 # number of lists I want to break x into > z = y/x > > what I would like to ge

Re: xsd, data binding. Modern approach?

2008-02-29 Thread Pierre Sangouard
Vladimir Kropylev wrote: > Hi, > > What is the most actual approach to python XML data-binding? > The answers given by google seam to be rather outdated. Can't believe > nothing's changed since 2003. > > To be concrete, i've faced the following task: > I HAVE: > - XSD schema (a huge collection of *

Converting a string to the most probable type

2008-03-06 Thread Pierre Quentel
to the *string* "123" instead of the *integer* 123 I could code it myself, but this wheel is probably already invented Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a string to the most probable type

2008-03-08 Thread Pierre Quentel
ch write the literal 123.456.789,99 when others write 123,456,789.99 ; for us, today is 8/3/2008 (or 08/03/2008) where for others it's 3/8/2008 or perhaps 2008/3/8 Popular spreadsheets know how to "guess" literals ; if the guess is not correct users can usually specify the pat

Re: why o/p is different ???

2009-01-14 Thread Pierre Bourdon
Use os.path.basename : >>> os.path.basename('/foo/bar/baz.py') 'baz.py' It will have the expected behavior on each system. You could also use os.sep instead of '/' in your split method call, but os.path.basename is more elegant. On Thu, Jan 15, 2009 at 7:34 AM, asit wrote: > I recently faced a

Re: output problem

2009-01-18 Thread Pierre Bourdon
IIRC, Windows automatically add a newline after the program output. On Fri, Jan 16, 2009 at 4:24 PM, Jean-Paul VALENTIN wrote: > Feature? the output of below Hello program he0.py started from command > line looks as follows: > F:\prompt>he0.py > Hello > F:\prompt> > > 'Hello' was sent with sys.st

Re: OCaml, Language syntax, and Proof Systems

2009-01-23 Thread Pierre Bourdon
On Sat, Jan 24, 2009 at 12:16 AM, Xah Lee wrote: > The haskell tutorials you can find online are the most mothefucking > stupid unreadable fuck. The Haskll community is almost stupid. What > they talk all day is about monads, currying, linder myer fuck type. > That's what they talk about all day.

Re: BaseHttpServer

2009-02-15 Thread Pierre Quentel
e sending it. In this case it's better to send the content by chunk, using shutil : replace self.wfile.write(f.read()) by : shutil.copyfileobj(f,self.wfile) - Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: error on windows with commands.getstatusoutput

2008-12-28 Thread Pierre Bourdon
The commands module is Unix only. See its documentation : http://docs.python.org/library/commands.html On Sun, Dec 28, 2008 at 10:03 PM, Lee Harr wrote: > > My application is trying to start twistd in a cross-platform way. > > Unfortunately, it works fine on my linux system, but I do not > have w

Re: SQL, lite lite lite

2008-12-29 Thread Pierre Quentel
lasses= db.Relation( 'class_', 'person', Unique( 'class_', 'person' ) ) > > #create table 'classes' ( 'key', 'class_', 'person' ) unique > ( 'class_', 'person' ) > > >>> classes._unique( 'class_', 'person' ) > >>> classes.class_.noneok= False #'class_' cannot be null > >>> classes.person.noneok= False > >>> classes._insert( 'Physics', 'Dan' ) > >>> classes._insert( 'Chem', 'Tim' ) > > Hoping-"good critic"-is-self-consistent-ly, hoping-to-hear-it's-too- > complicated-already-ly, > A. Brady Hi, PyDbLite (http://pydblite.sourceforge.net/) is not far from what you describe. The basic version stores data in cPickle format, and there are interfaces to use the same Pythonic syntax with SQLite and MySQL backends Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Which SOAP module?

2009-01-04 Thread Pierre Hanser
Ralf Schoenian a écrit : > Roy Smith wrote: >> I'm starting to play with SOAP. The zeroth question that needs >> answering is, "Which SOAP module should I use?" There seem to be a >> number of different ones to pick from. Any suggestions? >> >> > It depends on whether you want to write a client

Re: brackets content regular expression

2008-10-31 Thread Pierre Quentel
ver that it won't work if you have > > > something like this: " ". > > > > Matt > > Hi, Regular expressions or pyparsing might be overkill for this problem ; you can use a simple algorithm to read each character, increment a counter when you find a < a

simplejson: alternate encoder not called enought

2009-03-21 Thread Pierre Hanser
ought confirm my diagnostic? thanks in advance -- Pierre -- http://mail.python.org/mailman/listinfo/python-list

Bullshit Generator

2009-03-29 Thread Pierre Denis
f words. For Windows XP/Vista users: if you have installed the win32com package (delivered with PythonWin), you should hear the sentences pronounced by synthesized speech. Have fun, Pierre Denis Instruction: simply copy the following lines in a bullshit_generator.py file and executes the script

Logging exceptions to a file

2009-05-06 Thread Pierre GM
All, I need to log messages to both the console and a given file. I use the following code (on Python 2.5) >>> import logging >>> # >>> logging.basicConfig(level=logging.DEBUG,) >>> logfile = logging.FileHandler('log.log') >>> logfile.setLevel(level=logging.INFO) >>> logging.getLogger('').addHandl

Re: Logging exceptions to a file

2009-05-07 Thread Pierre GM
On May 7, 5:32 am, Lie Ryan wrote: > Pierre GM wrote: > > All, > > I need to log messages to both the console and a given file. I use the > > following code (on Python 2.5) > > >>>> import logging > >>>> # > >>>> logging.b

<    1   2   3   4   >