Re: [OT] Re: are there some special about '\x1a' symbol

2009-01-14 Thread Gabriel Genellina
En Tue, 13 Jan 2009 22:04:33 -0200, Terry Reedy escribió: Gabriel Genellina wrote: En Mon, 12 Jan 2009 12:00:16 -0200, John Machin escribió: I didn't think your question was stupid. Stupid was (a) CP/M recording file size as number of 128-byte sectors, forcing the use of an in-band EOF

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Carl Banks
On Jan 14, 1:40 am, Steven D'Aprano wrote: > On Tue, 13 Jan 2009 20:17:08 -0800, Carl Banks wrote: > > On Jan 13, 9:50 pm, Carl Banks wrote: > >> The cultural impact that would have on the community is far worse, > >> IMHO, than any short-sighted benefits like being able to catch an > >> accident

Re: pep 8 constants

2009-01-14 Thread Steven D'Aprano
On Tue, 13 Jan 2009 23:26:54 -0800, Brendan Miller wrote: > I tend to use constants as a means of avoiding the proliferation of > magic literals for maintenance reasons... Like say if your example of > FOO would have been used in 10 places. Maybe it is more pythonic to > simply denote such a thing

Re: initialising a class by name

2009-01-14 Thread Krishnakant
Hi, So should I not use getattr()? If I have one class in one module, then should I use global? I found getattr() very easy to use, my only dowbt is that if there is going to be one class per module then will it be a good idea? some thing like module, class_name happy hacking. Krishnakantt. On Tu

Re: initialising a class by name

2009-01-14 Thread Chris Rebert
On Wed, Jan 14, 2009 at 12:15 AM, Krishnakant wrote: > Hi, > So should I not use getattr()? > If I have one class in one module, then should I use global? > I found getattr() very easy to use, my only dowbt is that if there is > going to be one class per module then will it be a good idea? > some

Re: initialising a class by name

2009-01-14 Thread Krishnakant
Hi steevan, I liked this idea of dispatchTable. is it possible to say some thing like inst = dispatchTable{"ham"} according to me, inst will become the instance of class ham. Another thing to note is that all the classes are in different modules. So where do I create the dict of classes mapped wi

Re: initialising a class by name

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 13:19:23 +0530, Krishnakant wrote: > On Tue, 2009-01-13 at 21:51 -0800, Chris Rebert wrote: >> Assuming all the classes are in the same module as the main program: >> >> instance = vars()[class_name](args, to, init) >> > The classes are not in the same module. Every glade win

MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
I have this really strange problem. I hope someone can help: I am trying to update a database like so: UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy like '%certainvalue%' My Python code looks like this: fillsql = "UPDATE `tablename` set fieldx='test' WHERE flfieldx = nul

Re: read string in bits

2009-01-14 Thread John Machin
On Jan 14, 6:44 pm, ts wrote: > On Jan 14, 3:32 pm, Chris Rebert wrote: > > > > > On Tue, Jan 13, 2009 at 11:21 PM, ts wrote: > > > hi, is there a way to read a character/string into bits in python? > > > > i understand that character is read in bytes. Do i have to write a > > > function to conv

Re: read string in bits

2009-01-14 Thread Mark Smith
On Jan 14, 7:44 am, ts wrote: > On Jan 14, 3:32 pm, Chris Rebert wrote: > > > > > On Tue, Jan 13, 2009 at 11:21 PM, ts wrote: > > > hi, is there a way to read a character/string into bits in python? > > > > i understand that character is read in bytes. Do i have to write a > > > function to conv

Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 00:20 -0800, Chris Rebert wrote: > Aside from Steven's excellent idea, to use the getattr() technique > with your module scheme you'd probably also need to use __import__() > to dynamically import the right module. > I would generally import all the modules I would need at th

Re: read string in bits

2009-01-14 Thread Hendrik van Rooyen
"Chris Rebert" wrote: > It's not quite clear to me what you mean, but here are 2 guesses: > - If you want to convert an ASCII character to its ASCII integer > value, use ord() > - If you want to convert an integer into a string of its base-2 > representation, use bin() [requires Python 2.6, I th

Re: are there some special about '\x1a' symbol

