Re: any macro-like construct/technique/trick?

2005-06-01 Thread Jordan Rastrick
Is having to read two lines really that much worse than one? And the only thing you find objectionable about the most obvious solution? If so, then what's wrong with: def foo(): # do some stuff if debug: emit_dbg_obj(DbgObjFoo(a,b,c)) # do more stuff To my mind, this is no l

Re: * * * Please Read And/Or Print This! * * * Press [Ctrl][P] Keys On Your Keyboard To Print >> June 1, 2004 8:23:43 pm >> http://115639.aceboard.net/forum2.php?rub=158&cat=61&login=115639&page=0#id96 << * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

2005-06-01 Thread The Ghost In The Machine
In comp.os.linux.advocacy, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote on 1 Jun 2005 17:23:05 -0700 <[EMAIL PROTECTED]>: > * * * Please ... ... go jump in a lake. [rest snipped] -- #191, [EMAIL PROTECTED] It's still legal to go .sigless. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange KeyError using cPickle

2005-06-01 Thread Rune Strand
[Tim Peters] > What is "XWwz"? Assuming it's a bizarre typo for "open", change the > 'w' there to 'wb'. Pickles are binary data, and files holding pickles > must be opened in binary mode, especially since: > > > ... > > (on WinXP, CPython 2.4.1) Thanks Tim. The bizarre 'typo' appears to be cause

Re: What are OOP's Jargons and Complexities?

2005-06-01 Thread Greg Ewing
Anno Siegel wrote: > These languages had an axe to grind. They were designed (by Niklas > Wirth) at a time of a raging discussion whether structured programming > (goto-less programming, mostly) is practical. Their goal was to prove > that it is, and in doing so the restrictive aspects of the lan

Re: Pressing A Webpage Button

2005-06-01 Thread Grant Edwards
On 2005-06-01, Elliot Temple <[EMAIL PROTECTED]> wrote: > How do I make Python press a button on a webpage? You just do whatever action is specified for the form containing the button. > I looked at urllib, but I only see how to open a URL with > that. Guess what happens when you push that butt

Re: Strange KeyError using cPickle

2005-06-01 Thread Tim Peters
[Tim Peters] >> What is "XWwz"? Assuming it's a bizarre typo for "open", change the >> 'w' there to 'wb'. Pickles are binary data, and files holding pickles >> must be opened in binary mode, especially since: >> >>> ... >>> (on WinXP, CPython 2.4.1) [Rune Strand] > Thanks Tim. The bizarre 'typo

Re: Pressing A Webpage Button

2005-06-01 Thread Grant Edwards
On 2005-06-02, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-06-01, Elliot Temple <[EMAIL PROTECTED]> wrote: > >> How do I make Python press a button on a webpage? > > You just do whatever action is specified for the form > containing the button. > >> I looked at urllib, but I only see how to

Re: Pressing A Webpage Button

2005-06-01 Thread Paul Rubin
Grant Edwards <[EMAIL PROTECTED]> writes: > > I presume you can figure out how to open the URL instead of > > printing it? > > Ah, never mind. That doesn't work. Google somehow detects > you're not sending the query from a browser and bonks you. Try setting the User-agent: header to one that lo

Re: Python as client-side browser script language

2005-06-01 Thread Greg Ewing
Paul Rubin wrote: > Huh? The language itself has to provide the sandbox. > Remember that scripts have to be able to see > certain DOM elements but not others, and some of them have to be > read-only, etc. If the DOM objects are implemented as built-in Python types, there shouldn't be any diffi

Re: Like a star, I burn bright, dissipating into the night.

2005-06-01 Thread Peter "Shaggy" Haywood
Groovy hepcat Jeff_Relf was jivin' on 2 Jun 2005 00:37:41 GMT in comp.lang.c. Like a star, I burn bright, dissipating into the night.'s a bad trip! Dig it! > >Hi eprint10108, Hiding like a rat, You asked me if I was saved ? : [URL snipped.] >No, I am not, and neither are you. >You can't han

Re: any macro-like construct/technique/trick?

2005-06-01 Thread Mac
After I wrote my post I realized I didn't provide enough context of what I'm doing, hence it is not quite clear to any readers why the heck I would want this. The gist is this. I have a number of algorithms that perform the same task. I'm trying to assess which ones work better under which circum

Re: pickle alternative

2005-06-01 Thread mdoukidis
Running stest.py produced these results for me: marshal enc T: 12.5195908977 marshal dec T: 0.134508715493 sencode enc T: 3.75118904777 sencode dec T: 5.86602012267 11.9369997978 0.109000205994 True Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Notice the slow "m

viewing generated images

2005-06-01 Thread Tim Flynn
Hi, I'm trying to write a simple image viewer using Tkinter and ImageTk from the PIL toolkit. The images are stored in memory and I don't want to create temporary files for them. My code looks like this : from Tkinter import * import Image import ImageTk class Viewer(Frame):

