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

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

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

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

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

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

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

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

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

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

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

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

<    1   2   3