2009-01-14 Thread Hendrik van Rooyen
"Steve Holden" wrote: > Unknown wrote: > > On 2009-01-12, John Machin wrote: > > I believe that "feature" was inherited by CP/M from DEC OSes > > (RSX-11 or RSTS-11). AFAICT, all of CP/M's file I/O API > > (including the FCB) was lifted almost directly from DEC's > > PDP-11 stuff, which probab

Re: initialising a class by name

2009-01-14 Thread Chris Rebert
On Wed, Jan 14, 2009 at 12:36 AM, Krishnakant wrote: > On Wed, 2009-01-14 at 00:20 -0800, Chris Rebert wrote: >> Aside from Steven's excellent idea, to use the getattr() technique >> with your module scheme you'd probably also need to use __import__() >> to dynamically import the right module. >>

Re: read string in bits

2009-01-14 Thread Mark Smith
On Jan 14, 7:44 am, ts wrote: > On Jan 14, 3:32 pm, Chris Rebert wrote: > > > > > On Tue, Jan 13, 2009 at 11:21 PM, ts wrote: > > > hi, is there a way to read a character/string into bits in python? > > > > i understand that character is read in bytes. Do i have to write a > > > function to conv

Re: why cannot assign to function call

2009-01-14 Thread Steven D'Aprano
On Tue, 13 Jan 2009 23:06:58 +, Mark Wooding wrote: > I'm going to move away from the formal semantics stuff and try a > different tack. Here's what I think is the defining property of > pass-by-value (distilled from the formal approach I described earlier, > but shorn of the symbolism): >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 13, 11:51 pm, Paul Rubin wrote: > Carl Banks writes: > > At GE there was no encapsulation in sight on any system I worked on. > > In fact, our engine simulation was a special-purpose object-oriented > > language with--get this--no private variables.  Some othe

RE: Could you suggest optimisations ?

2009-01-14 Thread Barak, Ron
Hi Terry, -Original Message- From: Terry Reedy [mailto:tjre...@udel.edu] Sent: Wednesday, January 14, 2009 01:57 To: python-list@python.org Subject: Re: Could you suggest optimisations ? Barak, Ron wrote: > Hi, > > In the attached script, the longest time is spent in the following > funct

Re: Read binary file and dump data in

2009-01-14 Thread Santiago Romero
> If you are reading arbitrary bytes then it will likely not always "look" > like integers. What you probably meant is: > > for i in data: >    print "%d, " % ord(i) That's it! :-) Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Aaron Brady
On Jan 13, 7:02 pm, Catherine Moroney wrote: > Hello everybody, > > I know how to spawn a sub-process and then wait until it > completes.  I'm wondering if I can do the same thing with > a Python function. > > I would like to spawn off multiple instances of a function > and run them simultaneously

PYTHON HTTP POST

2009-01-14 Thread lilanidhaval
Hi, I need one complete example of how to do a http post to any site. I have tried making a POST to google but all I am returned with is a 405 error. I don't want to use Pygoogle as I want to try and do this with other sites. I am also having problems inputing with the param I have tried Mechanize

Re: initialising a class by name

2009-01-14 Thread Steve Holden
Krishnakant wrote: > hello all, > I have a strange situation where I have to load initiate an instance of > a class at run-time with the name given by the user from a dropdown > list. > Is this possible in python and how? > To make things clear, let me give the real example. > there is an inventory

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 13, 11:40 pm, Steven D'Aprano wrote: > But, gosh darn it, wouldn't it be nice to program the critical parts of > your code in "strict Python", and leave the rest as "trusting Python", > instead of having to use Java for the lot just to get strictness in the > critical parts? If only there

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 7:31 pm, gumbah wrote: > I have this really strange problem. I hope someone can help: > > I am trying to update a database like so: > > UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy > like '%certainvalue%' > > My Python code looks like this: > > fillsql = "UPDATE

Re: PYTHON HTTP POST

2009-01-14 Thread koranthala
Does google accept POST? Anyways, if you dont need to post files, you can use urlencode itself. def encode_formdata(fields): body = urllib.urlencode(dict()) content_type = "application/x-www-form-urlencoded" return content_type, body If you need to post files too, then you

Re: why cannot assign to function call

