Re: initialising a class by name

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 11:49 PM, 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 windo

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

2009-01-13 Thread Paul Rubin
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 other systems I > worked on didn't even use scoping, let alone encapsulation. Whe

Re: initialising a class by name

2009-01-13 Thread Steven D'Aprano
On Wed, 14 Jan 2009 11:16:58 +0530, 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. Not strange at all. > Is this possible in python and how? Of course. Just u

Re: initialising a class by name

2009-01-13 Thread Krishnakant
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 window is coupled with one py file (module) containing one class th

Re: read string in bits

2009-01-13 Thread ts
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 convert it myself into 1010101 or there is a librar

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

2009-01-13 Thread Steven D'Aprano
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 >> accidental usage of an internal variable. Trust would be repl

Re: WebDAV client module

2009-01-13 Thread Vincent Gulinao
Um.. and I can't seem to find any sample code of it around. Can anybody share a simple snippet of how to use it? I don't understand what's URI in PutFile method is suppose to be. TIA. On Tue, Jan 13, 2009 at 8:03 PM, Vincent Gulinao wrote: > Kindly point me to a good WebDAV client module for Py

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

2009-01-13 Thread Steve Holden
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 >> decades after peopl

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

2009-01-13 Thread Carl Banks
On Jan 13, 11:35 pm, "Russ P." wrote: > I suggest you call Boeing and tell them that encapsulation is more > trouble than it's worth for their 787 flight software. But please > don't do it if you ever wish to work for them, because you will be > proving conclusively that you don't have a clue abou

Re: read string in bits

2009-01-13 Thread Chris Rebert
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 convert it myself into 1010101 or there is a library in > python that enable me to do that? It's no

Re: pep 8 constants

2009-01-13 Thread Brendan Miller
> FOO = 1 > > def f(x=FOO): > ... > > > Use this instead: > > def f(x=1): > ... 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

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

2009-01-13 Thread Paul Rubin
"James Mills" writes: > Python is a dynamic object oriented language ... (almost verbatim > from the website). It is compiled to bytecode and run on a virtual > machine. 1. There is nothing inherent about dynamic languages that prevents them from being compiled. There are compiled implementatio

read string in bits

2009-01-13 Thread ts
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 convert it myself into 1010101 or there is a library in python that enable me to do that? -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-13 Thread Steven D'Aprano
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 enforced as such ? >> >> You're kidding, right? Think about a ten-milli

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Steve Holden
ajaksu wrote: > On Jan 13, 1:33 am, Philip Semanchuk wrote: >> I don't think I understand you clearly. Whether or not Google et al >> whitelist the Python UA isn't a Python issue, is it? > > Hi, sorry for taking so long to reply :) > > I imagine it's something akin to Firefox's 'Report broken

Re: pep 8 constants

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 4:49 PM, Brendan Miller wrote: > PEP 8 doesn't mention anything about using all caps to indicate a constant. > > Is all caps meaning "don't reassign this var" a strong enough > convention to not be considered violating good python style? I see a > lot of people using it, bu

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 4:35 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "James Mills" writes: >> Bare in mind also, that enfocing access control / policing as you >> called it has a performance hit as the machine (the Python vm) >> has to perform checks each time members of an object

pep 8 constants

2009-01-13 Thread Brendan Miller
PEP 8 doesn't mention anything about using all caps to indicate a constant. Is all caps meaning "don't reassign this var" a strong enough convention to not be considered violating good python style? I see a lot of people using it, but I also see a lot of people writing non-pythonic code... so I th

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

2009-01-13 Thread Paul Rubin
"James Mills" writes: > Bare in mind also, that enfocing access control / policing as you > called it has a performance hit as the machine (the Python vm) > has to perform checks each time members of an object are accessed. It's the other way around. If the compiler knows that you aren't creatin

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:35 PM, Russ P. wrote: > You know what? The more I think about the kind of nonsense you and > others are spouting here, the more annoyed I get. I will gladly agree > that encapsulation may be more trouble than it's worth for small > applications, maybe even some medium siz

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:11 PM, Russ P. wrote: > I think you are the one who is confused. Part of the problem here is > that the term "encapsulation" has at least two widely used meanings > (in the context of programming). In one sense, it just means grouping > data and methods together. In anoth

Re: initialising a class by name

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 9:46 PM, 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 rea

