Re: GUIs - A Modest Proposal
Yeah. I get the policy in general, a proliferation of ctypes stuff could be very bad -- but if code is very careful with type-checking and stuff, it should be possible to get an exception, I'd hope. Only if you can live with the respective module not being available all the time. The issue is not that you may mistakes in the ctypes code, thus allowing users to crash Python. The issue is that if users remove ctypes (which they may want to do because it's not trustworthy), then your module will stop working (unless you have a fallback for the case that ctypes is unavailable). In general, it's undesirable that absence of some module causes a different module to stop working in the standard library, except that absence of Tkinter clearly causes IDLE and turtle to stop working. Otherwise it makes certain windows-workarounds very problematic. You basically /have/ to write a C extension :| That's not problematic at all, for the standard library. Just write that C extension. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
pyreadline: default editable input; please, help.
I would like to run this minimal example: I get the prompt
(Question?), but not the 'default editable signal'. Please ¿any hints?
(Windows XP-SP3, Python 2.6, pyreadline 1.5)
import readline
def input_default(prompt, default):
def startup_hook():
readline.insert_text(default)
readline.set_startup_hook(startup_hook)
try:
return raw_input(prompt)
finally:
readline.set_startup_hook(None)
print input_default("Question?", default="default editable answer")
--
http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
tfgordon writes: > Consider Clojure: http://clojure.org/ > > You might want to watch one of these videos for an overview: > > http://clojure.blip.tv/ > > There is also evidence that Clojure is currently the most popular > Lisp, more "popular" than Scheme or Common Lisp, whatever that means: > > http://www.google.com/trends?q=common+lisp,+scheme+language,+clojure Maybe you can derive that the trend for Clojure is better (not surprisingly given its youth), but using such searches for guessing absolute numbers is meaningless. For example, if you compare "Scheme language" and "Clojure language", you don't see Clojure at all. Nicolas -- http://mail.python.org/mailman/listinfo/python-list
safer ctype? (was GUIs - A modest Proposal)
On 06/12/10 08:21, Martin v. Loewis wrote: The issue is not that you may mistakes in the ctypes code, thus allowing users to crash Python. The issue is that if users remove ctypes (which they may want to do because it's not trustworthy), then your module will stop working (unless you have a fallback for the case that ctypes is unavailable). Got me thinking, is it perhaps doable to have a 'safe' ctype that is guaranteed to be in the stdlib? Perhaps crippling it in a sense that it only allows a known set of functions to be called? My gut feeling is that you open a can of worms here but I would appreciate your opinion. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
Got me thinking, is it perhaps doable to have a 'safe' ctype that is guaranteed to be in the stdlib? Perhaps crippling it in a sense that it only allows a known set of functions to be called? In some sense, a C module wrapping a selected number of functions (like the win32 extensions) is exactly that. Notice that it's not (only) the functions itself, but also the parameters. It's absolutely easy to crash Python by calling a function through ctypes that expects a pointer, and you pass an integer. The machine code will dereference the pointer (trusting that it actually is one), and crash. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
My 2nd Glade GUI with Python
Hi all I have build my first simple GUI there create users on our cooperated ftp server, and then generate a mail, with an PDF attached with credentials including a NATO phonetic edition of a random generated password. I still rejoice over it, sens it is my first "program" in 10 years. The easiness of creating this simple, but yet handy program, convinced me to become a Python Enthusiast, and I then bought O'Rely's Learning Python Fourth Edition, I'm 1/4 in to it by now, and I keep using Python to simplify my day by day work tasks. Recently I decided to make my next big GUI project, there would Include a simple backup application for our users on Windows, This app should integrand with our corporate IBM tivoli storage manager backup system, instead of the "command lin"e "black box" there calls dsmc with there areas to backup. Informing the user to, remember to shutdown Outlook, there otherwise would lock the local PST files. In my first project I found that the use of Glade 3 helped me a great deal, so I went for it again. But this time I became so much more creative :-) and wanted a About Dialog to show my name. I quickly made my GUI, and from what I know made my signals for my buttons, but I keep struggling with how I can connect the Menuitem4 (help -> About) to my About Dialog, and sense I don't know if I can connect the menuitem from Glade it self, or I have to define a "function" there show the About Dialog when Menuitem4 is active, I'm having a hard time getting on with my project. Could somebody give me a hint, to which direction I need to move along to connect my menuitem4 to my About Dialog, I really would appreciate it. I keep hitting the same tutorials on Google search, and I can't find the solution from them, even that I have watched carefully many times. Best regards Dennis Appelon Nielsn A Python Fan Boy, but a newbie... -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
Martin P. Hellwig wrote: > Martin v. Loewis wrote: > > The issue is not that you may mistakes in the ctypes code, thus > allowing > > users to crash Python. The issue is that if users remove ctypes (which > > they may want to do because it's not trustworthy), then your module will > > stop working (unless you have a fallback for the case that ctypes is > > unavailable). > > > Got me thinking, is it perhaps doable to have a 'safe' ctype that is > guaranteed to be in the stdlib? Perhaps crippling it in a sense that it > only allows a known set of functions to be called? > My gut feeling is that you open a can of worms here but I would > appreciate your opinion. Perhaps instead of restricting what functions ctypes can use, we could restrict what modules can use ctypes. For example, maybe only modules in certain directories should be allowed to import ctypes. -- --Bryan Olson -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
10.6.2010 23:14, bolega kirjoitti: Which is the best implementation of LISP family of languages for real world programming ? http://wiki.alu.org/Implementation Kindly pick one from commercial and one from open-source . The criteria is : libraries, gui interface and builder, libraries for TCP, and evolving needs. Please compare LISP and its virtues with other languages such as javascript, python etc. I put javascript in the context that it is very similar in its architecture (homoiconic ie same representation for data-structures and operations, ie hierarchical, which means nested-lists<=> n-ary tree<=> binary tree<=> linked-list<=> dictionary<=> task-subtask, and implicitly based on what C calls pointers, and at machine level the indirect addressing of memory) to lisp family. I put python in the context that it has the most extensive libraries and shares the build-fix virtue of lisp highlighted by Paul Graham in his books. Python is touted for its rapid prototyping of guis. It syntax enforces stable format which guards against programmer malice or sloppiness - so that there is a certain level of legacy code readability. Both have eval but not clear what is the implementation efficiency to justify the habit of excessively using it. Certainly, lisp/scheme are excellent for learning the concepts of programming languages due to its multi-paradigm nature and readily available code of the elementary interpreter. Is there an IDE for these lispish-scheming languages ? Is there quality implementation for Eclipse ? Emacs pre-supposes some knowledge of these so that newbie can get stuck. Also, emacs help is not very good. Is there a project whereby the internal help of emacs (analogous to its man pages) are being continuously being updated AND shared ? I have never seen updates to the help. Perhaps, the commercial people are doing it, even from the posts of the newsgroups, but the public distros or these newsgroups have NEVER made such an announcement. Explanations integrated into the help are more important than the books - its like the wikipedia incorporated into emacs. Is there support for the color highlighting of the code by hovering as on this page ? http://community.schemewiki.org/?lexical-scope Which book/paper has the briefest minimal example of gui design along XML nested/hiearchical elements with event-listeners for lisp/scheme ? Thanks I have used several available LISP systems such as the Gigamonkeys CLISP Lispbox, and the Clozure Common LISP. The system which I currently am using is the Franz Allegro Common LISP. It is a commercial product; and so far I have had no problems with the Allegro. (NB: I am using the Express version. I feel that the full scale commercial license is not exceedingly expensive.) (Right now I'm studying and working with the exercises in Peter Norvig's book Paradigms of Artificial Intelligence Programming. I have done 16 of the 25 chapters.) This is not an advertisement. If someone wishes to criticize that product, or if someone would like to suggest some other equally usable implementation, of course please feel free to do so. regards, Antti J. Ylikoski Helsinki, Finland, the E.U. -- http://mail.python.org/mailman/listinfo/python-list
First program
Hi, Trying my hand with Python but have had a small hiccup. Reading 'A byte of Python' and created helloworld.py as directed. #!/usr/bin/python # filename : helloworld.py print 'Hello World' At the terminal prompt cd to the file location and run from the prompt. p...@grumpy:~/projects/python$ python helloworld.py Hello World All fine. Then I tried the following as described in the tutorial and get the following error p...@grumpy:~/projects/python$ chmod a+x helloworld.py p...@grumpy:~/projects/python$ ./helloworld.py bash: ./helloworld.py: /usr/bin/python^M: bad interpreter: No such file or directory The permissions are: rwxr-xr-x. Any help appreciated Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
Perhaps instead of restricting what functions ctypes can use, we could restrict what modules can use ctypes. For example, maybe only modules in certain directories should be allowed to import ctypes. And that's indeed the case. The test suite may use ctypes. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
12.6.2010 12:02, Antti "Andy" Ylikoski kirjoitti: 10.6.2010 23:14, bolega kirjoitti: Which is the best implementation of LISP family of languages for real world programming ? http://wiki.alu.org/Implementation Kindly pick one from commercial and one from open-source . The criteria is : libraries, gui interface and builder, libraries for TCP, and evolving needs. Please compare LISP and its virtues with other languages such as javascript, python etc. I put javascript in the context that it is very similar in its architecture (homoiconic ie same representation for data-structures and operations, ie hierarchical, which means nested-lists<=> n-ary tree<=> binary tree<=> linked-list<=> dictionary<=> task-subtask, and implicitly based on what C calls pointers, and at machine level the indirect addressing of memory) to lisp family. I put python in the context that it has the most extensive libraries and shares the build-fix virtue of lisp highlighted by Paul Graham in his books. Python is touted for its rapid prototyping of guis. It syntax enforces stable format which guards against programmer malice or sloppiness - so that there is a certain level of legacy code readability. Both have eval but not clear what is the implementation efficiency to justify the habit of excessively using it. Certainly, lisp/scheme are excellent for learning the concepts of programming languages due to its multi-paradigm nature and readily available code of the elementary interpreter. Is there an IDE for these lispish-scheming languages ? Is there quality implementation for Eclipse ? Emacs pre-supposes some knowledge of these so that newbie can get stuck. Also, emacs help is not very good. Is there a project whereby the internal help of emacs (analogous to its man pages) are being continuously being updated AND shared ? I have never seen updates to the help. Perhaps, the commercial people are doing it, even from the posts of the newsgroups, but the public distros or these newsgroups have NEVER made such an announcement. Explanations integrated into the help are more important than the books - its like the wikipedia incorporated into emacs. Is there support for the color highlighting of the code by hovering as on this page ? http://community.schemewiki.org/?lexical-scope Which book/paper has the briefest minimal example of gui design along XML nested/hiearchical elements with event-listeners for lisp/scheme ? Thanks I have used several available LISP systems such as the Gigamonkeys CLISP Lispbox, and the Clozure Common LISP. The system which I currently am using is the Franz Allegro Common LISP. It is a commercial product; and so far I have had no problems with the Allegro. (NB: I am using the Express version. I feel that the full scale commercial license is not exceedingly expensive.) (Right now I'm studying and working with the exercises in Peter Norvig's book Paradigms of Artificial Intelligence Programming. I have done 16 of the 25 chapters.) This is not an advertisement. If someone wishes to criticize that product, or if someone would like to suggest some other equally usable implementation, of course please feel free to do so. regards, Antti J. Ylikoski Helsinki, Finland, the E.U. You said that you also want one implementation from open-source. Amongst these, the best one according to my experience is the Clozure Commmon Lisp. (Disclaimer: I have not used the Embeddable Common Lisp, and not the Armed Bear Common Lisp, and not the Clojure Commmon Lisp. The reason for this is the fact that after beginnninng to use the Allegro, I felt that I need not personally test any more Lisp implementations.) Maybe it could be a good idea for someone to write an academic study of all these available Lisp implementations. Even Interlisp still lives, as it was recently noted in this newsgroup. (I did not check the Google. Has someone alredy done so? Ie. studied the existing many Lisp implementations?) regards, Antti J. Ylikoski Helsinki, Finland, the E.U. -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
On Sat, Jun 12, 2010 at 2:03 AM, Phil H wrote: > Hi, > Trying my hand with Python but have had a small hiccup. > Reading 'A byte of Python' and created helloworld.py as directed. > > #!/usr/bin/python > # filename : helloworld.py > print 'Hello World' > > At the terminal prompt cd to the file location and run from the prompt. > > p...@grumpy:~/projects/python$ python helloworld.py > Hello World > > All fine. > > Then I tried the following as described in the tutorial and get the > following error > > p...@grumpy:~/projects/python$ chmod a+x helloworld.py > p...@grumpy:~/projects/python$ ./helloworld.py > bash: ./helloworld.py: /usr/bin/python^M: bad interpreter: No such file > or directory > > The permissions are: rwxr-xr-x. > > Any help appreciated Seems your file is using Windows line endings (CR+LF) rather than Unix line endings (just LF), which is messing up the processing of the shebang line. Run your file thru `dos2unix` (http://gd.tuwien.ac.at/linuxcommand.org/man_pages/dos2unix1.html ). Further info: http://en.wikipedia.org/wiki/Newline Also, a more generic shebang line is usually recommended: #!/usr/bin/env python Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
Phil H wrote: > Hi, > Trying my hand with Python but have had a small hiccup. > Reading 'A byte of Python' and created helloworld.py as directed. > > #!/usr/bin/python > # filename : helloworld.py > print 'Hello World' > > At the terminal prompt cd to the file location and run from the prompt. > > p...@grumpy:~/projects/python$ python helloworld.py > Hello World > > All fine. > > Then I tried the following as described in the tutorial and get the > following error > > p...@grumpy:~/projects/python$ chmod a+x helloworld.py > p...@grumpy:~/projects/python$ ./helloworld.py > bash: ./helloworld.py: /usr/bin/python^M: bad interpreter: No such file > or directory > > The permissions are: rwxr-xr-x. > > Any help appreciated > Phil Did you write your script on a windows machine? Your line endings seem to be \r\n but you need \n. You can use dos2unix to fix the line endings: $ cat -v tmp.py #!/usr/bin/python^M print 'hello world'^M $ ./tmp.py bash: ./tmp.py: /usr/bin/python^M: bad interpreter: No such file or directory $ dos2unix tmp.py $ cat -v tmp.py #!/usr/bin/python print 'hello world' $ ./tmp.py hello world $ Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: numpy arrays to python compatible arrays
On Jun 11, 12:29 am, Martin wrote: > On Jun 10, 9:02 pm, Philip Semanchuk wrote: > > > > > On Jun 10, 2010, at 9:58 AM,JavierMontoyawrote: > > > > Dear all, > > > > I'm new to python and have been working with the numpy package. I have > > > some numpy float arrays (obtained from np.fromfile and np.cov > > > functions) and would like to convert them to simple python arrays. > > > I was wondering which is the best way to do that? Is there any > > > function to do that? > > > HiJavier, > > Since you are new to Python I'll ask whether you want to convert Numpy > > arrays to Python arrays (as you stated) or Python lists. Python lists > > are used very frequently; Python arrays see very little use outside of > > numpy. > > > If you can use a Python list, the .tolist() member of the numpy array > > object should do the trick. > > > bye > > P > > as Philip said...though I very much doubt you really want to do this? > Why wouldn't you just keep it in a numpy array? Thanks for the suggestions! The main reason not to use a numpy array is because I'm using a package that doesn't work with numpy arrays. With the .tolist() conversion it's now working fine, thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
On Sat, 12 Jun 2010 09:03:43 +, Phil H wrote: > Hi, > Trying my hand with Python but have had a small hiccup. Reading 'A byte > of Python' and created helloworld.py as directed. > > Any help appreciated > Phil Thanks Peter & Chris for your prompt replies. The line ending was the problem. The script was written using Gedit on Ubuntu. Cannot find a setting in Gedit to set the line ending but it must be there somewhere so will keep looking. Also how do you see or check the line endings of a file? Thanks again Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
Antti "Andy" Ylikoski wrote: snip > Maybe it could be a good idea for someone to write an academic study > of all these available Lisp implementations. Even Interlisp still > lives, as it was recently noted in this newsgroup. (I did not check > the Google. Has someone alredy done so? Ie. studied the existing > many Lisp implementations?) > > regards, Antti J. Ylikoski > Helsinki, Finland, the E.U. Common Lisp Implementations: A Survey http://common-lisp.net/~dlw/LispSurvey.html You bring up a good point -- there are so many mature lisp implementations that you can "jump" implementations until you find one that meets your needs. -- Did you know that dolphins are just gay sharks? -- http://mail.python.org/mailman/listinfo/python-list
non-uniform distribution
Dear all, I need to generate a vector of random float numbers between [0,1] such that their sum equals 1 and that are distributed non-uniformly. Is there any python function that generates such a vector? Best wishes -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
Phil H wrote:
> On Sat, 12 Jun 2010 09:03:43 +, Phil H wrote:
>
>> Hi,
>> Trying my hand with Python but have had a small hiccup. Reading 'A byte
>> of Python' and created helloworld.py as directed.
>>
>> Any help appreciated
>> Phil
>
> Thanks Peter & Chris for your prompt replies.
> The line ending was the problem.
> The script was written using Gedit on Ubuntu.
Strange. Did you perhaps start with a file that you got from elsewhere and
modified that? Gedit may have left the CRs untouched then.
> Cannot find a setting in Gedit to set the line ending but it must be
> there somewhere so will keep looking.
> Also how do you see or check the line endings of a file?
cat -v filename
is one option. CR (or "\r", or chr(13), or carriage return) shows up as ^M.
The ^ means "subtract 64 from the byte value", e. g.
^M = chr(ord("M")-64) = chr(77-64) = chr(13)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
Le 12/06/2010 12:05, Javier Montoya a écrit : > I need to generate a vector of random float numbers between [0,1] such > that their sum equals 1 and that are distributed non-uniformly. > Is there any python function that generates such a vector? Let f any function (injective is better). Let a1,...,an n numbers uniformly distributed. Let s the sum of f(a1),...,f(an). f(a1)/s, ... , f(an)/s is what you want. You have to choose f to obtain the distribution you prefer. -- Etienne -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
On Sat, 12 Jun 2010 12:51:18 +0200, Peter Otten wrote:
> Phil H wrote:
>> The script was written using Gedit on Ubuntu.
>
> Strange. Did you perhaps start with a file that you got from elsewhere
> and modified that? Gedit may have left the CRs untouched then.
>
>> Cannot find a setting in Gedit to set the line ending but it must be
>> there somewhere so will keep looking.
Found it. When using 'save as' there is an option box at the bottom where
you can select the line ending. Simple when you know how :)
>> Also how do you see or check the line endings of a file?
>
> cat -v filename
> is one option. CR (or "\r", or chr(13), or carriage return) shows up as
> ^M. The ^ means "subtract 64 from the byte value", e. g.
> ^M = chr(ord("M")-64) = chr(77-64) = chr(13)
> Peter
Thanks for the help
Cheers
Phil
--
http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
On Sat, 12 Jun 2010 03:05:43 -0700, Javier Montoya wrote: > Dear all, > > I need to generate a vector of random float numbers between [0,1] such > that their sum equals 1 and that are distributed non-uniformly. Is there > any python function that generates such a vector? You haven't explained your requirements in anywhere near enough detail. Any of these match your description: [1.0] [0.0, 0.0, 0.0, 0.0, 1.0] [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.3] [0.01, 0.01, 0.01, 0.01, 0.02, 0.02, 0.02, 0.03, 0.03, 0.84] and many, many more. What do you mean by "non-uniformly"? Do you have any specific distribution in mind? Do you have to have a particular number of items? For instance, you could do this: L = [] total = 0.0 while total < 1: x = random.uniform(0, 1-total) L.append(x) total += x assert sum(L) == total == 1.0 -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
On Jun 12, 1:08 pm, Etienne Rousee wrote: > Le 12/06/2010 12:05, Javier Montoya a écrit : > > > I need to generate a vector of random float numbers between [0,1] such > > that their sum equals 1 and that are distributed non-uniformly. > > Is there any python function that generates such a vector? > > Let f any function (injective is better). > Let a1,...,an n numbers uniformly distributed. > Let s the sum of f(a1),...,f(an). > > f(a1)/s, ... , f(an)/s is what you want. > > You have to choose f to obtain the distribution you prefer. > > -- > > Etienne Hi Etienne, Thanks for your suggestion. I ended with following code: N=5 a=np.random.random_integers(2*N, size=(1.,N)) a=a/float(sum(a)) However, in some cases, the random numbers are even repeated, for example, I obtained the following sequence: [0.03846154, 0.03846154, 0.23076923, 0.34615385, 0.34615385] This is mainly because in random_integers the integers generated might be repeated. One solution, would be to set the first parameter in random_integers to a larger number. What do you think? Do you suggest any other function instead of random_integers? Best wishes -- http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
On Jun 12, 1:08 pm, Etienne Rousee wrote: > Le 12/06/2010 12:05, Javier Montoya a écrit : > > > I need to generate a vector of random float numbers between [0,1] such > > that their sum equals 1 and that are distributed non-uniformly. > > Is there any python function that generates such a vector? > > Let f any function (injective is better). > Let a1,...,an n numbers uniformly distributed. > Let s the sum of f(a1),...,f(an). > > f(a1)/s, ... , f(an)/s is what you want. > > You have to choose f to obtain the distribution you prefer. > > -- > > Etienne Hi Etienne, Thanks for your suggestion. I ended with following code: N=5 a=np.random.random_integers(2*N, size=(1.,N)) a=a/float(sum(a)) However, in some cases, the random numbers are even repeated, for example, I obtained the following sequence: [0.03846154, 0.03846154, 0.23076923, 0.34615385, 0.34615385] This is mainly because in random_integers the integers generated might be repeated. One solution, would be to set the first parameter in random_integers to a larger number. What do you think? Do you suggest any other function instead of random_integers? Best wishes -- http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
On Jun 12, 2:09 pm, Steven D'Aprano wrote: > On Sat, 12 Jun 2010 03:05:43 -0700, Javier Montoya wrote: > > Dear all, > > > I need to generate a vector of random float numbers between [0,1] such > > that their sum equals 1 and that are distributed non-uniformly. Is there > > any python function that generates such a vector? > > You haven't explained your requirements in anywhere near enough detail. > Any of these match your description: > > [1.0] > [0.0, 0.0, 0.0, 0.0, 1.0] > [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.3] > [0.01, 0.01, 0.01, 0.01, 0.02, 0.02, 0.02, 0.03, 0.03, 0.84] > > and many, many more. What do you mean by "non-uniformly"? Do you have any > specific distribution in mind? Do you have to have a particular number of > items? > > For instance, you could do this: > > L = [] > total = 0.0 > while total < 1: > x = random.uniform(0, 1-total) > L.append(x) > total += x > > assert sum(L) == total == 1.0 > > -- > Steven Hi Steven, The number of items in the vector is usually between [4,15]. I was having in mind sth. like: [0.25, 0.23, 0.30, 0.22] for the 4 elems case. Best wishes -- http://mail.python.org/mailman/listinfo/python-list
Re: Deformed Form
Stephen Hansen suggests I move the line:
new_passengers_curr_customers =
int(form.getfirst('new_passengers_curr_customers', 0))
from "Script 3" (as he dubs it) to "Script 2". Naturally (though he wouldn't
have known) that's how I had it at first. After sending the post that
finally cleared up the confusion, I realized I should have addressed that
question therein (my bad). So here is the tail end of "Script 2" with said
change:
new_passengers_curr_customers =
int(form.getfirst('new_passengers_curr_customers', 0))
print new_passengers_curr_customers
new_passengers_curr_customers = New_Passengers_Curr_Customers(customers,
flights)
if new_passengers_curr_customers > 0:
print ""
print '\n'
cursor.close()
create_edit_passengers3()
You will note those very first lines. This also addresses two other
responders who believed perhaps I had called the variable from the form in
question more than once and that it had been "used up/consummed" in the
first call. Here, the first call is the first line in "Script 2" and it
prints the value "0", when the value gathered in the very next line from the
call to "Script 3" is "2", not "0".
With respect to Stephens playful jibe about my "absurdly long [variable]
names", they're long because they're descriptive, and other posters not so
playfully jibed me about my absurdly short nondescriptive names. Hey, could
you guys coordinate your jibes so you're all on the same page? ;/
DaveA suggested I not use the same name for my fn. as I do for my var;
however, there is a difference in capitalization, and I'm trying to
standardize this way. It makes it easy to recognize the difference (caps)
and easy to recognize which vars go with which fns.
DaveA also says:
> I'd suggest you do all your form interaction from a single script, and
pass any needed data explicitly to functions in the other modules, rather
than having them try to look it up themselves.
Well, yeah, that's what started this post! I'm trying to keep them all in
"Script 2".
Stephen also says:
> Yeah, those exact terminology issues tripped me up very hard in
> understanding what was going on.
Yeah, it's hard for me to keep all the terminology straight, frankly. Easy
for you guys, apparently. Sorry.
TIA,
beno
--
http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
[ye gods, i think this is the largest thread i've ever seen, but i still feel compelled to wind back to the beginning and spew forth words.] On Jun 6, 2:22 am, ant wrote: > I get the strong feeling that nobody is really happy with the state of > Python GUIs. yep. that's why i ported pyjamas, which was a web-only/browser-only UI toolkit, to the desktop. it's a _real_ eye-opener to try to use the "failed" ports of pyjamas to both pygtk2 and pyqt4, which you can still get at http://github.com/lkcl/pyjamas-desktop - see pyjd-pyqt4 and pyjd-pygtk2 these failed ports give you the clearest and bluntest indication of the failings of pyqt4 and pygtk2. after using those two "top" mainstream python GUI widget sets, i didn't try any others. > Whether or not we like graphics programming, it's not going to go > away. no you're right, it's not. ... but as web browser technology development continues to accelerate, the top mainstream GUI technology (not just python GUI technology) is going to look more and more archaic in comparison. > I ask the group; should we try to create a new GUI for Python, with > the following > properties?: > > - Pythonic > - The default GUI (so it replaces Tkinter) > - It has the support of the majority of the Python community > - Simple and obvious to use for simple things > - Comprehensive, for complicated things > - Cross-platform > - Looks good (to be defined) > - As small as possible in its default form i invite anyone considering starting a new python GUI project to consider these questions: * how much effort has been and is being spent, right now, on developing and debugging each of the python GUI widget sets, as compared to the efforts on web browser technology (MSHTML, KHTML ok maybe not kHTML, WebKit, XulRunner)? (put another way: how long have web browsers existed and how much user-market-share do web browsers have, compared to GUI and python GUI widget sets?) * are python GUI widget sets easy to compile cross-platform, as compared to web browser technology which is _definitely_ cross- platform? * how easy is it to extend the existing python GUI widget sets with "new" or "custom" widgets, as compared to web browser technology where you can manipulate bits of DOM? if you're not sure of how simple/ complex each task is, read and compare these: http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/ http://pyjd.sourceforge.net/controls_tutorial.html * how easy is it, using the "new" or "custom" widget extension methodology of existing python GUI widget sets, to extend that widget set to "keep up" with modern GUI advancements and user expectations, as compared to enhancing web browser technology? actually, this is a deliberately misleading question, but it at least illustrates that it's damn hard for GUI widget set developers to "keep up". in fact, many GUI widget set developers are actually embedding web browser technology as a widget in order to avoid the problem! (pywebkitgtk, pyqtwebkit etc.) * better question: how much time and money by large corporations with their associated vested interests is being invested into python GUI widget sets, as compared to how much by those same corporations into the W3C DOM Standards process and the resultant improvements and advances in web browser technology? * final question: how easy is it to create python "wrappers" around DOM browser technology, thus leveraging and riding on the back of the _vast_ amounts of effort and money being poured into web browser technology? answer for MSHTML (aka Trident Layout Engine): using python-comtypes - 3 weeks. answer for WebKit: using glib/gobject and pygobject "codegen" to augment pywebkitgtk - 12 weeks answer for XulRunner: using python-hulahop and python-xpcom - 2 weeks. answer for Opera's engine: unknown, because the developer hasn't responded yet. (it's qt-based, so it would be estimated around 12 weeks, if they haven't already done the work). so can you see where this is at? and that's why pyjamas/pyjamas- desktop exists. a _completely_ non-corporate-funded, _tiny_ team is riding on the back of the vast amounts of money and resources available to google, apple, nokia, microsoft, mozilla foundation and so on, and we're sitting back and offering it as free software to people to create applications that are as powerful as the underlying web technology on which the pyjamas UI toolkit is based. and with the addition of WebGL (3D SVG) and HTML5 (Video etc.), web technology is becoming pretty powerful. so this is why it can be claimed that pyjamas competes with silverlight and with adobe AIR/Flash, and it's not to do with pyjamas "per se": pyjamas is just a "leveraging" technology to get at the underlying power of the web engines. (the claim _does_ however grate against a lot of egos, somewhat understandably, and with a non- existent "marketing dept" there's not a lot that can be done about that). so let me go over these points aga
Re: non-uniform distribution
On 12/06/10 11:05, Javier Montoya wrote: Dear all, I need to generate a vector of random float numbers between [0,1] such that their sum equals 1 and that are distributed non-uniformly. Is there any python function that generates such a vector? Best wishes Hi Javier, The answer to your question is "No", and the reason is that your requirement is impossible. Whatever distribution you choose - and you have not said what you require - will be altered by any scaling to meet the constraint that the total is 1. What exactly are you trying to achieve? Regards Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: First program
On Sat, 12 Jun 2010 10:04:02 +, Phil H wrote: > On Sat, 12 Jun 2010 09:03:43 +, Phil H wrote: > >> Hi, >> Trying my hand with Python but have had a small hiccup. Reading 'A >> byte of Python' and created helloworld.py as directed. >> >> Any help appreciated >> Phil > > Thanks Peter & Chris for your prompt replies. The line ending was the > problem. > The script was written using Gedit on Ubuntu. Cannot find a setting in > Gedit to set the line ending but it must be there somewhere so will keep > looking. Also how do you see or check the line endings of a file? > > Thanks again > Phil You may want to try installing geany from your package manager, it is a pretty good but lightweight editor for programming with syntax highlighting & the option to replace tabs/spaces as req it also handles html,php, ruby & a whole host of others. before I found geany I also used bluefish which is probably more sophisticated but not as lightweight. -- The Movement Formerly Known As Open Source The battle over the Open Source trademark is heating up. Software in the Public Interest and the Open Source Initiative both hold competing claims to the trademark. In order to put an end to the infighting, a group of free software advocates have founded the Association for the Movement Formerly Known as Open Source (AMFKOS) One AMFKOS founder said, "I find it ironic that a trademark representing free software is itself proprietary. This situation must change. We propose that the free software movement adopt another name besides 'Open Source'. Hopefully then we can all Get-Back-To-Coding(tm) instead of fighting over Bruce Perens' and Eric Raymond's egos." Rumor has it that Richard Stallman plans to mount a campaign to promote the phrase "GNU/Free Software" in place of "Open Source". In addition, the terms "Ajar Source", "Unlocked Source", "Nude Source", "Unclosed Source", and "Just-Type-make Software" have all been proposed by various Usenet or Slashdot posters. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 6, 10:49 pm, Kevin Walzer wrote: > > - Pythonic > > - The default GUI (so it replaces Tkinter) > > - It has the support of the majority of the Python community > > - Simple and obvious to use for simple things > > - Comprehensive, for complicated things > > - Cross-platform > > - Looks good (to be defined) > > - As small as possible in its default form > > These goals are not all complementary. In fact, some of them, such as > "small" and "comprehensive," are mutually exclusive. that's not quite true - you can create a simple core which is easily extensible with third party contributions to create more comprehensive widgets. in the GWT arena, you have gwt-g3d, gwt-incubator, gwt-gchart and so on, all of which were created very easily thanks to the power of the underlying GWT core codebase, _none_ of which are actually included into GWT by default, _all_ of which can be installed by users and simply "imported" just like the core. now s/GWT/pyjamas and you have the exact same thing, and all the satisfiable requirements are met. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 6, 10:55 pm, ant wrote: > On Jun 6, 2:22 pm, ant wrote:> I get the strong feeling > that nobody is really happy with the state of > > Python GUIs. > > > > What an interesting set of responses I got! > And - even more interesting - how few of them actually seem to think > there is a problem, let > alone make any attempt to move the situation forward. > I appreciate that there are proponents of many different GUIs. I am > asking that all step back > from their particular interests and - for example - try to see the > situation from the viewpoint of > - say - a Python newbie, or an organisation that is thinking of > switching from (example only!) Visual Basic. > > I obviously didn't make my main point clearly enough; I'll restate it > with a different emphasis: > The default GUI shipped with Python is Tkinter. > Few people seem to like it much. This has several consequences. > - It has not blossomed, like Python has. > - There are not hundreds of talented programmers making rapid and > impressive improvements to it. > - Books about Python use it in examples (because it IS the default), > but imply that one should move on. > > The result that our hypothetical new recruit has to make a choice for > the new, big project. Remember that > GUIs have hundreds (sometimes thousands) of classes, functions and > constants. Let alone idioms and design > patterns. That is what I meant by 'Our resources are being > dissipated'; the effort of learning, remembering > and relearning a workable subset of these is substantial. > So it would be good to be able to use One Right Way, not try several > (as I have - I will admit I didn't try PyQt; > GUI fatigue was setting in by then). > > If we are to make progress, I can see two obvious approaches: > 1) Improve Tkinter to the point where it is supportable and supported > by a good fraction of Python programmers > or > 2) Drop Tkinter as the default and use something else. > > If we choose 2) then we have a new set of possibilities: > 2a) Use one of the 'major' GUIs, pretty much as is, but presumably > with a lot more people supporting it if it is the default. > 2b) Use one of the 'minor' GUIs, and get a lot of people working on it > to make it really good. > 2c) Start from scratch. With a project supported by the Community as a > whole, with the agreed objective of being the default. > > None of these is easy. All require strong leadership and great > committment. > > What surprises me is the apparent willingness of the Python community > to let this issue slide. ah - i think... i believe you may be confusing realism with fatalism. experienced python developers are also experienced, specialist c programmers (amongst other things) and experienced software engineers. they've been around a while (10+ years). they _know_ how much effort is involved in creating a major project such as a GUI widget set (and you can get a wildly-wrong but nevertheless useful answer from ohloh.net statistics, by going to http://ohloh.net/p/gtk for example) so, spec'ing it out, we _know_ that to create a decent GUI widget set, from scratch, in c (to make it fast enough) would be... ye gods... 50 man-years of effort, minimum? you _might_ be able to reduce that by using somebody else's library (libcairo, libpango) but... just... _why_?? so this was why i went "f*** that!" and "leveraged" web browser technology, jumping from virtually nothing (an abandoned python-to- javascript compiler project) to a world-class GUI toolkit, in under 18 months of _part time_ effort. > My concern is simple: I think that Python is doomed to remain a minor > language unless we crack this problem. ah. take a look at that chart that keeps cropping up every now and then: python is _not_ a minor programming language. most likely due to django, it's rated about 7th with about ... i think it was 6% share. perl is now _under_ 4%! so i don't believe there are any concerns there: python has enough alternate uses other than as a GUI toolkit to keep it going :) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: lambda question
On Fri, Jun 11, 2010 at 10:11 PM, Ian Kelly wrote: > On Fri, Jun 11, 2010 at 9:31 PM, Vincent Davis > wrote: >> Starting with an example. >> In [23]: x = [1,2,3,4,4,4,5,5,3,2,2,] >> In [24]: y = set(x) >> In [25]: y >> Out[25]: set([1, 2, 3, 4, 5]) >> In [26]: y2 = len(set(x)) >> In [27]: y2 >> Out[27]: 5 >> >> How would I do the above "y2 = len(set(x))" but have len(set()) in a >> dictionary. I know how to do .. >> In [30]: d = dict(s=set) >> In [32]: d['s'](x) >> Out[32]: set([1, 2, 3, 4, 5]) >> >> but not sure how to add the len() and thought maybe the answer in a >> lambda function. >> I know I could def a function but would prefer to keep it all on one line. > d = dict(s=lambda x: len(set(x))) d['s'](x) > 5 I must have been half asleep, I thought for sure I tried that. Well it works great this morning :) Thanks Vincent > > Cheers, > Ian > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 7, 9:25 pm, Arndt Roger Schneider wrote: > Terry Reedy schrieb: > Forget postscript! > Generate SVG from a tk canvas or --better-- from tkpath. > Jeszra (from me) generates SVG. There is also a SVG export ... orr, you use a modern web browser engine such as XulRunner 1.9 (the engine behind FF 3+), or webkit (the engine behind arora, midori, safari, android, chrome, palm's webos, adobe AIR, iphone, ipad, appcelerator, nokia S60 browser, the IE chrome plugin, blackberry 4 OS's web browser, and god knows what else). and you create python bindings to that modern web browser engine, and you can then use DOM manipulation (like javascript, only in python) to get at those SVG functions, and much much more. ... how does that sound? > Will any big GUI-Framework work on those devises? > > No! yes. called a web browser. most likely a modern webkit-based engine. > Will SVG run on thoses devices? yes. in the webkit-based web browser. or the "opera mini" browser. etc. etc. l. -- http://mail.python.org/mailman/listinfo/python-list
2010 world cup New Zealand jerseys,paypal payment and free shipping
2010 world cup Brazil jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup England jerseys,paypal payment and free shipping 2010 world cup France jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup New Zealand jerseys,paypal payment and free shipping 2010 world cup Portugal jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup Germany jerseys,paypal payment and free shipping 2010 world cup Italy jerseys,paypal payment and free shipping 2010 world cup Spain jerseys,paypal payment and free shipping 2010 world cup Turkey jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ACMilan#/ 2010 world cup Greece jerseys,paypal payment and free shipping 2010 world cup Russia jerseys,paypal payment and free shipping -- http://mail.python.org/mailman/listinfo/python-list
Re: non-uniform distribution
On Jun 12, 3:21 pm, Ian wrote: > On 12/06/10 11:05, Javier Montoya wrote:> Dear all, > > > I need to generate a vector of random float numbers between [0,1] such > > that their sum equals 1 and that are distributed non-uniformly. > > Is there any python function that generates such a vector? > > > Best wishes > > Hi Javier, > > The answer to your question is "No", and the reason is that your > requirement is impossible. > > Whatever distribution you choose - and you have not said what you > require - will be altered by any scaling to meet the constraint that the > total is 1. > > What exactly are you trying to achieve? > > Regards > > Ian Hi Ian, I found that the Dirichlet distribution is suitable for my case. Regards -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/12/10 9:44 AM, lkcl wrote: that's not quite true - you can create a simple core which is easily extensible with third party contributions to create more comprehensive widgets. That's exactly the design philosophy of Tk: a small core widget set (recently expanded somewhat with the ttk widgets) and an API that is easily extensible, either at the script level (megawidgets, cf. using an entry widget and a listbox to build a combobox) or at the C level (more complex, but hardly impossible). I've used a browser-based app before (Adobe AIR app running in IE) and while it wasn't horrible, I certainly did not prefer it to a native desktop app: I got sick of waiting for the app to reload because of a slow network connection. -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 5:12 am, rantingrick wrote: > But you know i think it boils down to fear really. He is comfortable > in his life and wishes to keep it as cookie cutter as he can. Any > outside influence must be quashed before these meddling forces can > take hold of him. He is so fearful of seeing the light in an opposing > argument that blinding himself from reality is easier than facing > reality. a very wise person told me a phrase which he'd heard, and i believe it's relevant and hope you won't mind me quoting it: "stress is where the mind compares the internal world with the external, cannot cope with the discrepancy, and places blame on the *external* world". there's food for thought in that, for all concerned. nobody's actions, here, are "wrong", they just "are". l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 8:45 am, Lie Ryan wrote: > On 06/09/10 08:20, Martin P. Hellwig wrote: > > I do think it is technically possible to have your own window manager in > > python on x11 but I have no idea if you have equal possibilities on mac > > Doesn't Mac uses an X server as well? not by default, no. you have to install it (from the XCode bundle/ package). l. p.s. i skipped replying to the other message but yes there is actually an implementation of x11 directly in pure python. you can use it to write window managers in it. but it's _not_ an x11 server implementation, it's just equivalent to... ooo... probably libx11: i.e. it connects to e.g. KDE, GDM, Fvwm and sends and responds to events. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do subprocess.Popen("ls | grep foo", shell=True) with shell=False?
On Thu, 10 Jun 2010 08:40:03 -0700, Chris Seberino wrote: > On Jun 10, 6:52 am, Nobody wrote: >> Without the p1.stdout.close(), if the reader (grep) terminates before >> consuming all of its input, the writer (ls) won't terminate so long as >> Python retains the descriptor corresponding to p1.stdout. In this >> situation, the p1.wait() will deadlock. >> >> The communicate() method wait()s for the process to terminate. Other >> processes need to be wait()ed on explicitly, otherwise you end up with >> "zombies" (labelled "" in the output from "ps"). > > You are obviously very wise on such things. I'm curious if this > deadlock issue is a rare event since I'm grep (hopefully) would rarely > terminate before consuming all its input. That depends; it might never start (missing grep, missing shared library), segfault, terminate due to a signal, etc. Also, the program might later be modified to use "grep -m ..." which will terminate after finding matches. > Even if zombies are created, they will eventually get dealt with my OS > w/o any user intervention needed right? They will persist until the parent either wait()s for them (I think that this will happen if the process gets garbage-collected) or terminates. For short-lived processes, you can forget about them; for long-lived processes, they need to be dealt with. > I'm just trying to verify the naive solution of not worrying about > these deadlock will still be ok and handled adequately by os. :) Deadlock is deadlock. If you wait() on the child while it's blocked waiting for your Python program to consume its output, the wait() will block forever. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 11:16 am, ant wrote: > And who are the beginning programmers going to turn into? If we do our > stuff right, Python programmers. If not, > Java or PHP or Visual Basic programmers. Or website designers. Or > worse (is there a worse?). yes - Java programmers who use COM under Win32 to connect to a OCX browser plugin written in Visual Basic, in a website written in PHP. no - wait: Java programmers who use COM under Win32 to connect to a Silverlight .NET application written in Visual Basic, in a website written in PHP. yeeehawww. got all the god-awful trite crap which has driven people nuts for years, and into the welcoming and consoling arms of the python community, alll into one gory sentence. :) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/12/10 12:21 AM, Martin v. Loewis wrote: >> Otherwise it makes certain windows-workarounds very problematic. You >> basically /have/ to write a C extension :| > > That's not problematic at all, for the standard library. Just write that > C extension. Come now, of course it is. It may not be problematic for *you*, but it *is* problematic for a lot of people. The pool of people competent to write solid, Pythonic, capable Python code and contribute it-- then add a few lines of ctypes for a windows-specific workaround-- is surely larger then the pool of people competent to write a safe C extension. I know I only *barely* fit into the latter category. Maybe Cython'll be mature enough eventually that the stdlib could accept Cython-based "C" extensions for such cases. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 5:16 pm, Ethan Furman wrote: > Gregory Ewing wrote: > > Kevin Walzer wrote: > >> PyGUI ... certainly is *not* a lightweight GUI toolkit that could > >> easily be incorporated into the Python core library--it instead has > >> rather complex dependencies on both other GUI toolkits and Python > >> wrappers of those toolkits. > > > I don't see how the dependencies could be regarded as "complex". > > There's more or less only one on each platform, and they're > > pretty standard accessories for the platform concerned. You could > > say there are two on Linux if you count gtk itself, but you almost > > certainly already have it these days if you're running any > > kind of desktop at all. > > *Alert* Potentially dumb question following: On the MS Windows > platform, Gtk is not required, just win32? by using python-comtypes and python-ctypes, you can pretty much control absolutely anything that's installed, and access just about anything: any win32 dll, any function. some of the function parameters you might have to guess, but it's doable. in this way you can actually access the win32 GDI (graphics driver interface) which is a serrriously low-level GUI toolkit built-in to the win32 API, and can implement much higher-level APIs on top of it. GDI is somewhat at the level of the X11 protocol. as it's so low-level, the number of applications which actually do this is _extremely_ small. the only reason i got involved at all was to do the bsolute minimum amount of work required to embed _one_ single object instance into a GDI window, taking up the entire width and height: an IWebBrowser2 OCX control, lifted straight out of MSHTML.DLL. you can look at what i did, here: http://pyjamas.git.sourceforge.net/git/gitweb.cgi?p=pyjamas/pyjamas;a=tree;f=pyjd;hb=master see windows.py and pyjd.py. windows.py is lifted straight out of a library by henk punkt; pyjd.py is a mish-mash amalgam of various bits of code i found by googling for 3 weeks solid on variations of "python MSHTML IWebBrowser2" and so on. much of the work that i found i had to go back _years_, to older versions of python and older python libraries that have long since been retired because nobody bothered with the techniques that were offered. so, yah. thanks to henk punkt's little windows.py module, it's possible to "appear" to have direct access to win32 functions such as "CreateWindowEx", and thanks to python-comtypes it's possible to get access to the COM interface of DLLs and then you're off (in this case, with the fairies). l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 5:38 pm, rantingrick wrote: > Yes we need a leader. Someone who is not afraid of the naysayers. > Someone with Guido's vision. When the leader emerges, the people will > rally. ... Mahh? Whey'rus ma guuhhn? haww haww :) -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
> That's the reason why it won't happen. Everybody asking for change is > not willing to lead the effort. Everybody who would be able and might be > willing to lead the change fails to see the need for change. *lol*. i don't know why, but i think that's so hilarious i might make it my .sig. it must be because it's so beautifully zen and circular. there are foools who aren't confident and know it; there are foools who _are_ confident, and experienced enough to not try it. that just leaves the foools who are confident enough to try it, but whom nobody will follow :) it's a bloody wonder anything gets achieved at all in free software ha ha :) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: Deformed Form
On 6/12/10 6:19 AM, Victor Subervi wrote: > You will note those very first lines. This also addresses two other > responders who believed perhaps I had called the variable from the form in > question more than once and that it had been "used up/consummed" in the > first call. Here, the first call is the first line in "Script 2" and it > prints the value "0", when the value gathered in the very next line from the > call to "Script 3" is "2", not "0". Assuming: -- You have only one "form" construction reading the FieldStorage in any module around that's imported or loaded, -- That the New_Passengers_Whatever_Other module has no top-level code which executes as a side-effect that may be changing things -- And that between the 'def New_Passengers_Whatever_Other' and the form, then the call to get the value from the FieldStorage, you are not doing any other actions which may be messing with stuff, then-- I call bullshit :) You're doing something that you're not telling us. There's something else going on. There's no way that form.getfirst() being in another file will in and of itself (notwithstanding possibilities of the second invocation actually not working at all due to reading the input) return different results. > With respect to Stephens playful jibe about my "absurdly long [variable] > names", they're long because they're descriptive, and other posters not so > playfully jibed me about my absurdly short nondescriptive names. Hey, could > you guys coordinate your jibes so you're all on the same page? ;/ Its a question of balance. Using a lot of extremely small nondescriptive names is bad. Using a bunch of really long ones is just as bad. Seek the middle of the road. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
On Jun 10, 6:26 pm, "Martin v. Loewis" wrote: > >> or PyGui would need to be implemented in terms of ctypes (which then > >> would prevent its inclusion, because there is a policy that ctypes > >> must not be used in the standard library). > > > Is there? I wasn't aware of that. What's the reason? > > ctypes is inherently unsafe. that's ok. only the sanest and most careful of programmers are going to use it. and all they're going to do is crash their application if they get it wrong. or, on an OS which is _known_ to be so unstable that it will fall over with the slightest provocation, crash the OS and require a press of that little button which was moved to the front _just_ to deal with that OS's instability, once again. just because a library has a means for programmers to shoot themselves in the foot doesn't mean that the programming language should come with kevlar-reinforced bullet-proof vests. > It must be possible to remove it > from a Python installation, as long as that's not an official policy statement that ctypes will, at some point in the future, be removed from python, i'm happy. the last thing i want to have to do is to have to include and maintain, as part of the pyjamas download, a complex python-ctypes library in order to get at the win32 functions "CreateWindowEx"; the second last thing i want to have to do is rewrite pyjd's MSHTML port; the third last thing i want to have to do is state that a 2nd and _much_ larger library dependency/download is required: pywin32. one of the really nice things about having chosen ctypes and a copy of henk punkt's windows.py file is that the only dependency required is one single 350k download: python-ctypes. last time i looked, pywin32 was a whopping 6mb, and there's _nothing_ in pywin32 that pyjd actually needs. i deliberately bypassed python-win32com for exactly the same reason: it turns out that direct ctypes access to Variant and all other OLE / COM types is perfectly sufficient. removal of ctypes would be a big, big mistake. i trust that i have misinterpreted the implication of what you're saying, martin. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
12.6.2010 13:04, vanekl kirjoitti: Antti "Andy" Ylikoski wrote: snip Maybe it could be a good idea for someone to write an academic study of all these available Lisp implementations. Even Interlisp still lives, as it was recently noted in this newsgroup. (I did not check the Google. Has someone alredy done so? Ie. studied the existing many Lisp implementations?) regards, Antti J. Ylikoski Helsinki, Finland, the E.U. Common Lisp Implementations: A Survey http://common-lisp.net/~dlw/LispSurvey.html You bring up a good point -- there are so many mature lisp implementations that you can "jump" implementations until you find one that meets your needs. -- Did you know that dolphins are just gay sharks? OT: (very Off Topic.) Yes, I would not trust dolphins to take care of my investments. "You shall know the truth, And the truth shall make you free." -- Quotation from the news:alt.politics.org.CIA newsgroup. (whether they are or are not affiliated with The Company, I will leave for the reader as a exercise.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Deformed Form
On Sat, Jun 12, 2010 at 11:46 AM, Stephen Hansen wrote: > On 6/12/10 6:19 AM, Victor Subervi wrote: > > You will note those very first lines. This also addresses two other > > responders who believed perhaps I had called the variable from the form > in > > question more than once and that it had been "used up/consummed" in the > > first call. Here, the first call is the first line in "Script 2" and it > > prints the value "0", when the value gathered in the very next line from > the > > call to "Script 3" is "2", not "0". > > Assuming: > > -- You have only one "form" construction reading the FieldStorage in > any module around that's imported or loaded, > -- That the New_Passengers_Whatever_Other module has no top-level code > which executes as a side-effect that may be changing things > -- And that between the 'def New_Passengers_Whatever_Other' and the > form, then the call to get the value from the FieldStorage, you are not > doing any other actions which may be messing with stuff, then-- > > I call bullshit :) > Yeah, well that's about how I feel, too. I mean, this is hardly the first time I've used a form like this...I might not be the sharpest programmer, but I think I know how to use this particular tool. And I've never had this problem before. I remember when I was working with server farms who shall remain nameless, it finally dawned on me that it wasn't my programming, but their crappy hardware that was breaking my code. Perhaps something like that is going on with this problem. > > You're doing something that you're not telling us. There's something > else going on. There's no way that form.getfirst() being in another file > will in and of itself (notwithstanding possibilities of the second > invocation actually not working at all due to reading the input) return > different results. > I'm not hiding aces up my sleeve to make you all lose sleep.Honestly. > > > With respect to Stephens playful jibe about my "absurdly long [variable] > > names", they're long because they're descriptive, and other posters not > so > > playfully jibed me about my absurdly short nondescriptive names. Hey, > could > > you guys coordinate your jibes so you're all on the same page? ;/ > > Its a question of balance. Using a lot of extremely small nondescriptive > names is bad. Using a bunch of really long ones is just as bad. > > Seek the middle of the road. > Yeah, well with copy and paste, the middle of the road might not be that far from "absurdly long variables". :) What's lost with long vars? Nothing but typing time, really. Short vars that aren't descriptive are problematic for far greater reasons. TIA, beno > > -- > > Stephen Hansen > ... Also: Ixokai > ... Mail: me+list/python (AT) ixokai (DOT) io > ... Blog: http://meh.ixokai.io/ > > -- http://mail.python.org/mailman/listinfo/python-list
WebBrowserProgramming [was: GUIs - A Modest Proposal]
On Jun 10, 6:56 pm, Stephen Hansen wrote: > For example: if you want to embed a CSS-capable web-browser into your > app? PyQT is actually your best option-- albeit a commercial one if > you're not open source.. wx/Python haven't yet finished WebKit > integration(*). there are _lots_ other options that i know of. here are three of the best: * python-comtypes and wrap an IWebBrowser2 instance (out of MSHTML) - you can get a win32 GDI "handle" id out of this: if you know what you're doing, you could likely embed that into a gtk or qt app, just in the same way as you can embed X11 "windows" into pygtk apps, by knowing the X11 window "handle" id. * python-xpcom and python-hulahop on top of xulrunner. hulahop is the python "magic glue" between GTK and the XPCOM "access" interface to the xulrunner web engine. hulahop allows the xulrunner engine to be embedded as a python gtk "widget", whilst also giving you a handle to the xpcom interface. * pywebkitgtk - in its current released/stable form, it gives you juuust enough to embed a web browser, but you can't actually get access to any of the DOM functions (unlike hulahop/xpcom and comtypes/ MSHTML). i'm recording all of these, and any other web browser manipulation technology that i've ever encountered, here: http://wiki.python.org/moin/WebBrowserProgramming l. -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
On Jun 12, 8:11 am, "Martin v. Loewis" wrote: > > Got me thinking, is it perhaps doable to have a 'safe' ctype that is > > guaranteed to be in the stdlib? Perhaps crippling it in a sense that it > > only allows a known set of functions to be called? > > In some sense, a C module wrapping a selected number of functions > (like the win32 extensions) is exactly that. > > Notice that it's not (only) the functions itself, but also the > parameters. It's absolutely easy to crash Python by calling a function > through ctypes that expects a pointer, and you pass an integer. The > machine code will dereference the pointer (trusting that it actually is > one), and crash. what's so bad about that? (this is a genuine, non-hostile, non- rhetorical, non-sarcastic question). (if the answer is "because you can't catch a segfault as a python exception", then the question is repeated) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 12, 3:07 pm, Kevin Walzer wrote: > On 6/12/10 9:44 AM, lkcl wrote: > > > that's not quite true - you can create a simple core which is easily > > extensible with third party contributions to create more comprehensive > > widgets. > > That's exactly the design philosophy of Tk: a small core widget set > (recently expanded somewhat with the ttk widgets) and an API that is > easily extensible, either at the script level (megawidgets, cf. using an > entry widget and a listbox to build a combobox) or at the C level (more > complex, but hardly impossible). thank you for pointing this out, kevin. learned a lot today, just from reading this one thread. about msg no 170 was where mention of tk libraries for opengl, and various other types of highly sophisticated widgets were mentioned. personally i think that these third party comprehensive extras alone make the answer to "should there be a replacement for python-tcl/tk" a resounding "no" but then i don't really need to say that - we kinda know the answer's "no" anyway :) > I've used a browser-based app before (Adobe AIR app running in IE) and > while it wasn't horrible, I certainly did not prefer it to a native > desktop app: I got sick of waiting for the app to reload because of a > slow network connection. yeahh, adobe AIR is basically webkit. not entirely sure what else they did with it - extended it to include their much-abused version of ecmascript (aka actionscript). never really been that interested in it, being a pythonist myself :) i think there's something about flash/AIR apps that just grates against the nerves. it doesn't really matter what reasons people come up with - it just feels... "wrong". that's not to say, however, based on that _one_ leveraging of browser- based web-app technology, that _all_ browser-based web-app technology falls into the same "feels wrong" bucket. coming back to pyjamas (again - sorry!) as an example: http://bit.ly/9xZ3MZ take a look at maxima's reply: you can clearly see that he's nuts about pyjd, and finds it to be slightly scarily wonderful for GUI development. perhaps it's because it's pythan, and free software- based, not adobe-driven, i don't know. *shrug* :) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/12/2010 3:21 AM, Martin v. Loewis wrote: Yeah. I get the policy in general, a proliferation of ctypes stuff could be very bad -- but if code is very careful with type-checking and stuff, it should be possible to get an exception, I'd hope. Only if you can live with the respective module not being available all the time. The issue is not that you may mistakes in the ctypes code, thus allowing users to crash Python. The issue is that if users remove ctypes (which they may want to do because it's not trustworthy), then your module will stop working (unless you have a fallback for the case that ctypes is unavailable). In general, it's undesirable that absence of some module causes a different module to stop working in the standard library, except that absence of Tkinter clearly causes IDLE and turtle to stop working. Having the absence of ctypes causing IDLE and turtle to stop working would not be any worse, in a sense, though probably less expected. Otherwise it makes certain windows-workarounds very problematic. You basically /have/ to write a C extension :| That's not problematic at all, for the standard library. Just write that C extension. I suppose one could develop in ctypes and then rewrite when 'stable', though 'stable' seldom is. Would it be possible to write a program that converts a module that uses ctypes to interface to a dll to a corresponding C extension program that would compile to a drop in replacement extension module? Given that the latter tends to be faster (as discovered/claimed by the pygame folks), this might prove useful for more than the specific case. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On Jun 12, 2:02 am, "Antti \"Andy\" Ylikoski" wrote: > 10.6.2010 23:14, bolega kirjoitti: > > > > > Which is the best implementation of LISP family of languages for real > > world programming ? > > >http://wiki.alu.org/Implementation > > > Kindly pick one from commercial and one from open-source . > > > The criteria is : > > > libraries, gui interface and builder, libraries for TCP, and evolving > > needs. > > > Please compare LISP and its virtues with other languages such as > > javascript, python etc. > > > I put javascript in the context that it is very similar in its > > architecture (homoiconic ie same representation for data-structures > > and operations, ie hierarchical, which means nested-lists<=> n-ary > > tree<=> binary tree<=> linked-list<=> dictionary<=> task-subtask, > > and implicitly based on what C calls pointers, and at machine level > > the indirect addressing of memory) to lisp family. > > > I put python in the context that it has the most extensive libraries > > and shares the build-fix virtue of lisp highlighted by Paul Graham in > > his books. Python is touted for its rapid prototyping of guis. It > > syntax enforces stable format which guards against programmer malice > > or sloppiness - so that there is a certain level of legacy code > > readability. > > > Both have eval but not clear what is the implementation efficiency to > > justify the habit of excessively using it. > > > Certainly, lisp/scheme are excellent for learning the concepts of > > programming languages due to its multi-paradigm nature and readily > > available code of the elementary interpreter. > > > Is there an IDE for these lispish-scheming languages ? Is there > > quality implementation for Eclipse ? Emacs pre-supposes some knowledge > > of these so that newbie can get stuck. Also, emacs help is not very > > good. > > > Is there a project whereby the internal help of emacs (analogous to > > its man pages) are being continuously being updated AND shared ? I > > have never seen updates to the help. Perhaps, the commercial people > > are doing it, even from the posts of the newsgroups, but the public > > distros or these newsgroups have NEVER made such an announcement. > > > Explanations integrated into the help are more important than the > > books - its like the wikipedia incorporated into emacs. > > > Is there support for the color highlighting of the code by hovering as > > on this page ? > > >http://community.schemewiki.org/?lexical-scope > > > Which book/paper has the briefest minimal example of gui design along > > XML nested/hiearchical elements with event-listeners for lisp/scheme ? > > > Thanks > > I have used several available LISP systems such as the Gigamonkeys CLISP > Lispbox, and the Clozure Common LISP. > > The system which I currently am using is the Franz Allegro Common LISP. > It is a commercial product; and so far I have had no problems with the > Allegro. (NB: I am using the Express version. I feel that the full > scale commercial license is not exceedingly expensive.) > > (Right now I'm studying and working with the exercises in Peter Norvig's > book Paradigms of Artificial Intelligence Programming. I have done 16 > of the 25 chapters.) > > This is not an advertisement. If someone wishes to criticize that > product, or if someone would like to suggest some other equally usable > implementation, of course please feel free to do so. > > regards, Antti J. Ylikoski > Helsinki, Finland, the E.U. What was your main reason for picking the Allegro (commercial) as opposed to one of the open source ones ? Is there anything in this old norvig book that makes it worth pursuing as a text ? http://norvig.com/paip.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
On 2010-06-12 10:57 , lkcl wrote: On Jun 10, 6:26 pm, "Martin v. Loewis" wrote: or PyGui would need to be implemented in terms of ctypes (which then would prevent its inclusion, because there is a policy that ctypes must not be used in the standard library). Is there? I wasn't aware of that. What's the reason? ctypes is inherently unsafe. that's ok. only the sanest and most careful of programmers are going to use it. and all they're going to do is crash their application if they get it wrong. or, on an OS which is _known_ to be so unstable that it will fall over with the slightest provocation, crash the OS and require a press of that little button which was moved to the front _just_ to deal with that OS's instability, once again. just because a library has a means for programmers to shoot themselves in the foot doesn't mean that the programming language should come with kevlar-reinforced bullet-proof vests. That's exactly why it's *in* the standard library, but also exactly why it won't be *used by* other parts of the standard library. If it's used by other parts of the standard library, then it won't be the case that only the sanest and most careful of programmers are going to use it. It must be possible to remove it from a Python installation, as long as that's not an official policy statement that ctypes will, at some point in the future, be removed from python, i'm happy. the last thing i want to have to do is to have to include and maintain, as part of the pyjamas download, a complex python-ctypes library in order to get at the win32 functions "CreateWindowEx"; the second last thing i want to have to do is rewrite pyjd's MSHTML port; the third last thing i want to have to do is state that a 2nd and _much_ larger library dependency/download is required: pywin32. one of the really nice things about having chosen ctypes and a copy of henk punkt's windows.py file is that the only dependency required is one single 350k download: python-ctypes. last time i looked, pywin32 was a whopping 6mb, and there's _nothing_ in pywin32 that pyjd actually needs. i deliberately bypassed python-win32com for exactly the same reason: it turns out that direct ctypes access to Variant and all other OLE / COM types is perfectly sufficient. removal of ctypes would be a big, big mistake. i trust that i have misinterpreted the implication of what you're saying, martin. Yes. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: Deformed Form
On 6/12/10 9:01 AM, Victor Subervi wrote: >> You're doing something that you're not telling us. There's something >> else going on. There's no way that form.getfirst() being in another file >> will in and of itself (notwithstanding possibilities of the second >> invocation actually not working at all due to reading the input) return >> different results. >> > > I'm not hiding aces up my sleeve to make you all lose sleep.Honestly. I don't think you are *on purpose*, I've been there, we all have. We did something in some other file, or some other part of the file that doesn't seem relevant, and it has an interaction we didn't predict, and it isn't immediately obvious. Now we're on over here, somewhere entirely else, and things are behaving oddly. The only suggestion I have is: try dumping all the .pyc's. Its extremely rare, but once in awhile, I've seen odd behavior due to Python not thinking a certain one is updated or not. Shouldn't ever happen (an updated .py should invalidate the .pyc and cause the .pyc to be regen'd), but it has to me like twice. (Ever) > Yeah, well with copy and paste, the middle of the road might not be that far > from "absurdly long variables". :) What's lost with long vars? Nothing but > typing time, really. Short vars that aren't descriptive are problematic for > far greater reasons. Yes, but its not either/or, at all. There is "long names", and then there is "short names": then there is a much wider gulf between, names that are neither "long" nor "short". I'm not sure what you're talking about with regards to copy and paste. But, what's lost with "absurdly long names"? The clarity of the resulting code. Names that are in the middle; long enough to be descriptive and clear, but not needlessly verbose, lead to clarity of the structure, certainly. Short names that are obscure abbreviations hurt the clarity of the structure, absolutely. However, once names get too verbose and long, you get into a situation where their use in any sort of expression suddenly makes it so you get obscenely long lines or need to start splitting that expression into multiple lines. Not that multiple lines *has* to be bad: but when something can be said succinctly and clearly on one, Baby Jeebus is happy. And when something can be said on a line that's not over oh, 80-100 (depending a lot on how Old School you are :)) characters wide, yet still clear and entirely comprehensible, Baby Jeebus is very happy. Even in the era of really wide monitors: the virtue of the narrower code is side-by-side comparison and evaluation (and less 'omg, my terminal is only 80 characters wide!' anymore). -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
On 6/12/10 8:57 AM, lkcl wrote: > On Jun 10, 6:26 pm, "Martin v. Loewis" wrote: >> It must be possible to remove it >> from a Python installation, > > as long as that's not an official policy statement that ctypes will, > at some point in the future, be removed from python, i'm happy. I believe the point is that it must be possible for users/admins to remove it, and that this removal will not cause any other part of the standard library to fail to function. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
On 6/12/10 9:55 AM, lkcl wrote: > On Jun 12, 8:11 am, "Martin v. Loewis" wrote: >> Notice that it's not (only) the functions itself, but also the >> parameters. It's absolutely easy to crash Python by calling a function >> through ctypes that expects a pointer, and you pass an integer. The >> machine code will dereference the pointer (trusting that it actually is >> one), and crash. > > what's so bad about that? (this is a genuine, non-hostile, non- > rhetorical, non-sarcastic question). > > (if the answer is "because you can't catch a segfault as a python > exception", then the question is repeated) ... ?! Its not OK for code written in Python to cause a segfault; its not OK for Python to error out in such a way that Python-level code can't catch and deal with the error or situation (Or, at least, make note of the traceback for later, in cases where there really isn't anything the Python-level code could have done about it). Its one of the reasons why we *like* Python at my day job. (Though it applies to nearly any other high level language): its inherently safer. A programming goof, oversight or unexpected event causes an exception. It doesn't cause a buffer overflow. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ P.S. Yes, I do understand that ctypes invalidates those assumptions. And that's OK. Every once in awhile, with great care and research to make sure I know what I'm doing, I'll take the risk anyways. I do understand the policy in terms of the stdlib though. I just wish it didn't apply to win32 API's somehow. No, I know its not at all logical. Leave me alone. :) signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" wrote: >OT: (very Off Topic.) >I would not trust dolphins to take care of my investments. Why not? Remember the chimpanzee that picked stocks and beat many professional fund managers? http://www.marketwatch.com/story/dart-throwing-chimp-still-making-monkey-of-internet-funds?pagenumber=2 The average dolphin's brain is bigger than the average human's (and far bigger than a chimpanzee's). Dolphin investment strategies might look fishy to us but dolphins have a unique point of view on important industries such as transportation, telecommunications, construction, tourism, energy exploration, food production, etc. I'd trust a dolphin over a Wall Street fund manager any day. -- http://mail.python.org/mailman/listinfo/python-list
Re: WebBrowserProgramming [was: GUIs - A Modest Proposal]
On 6/12/10 9:20 AM, lkcl wrote: > On Jun 10, 6:56 pm, Stephen Hansen wrote: > >> For example: if you want to embed a CSS-capable web-browser into your >> app? PyQT is actually your best option-- albeit a commercial one if >> you're not open source.. wx/Python haven't yet finished WebKit >> integration(*). > > there are _lots_ other options that i know of. here are three of the > best: Although I didn't state it or even hint at it, I thought it was implied and obvious-- though obviously I was wrong ;-) Oops! But my point and the discussion is grounded in, "and be cross platform", because we're discussing GUI's in the context of Tkinter: which is everywhere. If someone doesn't need to target the Big Three with one code base, then sure, the options you suggest may be very nice solutions for them. I was more talking about an app which can run on windows, linux and OSX. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Deformed Form
On Sat, Jun 12, 2010 at 1:58 PM, Stephen Hansen wrote: > The only suggestion I have is: try dumping all the .pyc's. > Interestingly, ls -al reveals *no* *.pyc files. Yeah, that problem caught me once as well. TIA, beno -- http://mail.python.org/mailman/listinfo/python-list
__getattribute__ and methods proxying
Hi,
I have a class which looks like the one below.
What I'm trying to accomplish is to "wrap" all my method calls and
attribute lookups into a "proxy" method which translates certain
exceptions into others.
The code below *apparently* works: the original method is called but
for some reason the "except" clause is totally ignored.
I thought __getattribute__ was designed for such kind of things
("proxying") but apparently it seems I was wrong.
class NoSuchProcess(Exception): pass
class AccessDenied(Exception): pass
class Process(object):
def __getattribute__(self, name):
# wrap all method calls and attributes lookups so that
# underlying OSError exceptions get translated into
# NSP and AD exceptions
try:
print "here 1!"
return object.__getattribute__(self, name)
except OSError, err:
print "here 2!"
if err.errno == errno.ESRCH:
raise NoSuchProcess
if err.errno == errno.EPERM:
raise AccessDenied
def cmdline(self):
raise OSError("bla bla")
proc = Process()
proc.cmdline()
--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil
--
http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/12/2010 9:26 AM, lkcl wrote:
[ye gods, i think this is the largest thread i've ever seen,
For python-list, it is possibly the longest this year, but definitely
not of all time ;-)
yep. that's why i ported pyjamas, which was a web-only/browser-only
UI toolkit, to the desktop. it's a _real_ eye-opener to try to use
the "failed" ports of pyjamas to both pygtk2 and pyqt4, which you can
still get at http://github.com/lkcl/pyjamas-desktop - see pyjd-pyqt4
and pyjd-pygtk2
these failed ports give you the clearest and bluntest indication of
the failings of pyqt4 and pygtk2. after using those two "top"
mainstream python GUI widget sets, i didn't try any others.
Can you expand on this? In brief, What were the 'failings' and were they
failings of the wrappers or the underlying toolkits?
* how much effort has been and is being spent, right now, on
developing and debugging each of the python GUI widget sets, as
compared to the efforts on web browser technology (MSHTML, KHTML ok
maybe not kHTML, WebKit, XulRunner)? (put another way: how long have
web browsers existed and how much user-market-share do web browsers
have, compared to GUI and python GUI widget sets?)
Your point that browser widget sets have gotten a lot of competitive
commercial development is well taken. HTML5 will be even more
competitive with desktop. It certainly will be a nicee cross-platform
platform for. for instance, casual no-install open-source games.
* are python GUI widget sets easy to compile cross-platform, as
compared to web browser technology which is _definitely_ cross-
platform?
* how easy is it to extend the existing python GUI widget sets with
"new" or "custom" widgets, as compared to web browser technology where
you can manipulate bits of DOM? if you're not sure of how simple/
complex each task is, read and compare these:
http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/
http://pyjd.sourceforge.net/controls_tutorial.html
The latter has a link to http://pyjd.sourceforge.net/controls/
which is currently a 403 Error.
It also has a link to
http://github.com/lkcl/pyjamas-desktop/blob/master/pyjamas-webkit/pyjamas/Controls.py
This works fine, but github has a formatting glitch.
It insists on displaying code in an embedded page/frame? of fixed width
(about half the width of my screen, what a waste). If a code line like
if type == "mousedown" or type == "mouseup" or type ==
"mousemove" or type == "mouseover" or type == "mouseout":
is too long for the restricted width, it provides a horizontal slider,
but it attaches the slider to the bottom of the embedded page rather
than to the bottom of the browser window. So the slider is only visible
when one scrolls down to the bottom of the embedded page. To read the
end of the above line with the scroll bars, one must scroll down with
the vertical slider to make the horizontal scroll visible, scoll right
with the horizontal slider, then scroll back up to where the line is.
And then repeat to go on to the next line.
It turns out that I can also scroll by selecting and moving the mouse. I
discovered that while cutting to write the above.
3 Suggestions:
1. 'type' is a built-in function. Reading a line like the above is
jarring to me. Use 'etype' for the event type.
2. I belive the above is equivalent to
if etype in ("mousedown", "mouseup", "mousemove" "mouseover",
"mouseout"):
which would fit github's (soft) limit and be clearer and faster.
3. Until you can persuade github to change, with a better explanation of
the needed change than I can give, keep to their line limit for code you
expect others to look at.
I enjoyed the rest of the post. When I need to do gui stuff, I will
definitely look at pyjamas as an alternative to desktop-only kits.
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On 12/06/2010 19:36, bolega wrote: What was your main reason for picking the Allegro (commercial) as opposed to one of the open source ones ? Is there anything in this old norvig book that makes it worth pursuing as a text ? http://norvig.com/paip.html My favorite Common Lisp environment is LispWorks, which is a commercial offering, but I regularly deal with many other Common Lisp implementations as well, including both commercial ones and open source ones, due to my role as a maintainer of a compatibility layer that is widely used. When I started using Common Lisp a couple of years ago, I started with a commercial environment (Macintosh Common Lisp back then). The main reason was that this allowed me to focus on learning the language, while being able to use an IDE that was relatively close to what other IDEs offered in a familiar way. Back then, it seemed too much of a hassle to set up an environment using Emacs + some open source Common Lisp implementation, which was (and still is) the most widely used choice in a pure open source setting. I still believe that this is a major strength of the commercial systems, that you have a mostly hassle-free set up and can directly go into learning and/or programming in Common Lisp, without having to install, set up, and/or learn other tools, which may be non-trivial. (Of course, if you are already used to using Emacs, for example, this may be less of a problem for you.) Some people have the fear that there is a risk of a vendor lock-in if you go the commercial route. However, that's not really true: The portability of Common Lisp code across different implementations is excellent, and it is very hard to paint yourself into a corner. Since the commercial systems also provide free editions, which have some limitations but are usually more than good enough for learning purposes, you can also decide to just use them for learning, and then still make your mind up later on which implementation you eventually go with - at a stage when you can make a well-informed, and thus better choice. In fact, it seems to me that it's quite common that Common Lisp users do use several implementations on a regular basis, taking advantage of their various strengths depending on the task at hand. Just my €0.02. Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
On Jun 12, 5:56 pm, Robert Kern wrote: > > just because a library has a means for programmers to shoot > > themselves in the foot doesn't mean that the programming language > > should come with kevlar-reinforced bullet-proof vests. > > That's exactly why it's *in* the standard library, but also exactly why it > won't > be *used by* other parts of the standard library. If it's used by other parts > of > the standard library, then it won't be the case that only the sanest and most > careful of programmers are going to use it. ack. understood. thank you. > > removal of ctypes would be a big, big mistake. i trust that i have > > misinterpreted the implication of what you're saying, martin. > > Yes. ok whew :) -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
Hi, The problem is that when you make this call: > proc.cmdline() there are really two steps involved. First you are accessing proc.cmdline, then you are calling it. You could think of it as this: func = proc.cmdline func() __getattribute__ is able to modify how the first step works, but not the second. And it is the second step where the OSError gets raised. You could get around this by returning a wrapper function from __getattribute__, something like this I think: def __getattribute__(self, name): f = object.__getattribute__(self, name) # here you should really check whether it's a function def wrapper(self, *args, **kwargs) print "here 1!" try: f(*args, **kwargs) except OSError, err: print "here 2!" if err.errno == errno.ESRCH: raise NoSuchProcess if err.errno == errno.EPERM: raise AccessDenied return wrapper That way "func" gets set to the wrapper function, which will handle your exception as you want. :) David -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
On 07:01 pm, [email protected] wrote: Hi, I have a class which looks like the one below. What I'm trying to accomplish is to "wrap" all my method calls and attribute lookups into a "proxy" method which translates certain exceptions into others. The code below *apparently* works: the original method is called but for some reason the "except" clause is totally ignored. I thought __getattribute__ was designed for such kind of things ("proxying") but apparently it seems I was wrong. class NoSuchProcess(Exception): pass class AccessDenied(Exception): pass class Process(object): def __getattribute__(self, name): # wrap all method calls and attributes lookups so that # underlying OSError exceptions get translated into # NSP and AD exceptions try: print "here 1!" return object.__getattribute__(self, name) except OSError, err: print "here 2!" if err.errno == errno.ESRCH: raise NoSuchProcess if err.errno == errno.EPERM: raise AccessDenied def cmdline(self): raise OSError("bla bla") proc = Process() proc.cmdline() You've proxied attribute access here. But no OSError is raised by the attribute access. It completes successfully. Then, the cmdline method which was retrieved by the attribute access is called, normally, with none of your other code getting involved. This raises an OSError, which your code doesn't handle because it has already returned. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
On Jun 12, 6:05 pm, Stephen Hansen wrote: > On 6/12/10 9:55 AM, lkcl wrote: > > > On Jun 12, 8:11 am, "Martin v. Loewis" wrote: > >> Notice that it's not (only) the functions itself, but also the > >> parameters. It's absolutely easy to crash Python by calling a function > >> through ctypes that expects a pointer, and you pass an integer. The > >> machine code will dereference the pointer (trusting that it actually is > >> one), and crash. > > > what's so bad about that? (this is a genuine, non-hostile, non- > > rhetorical, non-sarcastic question). > > > (if the answer is "because you can't catch a segfault as a python > > exception", then the question is repeated) > > ... ?! > > Its not OK for code written in Python to cause a segfault; its not OK [i knew this would be the / an / something-like-the answer, but i'm just... "reading the script" so to speak] > Its one of the reasons why we *like* Python at my day job. (Though it > applies to nearly any other high level language): its inherently safer. > A programming goof, oversight or unexpected event causes an exception. > It doesn't cause a buffer overflow. ok... analogy: when using g++ to compile c++ code, would you place use of "asm" statements into the same sort of foot-shooting category? > P.S. Yes, I do understand that ctypes invalidates those assumptions. And > that's OK. Every once in awhile, with great care and research to make > sure I know what I'm doing, I'll take the risk anyways. I do understand > the policy in terms of the stdlib though. I just wish it didn't apply to > win32 API's somehow. No, I know its not at all logical. Leave me alone. :) teehee :) -- http://mail.python.org/mailman/listinfo/python-list
Re: WebBrowserProgramming [was: GUIs - A Modest Proposal]
On Jun 12, 6:14 pm, Stephen Hansen wrote: > On 6/12/10 9:20 AM, lkcl wrote: > > > there are _lots_ other options that i know of. here are three of the > > best: > > [list of browser engines cut for brevity] > > Although I didn't state it or even hint at it, I thought it was implied > and obvious-- though obviously I was wrong ;-) Oops! i just wanted to do a "completeness" thing. apologies, there. -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On 12/06/2010 19:36, bolega wrote: Is there anything in this old norvig book that makes it worth pursuing as a text ? http://norvig.com/paip.html This "old" book by Peter Norvig is still one of the best Common Lisp introductions you can find, and has some excellent material that is not covered elsewhere. If you are interested in some fundamental AI concepts at the same time, this is one of the best choices. Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
bolega writes: > > > [PAIP] > > Is there anything in this old norvig book that makes it worth > pursuing as a text ? Yes. -- __Pascal Bourguignon__ http://www.informatimago.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
2010/6/12 David Zaslavsky : > Hi, > > The problem is that when you make this call: >> proc.cmdline() > there are really two steps involved. First you are accessing proc.cmdline, > then you are calling it. You could think of it as this: > func = proc.cmdline > func() > __getattribute__ is able to modify how the first step works, but not the > second. And it is the second step where the OSError gets raised. > > You could get around this by returning a wrapper function from > __getattribute__, something like this I think: > > def __getattribute__(self, name): > f = object.__getattribute__(self, name) > # here you should really check whether it's a function > def wrapper(self, *args, **kwargs) > print "here 1!" > try: > f(*args, **kwargs) > except OSError, err: > print "here 2!" > if err.errno == errno.ESRCH: > raise NoSuchProcess > if err.errno == errno.EPERM: > raise AccessDenied > return wrapper > > That way "func" gets set to the wrapper function, which will handle your > exception as you want. > > :) David > -- > http://mail.python.org/mailman/listinfo/python-list > Clear, thanks. Isn't there a prettier/common way to do this? A __methodcall__(self, method_obj) special method or something? Has something like that ever been proposed for inclusion? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
George Neuner writes: > On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" > wrote: > >>OT: (very Off Topic.) >>I would not trust dolphins to take care of my investments. > > Why not? Remember the chimpanzee that picked stocks and beat many > professional fund managers? > http://www.marketwatch.com/story/dart-throwing-chimp-still-making-monkey-of-internet-funds?pagenumber=2 > > > The average dolphin's brain is bigger than the average human's (and > far bigger than a chimpanzee's). Dolphin investment strategies might > look fishy to us but dolphins have a unique point of view on important > industries such as transportation, telecommunications, construction, > tourism, energy exploration, food production, etc. > > I'd trust a dolphin over a Wall Street fund manager any day. Me too. At least, the dolphin wouldn't be a former SEC president, and would have no use for our painfully spared dollars. -- __Pascal Bourguignon__ http://www.informatimago.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Toplevel sizing issue (using a grid)
Hi again, Is this possible to do? From lack of response i don't know if this is impossible or just nobody has done this before. If anybody know solution thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On Jun 12, 12:57 pm, [email protected] (Pascal J. Bourguignon) wrote: > George Neuner writes: > > On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" > > wrote: > > >>OT: (very Off Topic.) > >>I would not trust dolphins to take care of my investments. > > > Why not? Remember the chimpanzee that picked stocks and beat many > > professional fund managers? > >http://www.marketwatch.com/story/dart-throwing-chimp-still-making-mon... > > > The average dolphin's brain is bigger than the average human's (and > > far bigger than a chimpanzee's). Dolphin investment strategies might > > look fishy to us but dolphins have a unique point of view on important > > industries such as transportation, telecommunications, construction, > > tourism, energy exploration, food production, etc. > > > I'd trust a dolphin over a Wall Street fund manager any day. > > Me too. At least, the dolphin wouldn't be a former SEC president, and > would have no use for our painfully spared dollars. > > -- > __Pascal Bourguignon__ http://www.informatimago.com/ Are we really so sure to be that off topic ? What about the sweet Bernard Madoff ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On Jun 12, 12:57 pm, [email protected] (Pascal J. Bourguignon) wrote: > George Neuner writes: > > On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" > > wrote: > > >>OT: (very Off Topic.) > >>I would not trust dolphins to take care of my investments. > > > Why not? Remember the chimpanzee that picked stocks and beat many > > professional fund managers? > >http://www.marketwatch.com/story/dart-throwing-chimp-still-making-mon... > > > The average dolphin's brain is bigger than the average human's (and > > far bigger than a chimpanzee's). Dolphin investment strategies might > > look fishy to us but dolphins have a unique point of view on important > > industries such as transportation, telecommunications, construction, > > tourism, energy exploration, food production, etc. > > > I'd trust a dolphin over a Wall Street fund manager any day. > > Me too. At least, the dolphin wouldn't be a former SEC president, and > would have no use for our painfully spared dollars. > > -- > __Pascal Bourguignon__ http://www.informatimago.com/ Are we so sure to go so much off topic to SEC and Bernard Madoff ? http://www.youtube.com/watch?v=lX18zUp6WPY http://www.youtube.com/watch?v=XQapkVCx1HI http://www.youtube.com/watch?v=tXJ-k-iOg0M Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ? Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did you release the 5 dancing Israelis compromising the whole 911 investigation ? If the Dubai Police can catch Mossad Murderers and put the videos and Iranian Police can why cant you put the Pentagon Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and puting on INTERNATIONAL MEDIA a day after catching him without TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did you have to LIE about Dr Afiya Siddiqui and torture that Innocent little mother of 3 and smashing the skull of her one child ? http://www.youtube.com/watch?v=DhMcii8smxk http://www.youtube.com/watch?v=0SZ2lxDJmdg There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian courts. FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but only because he was a white. They got away with MURDER of thousands of Non-whites in all parts of the world. Daily 911 news : http://911blogger.com http://www.youtube.com/watch?v=tRfhUezbKLw http://www.youtube.com/watch?v=x7kGZ3XPEm4 http://www.youtube.com/watch?v=lX18zUp6WPY -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best implementation of LISP family of languages for real world programming ?
On Jun 12, 1:14 pm, nanothermite911fbibustards wrote: > On Jun 12, 12:57 pm, [email protected] (Pascal J. Bourguignon) > wrote: > > > > > George Neuner writes: > > > On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" > > > wrote: > > > >>OT: (very Off Topic.) > > >>I would not trust dolphins to take care of my investments. > > > > Why not? Remember the chimpanzee that picked stocks and beat many > > > professional fund managers? > > >http://www.marketwatch.com/story/dart-throwing-chimp-still-making-mon... > > > > The average dolphin's brain is bigger than the average human's (and > > > far bigger than a chimpanzee's). Dolphin investment strategies might > > > look fishy to us but dolphins have a unique point of view on important > > > industries such as transportation, telecommunications, construction, > > > tourism, energy exploration, food production, etc. > > > > I'd trust a dolphin over a Wall Street fund manager any day. > > > Me too. At least, the dolphin wouldn't be a former SEC president, and > > would have no use for our painfully spared dollars. > > > -- > > __Pascal Bourguignon__ http://www.informatimago.com/ > > Are we really so sure to be that off topic ? > > What about the sweet Bernard Madoff ? how to get off topic - http://www.youtube.com/watch?v=lX18zUp6WPY http://www.youtube.com/watch?v=XQapkVCx1HI http://www.youtube.com/watch?v=tXJ-k-iOg0M Hey Racist and INcompetent FBI Bustards, where is the ANTHRAX Mailer ? Where are the 4 blackboxes ? Where are the Pentagon Videos ? Why did you release the 5 dancing Israelis compromising the whole 911 investigation ? If the Dubai Police can catch Mossad Murderers and put the videos and Iranian Police can why cant you put the Pentagon Videos ? If Iran police can put the AMERICAN TERRORIST, Riggi and puting on INTERNATIONAL MEDIA a day after catching him without TORTURE, why cant you put the INNOCENT patsies on the MEDIA. Why did you have to LIE about Dr Afiya Siddiqui and torture that Innocent little mother of 3 and smashing the skull of her one child ? http://www.youtube.com/watch?v=DhMcii8smxk http://www.youtube.com/watch?v=0SZ2lxDJmdg There are CRIMINAL cases against CIA CRIMINAL Bustards in Italian courts. FBI bustards paid a penalty of $5.8 million to Steven Hatfill, but only because he was a white. They got away with MURDER of thousands of Non-whites in all parts of the world. Daily 911 news : http://911blogger.com http://www.youtube.com/watch?v=tRfhUezbKLw http://www.youtube.com/watch?v=x7kGZ3XPEm4 http://www.youtube.com/watch?v=lX18zUp6WPY -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 12, 7:29 pm, Terry Reedy wrote: > On 6/12/2010 9:26 AM, lkcl wrote: > > > [ye gods, i think this is the largest thread i've ever seen, > > For python-list, it is possibly the longest this year, but definitely > not of all time ;-) oh dearie me... > > yep. that's why i ported pyjamas, which was a web-only/browser-only > > UI toolkit, to the desktop. it's a _real_ eye-opener to try to use > > the "failed" ports of pyjamas to both pygtk2 and pyqt4, which you can > > still get athttp://github.com/lkcl/pyjamas-desktop- see pyjd-pyqt4 > > and pyjd-pygtk2 > > > these failed ports give you the clearest and bluntest indication of > > the failings of pyqt4 and pygtk2. after using those two "top" > > mainstream python GUI widget sets, i didn't try any others. > > Can you expand on this? In brief, What were the 'failings' and were they > failings of the wrappers or the underlying toolkits? the toolkits themselves. it's related to layout, to presentation, but most of all to the implementation of the most basic widget - Label! i actually got quite a long way with the qt4 port, after deciding to deal with Label some other time, but then... ok, best to read on :) * in neither gtk nor qt does there exist an "auto-layout" widget that's equivalent to putting some DOM objects into a , to "flow" widgets that wrap around. yes, you can put words into a Label and get them to flow, but not _widgets_. * in neither gtk nor qt is HTML properly supported. qt has a "RichText" widget but it's drastically limited. * if in gtk you use PyGTKHTML2 you cannot expect it to take care of its own width and height: you *have* to set width and height, whereupon it immediately defeats the container's layout rules. (and i just was not prepared to do "onresize" notification throughout the entiiire UI wrapper toolkit, explicitly implementing W3C DOM rules in terms of gtk or qt widgets, examining the size of the HTML text after it had been drawn once, then... gaah. _no_.) * GTKHTML3 does have "flow" capability, and even allows you to attach widgets to the layout based on the "id" associated with bits of HTML... but PyGTKHTML3 was dropped because webkit came along, and everyone loved that so much they abandoned work on making python wrappers to GTKHTML3. * qt4 "RichText" _also_ fails to set width and height correctly and requires explicit width and height setting, in pixels, which _again_ defeats container layout rules. * in implementing a Pyjamas Grid widget using qt4, qt4's Grid widget turned out to have a bug where the Layout Container classes could only be added once. you're _supposed_ to be able to remove the widgets and the Layout Containers and be able to re-add and re-lay-out the Grid, but this failed miserably: the widgets _remained_ in-place and were drawn _twice_. whoops. * developing containers for both gtk and qt4 (one idea suggested to solve some of the above problems) requires writing c code, and adoption of the resultant containers by the respective communities. i scratched that idea as unworkable. * both gtk and qt4 can use webkit to display HTML. all i ing wanted was a Label widget to display a word or a sentence, not an entire whopping 12mb library with a runtime overhead of 6mb per widget! so the use of pywebkitqt or pywebkitgtk _just_ to implement pyjamas.ui.Label was absolutely out of the question. * there's no way you can apply CSS stylesheets to gtk or qt4 (and Qt4's RichText certainly doesn't support CSS). one developer i spoke to at the time was working on exactly this, for gtk, but it was an "afterthought" - and more of a GTK "theme". you certainly weren't going to be able to add a CSS style on a per-id basis: only to "classes" of widgets (Buttons etc.) the second thing i had to consider was: how the hell am i going to implement the embedded object tag, using gtk or qt4? although it _is_ possible to put ... ohh... what is it... you can embed ... something, i can't remember what it is, but there's a way to put SWF into gtk apps... well, i realised i was looking at this entirely the wrong way. and that was the point at which i went, well wtf am i doing considering shoe-horning a square peg into a round hole for, when i can just use webkit with glib/gobject bindings and then python bindings on top of that, or xulrunner with python-xpcom for that matter, and dropped both gtk and qt4 like scalding hot coals and made a beeline for webkit's source code. hulahop, the missing piece of the "xulrunner" puzzle, turned up a few months later; once the dust had settled from those, MSHTML actually turned out to be a breeze. so i apologise if you were expecting a short answer, but gtk2 and qt4 _just_ don't cut the mustard. to be fair: whilst the pyjamas panels are _supposed_ to be "stable" and "look the same on all engines", it has to be said that, like GWT, we're relying on the "underlying browser engines", and they're not entiiirely the same. you can't work round _all_ browser b
Re: Tkinter menu checkbutton not working
Le 09/06/2010 20:37, rantingrick a écrit : On Jun 9, 12:20 pm, Dodo wrote: Le 09/06/2010 18:54, rantingrick a crit : On Jun 9, 11:26 am, Dodowrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label="My checkbutton", variable=self.ck, command=self.displayCK) self.menu.add_cascade(label="sub", menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() see my recent post on your last question. The way you are writing these classes is wrong. Always inherit from something, in this case Tk. Fix that first and then pretty up this GUI. But to answer your question "self.ck" needs to be an instance of tk.IntVar. Read more about it here... http://infohost.nmt.edu/tcc/help/pubs/tkinter/checkbutton.html I already tried with self.ck = IntVar() and now it displays PY_VAR0 FYI, I'm using Thunderbird 3, which appears to have some bugs with indentation (according to Alf P. Steinbach). That's why I replaced \t by a single space IntVar is a class and self.ck is an instance of that class which is a PY_VAR. Try print(dir(self.ck)) in your callback to see what methods are available to this instance. Im just speculating here but somehow there must be a way to "get" and "set" the IntVar's value... hmmm? You're about to kick yourself when you realize it. ;-) thanks I realised it eventually -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
On 06/12/2010 09:59 PM, Giampaolo Rodolà wrote:
> 2010/6/12 David Zaslavsky :
>> Hi,
>>
>> The problem is that when you make this call:
>>> proc.cmdline()
>> there are really two steps involved. First you are accessing proc.cmdline,
>> then you are calling it. You could think of it as this:
>> func = proc.cmdline
>> func()
>> __getattribute__ is able to modify how the first step works, but not the
>> second. And it is the second step where the OSError gets raised.
>>
>> You could get around this by returning a wrapper function from
>> __getattribute__, something like this I think:
>>
>> def __getattribute__(self, name):
>> f = object.__getattribute__(self, name)
>> # here you should really check whether it's a function
>> def wrapper(self, *args, **kwargs)
>> print "here 1!"
>> try:
>> f(*args, **kwargs)
>> except OSError, err:
>> print "here 2!"
>> if err.errno == errno.ESRCH:
>> raise NoSuchProcess
>> if err.errno == errno.EPERM:
>> raise AccessDenied
>>return wrapper
>>
>> That way "func" gets set to the wrapper function, which will handle your
>> exception as you want.
>>
>> :) David
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> Clear, thanks.
> Isn't there a prettier/common way to do this?
> A __methodcall__(self, method_obj) special method or something? Has
> something like that ever been proposed for inclusion?
There is no such thing as a method call in Python. There is attribute
access, and there is calling objects. You could, of course, create a
__methodcall__ method. That might look something like this:
class with_methodcall_trick(object):
def __methodcall__(self, method, *args, **kwa):
raise NotImplementedError("__methodcall__ must be overriden")
def __getattribute__(self, name):
obj = super(with_methodcall_trick, self).__getattribute__(name)
if callable(obj):
wrapper = functools.partial(self.__methodcall__, obj)
functools.update_wrapper(wrapper, obj)
return wrapper
else:
return wrapped
--
http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
On 6/12/10 12:46 PM, lkcl wrote: > On Jun 12, 6:05 pm, Stephen Hansen wrote: >> Its one of the reasons why we *like* Python at my day job. (Though it >> applies to nearly any other high level language): its inherently safer. >> A programming goof, oversight or unexpected event causes an exception. >> It doesn't cause a buffer overflow. > > ok... analogy: when using g++ to compile c++ code, would you place > use of "asm" statements into the same sort of foot-shooting category? Sure, dangerous tools exist for expert users who really, really know what they're doing, to achieve things that would be either burdensome, slow, or impossible in the higher level abstraction. Its one thing for Python to make available foot-shooting tools(this is good! I love ctypes, with care) for the developer, its another thing entirely for it to shoot at the ground in the normal course of its operation and hope it doesn't blow off any big toes. :) -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
On 6/12/10 12:59 PM, Giampaolo Rodolà wrote: > Clear, thanks. > Isn't there a prettier/common way to do this? > A __methodcall__(self, method_obj) special method or something? Has > something like that ever been proposed for inclusion? Not really, because that doesn't actually fit into the object model. A class isn't actually involved with the calling of the method: once the class returns it, the method's own __call__ is invoked later on. The class is completely out of touch at that point. The idiomatic way is really returning a wrapped function-- or using decorators (which is just more explicit wrapping), I think. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: simple chat server
On 06/11/2010 12:26 AM, Burakk wrote:
> Hi,
>
> I am using ubuntu lucid and i have started to learn python(vrs 3.1). I
> am trying to make a tutorial code(see below) work but when i run the
> code, open a terminal window and connect as client with telnet and
> type somethings and hit enter, give me error below...(the terminal
> says connection closed by foreign host)
>
> if someone can help i will be glad...
>
> thanx
>
> -- error: uncaptured python exception, closing channel
> <__main__.ChatSession connected 127.0.0.1:46654 at 0xb71cce8c> ( 'TypeError'>:expected an object with the buffer interface [/usr/lib/
> python3.1/asyncore.py|read|75] [/usr/lib/python3.1/asyncore.py|
> handle_read_event|420] [/usr/lib/python3.1/asynchat.py|handle_read|
> 170]) --
>
my guess is that you can't use (unicode) strings as network data. You'd
have to use byte strings most of the time. (only a guess)
This code was probably written with Python 2 in mind.
See below
> code
>
> from asyncore import dispatcher
> from asynchat import async_chat
> import asyncore
> import socket
>
> PORT = 5005
> NAME = 'TestChat'
>
> class ChatSession(async_chat):
>
> def __init__(self, sock):
> async_chat.__init__(self, sock)
> self.set_terminator("xx")
replace that with b"xx"
> self.data = []
>
>
> def collect_incoming_data(self, data):
> self.data.append(data)
>
>
> def found_terminator(self):
> line = ''.join(self.data)
use b''.join(self.data)
> self.data = []
> self.push(line)
>
> class ChatServer(dispatcher):
> def __init__(self, port):
> dispatcher.__init__(self)
> self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
> self.set_reuse_addr()
> self.bind(('', PORT))
> self.listen(5)
> self.sessions = []
>
>
> def handle_accept(self):
> conn, addr = self.accept()
> self.sessions.append(ChatSession(conn))
>
> if __name__== '__main__':
> s = ChatServer(PORT)
> try: asyncore.loop()
> except KeyboardInterrupt : print
This won't do anything: print is now a function, not a statement. Use
print() instead.
Also, that's silly. If you want to ignore keyboard interrupts (I don't
think that's a good idea), use "pass" instead of "print()".
>
--
http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Toplevel sizing issue (using a grid)
* random joe, on 12.06.2010 01:40: Hello all, Hi this i my first post here. I would like to create a tkinter toplevel window with a custom resize action based on a grid. From the Tk docs it say you can do this but for the life of me i cannot figure out how? In my app i wish for the main window to only resize in 20 pixel "jumps" (if you will). I have tried using the toplevel.grid() and setgrid option and no luck! ## here is the tk doc page about setGrid http://www.tcl.tk/man/tcl/TkLib/SetGrid.htm ## here is the Tkinter method from wm class def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): """Instruct the window manager that this widget shall only be resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the number of grid units requested in Tk_GeometryRequest.""" return self._getints(self.tk.call( 'wm', 'grid', self._w, baseWidth, baseHeight, widthInc, heightInc)) grid = wm_grid ## Here is my code. from Tkinter import * class TopWin(Tk): def __init__(self): Tk.__init__(self)#, setgrid=1) #self.maxsize(width=50, height=50) #self.minsize(width=1, height=1) self.grid(10, 10, 20, 20) topwin = TopWin() topwin.mainloop() Please help. I am going nuts trying to make this work for three hours already :( It seems that the 'grid' call only affects programmatic resizing, not user resizing. #Py3 from tkinter import * class TopWin(Tk): def __init__(self): Tk.__init__( self ) self.geometry( "40x30" ) self.grid( 10, 10, 20, 20 ) topwin = TopWin() topwin.mainloop() Here the effective presentation area size is (seems to be) 400x300 pixels. Cheers & hth., - Alf -- blog at http://alfps.wordpress.com> -- http://mail.python.org/mailman/listinfo/python-list
MySQLdb and bits
Hi there This is my first post to the list - please forgive me if this has been addressed elsewhere. I'm running MySQL 32-bit in Snow Leopard, and had MySQLdb working well. I switched to 64-bit, rebuilt MySQLdb, and again it worked fine within Python, but had to switch back to 32 bit - I'm using a wrapper for Python within Pure Data, and it forces Python to 32-bit. So back to 32-bit. It works fine wrapped in Pd, but if I try import MySQLdb from the terminal, I get: >>> import MySQLdb Traceback (most recent call last): File "", line 1, in File "build/bdist.macosx-10.6-fat/egg/MySQLdb/__init__.py", line 19, in File "build/bdist.macosx-10.6-fat/egg/_mysql.py", line 7, in File "build/bdist.macosx-10.6-fat/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/dafydd/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-fat.egg-tmp/_mysql.so, 2): no suitable image found. Did find: /Users/dafydd/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-fat.egg-tmp/_mysql.so: mach-o, but wrong architecture Is there a solution to this? I assume this is happening because Python's trying to work 64-bit but MySQLdb was built 32. Am I way off base? Thanks for any help. cheers dafydd -- http://mail.python.org/mailman/listinfo/python-list
OFF TOPIC
12.6.2010 21:06, George Neuner kirjoitti: On Sat, 12 Jun 2010 18:57:08 +0300, "Antti \"Andy\" Ylikoski" wrote: OT: (very Off Topic.) I would not trust dolphins to take care of my investments. Why not? Remember the chimpanzee that picked stocks and beat many professional fund managers? http://www.marketwatch.com/story/dart-throwing-chimp-still-making-monkey-of-internet-funds?pagenumber=2 It is rather easy to show that in a "homo homini lupus" stock market a non-ultra-professional (not affiliated with the MKULTRA) strategy is actually worse than a completely random strategy. Therefore, these small-brained primates of the genus Pan can actually be advantageously used in making stocks related business decisions. One disadvantage is the pecking order of chimpanzees. Chimps detest, hate, and will bully, any intelligent animate beings, in particular intelligent beings of the Homo sapiens sapiens genus. Scientific data are insufficient concerning, how they will relate to inanimate intelligent objects such as AI. -- Well, that story, roughly, was what one of my American Jewish acquaintances (with the surname Levine) suggested to me after he got to know me and my story. The average dolphin's brain is bigger than the average human's (and far bigger than a chimpanzee's). Dolphin investment strategies might look fishy to us but dolphins have a unique point of view on important industries such as transportation, telecommunications, construction, tourism, energy exploration, food production, etc. I'd trust a dolphin over a Wall Street fund manager any day. Individuals whose political views are in the left are probably the only ones who will call bankers and their kind "untrustworthy". One note of leftist politics. When the USSR still was there then there was there a common pastime in Finland: travel to the USSR as a tourist, smuggle say a dozen nylons (the kind that women wear) with you, sell the nylons to Russian ladies, and then with the money that you got from the nylons invite all of your friends to an expensive (to the proletariat, expensive) restaurant and spend the entire evening and night there, enjoying the best of food and drinks, until early morning light. The money will suffice, nylons were being considered so precious in the USSR. So common nylons were above the technological capabilities of the Communist system. When Ronal Reagan announced the Strategic Defence Initiative, the leaders of the USSR military said they will devise an SDI system of their own. But, if it is clearly too difficult for the Communist system to make womens' nylons, then I would not very much fear the Russkies' capabilities to thwart Reagan's SDI plans, and that which those plans originally by Reagan have become as decades have passed. One more note. Russkies have been reputed to have killer satellites, eg. equip an ordinary in the sky relocatable satellite with a relatively big explosive (nuclear warheads would be best under actual combat circumstances) and detonate it close enough to the enemy satellite so that the explosion will incapacitate the enemy satellite. I decided not to write more about this here. kind regards, A. J. Y. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Sat, Jun 12, 2010 at 10:32 AM, Terry Reedy wrote: > On 6/12/2010 3:21 AM, Martin v. Loewis wrote: >>> >>> Yeah. I get the policy in general, a proliferation of ctypes stuff could >>> be very bad -- but if code is very careful with type-checking and stuff, >>> it should be possible to get an exception, I'd hope. >> >> Only if you can live with the respective module not being available all >> the time. >> >> The issue is not that you may mistakes in the ctypes code, thus allowing >> users to crash Python. The issue is that if users remove ctypes (which >> they may want to do because it's not trustworthy), then your module will >> stop working (unless you have a fallback for the case that ctypes is >> unavailable). >> >> In general, it's undesirable that absence of some module causes a >> different module to stop working in the standard library, except that >> absence of Tkinter clearly causes IDLE and turtle to stop working. > > Having the absence of ctypes causing IDLE and turtle to stop working would > not be any worse, in a sense, though probably less expected. > >>> Otherwise it makes certain windows-workarounds very problematic. You >>> basically /have/ to write a C extension :| >> >> That's not problematic at all, for the standard library. Just write that >> C extension. > > I suppose one could develop in ctypes and then rewrite when 'stable', though > 'stable' seldom is. > > Would it be possible to write a program that converts a module that uses > ctypes to interface to a dll to a corresponding C extension program that > would compile to a drop in replacement extension module? I did a similar thing using Java and the JNI, so this seems pretty plausible to me. Having said that, it turned into a time sink very quickly, and there were cases that I never got ironed out- I suspect the same would be true here. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
math.erfc OverflowError
In Python3.2, calling math.erfc with a value in [-27.2, -30) raises an OverflowError: math range error. This is inconsistent with the erfc function from scipy (scipy.special.erfc) as well as with the C99 function by the same name, both of which return 2. I suspect that this is the result of the cutoff for the use of the continuing fraction approximation of erfc beginning when abs(x) > 30, but I'm not sure. Is this desired behavior or should I file a bug report? Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
On 6/12/2010 11:57 AM, lkcl wrote: On Jun 10, 6:26 pm, "Martin v. Loewis" wrote: ctypes is inherently unsafe. It must be possible to remove it from a Python installation, Which is to say, anyone who wants to remove it from *their* individual custom installation should be able to do so, without disabling other stdlib modules. I can imagine someone providing Python hosting on shared machines might want to do so. [snip] removal of ctypes would be a big, big mistake. i trust that i have misinterpreted the implication of what you're saying, martin. I believe so. It was an independent 3rd party module of Thomas Heller (who is still maintaining it) until recently and I have seen no suggestion that it be removed in general from the PSF distribution. Indeed, other distributions are implementing it also. Interface modules written with ctypes are more portable to such than the same modules written in C with, for instance, SWIG. For some people, is it also much easier than SWIG. So it is an important addition to the stdlib. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: math.erfc OverflowError
On 2010-06-12 17:49 , geremy condra wrote: In Python3.2, calling math.erfc with a value in [-27.2, -30) raises an OverflowError: math range error. This is inconsistent with the erfc function from scipy (scipy.special.erfc) as well as with the C99 function by the same name, both of which return 2. I suspect that this is the result of the cutoff for the use of the continuing fraction approximation of erfc beginning when abs(x)> 30, but I'm not sure. Is this desired behavior or should I file a bug report? Bug, I think. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: simple chat server
Thank you , now i can go on happy learning... :) -- http://mail.python.org/mailman/listinfo/python-list
Re: math.erfc OverflowError
On Sat, Jun 12, 2010 at 4:40 PM, Robert Kern wrote: > On 2010-06-12 17:49 , geremy condra wrote: >> >> In Python3.2, calling math.erfc with a value in [-27.2, -30) raises >> an OverflowError: math range error. This is inconsistent with the >> erfc function from scipy (scipy.special.erfc) as well as with the C99 >> function by the same name, both of which return 2. I suspect that >> this is the result of the cutoff for the use of the continuing fraction >> approximation of erfc beginning when abs(x)> 30, but I'm not sure. >> Is this desired behavior or should I file a bug report? > > Bug, I think. > > -- > Robert Kern Bug filed, http://bugs.python.org/issue8986. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
Notice that it's not (only) the functions itself, but also the parameters. It's absolutely easy to crash Python by calling a function through ctypes that expects a pointer, and you pass an integer. The machine code will dereference the pointer (trusting that it actually is one), and crash. what's so bad about that? (this is a genuine, non-hostile, non- rhetorical, non-sarcastic question). (if the answer is "because you can't catch a segfault as a python exception", then the question is repeated) It's not only that a segfault may occur, but also that you may overwrite arbitrary memory. What's so bad about that? Nothing per se, but some people actually like the property that you can't crash Python with pure Python code. Those people would want to remove ctypes. It would be unfair to them if then large parts of the standard library stopped working, in particular as there is no real technical reason for them to stop working. In particular, in some applications, untrusted code is executed. In order to execute it, all "dangerous" API functions must be removed from the interpreter, or appropriately wrapped. In these applications, wrapping ctypes is not feasible, so only removal would work. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: safer ctype? (was GUIs - A modest Proposal)
ok... analogy: when using g++ to compile c++ code, would you place use of "asm" statements into the same sort of foot-shooting category? In a slightly different way, yes. There is no way of disabling inline assembly in g++, so the analogy is not fully appropriate. However, IIUC, using inline assembly in glibc (in particular, in header files) requires a pure-C replacement version to be written for the case inline assembly is not available. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Am 12.06.2010 17:33, schrieb Stephen Hansen: On 6/12/10 12:21 AM, Martin v. Loewis wrote: Otherwise it makes certain windows-workarounds very problematic. You basically /have/ to write a C extension :| That's not problematic at all, for the standard library. Just write that C extension. Come now, of course it is. It may not be problematic for *you*, but it *is* problematic for a lot of people. Sure, but a lot of people don't contribute to the standard library. They can happily continue to use ctypes. Please trust me that, *for the standard library*, the requirement to write explicit wrappers never was a problem. Maybe Cython'll be mature enough eventually that the stdlib could accept Cython-based "C" extensions for such cases. For Cython, the issue is rather the bootstrapping issue (would we need to incorporate it if we have Cython code in CPython?). Perhaps the answer is "no", assuming that the generated C file also gets checked into Python (after all, autoconf is also not distributed along with Python). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Would it be possible to write a program that converts a module that uses ctypes to interface to a dll to a corresponding C extension program that would compile to a drop in replacement extension module? If implemented at all, I think the ctypes implementation itself could do that. I.e. create all the function objects, let the Python script declare the APIs, and then generate C code from those signatures. The C code would then best be adjusted: you'd rather use the struct declarations from the header files instead of the one you learned from ctypes (which may be wrong, or processor-dependent, or version-dependent). So a manual adjustment of header files would be necessary afterwards. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ctypes / pywin32 [was: GUIs - A Modest Proposal]
Am 12.06.2010 19:59, schrieb Stephen Hansen: On 6/12/10 8:57 AM, lkcl wrote: On Jun 10, 6:26 pm, "Martin v. Loewis" wrote: It must be possible to remove it from a Python installation, as long as that's not an official policy statement that ctypes will, at some point in the future, be removed from python, i'm happy. I believe the point is that it must be possible for users/admins to remove it, and that this removal will not cause any other part of the standard library to fail to function. Exactly so. End users/packagers/admins may want to remove it. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Pyro 4.0 released
Pyro 4.0 - I'm extremely pleased to announce the release of Pyro 4.0! This is the first official release of the new incarnation of Pyro. What is Pyro? - PYthon Remote Objects provides a very easy way of remote communication between python objects somewhere in a network. It enables you to do remote method calls on objects as if they were normal local objects. Objects can be located by a direct identifier or indirectly by logical, humanly-readable names that are managed in a name server. Pyro is designed to be simple (but powerful) so it's only a manner of adding a few lines of code to ignite your objects. Simple example: http://www.razorvine.net/python/Pyro/Example Changes --- The most important changes compared to Pyro 3.x are: - total rewrite, API similar but not backward compatible - simpler & faster & better - some features have been removed for the sake of the above - Python 3.x compatible! (separate download for now) - requires Python 2.5+, works with jython and ironpython (recent versions) - large amount of unit tests - many rewritten examples - no manual yet, but the ideas are similar to Pyro 3.x, so look there for now Website & Download -- Detailed info here: http://www.razorvine.net/python/Pyro (a page about migration from Pyro 3.x is included) Download Pyro 4.0 here: http://www.xs4all.nl/~irmen/pyro4/download/ License: MIT software license. Enjoy, Irmen de Jong -- http://mail.python.org/mailman/listinfo/python-list
2010 World Cup jerseys,paypal payment and free shipping
2010 world cup Brazil jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup England jerseys,paypal payment and free shipping 2010 world cup France jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup New Zealand jerseys,paypal payment and free shipping 2010 world cup Portugal jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup Germany jerseys,paypal payment and free shipping 2010 world cup Italy jerseys,paypal payment and free shipping 2010 world cup Spain jerseys,paypal payment and free shipping 2010 world cup Turkey jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ACMilan#/ 2010 world cup Greece jerseys,paypal payment and free shipping 2010 world cup Russia jerseys,paypal payment and free shipping -- http://mail.python.org/mailman/listinfo/python-list
Cheap wholesale 2010 World Cup jerseys by paypal and free shipping
2010 world cup Brazil jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup England jerseys,paypal payment and free shipping 2010 world cup France jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup New Zealand jerseys,paypal payment and free shipping 2010 world cup Portugal jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ 2010 world cup Germany jerseys,paypal payment and free shipping 2010 world cup Italy jerseys,paypal payment and free shipping 2010 world cup Spain jerseys,paypal payment and free shipping 2010 world cup Turkey jerseys,paypal payment and free shipping http://picasaweb.google.ca/113858744773724803250/ACMilan#/ 2010 world cup Greece jerseys,paypal payment and free shipping 2010 world cup Russia jerseys,paypal payment and free shipping -- http://mail.python.org/mailman/listinfo/python-list
Re: math.erfc OverflowError
On Sat, 12 Jun 2010 15:49:37 -0700, geremy condra wrote: > In Python3.2, calling math.erfc with a value in [-27.2, -30) raises an > OverflowError: math range error. This is inconsistent with the erfc > function from scipy (scipy.special.erfc) as well as with the C99 > function by the same name, both of which return 2. I suspect that this > is the result of the cutoff for the use of the continuing fraction > approximation of erfc beginning when abs(x) > 30, but I'm not sure. Is > this desired behavior or should I file a bug report? Geremy, I know that as a general rule, whenever a person finds what seems to be a bug in Python (or the standard library) they should suspect their own mistake rather than a bug, but I think this is taking caution to extremes. The domain of erfc is the set of all real numbers, and the result is bounded by [0, 2]. So asking if OverflowError is desired behaviour is a bit like the fellow who bought a new car and then asked if it's supposed to catch fire when starting the engine... :) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Community (A Modest Proposal)
- Where is the community? - I think the Python community is broken. I think we don't really "have" a community. It's more like a handful of negitive people at the top and every one else is chopped liver. Just today i saw another chance to contribute code to Python's stdlib, but then that nagging feeling of "Whats the use, these people are just going to discredit you and never accept code from you just because they hate you". Sadly though the only damage is done to Python. For those who are not aware my very first post to c.l.p (and Usenet) was about 1.5 years ago. At that time i saw a void that Python could fill nicely as a simple scripting language for an very quickly advancing 3D modeling application (Google SketchUp). (You can search the archives for a thread called..."Help, Google SketchUp needs a Python API" if you are interested.) So i my first thought was to find out if anyone was interested in starting this project up. So i posted my ideas and to my complete and utter surprise i was lynched by the Python community as a heretic" How dare you ask other people to help do what you should be doing yourself "... well that was the "Sunday school" version of the responses i received. I was discredited and mobbed for no apparent reason except that i had the balls to ask the question in the first place. I was only looking to get feedback, but the endless hoards insisted that "they" new my intentions better than *I*. Why was the reaction so negative? Well i will admit some fault in the fact that i trashed Ruby pretty bad. I felt everything i said was true IMO then as is now (mostly). People should have a right to opinions. However since i was such an "unknown" and you could say a "newbie", was this reaction warranted? I think not, and it speaks volumes to the negative attitudes within this community. This brings me to a new question. How many really exceptional Python programmers have been left out OR pushed out because of the extreme narcissism of the "core" python group. And when i say "core" i am speaking of the handful of people who hang out here discrediting and mobbing anybody they see as a threat to their superiority. They clutch to power like a hated dictator because that is all they have left. You people need to get a life, drop your narcissistic attitudes and be more helpful, friendly, and welcoming to the wider world. This community is not a community, its a "Cosa Nostra". Your predator like behaviors are bleeding the spirit of Python's community. This community does not belong to you or me or even GvR, we all share an equal piece. And no matter how much, or little, each of use contribute, we all share an equally divided peice. I have spoken with "other" Python programmers (far more advanced than myself) who echo this sentiment. However unlike me they cannot afford to sacrifice their image to this group, EVEN if the group is at fault! However this behavior is causing Python to suffer from lack of diverse developers, and shrinks the pool of those who wish to participate. But i'll tell you one thing, you will never bleed me dry because i am stronger than all! I will be a thorn in your sides every time you pick on a newbie. I will point out every negative comment you make, it will not be hidden as you like. Whether i am accepted or assassinated i will create an irreversible butterfly affect that no organization of negativity can endure. I will bring some positive attitudes to this group if it's the last thing i do! That will be my contribution to this group, and it may just save the Python community as a whole! -- http://mail.python.org/mailman/listinfo/python-list