2009-01-14 Thread Mark Wooding
Steven D'Aprano wrote: > > Ah! (say I) but assignment in C and Pascal looks different from the way > > it looks in C > > I'm sorry, that confuses me. Assignment in C looks different from the way > it looks in C? I guess the second C should be Python. Yes, you're right. Stupid mistake on my par

Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 04:09 -0500, Steve Holden wrote: > > > You don't need to have the names of the classes related to anything in > the interface. Just use a list of classes, and have the user interface > return the correct index for each class. Then (supposing the selection > by the user is sel

Re: PYTHON HTTP POST

2009-01-14 Thread koranthala
On Jan 14, 2:21 pm, koranth...@gmail.com wrote: > Does google accept POST? > > Anyways, if you dont need to post files, you can use urlencode itself. > def encode_formdata(fields): >         body = urllib.urlencode(dict()) >         content_type = "application/x-www-form-urlencoded" >         retur

Why this code is working?

2009-01-14 Thread Hussein B
Hey, Why this code is working? >>> def f1( ): ... x = 88 ... f2(x) ... >>> def f2(x): ... print x ... >>> f1( ) 88 Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: initialising a class by name

2009-01-14 Thread Krishnakant
On Wed, 2009-01-14 at 00:39 -0800, Chris Rebert wrote: > On Wed, Jan 14, 2009 at 12:36 AM, Krishnakant wrote: > > On Wed, 2009-01-14 at 00:20 -0800, Chris Rebert wrote: > >> Aside from Steven's excellent idea, to use the getattr() technique > >> with your module scheme you'd probably also need to

Re: Why this code is working?

2009-01-14 Thread Bruno Desthuilliers
Hussein B a écrit : Hey, Why this code is working? def f1( ): ... x = 88 ... f2(x) ... def f2(x): ... print x ... f1( ) 88 Well... Because it is correct ? What make you think it _shouldn't_ work ? -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Hi John, thanks a lot for your quick reply! I tried all of your suggestions but none of them work... I have a clue on why it is failing: MySQLdb seems to quote the % characters or something... Even when i do: cursor.execute("UPDATE tablename set fieldx='test' WHERE flfieldx is null and fieldy li

Re: Why this code is working?

2009-01-14 Thread Hussein B
On Jan 14, 11:55 am, Bruno Desthuilliers wrote: > Hussein B a écrit : > > > Hey, > > Why this code is working? > > def f1( ): > > ...      x = 88 > > ...      f2(x) > > ... > def f2(x): > > ...      print x > > ... > f1( ) > > 88 > > Well... Because it is correct ? > > What make you

Re: why cannot assign to function call