initialising a class by name

2009-01-13 Thread Krishnakant
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 management system and products b

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

2009-01-13 Thread Russ P.
On Jan 13, 7:50 pm, Carl Banks wrote: > You know what?  Computer science buzzwords mean jack squat to me.  I > don't give a horse's tail whether some people label it a fundamental > concept of object-oriented programming or not.  I think it's a bad > thing.  And it's a bad thing for exactly the r

Re: executing multiple functions in background simultaneously

2009-01-13 Thread Michele Simionato
On Jan 14, 2:02 am, 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: Does Python really follow its philosophy of "Readability counts"?

2009-01-13 Thread James Mills
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 enforced as such ? > > You're kidding, right? Think about a ten-million line program being > developed by 100 developers. No I"m so

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

2009-01-13 Thread Russ P.
On Jan 13, 7:32 pm, "James Mills" wrote: > On Wed, Jan 14, 2009 at 1:18 PM, Russ P. wrote: > > Yes, but the fact that you can approximate OO programming in a > > particular language does not make that language object oriented. You > > can approximate OO programming in C, but that does not mean th

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 11:26 PM, drobi...@gmail.com wrote: On Jan 13, 5:08 pm, Philip Semanchuk wrote: On Jan 13, 2009, at 4:31 PM, drobi...@gmail.com wrote: On Jan 13, 2:37 pm, Philip Semanchuk wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library

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

2009-01-13 Thread r
Here is a piece of C code this same guy showed me saying Pythonic indention would make this hard to read -- Well lets see then! I swear, before god, this is the exact code he showed me. If you don't believe me i will post a link to the thread. // Warning ugly C code ahead! if( is_opt_data() < si

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

2009-01-13 Thread Russ P.
On Jan 13, 7:50 pm, Carl Banks wrote: > On Jan 13, 6:45 pm, "Russ P." wrote: > > > > > On Jan 13, 3:07 pm, Carl Banks wrote: > > > > I've seen no evidence that any Python project is moving even remotely > > > toward data encapsulation.  That would be a drastic change.  Even if > > > it were only

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

2009-01-13 Thread Roy Smith
In article , "Russ P." wrote: > I can claim that Python is not strictly object oriented until it > gets encapsulation (in the sense of data hiding). That is simply a > fact, and no amount of pleading or obfuscation will change it. I have no idea if Python is strictly anything. What I do know

Re: Weird behaviour re: Python on Windows

2009-01-13 Thread Jerry Hill
On Tue, Jan 13, 2009 at 5:29 PM, Kevin Jing Qiu wrote: > I've been experiencing weird behavior of Python's os module on Windows: > > Here's the environment: > Box1: Running Windows 2003 Server with Apache+mod_python > Box2: Running Windows 2003 Server with Zope/Plone and Z:\ mapped to D:\ > on Box

Re: Standard IPC for Python?

2009-01-13 Thread drobi...@gmail.com
On Jan 13, 5:08 pm, Philip Semanchuk wrote: > On Jan 13, 2009, at 4:31 PM, drobi...@gmail.com wrote: > > > On Jan 13, 2:37 pm, Philip Semanchuk wrote: > >> I was suggesting getting posix_ipc or sysv_ipc to compile against a > >> compatibility library (Cygwin?) under Windows. It sounds like you're

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

2009-01-13 Thread r
On Jan 13, 9:50 pm, Carl Banks wrote: [snip] it gives > the library implementor the power to dictate to the user how they can > and can't use the library.  The cultural impact that would have on the > community is far worse, IMHO, than any short-sighted benefits like > being able to catch an accid

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:50 PM, Carl Banks wrote: > 1. Wise people don't believe everything that is written on Wikipedia. > 2. The person who wrote that line in Python.org is a wise person. Agreed. > You know what? Computer science buzzwords mean jack squat to me. I > don't give a horse's tai

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

2009-01-13 Thread Carl Banks
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 accidental usage of an internal variable. > Trust would be replaced by mistrust, and programming in Python would > go fro

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 9:42 PM, ajaksu wrote: On Jan 13, 1:33 am, Philip Semanchuk wrote: I don't think I understand you clearly. Whether or not Google et al whitelist the Python UA isn't a Python issue, is it? Hi, sorry for taking so long to reply :) I imagine it's something akin to Firefox'

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