Re: any macro-like construct/technique/trick?

2005-06-01 Thread Andrew Dalke
Mac wrote: > Is there a way to mimic the behaviour of C/C++'s preprocessor for > macros? There are no standard or commonly accepted ways of doing that. You could do as Jordan Rastrick suggested and write your own sort of preprocessor, or use an existing one. With the new import hooks you can pro

Re: Python as client-side browser script language

2005-06-01 Thread Paul Rubin
Greg Ewing <[EMAIL PROTECTED]> writes: > If the DOM objects are implemented as built-in Python > types, there shouldn't be any difficulty with that. > Python objects have complete control over which attributes > can be read or written by Python code. No, they don't. See the sorry history of the r

dictionaries and threads

2005-06-01 Thread Gary Robinson
Hi, I know the Global Interpreter Lock ensures that only one python thread has access to the interpreter at a time, which prevents a lot of situations where one thread might step on another's toes. But I'd like to ask about a specific situation just to be sure I understand things relative to

Re: anygui,anydb, any opinions?

2005-06-01 Thread Skip Montanaro
>> Apparently, most Python people feel productive enough without such a >> tool. Thomas> As did many with Fortran. Or Cobol. Are we now so productive Thomas> that there is no longer an unmet need for new/better software? Thomas> Do we stop here? Is Python a comfortable place

Re: Rss lib in python?

2005-06-01 Thread Owen
lihui <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Please use feedparser: > > http://feedparser.org/ > > 2005/6/1, Grant Edwards <[EMAIL PROTECTED]>: > > On 2005-06-01, Owen <[EMAIL PROTECTED]> wrote: > >=20 > > > i want to know some rss library in python.For example, some

Re: PySol not working on WinXP, SP2

2005-06-01 Thread Skip Montanaro
Ivan> Nope. The pyc files don't match the py files, and he imports the Ivan> pyc files directly. That's what 'imp.load_compiled("__main__", Ivan> sys.argv[0])' means. The windows version that Markus shipped Ivan> never included the .py files anyway, since he didn't need them. Iv

Re: dictionaries and threads

2005-06-01 Thread Paul Rubin
Gary Robinson <[EMAIL PROTECTED]> writes: > As far as I can tell, if the Python bytecodes that cause dictionary > modifications are atomic, then there should be no problem. But I don't > know that they are because I haven't looked at the bytecodes. Depending on behavior like that is asking for

Re: any macro-like construct/technique/trick?

2005-06-01 Thread Andrew Dalke
Mac wrote: > After I wrote my post I realized I didn't provide enough context of > what I'm doing, [explanation followed] I have a similar case in mind. Some graph algorithms work with a handler, which is notified about various possible events: "entered new node", "doing a backtrack", "about to l

Re: any macro-like construct/technique/trick?

2005-06-01 Thread alex23
Mac wrote: > * using >def debug_emit(obj): >if debug: >emit_dbg_obj(obj) > is a poor solution, because it *always* instantiates DbgObj*, even when > not needed; I want to avoid such unnecessary waste Rather than passing in an instantiated object and only operating on it if

Re: anygui,anydb, any opinions?

2005-06-01 Thread Skip Montanaro
>> Are we talking about a drag-and-drop GUI builder? Thomas> I am! >> What about Glade? Thomas> Dying to try that. Ask me again in a week. I use Glade at work on a regular basis. Took me a few days to get proficient, and it has some warts, but it sure beats the heck out of manu

Beginner question: Logs?

2005-06-01 Thread Svens
Hey everyone! I'm a math student working on a short script involving logs. I have a function on my scientific calculator, and was wondering if there was a similar funtion in python. For example: (log65536)/(log4)= 8 I've searched around a bit and haven't been able to find anything. Thanks! -Ch

Re: Beginner question: Logs?

2005-06-01 Thread Robert Kern
Svens wrote: > Hey everyone! I'm a math student working on a short script involving > logs. I have a function on my scientific calculator, and was wondering > if there was a similar funtion in python. > > For example: > > (log65536)/(log4)= 8 > > I've searched around a bit and haven't been able

Re: Information about Python Codyng Projects Ideas

2005-06-01 Thread Casey Hawthorne
The slightly slower startup time makes no difference for apps running 24 hours a day, except when reloading changed source modules! I imagine reloading modules is also slower -- but I could be mis t ak en! -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle alternative

2005-06-01 Thread Paul Rubin
[EMAIL PROTECTED] writes: > It appears to work faster than pickle, however, the decode process is > much slower (5x) than the encode process. Has anyone got any tips on > ways I might speed this up? I think you should implement it as a C extension and/or write a PEP. This has been an unfilled need

Re: The need to put "self" in every method

2005-06-01 Thread spinach
>Explicit is better than implicit. import sarcasm def whatAboutMyImplicitModuleMethod() -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: Logs?