2009-01-14 Thread Mark Wooding
Aaron Brady wrote: > On Jan 13, 5:06 pm, Mark Wooding wrote: > snip > > I'm going to move away from the formal semantics stuff and try a > > different tack. Here's what I think is the defining property of > > pass-by-value (distilled from the formal approach I described earlier, > > but shorn o

Re: Why this code is working?

2009-01-14 Thread Peter Otten
Hussein B wrote: > Why this code is working? > def f1( ): > ... x = 88 > ... f2(x) > ... def f2(x): > ... print x > ... f1( ) > 88 The name 'f2' is not resolved once when the f1 function is created. Instead Python looks for a global name 'f2' each time f1 is execute

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Yep, also tried that. Weird thing is that I get no errors, it's just silently not updating... On 14 jan, 11:06, Peter Otten <__pete...@web.de> wrote: > gumbah wrote: > > I tried all of your suggestions but none of them work... I have a clue > > on why it is failing: MySQLdb seems to quote the % ch

Parent module not loaded error

2009-01-14 Thread Ståle Undheim
I have a pretty strange error that I can't figure out the cause off. This is in a Django app. I am using berkelydb, with secondary databases for indexing. The secondary databases are associated with a callback that uses cPickle to serialize index values. The problem is that cPickle.dumps(value) fa

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread gumbah
Aahh the conn.commit() DID the trick!! I tried that before, but then it failed at another point. I got it working now! Thanks a lot Peter and John!! cheers! On 14 jan, 11:14, gumbah wrote: > Yep, also tried that. Weird thing is that I get no errors, it's just > silently not updating... > > On 1

os system command not found

2009-01-14 Thread codicedave
Hi all! I installed a external program called infomap using the classical procedure ./configure make sudo make install and it works perfectly in Terminal (Os x) using both bash and tcsh shell admins-macbook-pro-2:~ unil$ infomap-build Usage: infomap-build [-w working_dir] [-p param_file]

Re: Parent module not loaded error

2009-01-14 Thread Graham Dumpleton
On Jan 14, 9:20 pm, Ståle Undheim wrote: > I have a pretty strange error that I can't figure out the cause off. > This is in a Django app. > > I am using berkelydb, with secondary databases for indexing. The > secondary databases are associated with a callback that uses cPickle > to serialize inde

Re: Implementing file reading in C/Python

2009-01-14 Thread David Bolen
Johannes Bauer writes: > Yup, I changed the Python code to behave the same way the C code did - > however overall it's not much of an improvement: Takes about 15 minutes > to execute (still factor 23). Not sure this is completely fair if you're only looking for a pure Python solution, but to be

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Steve Holden
gumbah wrote: > I have this really strange problem. I hope someone can help: > > I am trying to update a database like so: > > UPDATE `tablename` set fieldx='test' WHERE flfieldx = null and fieldy > like '%certainvalue%' > > My Python code looks like this: > > fillsql = "UPDATE `tablename` set

Re: initialising a class by name

2009-01-14 Thread Willi Richert
Hi, try the following exemplarily for the os module import os, types [(c, klass) for (c,klass) in os.__dict__.items() if type(klass)==types.ClassType] will print: [('_Environ', )] Regards, wr Am Mittwoch, 14. Januar 2009 10:55:27 schrieb Krishnakant: > On Wed, 2009-01-14 at 00:39 -0800, Chris

Re: Parent module not loaded error

2009-01-14 Thread Ståle Undheim
On Jan 14, 11:31 am, Graham Dumpleton wrote: > On Jan 14, 9:20 pm, Ståle Undheim wrote: > > > > > I have a pretty strange error that I can't figure out the cause off. > > This is in a Django app. > > > I am using berkelydb, with secondary databases for indexing. The > > secondary databases are as

Re: Parent module not loaded error

2009-01-14 Thread Graham Dumpleton
On Jan 14, 9:41 pm, Ståle Undheim wrote: > On Jan 14, 11:31 am, Graham Dumpleton > wrote: > > > > > On Jan 14, 9:20 pm, Ståle Undheim wrote: > > > > I have a pretty strange error that I can't figure out the cause off. > > > This is in a Django app. > > > > I am using berkelydb, with secondary da

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) I think the issue here is the distinction between hacking and software engineering. I may be misusing the term "hacking," but I do not mean it in a pejoritive sense. I just mean getting things done fast without a lot of concern for safety, security, and long-term maintain

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ben Sizer
On Jan 14, 1:55 am, Ivan Illarionov wrote: > Ben Sizer wrote: > > What am I doing wrong? > > What are you trying to achieve? > If you want to modify sys.path I suggest using Python/C API directly: No, I don't want to do anything with sys.path apart from see it. I just wanted my original question

Re: PYTHON HTTP POST