2009-01-13 Thread Carl Banks
On Jan 13, 6:45 pm, "Russ P." wrote: > On Jan 13, 3:07 pm, Carl Banks wrote: > > > I've seen no evidence that any Python project is moving even remotely > > toward data encapsulation.  That would be a drastic change.  Even if > > it were only a minor change in the implementation (and it would not

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:31 PM, r wrote: >> public = no leading underscore >> private = one leading underscore >> protected = two leading underscores >> >> Python uses encapsulation by convention rather than by enforcement. > > Very well said Terry! > > I like that python does not force me to do

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:25 PM, Rhodri James wrote: > I wouldn't violently object to having some means of policing class > or module privacy, but it does have consequences. When it's a > convention, you can break it; when it isn't, you can't, even if > you do have good reason. Add that to the o

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

2009-01-13 Thread r
> public = no leading underscore > private = one leading underscore > protected = two leading underscores > > Python uses encapsulation by convention rather than by enforcement. Very well said Terry! I like that python does not force me to do "everything" but does force things like parenthesis in

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 1:18 PM, Russ P. wrote: > Yes, but the fact that you can approximate OO programming in a > particular language does not make that language object oriented. You > can approximate OO programming in C, but that does not mean that C is > an OO language. Wrong. Not having stric

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

2009-01-13 Thread Rhodri James
On Wed, 14 Jan 2009 02:27:09 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: But, if something is done by convention, then departing from the convention is by definition unconventional. If you do something unconventional in a program, it could be on purpose for a reason, or it could

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

2009-01-13 Thread Russ P.
On Jan 13, 6:04 pm, "James Mills" wrote: > On Wed, Jan 14, 2009 at 11:50 AM, Russ P. wrote: > > Here's the definition on the Wikipedia page for object oriented > > programming (and it does *not* sound like Python classes): > > > Encapsulation conceals the functional details of a class from object

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 12:57 PM, Terry Reedy wrote: > public = no leading underscore > private = one leading underscore > protected = two leading underscores > > Python uses encapsulation by convention rather than by enforcement. As mentioned previously this is not encapsulation, but access cont

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

2009-01-13 Thread Terry Reedy
Russ P. wrote: On Jan 13, 5:29 pm, alex23 wrote: On Jan 14, 10:45 am, "Russ P." wrote: The Wikipedia entry for "object-oriented programming" also lists encapsulation as a "fundamental concept." The Wikipedia entry for "encapsulation" defines it as "the grouping together of data and function

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 6:41 PM, Mel wrote: Philip Semanchuk wrote: I'm working on message queue support, but the Sys V IPC API is a headache and takes longer to code against than the POSIX API. I hadn't found it that bad. I have a C extension I should perhaps clean up and make public. Ha

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread ajaksu
On Jan 13, 1:33 am, Philip Semanchuk wrote: > I don't think I understand you clearly. Whether or not Google et al   > whitelist the Python UA isn't a Python issue, is it? Hi, sorry for taking so long to reply :) I imagine it's something akin to Firefox's 'Report broken website': evangelism. IMH

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 12:27 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> 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 con

Re: problem calling method

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:28 AM, wrote: > class MyFrame(wx.Frame): >def __init__(self, *args, **kwds): It might be helpful here if you called the parent __init__. Like so: class MyFrame(wx.Frame): def __init__(self, *args, **kwds): super(MyFrame, self).__init__(*args, **kwargs) .

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

2009-01-13 Thread Paul Rubin
"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. If you do somet

Re: Programming friction

2009-01-13 Thread Jervis Whitley
On Wed, Jan 14, 2009 at 12:29 PM, killsto wrote: > > force. So lets say I am slowing down at a rate of -2m/s^2, if I hit 1, > the next number will be -1 and I shoot off in the other direction. How > do I fix this an still have backwards movement? > -- > http://mail.python.org/mailman/listinfo/pyt

Re: why cannot assign to function call

2009-01-13 Thread Aaron Brady
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 of the symbolism): > >   The calle

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

2009-01-13 Thread Christian Heimes
Ivan Illarionov schrieb: > 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: > (boilerplate removed) > PyImport_ImportModule("sys") > PyObject_GetAttrString(sysmod_pointer, "path") > PyList_Insert

Re: ctype problem