2005-06-01 Thread Svens
Hey thanks... Still getting an error message though. Here's what i'm doing: -- import math log10(15625) -- -It says that log10 is not defined, but it is since the module is imported, right? -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: Logs?

2005-06-01 Thread Robert Kern
Svens wrote: > Hey thanks... > > Still getting an error message though. Here's what i'm doing: > -- > import math > log10(15625) > -- > -It says that log10 is not defined, but it is since the module is > imported, right? No, read the tutorial. import math math.log10(15625) -- Robert K

Re: Beginner question: Logs?

2005-06-01 Thread Stephen Prinster
Svens wrote: > Hey thanks... > > Still getting an error message though. Here's what i'm doing: > -- > import math > log10(15625) > -- > -It says that log10 is not defined, but it is since the module is > imported, right? > try this: import math math.log10(15625) -- http://mail.python.

Re: Beginner question: Logs?

2005-06-01 Thread Elliot Temple
On Jun 1, 2005, at 9:04 PM, Svens wrote: > Hey thanks... > > Still getting an error message though. Here's what i'm doing: > -- > import math > log10(15625) > -- > -It says that log10 is not defined, but it is since the module is > imported, right? do either import math math.log10(1562

Re: dictionaries and threads

2005-06-01 Thread Tim Peters
[Gary Robinson] > I know the Global Interpreter Lock ensures that only one python thread > has access to the interpreter at a time, which prevents a lot of > situations where one thread might step on another's toes. Not really. The CPython implementation's C code relies on the GIL in many ways t

Weekly Python Patch/Bug Summary

2005-06-01 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 344 open ( +2) / 2845 closed ( +6) / 3189 total ( +8) Bugs: 916 open (-20) / 5014 closed (+40) / 5930 total (+20) RFE : 191 open ( +2) / 163 closed ( +4) / 354 total ( +6) New / Reopened Patches __ Optimizat

Re: What are OOP's Jargons and Complexities?

2005-06-01 Thread Ray Dillinger
Matthias Buelow wrote: > And btw., I haven't used Pascal in a dozen years but my latest info is > that Turbo Pascal still lives in the form of "Delphi" for the Windows > platform. Surely not "dead" as I understand it. There's also FreePascal, which compiles approximately the same language as Tur

Unicode string in exec()

2005-06-01 Thread Shrii
1.I read a unicode file by using codec 2.I want to pass that string to exec() statement 3.But one of my character (U+0950) in that string is not showing properly in the output got by that exec() statement could anyone help me to get proper output. ? somesh -- http://mail.python.org/mailman/lis

Re: scripting browsers from Python

2005-06-01 Thread Olivier Favre-Simon
On Wed, 01 Jun 2005 22:27:44 +, John J. Lee wrote: > Olivier Favre-Simon <[EMAIL PROTECTED]> writes: > >> On Tue, 31 May 2005 00:52:33 -0700, Michele Simionato wrote: >> >> > I would like to know what is available for scripting browsers from >> > Python. > [...] >> ClientForm http://wwwsea

Re: scripting browsers from Python

2005-06-01 Thread Stephen Thorne
On 31 May 2005 00:52:33 -0700, Michele Simionato <[EMAIL PROTECTED]> wrote: > I would like to know what is available for scripting browsers from > Python. > For instance, webbrowser.open let me to perform GET requests, but I > would like > to do POST requests too. I don't want to use urllib to emul

Re: Performance Issues please help

2005-06-01 Thread Peter Otten
PyPK wrote: > I was testing this piece of code and it takes about 24-30 seconds to do > a look up on a list(m) of size 1000x1000 > m -> list of size 1000x1000 > import time > print time.ctime() > box = {} > for r,row in enumerate(m): > for c,e in enumerate(row): > if box.has_key(e): >

Re: Software licenses and releasing Python programs for review

2005-06-01 Thread poisondart
If this thread has shown anything it is I'm a bit green with respect to software licenses, but the other thing is that I consider myself as an isolated case and I wanted to know if there were others who wanted the same thing as me. I'm curious to know what the money that open source or GPL'd proje

Re: creating a hex value

2005-06-01 Thread Peter Otten
John Machin wrote: >> delim = chr(0x15) > > Ooooh -- a function with a constant arg; I wonder what that evaluates to? > > >>> chr(0x15) > '\x15' > > Shsh. OK, let's double-check that: >>> chr(0x15) 'The argument is constant -- but not necessarily the /function/.' >>> Shsh :-) Peter

Moving Places, Subtracting from slices/lists

2005-06-01 Thread Mark Sargent
Hi All, playing around with the tut now. How can I get this code to remove the original instance of 'roof'.? >>> hotcat = ['Cat', 'roof', 'on', 'a', 'hot', 'tin'] >>> for x in hotcat[:]: ... if x == 'roof': hotcat.insert(6,x) ... >>> hotcat ['Cat', 'roof', 'on', 'a', 'hot', 'tin', 'roof']

<    1   2   3