2009-01-14 Thread dhaval
The action part of the field is not set to anything. I need any site with working example that accepts POST. On Jan 14, 2:21 pm, koranth...@gmail.com wrote: > Does google accept POST? > > Anyways, if you dont need to post files, you can use urlencode itself. > def encode_formdata(fields): >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Marc 'BlackJack' Rintsch
On Wed, 14 Jan 2009 07:14:06 +, Steven D'Aprano wrote: > On Wed, 14 Jan 2009 15:25:38 +1000, James Mills wrote: > >> On Wed, Jan 14, 2009 at 3:11 PM, Russ P. >> wrote: (...) >> Give me one use-case where you strictly require that members of an object be private and their access en

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 8:55 pm, gumbah wrote: > Hi John, > > thanks a lot for your quick reply! Please don't top-post. Please answer the question """You don't say what "doesn't work" means ... did you get exceptions, or just silently not updating?""" > > I tried all of your suggestions but none of them work

Re: Standard IPC for Python?

2009-01-14 Thread sturlamolden
On Jan 13, 5:25 pm, Laszlo Nagy wrote: > I would like to develop some module for Python for IPC. Socket > programming howto recommends that for local communication, and I > personally experienced problems with TCP (see my previous post: "Slow > network"). There are plenty of different IPC mechan

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 9:22 pm, gumbah wrote: > Aahh the conn.commit() DID the trick!! > > I tried that before, but then it failed at another point. I got it > working now! Thanks a lot Peter and John!! For the benefit of future searchers, can you please tell us which varieties of cursor.execute() it works o

PYTHON HTTP POST WORKING EXAMPLE NEEDED

2009-01-14 Thread dhaval
Hi, Can someone please give me an example of a working python post? for example using the site http://www.cookiemag.com/ Thanks in advance, Dhaval -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON HTTP POST WORKING EXAMPLE NEEDED

2009-01-14 Thread dhaval
On Jan 14, 4:11 pm, dhaval wrote: > Hi, > > Can someone please give me an example of a working python post? > for example using the sitehttp://www.cookiemag.com/ > > Thanks in advance, > Dhaval I have tried to look at the code at http://code.activestate.com/recipes/146306/ I can't make any sense

Re: Re: problem calling method

2009-01-14 Thread pieterprovoost
The parent is called like this (I didn't copy that line): def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) The frame works fine and so does the button, but somehow I cannot call the s

[ANN] SWIG 1.3.37

2009-01-14 Thread Haoyu Bai
This is the SWIG with Python 3.0 support! :) *** ANNOUNCE: SWIG 1.3.37 (13 January 2009) *** http://www.swig.org We're pleased to announce SWIG-1.3.37, the latest installment in the SWIG development effort. SWIG-1.3.37 includes a number of bug fixes and enhancements. What is SWIG? ---

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Carl Banks
On Jan 14, 2:44 am, "Russ P." wrote: > On Jan 13, 11:51 pm, Paul Rubin wrote: > > > Carl Banks writes: > > > At GE there was no encapsulation in sight on any system I worked on. > > > In fact, our engine simulation was a special-purpose object-oriented > > > languag

Re: sys.stdout.write()'s bug or doc bug?

2009-01-14 Thread Steven D'Aprano
On Sun, 11 Jan 2009 19:38:48 -0800, Aahz wrote: > In article > , > Qiangning Hong wrote: >> >>So, my question is, as sys.stdout IS a file object, why it does not use >>its encoding attribute to convert the given unicode? An implementation >>bug? A documenation bug? > > Please file a bug on bug

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Terry Reedy
Paul Rubin wrote: "James Mills" writes: You do realize this is a model and not strictly a requirement. Quite a few things in Python are done merely by convention. Don't get caught up. But, if something is done by convention, then departing from the convention is by definition unconventional.

Re: PYTHON HTTP POST WORKING EXAMPLE NEEDED

2009-01-14 Thread Diez B. Roggisch
dhaval wrote: > On Jan 14, 4:11 pm, dhaval wrote: >> Hi, >> >> Can someone please give me an example of a working python post? >> for example using the sitehttp://www.cookiemag.com/ >> >> Thanks in advance, >> Dhaval > > I have tried to look at the code at > http://code.activestate.com/recipes/1

Re: Parent module not loaded error

2009-01-14 Thread Ståle Undheim
On Jan 14, 11:48 am, Graham Dumpleton wrote: > As a test, just prior to where unpickle is done, do: > >   import sys >   import d4 > >   print >> sys.stderr, "d4.__name__", dr.__name__ >   print >> sys.stderr, "d4.__file__", dr.__file__ > > This will just confirm that manual import works and what

Re: Standard IPC for Python?

2009-01-14 Thread Laszlo Nagy
There are plenty of different IPC mechanisms available in multiprocessing. It is good for a special case: a tree of processes, forked from a main process. multiprocessing.Queue cannot be used as a general message queue between arbitrary processes. - mmap.mmap with 0 or -1 as the first argu

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread John Machin
On Jan 14, 9:42 pm, Steve Holden wrote: > 3. I can't be certain my experience with PostgreSQL extends to MySQl, > but I have done experiments which prove to my satisfaction that it isn't > possible to parameterize LIKE arguments. So the only way to do it > appears to be to build the query yoursel

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 10:53:33 +, Marc 'BlackJack' Rintsch wrote: > On Wed, 14 Jan 2009 07:14:06 +, Steven D'Aprano wrote: > >> On Wed, 14 Jan 2009 15:25:38 +1000, James Mills wrote: >> >>> On Wed, Jan 14, 2009 at 3:11 PM, Russ P. >>> wrote: (...) >>> > Give me one use-case where you

Re: Standard IPC for Python?

2009-01-14 Thread sturlamolden
On Jan 14, 12:47 pm, Laszlo Nagy wrote: > multiprocessing.Queue cannot be used as a general message queue > between arbitrary processes. Then e.g. use Listener and Client in multiprocessing.connection to create a named pipe (AF_PIPE). Or use win32pipe.CreateNamedPipe from pywin32. > - mmap.mma

Re: Why this code is working?

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 01:57:48 -0800, Hussein B wrote: >> Well... Because it is correct ? >> >> What make you think it _shouldn't_ work ? > > Because def2 is defined after def1 in an interpreted language, not > compiled. Python is compiled. What do you think the c in .pyc stands for? And what do

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Peter Otten
gumbah wrote: > I tried all of your suggestions but none of them work... I have a clue > on why it is failing: MySQLdb seems to quote the % characters or > something... > > Even when i do: > cursor.execute("UPDATE tablename set fieldx='test' WHERE flfieldx is > null and fieldy like '%therealvalue

Re: Why this code is working?

2009-01-14 Thread Hussein B
On Jan 14, 2:21 pm, Steven D'Aprano wrote: > On Wed, 14 Jan 2009 01:57:48 -0800, Hussein B wrote: > >> Well... Because it is correct ? > > >> What make you think it _shouldn't_ work ? > > > Because def2 is defined after def1 in an interpreted language, not > > compiled. > > Python is compiled. > >

Re: os system command not found

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 02:25:52 -0800, codicedave wrote: > Hi all! > I installed a external program called infomap using the classical > procedure > > ./configure > make > sudo make install > > and it works perfectly in Terminal (Os x) using both bash and tcsh > shell What happens when you call i

Re: Why this code is working?

2009-01-14 Thread Benjamin Kaplan
On Wed, Jan 14, 2009 at 7:59 AM, Hussein B wrote: > On Jan 14, 2:21 pm, Steven D'Aprano cybersource.com.au> wrote:a > > On Wed, 14 Jan 2009 01:57:48 -0800, Hussein B wrote: > > >> Well... Because it is correct ? > > > > >> What make you think it _shouldn't_ work ? > > > > > Because def2 is defin

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Benjamin Kaplan
On Wed, Jan 14, 2009 at 7:07 AM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Wed, 14 Jan 2009 10:53:33 +, Marc 'BlackJack' Rintsch wrote: > > > On Wed, 14 Jan 2009 07:14:06 +, Steven D'Aprano wrote: > > > >> On Wed, 14 Jan 2009 15:25:38 +1000, James Mills wrote: > >

Re: Why this code is working?

2009-01-14 Thread Diez B. Roggisch
r wrote: > Listen Hussien, Granted, with a name of "r", spelling it wrong is hard, and thus you might not be trained in the art of spelling names proper. But I suggest you try your best. After all, you posts lack so much in content, you could at least excel in form... > In python you do not have

Re: ctype problem

2009-01-14 Thread Nick Craig-Wood
Grimson wrote: > hello out there, > I have a problem with c-types. > I made a c-library, which expects a pointer to a self defined structure. > > let the funtion call myfunction(struct interface* iface) > > and the struct: > struct interface > { > int a; > int b; > char *c;

Re: are there some special about '\x1a' symbol

2009-01-14 Thread Grant Edwards
On 2009-01-14, Steve Holden wrote: > Unknown wrote: >> On 2009-01-12, John Machin wrote: >> >>> I didn't think your question was stupid. Stupid was (a) CP/M recording >>> file size as number of 128-byte sectors, forcing the use of an in-band >>> EOF marker for text files (b) MS continuing to reg

Re: why cannot assign to function call

2009-01-14 Thread Aaron Brady
On Jan 14, 3:51 am, Mark Wooding wrote: > Aaron Brady wrote: > > On Jan 13, 5:06 pm, Mark Wooding wrote: > > snip > > > I'm going to move away from the formal semantics stuff and try a > > > different tack.  Here's what I think is the defining property of > > > pass-by-value (distilled from the

Re: [OT] Re: are there some special about '\x1a' symbol

2009-01-14 Thread Grant Edwards
On 2009-01-14, Gabriel Genellina wrote: > En Tue, 13 Jan 2009 22:04:33 -0200, Terry Reedy > escribió: > >> Gabriel Genellina wrote: >>> En Mon, 12 Jan 2009 12:00:16 -0200, John Machin >>> escribió: >>> I didn't think your question was stupid. Stupid was (a) CP/M recording file size

can someone tell me why this doesn't work please python 3

2009-01-14 Thread garywood
def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if password in ('n', 'no', 'nope'): return False retries = retries - 1 if retries < 0:

Re: pep 8 constants

2009-01-14 Thread Benjamin Kaplan
On Wed, Jan 14, 2009 at 3:13 AM, Steven D'Aprano < ste...@remove.this.cybersource.com.au> wrote: > On Tue, 13 Jan 2009 23:26:54 -0800, Brendan Miller wrote: > > > I tend to use constants as a means of avoiding the proliferation of > > magic literals for maintenance reasons... Like say if your exam

Re: os system command not found

2009-01-14 Thread codicedave
On 14 Gen, 13:16, Steven D'Aprano wrote: > On Wed, 14 Jan 2009 02:25:52 -0800, codicedave wrote: > > Hi all! > > I installed a external program called infomap using the classical > > procedure > > > ./configure > > make > > sudo make install > > >  and it works perfectly in Terminal (Os x) using b

Re: os system command not found

2009-01-14 Thread Diez B. Roggisch
codicedave wrote: > On 14 Gen, 13:16, Steven D'Aprano cybersource.com.au> wrote: >> On Wed, 14 Jan 2009 02:25:52 -0800, codicedave wrote: >> > Hi all! >> > I installed a external program called infomap using the classical >> > procedure >> >> > ./configure >> > make >> > sudo make install >> >> >

Re: initialising a class by name

2009-01-14 Thread Sion Arrowsmith
Krishnakant wrote: >By the way, is there a kind of global list of modules/classes which are >maintained in a package once the program is loaded into memory? sys.modules is a dict of loaded module objects, keyed by module name. So: >>> getattr(sys.modules["sys"], "version_info") (2, 5, 0, 'final

Twisted Trial - Framework for Test

2009-01-14 Thread wladimir
Hi, Somebody have some tutorial or examples using Twisted Trial?? -- View this message in context: http://www.nabble.com/Twisted-Trial---Framework-for-Test-tp21456710p21456710.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinf

Re: LGPL license for Qt 4.5

2009-01-14 Thread drobi...@gmail.com
On Jan 14, 7:57 am, sturlamolden wrote: > According to a Norwegian publication, Nokia will release Qt under LGPL > as of version 4.5. > > If I had stocks in Riverbank Computing ltd., I would sell them now... > > For the rest of us, this is fantastic news. > > http://digi.no/php/art.php?id=800922

Re: LGPL license for Qt 4.5

2009-01-14 Thread sturlamolden
On Jan 14, 3:11 pm, "drobi...@gmail.com" wrote: > On Jan 14, 7:57 am, sturlamolden wrote: > > > According to a Norwegian publication, Nokia will release Qt under LGPL > > as of version 4.5. > > > If I had stocks in Riverbank Computing ltd., I would sell them now... > > > For the rest of us, this

Re: Understanding search queries, semantics, and "Meaning" ...aren't we all looking for meaning?

2009-01-14 Thread Aahz
In article <82372457-2503-4682-96b3-37540328b...@w39g2000prb.googlegroups.com>, <5lvqbw...@sneakemail.com> wrote: > >I have Section 4.4.1 of SICP rattling around in my head (database >queries), and I'm trying to come up with a simple dictionary-based >database in Python to represent circuit diagra

Re: os system command not found

2009-01-14 Thread Daniel da Silva
On Jan 14, 5:25 am, codicedave wrote: > Hi all! > I installed a external program called infomap using the classical > procedure > > ./configure > make > sudo make install > >  and it works perfectly in Terminal (Os x) using both bash and tcsh > shell > > admins-macbook-pro-2:~ unil$ infomap-build

pyjamas 0.4p1 release

2009-01-14 Thread Luke Kenneth Casson Leighton
This is a minor patch release of pyjamas 0.4p1, the Python-to-Javascript compiler and Python Web UI Widgets Toolkit. What is Pyjamas for? Pyjamas allows a developer to create U.I applications in python as if the Web Browser was a Desktop Widget Set toolkit platform (like pygtk2, pywxWidgets and p

Re: can someone tell me why this doesn't work please python 3

2009-01-14 Thread Gary M. Josack
garywood wrote: def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if password in ('n', 'no', 'nope'): return False retries = retries - 1 if retri

Re: can someone tell me why this doesn't work please python 3

2009-01-14 Thread Ben Kaplan
On Jan 14, 2009, at 9:44 AM, "Gary M. Josack" wrote: garywood wrote: def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if password in ('n', 'no', 'nope'): retur

Re: can someone tell me why this doesn't work please python 3

2009-01-14 Thread Gary M. Josack
Ben Kaplan wrote: On Jan 14, 2009, at 9:44 AM, "Gary M. Josack" wrote: garywood wrote: def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if password in ('n', '

Re: Why this code is working?

2009-01-14 Thread Bruno Desthuilliers
Hussein B a écrit : On Jan 14, 11:55 am, Bruno Desthuilliers wrote: Hussein B a écrit : Hey, Why this code is working? def f1( ): ... x = 88 ... f2(x) ... def f2(x): ... print x ... f1( ) 88 Well... Because it is correct ? What make you think it _shouldn't_ work ? Bec

Re: Why this code is working?

2009-01-14 Thread Bruno Desthuilliers
Hussein B a écrit : On Jan 14, 2:21 pm, Steven D'Aprano wrote: On Wed, 14 Jan 2009 01:57:48 -0800, Hussein B wrote: Well... Because it is correct ? What make you think it _shouldn't_ work ? Because def2 is defined after def1 in an interpreted language, not compiled. Python is compiled. (sn

Re: are there some special about '\x1a' symbol

2009-01-14 Thread Mel
Steve Holden wrote: > Unknown wrote: >> On 2009-01-12, John Machin wrote: >>> I didn't think your question was stupid. Stupid was (a) CP/M recording >>> file size as number of 128-byte sectors, forcing the use of an in-band >>> EOF marker for text files (b) MS continuing to regard Ctrl-Z as an EOF

Re: can someone tell me why this doesn't work please python 3

2009-01-14 Thread Michael Hartl
garywood schrieb: def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if password in ('n', 'no', 'nope'): return False retries = retries - 1 if ret

Re: initialising a class by name

2009-01-14 Thread Nick Craig-Wood
Krishnakant wrote: > I liked this idea of dispatchTable. > is it possible to say some thing like > inst = dispatchTable{"ham"} > according to me, inst will become the instance of class ham. > Another thing to note is that all the classes are in different modules. > So where do I create the

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Marco Mariani
Steve Holden wrote: 3. I can't be certain my experience with PostgreSQL extends to MySQl, but I have done experiments which prove to my satisfaction that it isn't possible to parameterize LIKE arguments. So the only way to do it appears to be to build the query yourself. Or using Postgres thro

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > > If the programmer could > > somehow disallow it in certain classes, > > Already possible - you just have to provide your own implementation of > __setattr__. Part of the idea of non-dynamic attribute sets is to make the program run faster, not slower. -- http://ma

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Luis Zarrabeitia
On Wednesday 14 January 2009 02:22:45 am Paul Rubin wrote: > 2. There is also nothing inherent in a dynamic OO language that says > that class descriptors have to be mutable, any more than strings have > to be mutable (Python has immutable strings).  I agree that being able > to modify class descri

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Mel
Russ P. wrote: > On Jan 13, 11:40 pm, Steven D'Aprano > wrote: > >> But, gosh darn it, wouldn't it be nice to program the critical parts of >> your code in "strict Python", and leave the rest as "trusting Python", >> instead of having to use Java for the lot just to get strictness in the >> crit

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Luis Zarrabeitia
On Tuesday 13 January 2009 09:57:04 pm Terry Reedy wrote: > Russ P. wrote: > public = no leading underscore > private = one leading underscore > protected = two leading underscores Aren't the last two reversed? protected = one leading underscore [both you and your subclasses should access it] pr

  1   2   3   >