2009-01-13 Thread Mark Tolonen
"Aaron Brady" wrote in message news:6197f37d-0ea0-4430-a466-2f36b2011...@v42g2000yqj.googlegroups.com... On Jan 13, 10:22 am, 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 myfuncti

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

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:50 AM, Russ P. wrote: > Here's the definition on the Wikipedia page for object oriented > programming (and it does *not* sound like Python classes): > > Encapsulation conceals the functional details of a class from objects > that send messages to it. ... Encapsulation is

problem calling method

2009-01-13 Thread pieterprovoost
I'm trying to call a method within my wx frame, but that doesn't seem to work. What am I doing wrong? class MyFrame(wx.Frame): def __init__(self, *args, **kwds): self.Bind(wx.EVT_BUTTON, self.test, self.testbutton) ... def sendmail(self): ... def test(self, even

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

2009-01-13 Thread Ivan Illarionov
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: (boilerplate removed) PyImport_ImportModule("sys") PyObject_GetAttrString(sysmod_pointer, "path") PyList_Insert(pathobj_pointer, 0, path_python_str) --

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

2009-01-13 Thread Russ P.
On Jan 13, 5:29 pm, alex23 wrote: > On Jan 14, 10:45 am, "Russ P." wrote: > > > The Wikipedia entry for "object-oriented programming" also lists > > encapsulation as a "fundamental concept." > > The Wikipedia entry for "encapsulation" defines it as "the grouping > together of data and functionali

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

2009-01-13 Thread Grant Edwards
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 > decades after people stopped writing Ctrl-

Re: New Python 3.0 string formatting - really necessary?

2009-01-13 Thread Arlo Belshee
For R, and others who haven't read the PEP or worked a lot with the web, here are some really strong advantages of the new string formatting over the old. Note: I'm not saying that you have to use one or the other. I'm just pointing out some of the things that the new format gives us - things whic

Re: executing multiple functions in background simultaneously

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:35 AM, MRAB wrote: > The disadvantage of threads in Python (CPython, actually) is that > there's the GIL (Global Interpreter Lock), so you won't get any speed > advantage if the threads are mostly processor-bound. The OP didn't really say what this function does :) *sig

Re: executing multiple functions in background simultaneously

2009-01-13 Thread MRAB
James Mills wrote: On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: I would like to spawn off multiple instances of a function and run them simultaneously and then wait until they all complete. Currently I'm doing this by calling them as sub-processes executable from the command-lin

Re: Programming friction

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:29 AM, killsto wrote: > I'm trying to implement a basic user controlled sliding box with > pygame. I have everything worked out, except for two things. Try the pygame mailing list :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-13 Thread alex23
On Jan 14, 10:45 am, "Russ P." wrote: > The Wikipedia entry for "object-oriented programming" also lists > encapsulation as a "fundamental concept." The Wikipedia entry for "encapsulation" defines it as "the grouping together of data and functionality". That sounds like Python classes & modules

Programming friction

2009-01-13 Thread killsto
I'm trying to implement a basic user controlled sliding box with pygame. I have everything worked out, except for two things. The acceleration is changed once a second (for meters/second) this leads to very jumpy movement. I need to add a way to check how long it takes the program to loop and mult

Re: executing multiple functions in background simultaneously

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: > I would like to spawn off multiple instances of a function > and run them simultaneously and then wait until they all complete. > Currently I'm doing this by calling them as sub-processes > executable from the command-line. Is there a w

executing multiple functions in background simultaneously

2009-01-13 Thread Catherine Moroney
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 and then wait until they all complete. Currently I'm doing

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

2009-01-13 Thread Russ P.
On Jan 13, 3:07 pm, Carl Banks wrote: > I've seen no evidence that any Python project is moving even remotely > toward data encapsulation. That would be a drastic change. Even if > it were only a minor change in the implementation (and it would not > be), it would be a major stroke in the Pytho

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:40 AM, Laszlo Nagy wrote: > Can anyone tell me if select.select works under OS X? Yes it does. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 2:25 AM, Laszlo Nagy wrote: > The question is: what is the standard way to implement fast and portable IPC > with Python? Are there tools in the standard lib that can do this? Certainly not standard by any means, but I use circuits (1). Two or more processes can communicat

Re: python3.0 MySQLdb

2009-01-13 Thread Daniel Fetchinson
I need something to connect to a database, preferably mysql, that works in python3.0 please. >>> And your question is? >>> >>> >> Surely it's fairly obvious that the question is "does such a thing >> exist, and if so where can I find it?". > > Interestingly enough, the question was slight

Re: Extracting real-domain-name (without sub-domains) from a given URL

2009-01-13 Thread Terry Reedy
S.Selvam Siva wrote: I doubt anyone's created a general ready-made solution for this, you'd have to code it yourself. To handle the common case, you can cheat and just .split() at the periods and then slice and rejoin the list of domain parts, ex: '.'.join(domain.split('.')[-2:]) Cheers, Chris

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread John Machin
On Jan 14, 9:56 am, Andy Grove wrote: > On Jan 13, 3:08 pm, John Machin wrote: > > > Please show the full traceback. > > John, > > Thanks. Here it is: > >   File "/Library/Frameworks/Python.framework/Versions/3.0/lib/ > python3.0/socketserver.py", line 281, in _handle_request_noblock >     self.p

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

2009-01-13 Thread Terry Reedy
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 marker for text files (b) MS continuing to regard Ctrl-Z as an E

Re: Could you suggest optimisations ?

2009-01-13 Thread Terry Reedy
Barak, Ron wrote: Hi, In the attached script, the longest time is spent in the following functions (verified by psyco log): I cannot help but wonder why and if you really need all the rigamorole with file pointers, offsets, and tells instead of for line in open(...): do your processing.

Re: Standard IPC for Python?

2009-01-13 Thread Terry Reedy
Laszlo Nagy wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? OK I see. But probably I do not want to use Cygwin because that would create another depende

Re: Standard IPC for Python?

2009-01-13 Thread Mel
Philip Semanchuk wrote: > I'm working on message queue support, but the Sys V IPC API is a > headache and takes longer to code against than the POSIX API. I hadn't found it that bad. I have a C extension I should perhaps clean up and make public. Mel. -- http://mail.python.org/mailman/

cgi.FieldStorage hanging with Python 3.0 (but works with 2.5.1)

2009-01-13 Thread Andy Grove
I'm trying to get a Python web server running that I can upload files to. I actually have the code running with the version of Python pre- installed on Mac OS X but it doesn't work with ActivePython 3.0 - I have not been able to compile Python from source myself to see if the issue is specific to t

Re: why cannot assign to function call

2009-01-13 Thread Mark Wooding
Steven D'Aprano wrote: > I found it interesting. Well, that's something, at any rate. > I think this conversation is reaching it's natural end. Frustration > levels are rising. I think you may be right. That said... > So I'm going to take a different tack in an attempt to reduce > frustrat

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread Andy Grove
I don't fully understand this but if I pass in "str(qs)" instead of "qs" then the call works. However, qs is returned from file.read() operation so shouldn't that be a string already? In case it's not already obvious, I am new to Python :-) .. so I'm probably missing something here. -- http://mail

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

2009-01-13 Thread Carl Banks
On Jan 13, 4:03 pm, Paul Rubin wrote: > Bruno Desthuilliers writes: > > And that's the problem : what Paul suggests are not "improvements" but > > radical design changes. > > Eh?  I think of them as moderate and incremental improvements, in a > direction that Python

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

2009-01-13 Thread Ben Sizer
I have the following C++ code and am attempting to embed Python 2.5, but although the "import sys" statement works, attempting to reference "sys.path" from inside a function after that point fails. It's as if it's not treating it as a normal module but as any other global variable which I'd have to

Re: python3.0 MySQLdb

2009-01-13 Thread Martin v. Löwis
Steve Holden wrote: > Daniel Fetchinson wrote: >>> I need something to connect to a database, preferably mysql, that >>> works in python3.0 please. >> And your question is? >> >> > Surely it's fairly obvious that the question is "does such a thing > exist, and if so where can I find it?". Interes

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread Andy Grove
On Jan 13, 3:08 pm, John Machin wrote: > Please show the full traceback. John, Thanks. Here it is: File "/Library/Frameworks/Python.framework/Versions/3.0/lib/ python3.0/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/Library/

Weird behaviour re: Python on Windows

2009-01-13 Thread Kevin Jing Qiu
I've been experiencing weird behavior of Python's os module on Windows: Here's the environment: Box1: Running Windows 2003 Server with Apache+mod_python Box2: Running Windows 2003 Server with Zope/Plone and Z:\ mapped to D:\ on Box1 It appears any os calls that deals with file/dir on the mapped d

Re: Scheduled Tasks - SetFlags

2009-01-13 Thread Roger Upole
kj7ny wrote: > How do I enable/disable a scheduled task using Python? > > I can get to a task: > >self.ts=pythoncom.CoCreateInstance > (taskscheduler.CLSID_CTaskScheduler,None,pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) >self.ts.SetTargetComputer(u'SomeServ

Pydev 1.4.2 Released

2009-01-13 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.4.2 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ---

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread John Machin
On Jan 14, 6:54 am, ag73 wrote: > Hi, > > I am trying to parse data posted to a Python class that extends > http.server.BaseHTTPRequestHandler. Here is the code I am using: > >         def do_POST(self): >                 ctype, pdict = cgi.parse_header(self.headers['Content-Type']) >            

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 4:31 PM, drobi...@gmail.com wrote: On Jan 13, 2:37 pm, Philip Semanchuk wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? It's not rea

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 3:04 PM, Laszlo Nagy wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? OK I see. But probably I do not want to use Cygwin because t

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

2009-01-13 Thread Paul Rubin
Bruno Desthuilliers writes: > And that's the problem : what Paul suggests are not "improvements" but > radical design changes. Eh? I think of them as moderate and incremental improvements, in a direction that Python is already moving in. Radical would be something like a full-scale static type

Re: ctype problem

2009-01-13 Thread Aaron Brady
On Jan 13, 10:22 am, 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; >    

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread John Machin
On Jan 13, 5:36 pm, Steve Holden wrote: > Miles wrote: > > On Tue, Jan 13, 2009 at 12:02 AM, imageguy wrote: > >> Using py2.5.4 and entering the following lines in IDLE, I don't really > >> understand why I get the result shown in line 8. > > >> Note the difference between lines 7 and 10 is that

Re: Standard IPC for Python?

2009-01-13 Thread Aaron Brady
On Jan 13, 2:04 pm, Laszlo Nagy wrote: > - create a wrapper, using ctypes, /windll / cdll/ to access API functions > - use CreateFileMapping on the page file to create shared memory (a la > windows:http://msdn.microsoft.com/en-us/library/aa366537.aspx) > - use CreateEvent/WaitForSingleObject for s

Re: Standard IPC for Python?

2009-01-13 Thread drobi...@gmail.com
On Jan 13, 2:37 pm, Philip Semanchuk wrote: > On Jan 13, 2009, at 2:01 PM, Laszlo Nagy wrote: > > > > >> I realize that lack of Windows support is a big minus for both of   > >> these modules. As I said, any help getting either posix_ipc or   > >> sysv_ipc working under Windows would be much appre

Reminder: Calgary Python User Group - 1st Meeting tomorrow - Wed Jan 14

2009-01-13 Thread Greg
Our first meeting is tomorrow night at: Good Earth Cafe, 1502 11 Street SW, Calgary, AB Wed Jan 14, 7pm - 8pm Topic: Google App Engine http://www.google.com/calendar/event?eid=Z2Q0cDdpYmJobzVzbzZobXJxbTc2OHUxYW9fMjAwOTAxMTVUMDIwMDAwWiBhZG1pbkBweXRob25jYWxnYXJ5LmNvbQ&ctz=America/Edmonton Google

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

2009-01-13 Thread Russ P.
On Jan 13, 9:47 am, Bruno Desthuilliers wrote: > Steven D'Aprano a écrit : > > > On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote: > > >> Bruno Desthuilliers writes: > >>> Why on earth are you using Python if you don't like the way it work ??? > >> Why on earth keep releasing new versions of

Re: Read binary file and dump data in

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 12:02 PM, Santiago Romero wrote: > > Hi. > > Until now, all my python programs worked with text files. But now I'm > porting an small old C program I wrote lot of years ago to python and > I'm having problems with datatypes (I think). > > some C code: > > fp = fopen( fi

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread imageguy
On Jan 13, 1:01 am, Miles wrote: > On Tue, Jan 13, 2009 at 12:02 AM, imageguy wrote: > > Using py2.5.4 and entering the following lines in IDLE, I don't really > > understand why I get the result shown in line 8. > > > Note the difference between lines 7 and 10 is that 'else' clause > > result en

  1   2   >