Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> Now I understand it is meaning 12 in Merriam-Webster's dictionary,
> a) "to decline to bid, double, or redouble in a card game", or b)
> "to let something go by without accepting or taking
> advantage of it".

I never thought of it as having that meaning.  I thought of it in the
sense of going by something without stopping, like "I passed a post
office on my way to work today".
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unusual i/o problems

2007-05-18 Thread saif . shakeel
On May 16, 7:55 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > output_file = open(test_file,"w")
>   ...
> > input_xml_sec = open(output_file,'r')
>
> Can you spot the problem now? To prevent it, use a naming convention that
> allows you to distinguish between file /names/ and file /objects/.
>
> >   But i am getting an error on this line
> > (input_xml_sec = open(output_file,'r')).I have tried to figure out but
> > not able to debug.Can someone throw some light or anything they feel
> > could be going wrong somewhere.
>
> In the future, to make it as easy as possible to help you, please post the
> actual traceback which contains valuable hints about the error you
> encountered even if you cannot make sense of it.
>
> Peter

Hi,
   I am running the exe from command prompt,but i am not able to see
the error as it goes off very quickly.How do i capture the error
(traceback).I tried putting an input prompt after the expected line of
error but wont work.Is there a command to capture the error.
   Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: alternative to eclipse [ python ide AND cvs ]

2007-05-18 Thread Nathan Harmston
I have had very few problems with eclipse on ubuntu with pydev
installed. Is it still running under the gnu jvm, not the sun one? It
was crashing on me until I changed them around, detials about changing
it around on ubuntu anyway

http://ubuntuguide.org/wiki/Ubuntu_Edgy#How_to_install_Java_Integrated_Development_Environment_.28Eclipse.29

Hope this helps,

Nathan
-- 
http://mail.python.org/mailman/listinfo/python-list


How to stop a scheduler stated using

2007-05-18 Thread Nagendra Kumar
Hello ALL,

I am trying to schdule some of my class methods using sched module of
python

import sched, time
s=sched.scheduler(time.time, time.sleep)

event1=s.enter(60, 1, obj.scheduleAbuseAssignment1, ())
event2=s.enter(60, 1, obj.scheduleAbuseAssignment2, ())
event3=s.enter(60, obj.scheduleAbuseAssignment3, ())

Is there any way to stop these scheduled events?If so, can we do it
through a UI

Thanks in advance.

Regards,
- Nagendra Kumar

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> > Integration with existing tools *is* something that a PEP should
> > consider. This one does not do that sufficiently, IMO.
> What specific tools should be discussed, and what specific problems
> do you expect?

Emacs, whose unicode support is still pretty weak.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Hendrik van Rooyen

"Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:

> 
> 
> > > Now look me in the eye and tell me that you find
> > > the mix of proper German and English keywords
> > > beautiful.
> > 
> > I can't admit that, but I find that using German
> > class and method names is beautiful. The rest around
> > it (keywords and names from the standard library)
> > are not English - they are Python.
> > 
MvL:
> > (look me in the eye and tell me that "def" is
> > an English word, or that "getattr" is one)
> > 
> 
HvR:
> LOL - true - but a broken down assembler programmer like me
> does not use getattr - and def is short for define, and for and while
> and in are not German.

After an intense session of omphaloscopy, I would like another bite 
at this cherry.

I think my problem is something like this - when I see a line of code
like:

def frobnitz():

I do not actually see the word "def" - I see something like:

define a function with no arguments called frobnitz

This "expansion" process is involuntary, and immediate in my mind.

And this is immediately followed by an irritated reaction, like:

WTF is frobnitz? What is it supposed to do? What Idiot wrote this?

Similarly, when I encounter the word "getattr" - it is immediately
expanded to "get attribute" and this "expansion" is kind of
dependant on another thing, namely that my mind is in "English
mode" - I refer here to something that only happens rarely, but
with devastating effect, experienced only by people who can read
more than one language - I am referring to the phenomenon that you 
look at an unfamiliar piece of writing on say a signboard, with the 
wrong language "switch" set in your mind - and you cannot read it,
it makes no sense for a second or two - until you kind of step back 
mentally and have a more deliberate look at it, when it becomes 
obvious that its not say English, but Afrikaans, or German, or vice 
versa.

So in a sense, I can look you in the eye and assert that "def" and 
"getattr" are in fact English words...  (for me, that is)

I suppose that this "one language track" - mindedness of mine
is why I find the mix of keywords and German or Afrikaans so 
abhorrent - I cannot really help it, it feels as if I am eating a 
sandwich, and that I bite on a stone in the bread. - It just jars.

Good luck with your PEP - I don't support it, but it is unlikely
that the Python-dev crowd and GvR would be swayed much
by the opinions of the egregious HvR.

Aesthetics aside, I think that the practical maintenance problems
(especially remote maintenance) is the rock on which this
ship could founder.

- Hendrik

--
Philip Larkin (English Poet) :
They fuck you up, your mom and dad -
They do not mean to, but they do.
They fill you with the faults they had,
and add some extra, just for you.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-URL! - weekly Python news and links (May 16)

2007-05-18 Thread Hendrik van Rooyen

"Beliavsky" <[EMAIL PROTECTED]> wrote:

> On May 16, 2:45 pm, "Cameron Laird" <[EMAIL PROTECTED]> wrote:
> > QOTW:  "Sometimes you just have to take the path of least distaste". - Grant
> > Edwards
> >
> > "I want to choose my words carefully here, so I'm not misunderstood.
>
> 
>
> I think Cameron Laird does a good job with the Python digest but
> blundered here. Why did he highlight a foul comment having nothing to
> do with Python?
>

Because its funny - you normally only say "I choose my words carefully", when
you are about to say something that can be easily misconstrued, or that is
technically difficult to follow - That particular preamble prepares you mentally
for something difficult, and the coarse comment that follows is in such contrast
that it had me ROTFLMAO

- Hendrik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Hendrik van Rooyen
"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote:

Hvr:
>>Would not like it at all, for the same reason I don't like re's -
>>It looks like random samples out of alphabet soup to me.
>
>What I meant was, would the use of "foreign" identifiers look so
>horrible to you if the core language had fewer English keywords?
>(Perhaps Perl, with its line-noise, was a poor choice of example.
>Maybe Lisp would be better, but I'm not so sure of my Lisp as to
>make such an assertion for it.)

I suppose it would jar less - but I avoid such languages, as the whole
thing kind of jars - I am not on the python group for nothing..

: - )

- Hendrik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter button state = DISABLED

2007-05-18 Thread Eric Brunel
On Thu, 17 May 2007 09:30:57 +0200, Hendrik van Rooyen  
<[EMAIL PROTECTED]> wrote:
>  "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
>> En Wed, 16 May 2007 03:22:17 -0300, Hendrik van Rooyen
>>> I have never seen this working in Tkinter, unless the button was  
>>> pressed
>>> on the
>>> widget
>>> in question - and worse, once you have clicked down on a ButtonRelease
>>> binding
>>> you can move the mouse pointer anywhere you like, even out of the
>>> application
>>> and when you release it, the bound function is called...
>>>
>>> Its either a bug or a feature, I don't know.
>>
>> Uhmm... I'm not sure I understand you completely. I only said that the
>> "command" is fired only when the mouse button is pressed on the widget,
>> AND released inside the same widget. If both events don't happen in the
>> same widget, "command" won't fire. Maybe you are saying the same  
>> thing...
>> anyway I'm not a Tk expert.
>
> No command is ok and you have described it right - its ButtonRelease that
> seems broken to me

Apparently, this behaviour is the intended one, at least for buttons; see:
http://www.tcl.tk/man/tcl8.4/TkCmd/bind.htm#M11

As for the question "why?", maybe you should ask it on the c.l.tcl  
newsgroup?
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execute commands from file

2007-05-18 Thread Douglas Woodrow
On Fri, 18 May 2007 04:45:30, Dennis Lee Bieber <[EMAIL PROTECTED]> 
wrote
>On 17 May 2007 13:12:10 -0700, i3dmaster <[EMAIL PROTECTED]> declaimed
>the following in comp.lang.python:
>
>> 'b' is generally useful on systems that don't treat binary and text
>> files differently. It will improve portability.
>
>   "b" is needed for binary files on systems that /do/ treat binary
>differently from text. And it does add to portability only in that it
>has no effect on those that treat all files the same.
>
>   However, as I recall the thread, the intent is to process text lines
>from a file -- and using "b" is going to affect how the line endings are
>being treated.

Yes that was my understanding too, Dennis, and the reason I queried it 
in the first place.  I had to remove the "b" option in order to get the 
sample code to work under Windows, because the standard line termination 
under Windows is carriage return + linefeed (\r\n).

Of course if I manually edit the command file so that it only has a 
linefeed character at the end of each line, the binary mode works.

So I think i3dmaster's method is only portable as long as the command 
file is created with unix-style line termination.

-- 
Doug Woodrow

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: alternative to eclipse [ python ide AND cvs ]

2007-05-18 Thread Jarek Zgoda
Stargaming napisał(a):

> Well, basically any editor that features plugins IMO. Although this
> sounds much like a "which editor is the best?" question (what will
> enrage us even more than non-ASCII identifiers ), I'd suggest Vim.

The IDE which embeds Vim is PIDA: http://www.pida.co.uk/. Looks promising.

-- 
Jarek Zgoda

"We read Knuth so you don't have to."
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Jarek Zgoda
Wildemar Wildenburger napisał(a):

> To make it short: Is there something like this already?
> 
> There seem to loads of python frameworks for Web-Apps, but I have a hard
> time finding one for desktop-apps.
> I imagine it wouldn't be too hard (if still time consuming) whipping up
> something simple myself, but I thought, I'd ask here before diving into it.

There are few GUI frameworks building on various toolkits. I used to use
Kiwi for PyGTK, it's mature and stable, although the approach is not the
same as, for example, Delphi.

-- 
Jarek Zgoda

"We read Knuth so you don't have to."
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexes: How to handle escaped characters

2007-05-18 Thread Torsten Bronger
Hallöchen!

John Machin writes:

> On May 18, 6:00 am, Torsten Bronger <[EMAIL PROTECTED]>
> wrote:
>
>> [...]
>>
>> Example string: u"Hollo", escaped positions: [4].  Thus, the
>> second "o" is escaped and must not be found be the regexp
>> searches.
>>
>> Instead of re.search, I call the function guarded_search(pattern,
>> text, offset) which takes care of escaped caracters.  Thus, while
>>
>> re.search("o$", string)
>>
>> will find the second "o",
>>
>> guarded_search("o$", string, 0)
>
> Huh? Did you mean 4 instead of zero?

No, the "offset" parameter is like the "pos" parameter in the search
method of regular expression objects.  It's like

guarded_search("o$", string[offset:])

Actually, my real guarded_search even has an "endpos" parameter,
too.

> [...]
>
> Quite apart from the confusing use of "escape", your requirements are
> still as clear as mud. Try writing up docs for your "guarded_search"
> function.

Note that I don't want to add functionality to the stdlib, I just
want to solve my tiny annoying problem.  Okay, here is a more
complete story:

I've specified a simple text document syntax, like reStructuredText,
Wikimedia, LaTeX or whatever.  I already have a preprocessor for it,
now I try to implement the parser.  A sectioning heading looks like
this:

Introduction


Thus, my parser searches (among many other things) for
r"\n\s*={4,}\s*$".  However, the author can escape any character
with a backslash:

Introduction or Introduction
\===\===

This means the first (or fifth) equation sign is an equation sign as
is and not part of a heading underlining.  This must not be
interpreted as a section begin.  The preprocessor generates
u"===" with escaped_positions=[0].  (Or [4], in the
righthand case.)

This is why I cannot use normal search methods.

> [...]
>
> Whatever your exact requirement, it would seem unlikely to be so
> wildly popularly demanded as to warrant inclusion in the "regexp
> machine". You would have to write your own wrapper, something like
> the following totally-untested example of one possible
> implementation of one possible guess at what you mean:
>
> import re
> def guarded_search(pattern, text, forbidden_offsets, overlap=False):
> regex = re.compile(pattern)
> pos = 0
> while True:
> m = regex.search(text, pos)
> if not m:
> return
> start, end = m.span()
> for bad_pos in forbidden_offsets:
> if start <= bad_pos < end:
> break
> else:
> yield m
> if overlap:
> pos = start + 1
> else:
> pos = end
> 8<---

This is similar to my current approach, however, it also finds too
many "^a" patterns because it starts a fresh search at different
positions.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
  (See http://ime.webhop.org for ICQ, MSN, etc.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to convert a number to binary?

2007-05-18 Thread Lyosha
On May 17, 11:04 pm, Stargaming <[EMAIL PROTECTED]> wrote:
[...]
> >>>Is there an *easy* way to convert a number to binary?
[...]
>
> Wrote this a few moons ago::
>
>dec2bin = lambda x: (dec2bin(x/2) + str(x%2)) if x else ''

This is awesome.  Exactly what I was looking for.  Works for other
bases too.

I guess the reason I couldn't come up with something like this was
being brainwashed that lambda is a no-no.

And python2.5 funky ?: expression comes in handy!

Thanks a lot!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: alternative to eclipse [ python ide AND cvs ]

2007-05-18 Thread Steven Howe
Stargaming wrote:
> yomgui schrieb:
>   
> Hi,
>
> Eclipse is just not really working on linux 64 bit
> (I tried ubuntu and centos, it is freesing and crashing
> and extremly slow)
>
> I use eclipse for python and cvs, what is "the" good alternative ?
>
> thanks
>
> yomgui
>   

Fond of Komodo. Seems to run most of my python programming tasks. Has 
breakpoints/debugging, introspection, projects and the professional 
version supports CVS.  The only issue I have is that they 
(ActiveState.com) just raised the price of the personal IDE way too 
high. I'll be using my older version (3.1) for a while. If I used it at 
work, I'd certainly have my boss splurge the 200 odd dollar price. But, 
in their favor, they have a editor version for free. I 'think' it 
doesn't have the damn fine debugging or CVS feature though.

sph

-- 
HEX: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Jarek Zgoda wrote:
> There are few GUI frameworks building on various toolkits. I used to use
> Kiwi for PyGTK, it's mature and stable, although the approach is not the
> same as, for example, Delphi
Thanks for the effort, but I think I'm not well understood. I'm not 
looking for a GUI framework (which, by the way, is most likely to be 
wxPython), but for a pure plugin architecture. A rich-client-platform, 
as it is sometimes called. Nothing specific about anythin in particular, 
just something that runs plugins. Like Eclipse does these days.

It's beginning to dawn on me that I'll have to cook something up myself. 
*grumble*
;)

W
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to convert a number to binary?

2007-05-18 Thread Lyosha
On May 17, 11:10 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
[...]
> > That's way too complicated...  Is there any way to convert it to a
> > one- liner so that I can remember it?
>
> You put in a module so you don't *have* to remember it.
>
> Then, you use it in this one-liner:
>
> foo = to_base(15, 2)
>
> Carrying a whole lot of one-liners around in your head is a waste of
> neurons. Neurons are far more valuable than disk space, screen lines,
> or CPU cycles.

While I agree with this general statement, I think remembering a
particular one-liner to convert a number to a binary is more valuable
to my brain than remembering where I placed the module that contains
this function.

I needed the one-liner not to save disk space or screen lines.  It's
to save time, should I need to convert to binary when doing silly
little experiments.  I would spend more time getting the module
wherever it is I stored it (and rewriting it if it got lost).

It's fun, too.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sending a JavaScript array to Python script?

2007-05-18 Thread Bruno Desthuilliers
placid a écrit :
> Hi All,
> 
> Just wondering if there is any way of sending a JavaScript array to a
> Python cgi script? A quick Google search didn't turn up anything
> useful.

Look for "json".
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unusual i/o problems

2007-05-18 Thread Peter Otten
[EMAIL PROTECTED] wrote:

> I am running the exe from command prompt,but i am not able to see
> the error as it goes off very quickly.

http://effbot.org/pyfaq/how-do-i-run-a-python-program-under-windows.htm

> How do i capture the error (traceback).I tried putting an input prompt
> after the expected line of error but wont work.Is there a command to 
> capture the error. 

You can redirect stderr to a file:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Anyone use PyPar (Python MPI implementation) recently?

2007-05-18 Thread Ole Nielsen

Cheers and thanks
Ole
-- 
http://mail.python.org/mailman/listinfo/python-list

i/o prob revisited

2007-05-18 Thread saif . shakeel
Hi,
I am parsing an xml file ,before that i have replaced a string in
the original xml file with another and made a new xml file which will
now be parsed.I am also opening some more files for output.The
following code shows some i/o commands.
file_input = raw_input("Enter The ODX File Path:")
input_xml = open(file_input,'r')

(shortname,ext)=os.path.splitext(file_input)
f_open_out=shortname+".ini"
log=shortname+".xls"
test_file=shortname+"testxml.xml"


saveout = sys.stdout


xmlcont=input_xml.read()
input_xml.close()


xmlcont=xmlcont.replace('localId','dataPackageId')


output_file = open(test_file,"w")
output_file.write(xmlcont)
output_file.close()


f_open=open(f_open_out, 'w')
logfile=open(log,"w")
sys.stdout = f_open


 After this i have to parse the new xml file which is in
output_file .hence


input_xml_sec = open(output_file,'r')
xmldoc = minidom.parse(input_xml_sec)


  But i am getting an error on this line
(input_xml_sec = open(output_file,'r')).I have tried to figure out
but
not able to debug.Can someone throw some light or anything they feel
could be going wrong somewhere.
  How do i capture the error as it vanishes very
qucikly when i run through command prompt,(the idle envir gives
indentation errors for no reason(which runs perfectly from cmd
prompt),hence i dont run using conventional F5.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> If you doubt the claim, please indicate which of these three aspects
> you doubt:
> 1. there are programmers which desire to defined classes and functions
>with names in their native language.
> 2. those developers find the code clearer and more maintainable than
>if they had to use English names.
> 3. code clarity and maintainability is important.

I think it can damage clarity and maintainability and if there's so
much demand for it then I'd propose this compromise: non-ascii
identifiers are allowed but they produce a compiler warning message
(including from eval and exec).  You can suppress the warning message
with a command line option.
-- 
http://mail.python.org/mailman/listinfo/python-list


emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Paul Rudin

I can't get the gdb fringe interaction functionality to work with
either pdb or pydb. Any hints as to versions or incantations I should
try?


I have the emacs22 from debian unstable emacs-snapshot-gtk package
fwiw.

-- 
http://mail.python.org/mailman/listinfo/python-list


App Leaving 'sh ' Everywhere

2007-05-18 Thread Robert Rawlins - Think Blue
Hello Guys,

 

I've got an application that seems to leave 'sh ' in my os
processes list. I'm running it on Debian, albeit a stripped down embedded
version. I'm not sure what the cause of this is, My application starts
several threads and also uses popen2.popen3() to run a few CMD commands.

 

Any ideas why I'm getting this, or if it's even something to be concerned
about.

 

Thanks,

 

Rob

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Jarek Zgoda
Wildemar Wildenburger napisał(a):

>> There are few GUI frameworks building on various toolkits. I used to use
>> Kiwi for PyGTK, it's mature and stable, although the approach is not the
>> same as, for example, Delphi
> Thanks for the effort, but I think I'm not well understood. I'm not
> looking for a GUI framework (which, by the way, is most likely to be
> wxPython), but for a pure plugin architecture. A rich-client-platform,
> as it is sometimes called. Nothing specific about anythin in particular,
> just something that runs plugins. Like Eclipse does these days.

I know what is Eclipse RCP. The world would be much better place to live
if we had something similar. :)

Many applications employ "plugin framework"-like things and in Python
this is specially easy to do, but I saw none that is built as one big
plugin framework. The one that mostly resembles such approach is PIDA
(http://www.pida.co.uk/), which is built around the concept of pluggable
views and services, but again, this is far from Eclipse RCP.

-- 
Jarek Zgoda

"We read Knuth so you don't have to."
-- 
http://mail.python.org/mailman/listinfo/python-list


Random selection

2007-05-18 Thread Tartifola

Hi,
I have a list with probabilities as elements 

[p1,p2,p3]

with of course p1+p2+p3=1. I'd like to draw a
random element from this list, based on the probabilities contained in
the list itself, and return its index. 

Any help on the best way to do that?
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Torsten Bronger
Hallöchen!

Martin v. Löwis writes:

>> In <[EMAIL PROTECTED]>, Nick Craig-Wood
>> wrote:
>> 
>>> My initial reaction is that it would be cool to use all those
>>> great symbols.  A variable called OHM etc!
>> 
>> This is a nice candidate for homoglyph confusion.  There's the
>> Greek letter omega (U+03A9) Ω and the SI unit symbol (U+2126) Ω,
>> and I think some omegas in the mathematical symbols area too.
>
> Under the PEP, identifiers are converted to normal form NFC, and
> we have
>
> py> unicodedata.normalize("NFC", u"\u2126")
> u'\u03a9'
>
> So, OHM SIGN compares equal to GREEK CAPITAL LETTER OMEGA. It can't
> be confused with it - it is equal to it by the proposed language
> semantics.

So different unicode sequences in the source code can denote the
same identifier?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
  (See http://ime.webhop.org for ICQ, MSN, etc.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Thomas Bellman
=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= <[EMAIL PROTECTED]> wrote:

>> 3) Is or will there be a definitive and exhaustive listing (with
>> bitmap representations of the glyphs to avoid the font issues) of the
>> glyphs that the PEP 3131 would allow in identifiers? (Does this
>> question even make sense?)

> As for the list I generated in HTML: It might be possible to
> make it include bitmaps instead of HTML character references,
> but doing so is a licensing problem, as you need a license
> for a font that has all these characters. If you want to
> lookup a specific character, I recommend to go to the Unicode
> code charts, at

> http://www.unicode.org/charts/

My understanding is also that there are several east-asian
characters that display quite differently depending on whether
you are in Japan, Taiwan or mainland China.  So much differently
that for example a Japanese person will not be able to recognize
a character rendered in the Taiwanese or mainland Chinese way.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"Adde parvum parvo magnus acervus erit"   ! bellman @ lysator.liu.se
  (From The Mythical Man-Month)   ! Make Love -- Nicht Wahr!
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Jarek Zgoda
Daniel Nogradi napisał(a):

>> For example, it HAS been published elsewhere that YouTube uses lighttpd,
>> not Apache: .
> 
> How do you explain these, then:
> 
> http://www.youtube.com/results.xxx
> http://www.youtube.com/results.php
> http://www.youtube.com/results.py

Server signature is usually configurable.

-- 
Jarek Zgoda

"We read Knuth so you don't have to."
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An expression that rebinds a variable?

2007-05-18 Thread Thomas Bellman
GreenH <[EMAIL PROTECTED]> writes:

> Can I know what kind of expressions rebind variables, of course unlike
> in C, assignments are not expressions (for a good reason)
> So, eval(expr) should bring about a change in either my global or
> local namespace, where 'expr' is the expression

List comprehensions:

>>> c
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'c' is not defined
>>> eval('[ord(c) for c in "parrot"]')
[112, 97, 114, 114, 111, 116]
>>> c
't'

This is supposed to be changed in Python 3.0.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"What sane person could live in this world   !  bellman @ lysator.liu.se
 and not be crazy?"  -- Ursula K LeGuin  !  Make Love -- Nicht Wahr!
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
> For example, it HAS been published elsewhere that YouTube uses lighttpd,
> not Apache: .

How do you explain these, then:

http://www.youtube.com/results.xxx
http://www.youtube.com/results.php
http://www.youtube.com/results.py

Just wondering,
Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: i/o prob revisited

2007-05-18 Thread half . italian
On May 18, 12:06 am, [EMAIL PROTECTED] wrote:
> Hi,
> I am parsing an xml file ,before that i have replaced a string in
> the original xml file with another and made a new xml file which will
> now be parsed.I am also opening some more files for output.The
> following code shows some i/o commands.
> file_input = raw_input("Enter The ODX File Path:")
> input_xml = open(file_input,'r')
>
> (shortname,ext)=os.path.splitext(file_input)
> f_open_out=shortname+".ini"
> log=shortname+".xls"
> test_file=shortname+"testxml.xml"
>
> saveout = sys.stdout
>
> xmlcont=input_xml.read()
> input_xml.close()
>
> xmlcont=xmlcont.replace('localId','dataPackageId')
>
> output_file = open(test_file,"w")
> output_file.write(xmlcont)
> output_file.close()
>
> f_open=open(f_open_out, 'w')
> logfile=open(log,"w")
> sys.stdout = f_open
>
>  After this i have to parse the new xml file which is in
> output_file .hence
>
> input_xml_sec = open(output_file,'r')
> xmldoc = minidom.parse(input_xml_sec)
>
>   But i am getting an error on this line
> (input_xml_sec = open(output_file,'r')).I have tried to figure out
> but
> not able to debug.Can someone throw some light or anything they feel
> could be going wrong somewhere.
>   How do i capture the error as it vanishes very
> qucikly when i run through command prompt,(the idle envir gives
> indentation errors for no reason(which runs perfectly from cmd
> prompt),hence i dont run using conventional F5.

http://docs.python.org/tut/

Read carefully.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to convert a number to binary?

2007-05-18 Thread Nick Craig-Wood
Lyosha <[EMAIL PROTECTED]> wrote:
>  On May 17, 11:04 pm, Stargaming <[EMAIL PROTECTED]> wrote:
>  [...]
> > >>>Is there an *easy* way to convert a number to binary?
>  [...]
> >
> > Wrote this a few moons ago::
> >
> >dec2bin = lambda x: (dec2bin(x/2) + str(x%2)) if x else ''
> 
>  This is awesome.  Exactly what I was looking for.  Works for other
>  bases too.

Just don't pass it a negative number ;-)

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: i/o prob revisited

2007-05-18 Thread saif . shakeel
On May 18, 1:50 pm, [EMAIL PROTECTED] wrote:
> On May 18, 12:06 am, [EMAIL PROTECTED] wrote:
>
>
>
>
>
> > Hi,
> > I am parsing an xml file ,before that i have replaced a string in
> > the original xml file with another and made a new xml file which will
> > now be parsed.I am also opening some more files for output.The
> > following code shows some i/o commands.
> > file_input = raw_input("Enter The ODX File Path:")
> > input_xml = open(file_input,'r')
>
> > (shortname,ext)=os.path.splitext(file_input)
> > f_open_out=shortname+".ini"
> > log=shortname+".xls"
> > test_file=shortname+"testxml.xml"
>
> > saveout = sys.stdout
>
> > xmlcont=input_xml.read()
> > input_xml.close()
>
> > xmlcont=xmlcont.replace('localId','dataPackageId')
>
> > output_file = open(test_file,"w")
> > output_file.write(xmlcont)
> > output_file.close()
>
> > f_open=open(f_open_out, 'w')
> > logfile=open(log,"w")
> > sys.stdout = f_open
>
> >  After this i have to parse the new xml file which is in
> > output_file .hence
>
> > input_xml_sec = open(output_file,'r')
> > xmldoc = minidom.parse(input_xml_sec)
>
> >   But i am getting an error on this line
> > (input_xml_sec = open(output_file,'r')).I have tried to figure out
> > but
> > not able to debug.Can someone throw some light or anything they feel
> > could be going wrong somewhere.
> >   How do i capture the error as it vanishes very
> > qucikly when i run through command prompt,(the idle envir gives
> > indentation errors for no reason(which runs perfectly from cmd
> > prompt),hence i dont run using conventional F5.
>
> http://docs.python.org/tut/
>
> Read carefully.- Hide quoted text -
>
> - Show quoted text -

ok i am able to trace the error ...It says:
Traceback (most recent call last):
  File "C:\Projects\ODX Import\code_ini\odxparse_mod.py", line 294, in

input_xml_sec = open(output_file,'r')
TypeError: coercing to Unicode: need string or buffer, file found
Any solutions.
Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unusual i/o problems

2007-05-18 Thread saif . shakeel
On May 18, 1:01 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I am running the exe from command prompt,but i am not able to see
> > the error as it goes off very quickly.
>
> http://effbot.org/pyfaq/how-do-i-run-a-python-program-under-windows.htm
>
> > How do i capture the error (traceback).I tried putting an input prompt
> > after the expected line of error but wont work.Is there a command to
> > capture the error.
>
> You can redirect stderr to a file:
>
> http://www.microsoft.com/resources/documentation/windows/xp/all/prodd...
>
> Peter

ok i traced the error for above code.It says something like this:
Traceback (most recent call last):
  File "C:\Projects\ODX Import\code_ini\odxparse_mod.py", line 294, in

input_xml_sec = open(output_file,'r')
TypeError: coercing to Unicode: need string or buffer, file found
Can someone help me in this.
   Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unusual i/o problems

2007-05-18 Thread Peter Otten
[EMAIL PROTECTED] wrote:

> On May 18, 1:01 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>> > I am running the exe from command prompt,but i am not able to see
>> > the error as it goes off very quickly.
>>
>> http://effbot.org/pyfaq/how-do-i-run-a-python-program-under-windows.htm
>>
>> > How do i capture the error (traceback).I tried putting an input prompt
>> > after the expected line of error but wont work.Is there a command to
>> > capture the error.
>>
>> You can redirect stderr to a file:
>>
>> http://www.microsoft.com/resources/documentation/windows/xp/all/prodd...
>>
>> Peter
> 
> ok i traced the error for above code.It says something like this:
> Traceback (most recent call last):
>   File "C:\Projects\ODX Import\code_ini\odxparse_mod.py", line 294, in
> 
> input_xml_sec = open(output_file,'r')
> TypeError: coercing to Unicode: need string or buffer, file found
> Can someone help me in this.
>Thanks

I already pointed you to the error in my first post in this thread.
output_file is a file, but open() expects a file name.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Laurent Pointal
Long and interresting discussion with different point of view.

Personnaly, even if the PEP goes (and its accepted), I'll continue to use
identifiers as currently. But I understand those who wants to be able to
use chars in their own language.

* for people which are not expert developers (non-pros, or in learning
context), to be able to use names having meaning, and for pro developers
wanting to give a clear domain specific meaning - mainly for languages non
based on latin characters where the problem must be exacerbated.
They can already use unicode in strings (including documentation ones).

* for exchanging with other programing languages having such identifiers...
when they are really used (I include binding of table/column names in
relational dataabses).

* (not read, but I think present) this will allow developers to lock the
code so that it could not be easily taken/delocalized anywhere by anybody.


In the discussion I've seen that problem of mixing chars having different
unicode number but same representation (ex. omega) is resolved (use of an
unicode attribute linked to representation AFAIU).

I've seen (on fclp) post about speed, it should be verified, I'm not sure we
will loose speed with unicode identifiers.

On the unicode editing, we have in 2007 enough correct editors supporting
unicode (I configure my Windows/Linux editors to use utf-8 by default).


I join concern in possibility to read code from a project which may use such
identifiers (i dont read cyrillic, neither kanji or hindi) but, this will
just give freedom to users.

This can be a pain for me in some case, but is this a valuable argument so
to forbid this for other people which feel the need ?


IMHO what we should have if the PEP goes on:

* reworking on traceback to have a general option (like -T) to ensure
tracebacks prints only pure ascii, to avoid encoding problem when
displaying errors on terminals.

* a possibility to specify for modules that they must *define* only
ascii-based names, like a from __futur__ import asciionly. To be able to
enforce this policy in projects which request it.

* and, as many wrote, enforce that standard Python libraries use only ascii
identifiers.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Torsten Bronger
Hallöchen!

Laurent Pointal writes:

> [...]
>
> Personnaly, even if the PEP goes (and its accepted), I'll continue
> to use identifiers as currently. [...]

Me too (mostly), although I do like the PEP.  While many people have
pointed out possible issues of the PEP, only few have tried to
estimate its actual impact.  I don't think that it will do harm to
Python code because the programmers will know when it's appropriate
to use it.  The potential trouble is too obvious for being ignored
accidentally.  And in the case of a bad programmer, you have more
serious problems than flawed identifier names, really.

But for private utilities for example, such identifiers are really a
nice thing to have.  The same is true for teaching in some cases.
And the small simulation program in my thesis would have been better
with some α and φ.  At least, the program would be closer to the
equations in the text then.

> [...]
>
> * a possibility to specify for modules that they must *define*
> only ascii-based names, like a from __futur__ import asciionly. To
> be able to enforce this policy in projects which request it.

Please don't.  We're all adults.  If a maintainer is really
concerned about such a thing, he should write a trivial program that
ensures it.  After all, there are some other coding guidelines too
that could be enforced this way but aren't, for good reason.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
  (See http://ime.webhop.org for ICQ, MSN, etc.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Random selection

2007-05-18 Thread Peter Otten
Tartifola wrote:

> I have a list with probabilities as elements
> 
> [p1,p2,p3]
> 
> with of course p1+p2+p3=1. I'd like to draw a
> random element from this list, based on the probabilities contained in
> the list itself, and return its index.
> 
> Any help on the best way to do that?

import random
import bisect

def draw(probabilities):
sigma = 0.0
ps = []
for p in probabilities:
sigma += p
ps.append(sigma)

_bisect = bisect.bisect
_random = random.random
while 1:
yield _bisect(ps, _random())

if __name__ == "__main__":
from itertools import islice
histo = [0]*4
for i in islice(draw([0.2, 0.3, 0.5]), 10):
histo[i] += 1
print histo


-- 
http://mail.python.org/mailman/listinfo/python-list


Cannot parse simple entity references using xml.sax

2007-05-18 Thread Debajit Adhikary
I'm writing a SAX parser using Python and need to parse XML with
entity references.

<>

Only the last entity reference gets parsed. Why are startEntity() and
endEntity() never called?

I'm using the following code:
http://pastie.textmate.org/62610

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Jarek Zgoda
Ben Finney napisał(a):

>> Thanks for the effort, but I think I'm not well understood. I'm not
>> looking for a GUI framework (which, by the way, is most likely to be
>> wxPython), but for a pure plugin architecture. A
>> rich-client-platform, as it is sometimes called. Nothing specific
>> about anythin in particular, just something that runs plugins. Like
>> Eclipse does these days.
> 
> I've never used Eclipse (beyond proving that it runs on various
> computers). Can you please describe what behaviour you're looking for?

The key is not "Eclipse" itself, but the whole Eclipse Platform.

See http://wiki.eclipse.org/index.php/Rich_Client_Platform

-- 
Jarek Zgoda

"We read Knuth so you don't have to."
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: zipfile stupidly broken

2007-05-18 Thread Nick Craig-Wood
Martin Maney <[EMAIL PROTECTED]> wrote:
>  To quote from zipfile.py (2.4 library):
> 
>  # Search the last END_BLOCK bytes of the file for the record signature.
>  # The comment is appended to the ZIP file and has a 16 bit length.
>  # So the comment may be up to 64K long.  We limit the search for the
>  # signature to a few Kbytes at the end of the file for efficiency.
>  # also, the signature must not appear in the comment.
>  END_BLOCK = min(filesize, 1024 * 4)
> 
>  So the author knows that there's a hard limit of 64K on the comment
>  size, but feels it's more important to fail a little more quickly when
>  fed something that's not a zipfile - or a perfectly legitimate zipfile
>  that doesn't observe his ad-hoc 4K limitation.  I don't have time to
>  find a gentler way to say it because I have to find a work around for
>  this arbitrary limit (1): this is stupid.

To search 64k for all zip files would slow down the opening of all zip
files whereas most zipfiles don't have comments.

The code in _EndRecData should probably read 1k first, and then retry
with 64k.

>  (1) the leading candidate is to copy and paste the whole frigging
>  zipfile module so I can patch it, but that's even uglier than it is
>  stupid.  "This battery is pining for the fjords!"

You don't need to do that, you can just "monkey patch" the _EndRecData
function.

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Ben Finney
Wildemar Wildenburger <[EMAIL PROTECTED]> writes:

> Thanks for the effort, but I think I'm not well understood. I'm not
> looking for a GUI framework (which, by the way, is most likely to be
> wxPython), but for a pure plugin architecture. A
> rich-client-platform, as it is sometimes called. Nothing specific
> about anythin in particular, just something that runs plugins. Like
> Eclipse does these days.

I've never used Eclipse (beyond proving that it runs on various
computers). Can you please describe what behaviour you're looking for?

"Just runs plugins" is very vague, and would seem to be satisfied on
the face of it by loading Python modules. If there's something more
specific, you'll have to specify.

-- 
 \  "I hope if dogs ever take over the world, and they chose a |
  `\king, they don't just go by size, because I bet there are some |
_o__)Chihuahuas with some good ideas."  -- Jack Handey |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyhdf

2007-05-18 Thread [EMAIL PROTECTED]
Hi, I can't help here, just a recommendation:

I am using pytables (http://www.pytables.org) build upon hdf5. If
you're not bound to hdf4, go and try pytables instead of pyhdf.

Bernhard

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: App Leaving 'sh ' Everywhere

2007-05-18 Thread Michael Bentley


On May 18, 2007, at 3:49 AM, Robert Rawlins - Think Blue wrote:

I’ve got an application that seems to leave ‘sh ’ in my os  
processes list. I’m running it on Debian, albeit a stripped down  
embedded version. I’m not sure what the cause of this is, My  
application starts several threads and also uses popen2.popen3() to  
run a few CMD commands.


Any ideas why I’m getting this, or if it’s even something to be  
concerned about.
These processes have completed execution, but their parents have not  
read their exit status so they still have entries in the process  
table.  They'll more than likely be reaped when the parent process  
goes away.  If you'd rather not have zombies roaming around your  
system, use wait() to read the child's exit status.


If, after the parent process exits, these processes persist -- run  
'init -q' to get rid of them.


hth,
Michael

---
"I would rather use Java than Perl. And I'd rather be eaten by a  
crocodile than use Java." — Trouser



-- 
http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Gregor Horvath
Hendrik van Rooyen schrieb:

> I suppose that this "one language track" - mindedness of mine
> is why I find the mix of keywords and German or Afrikaans so 
> abhorrent - I cannot really help it, it feels as if I am eating a 
> sandwich, and that I bite on a stone in the bread. - It just jars.

Please come to Vienna and learn the local slang.
You would be surprised how beautiful and expressive a language mixed up 
of a lot of very different languages can be. Same for music. It's the 
secret of success of the music from Vienna. It's just a mix up of all 
the different cultures once living in a big multicultural kingdom.

A mix up of Python key words and German identifiers feels very natural 
for me. I live in cultural diversity and richness and love it.

Gregor
-- 
http://mail.python.org/mailman/listinfo/python-list


A best approach to a creating specified http post body

2007-05-18 Thread dzawer
Hi all, I'm rather new to python but not exaclty without  programming
experience and not quite get  best pyhton practices.
I have a following problem that it seems I cannot find a way to solve
correctly.

I need to build a special http post body that consists of :
name=value +\r\n strings.
Problem is that depending on operations the number of  name,value
pairs can increase and decrease.
Values need to be initialized at runtime, so storing premade text
files is not possible.

The worst thing that some operations must be at beginning, so
dictionary approach with classes  is kinda out.

Could you please provide some examples or descriptions on how you
would solve such problem ?
Thanks in advance.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread stefaan
> To make it short: Is there something like this already?

To keep it short: yes.
To make it longer: not sure about its status... i've never tried it
myself.
To make it short again: http://code.enthought.com/ets/

I also know some people are trying to create something called pyxides,
but
also there I am not sure about the status: http://pyxides.stani.be/

Best regards,
Stefaan.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexes: How to handle escaped characters

2007-05-18 Thread Charles Sanders
Torsten Bronger wrote:
> Hallöchen!
[...]
>>>
>>> Example string: u"Hollo", escaped positions: [4].  Thus, the
>>> second "o" is escaped and must not be found be the regexp
>>> searches.
>>>
>>> Instead of re.search, I call the function guarded_search(pattern,
>>> text, offset) which takes care of escaped caracters.  Thus, while
>>>
> 
> Tschö,
> Torsten.

I'm still pretty much a beginner, and I am not sure
of the exact requirements, but the following seems to work
for at least simple cases when overlapping matches are not
considered.

def guarded_search( pattern, text, exclude ):
   return [ m for m in re.finditer(pattern,text)
 if not [ e for e in exclude if m.start() <= e < m.end() ] ]

txt = "axbycz"
exc = [ 3 ]  # "y"
pat = "[xyz]"
mtch = guarded_search(pat,txt,exc)
print "Guarded search text='%s' excluding %s" % ( txt,exc )
for m in mtch:
   print m.group(), 'at', m.start()

txt = "Hollo"
exc = [ 4 ]  # Final "o"
pat = "o$"
mtch = guarded_search(pat,txt,exc)
print "Guarded search text='%s' excluding %s %s matches" % 
(txt,exc,len(mtch))
for m in mtch:
   print m.group(), 'at', m.start()

Guarded search text='axbycz' excluding [3] 2 matches
x at 1
z at 5
Guarded search text='Hollo' excluding [4] 0 matches


Simply finds all the (non-overlapping) matches and rejects any
that include one of the excluded columns (the "y" in the first
case and the final "o" in the second).

Charles
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Bruno Desthuilliers
John Nagle a écrit :
> Victor Kryukov wrote:
>> Hello list,
>>
>> our team is going to rewrite our existing web-site, which has a lot of
>> dynamic content and was quickly prototyped some time ago.
> ...
>> Our main requirement for tools we're going to use is rock-solid
>> stability. As one of our team-members puts it, "We want to use tools
>> that are stable, has many developer-years and thousands of user-years
>> behind them, and that we shouldn't worry about their _versions_." The
>> main reason for that is that we want to debug our own bugs, but not
>> the bugs in our tools.
> 
>You may not be happy with Python, then.

John, I'm really getting tired of your systemic and totally 
unconstructive criticism. If *you* are not happy with Python, by all 
means use another language.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Bruno Desthuilliers
Istvan Albert a écrit :
> On May 16, 5:04 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote:
> 
>> Our main requirement for tools we're going to use is rock-solid
>> stability. As one of our team-members puts it, "We want to use tools
>> that are stable, has many developer-years and thousands of user-years
>> behind them, and that we shouldn't worry about their _versions_." The
>> main reason for that is that we want to debug our own bugs, but not
>> the bugs in our tools.
> 
> I think this is a requirement that is pretty much impossible to
> satisfy. Only dead frameworks stay the same.  I have yet to see a
> framework that did not have incompatible versions.
> 
> Django has a very large user base, great documentation and is deployed
> for several online new and media sites. It is fast, it's efficient and
> is simple to use. Few modern frameworks (in any language) are
> comparable, and I have yet to see one that is better,

Then have a look at Pylons.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to convert a number to binary?

2007-05-18 Thread Sion Arrowsmith
Lyosha  <[EMAIL PROTECTED]> wrote:
>On May 17, 11:04 pm, Stargaming <[EMAIL PROTECTED]> wrote:
>>dec2bin = lambda x: (dec2bin(x/2) + str(x%2)) if x else ''
> [ ... ]
>I guess the reason I couldn't come up with something like this was
>being brainwashed that lambda is a no-no.
>
>And python2.5 funky ?: expression comes in handy!

def dec2bin(x): return x and (dec2bin(x/2)+str(x%2)) or ''

does the same job without lambda or Python 2.5 (and note that the
usual warning about a and b or c doesn't apply here as b is
guaranteed to evaluate as true).

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: List Moderator

2007-05-18 Thread kyosohma
On May 18, 12:36 am, Steve Holden <[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
> > Is this list not moderated? I'm really not interested in Britney
> > Spears boobs. All the spam on this list is from the same place, it
> > should be very easy to filter.
>
> Is it a list, is it a newsgroup? No, it's c.l.py!
>
> In fact you could be reading this in a number of different forms, and
> there are equally many ways to inject content into the stream. It's
> surprisingly difficult to filter everything out, though the list
> managers at python.org seem to do a remarkably effective job.
>
> I'm not particularly interested in that subject matter either, but
> believe me there could be a lot more of that kind of thing than actually
> makes it through!
>
> regards
>   Steve
> --
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC/Ltd  http://www.holdenweb.com
> Skype: holdenweb  http://del.icio.us/steve.holden
> -- Asciimercial -
> Get on the web: Blog, lens and tag your way to fame!!
> holdenweb.blogspot.comsquidoo.com/pythonology
> tagged items: del.icio.us/steve.holden/python
> All these services currently offer free registration!
> -- Thank You for Reading 

You're probably right, but this week has been pretty bad. Every few
posts there's another porn or boob related link. Sheesh!

Mike

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multi-Page login WITH Cookies (POST Data)

2007-05-18 Thread Dave Borne
> After we are able to get a succussful login, i need a way that i can browse
> my site always including this cookie, like if i went to open up a page, it
> would use the cookie we got from logging in.

You need something like this:
import cookielib,urllib2
cookiejar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar))

more info here: http://docs.python.org/lib/module-urllib2.html
and here: http://docs.python.org/lib/module-cookielib.html

-Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A best approach to a creating specified http post body

2007-05-18 Thread Dave Borne
> I need to build a special http post body that consists of :
> name=value +\r\n strings.
> Problem is that depending on operations the number of  name,value
> pairs can increase and decrease.
> Values need to be initialized at runtime, so storing premade text
> files is not possible.

I'm not completely understanding your problems here. Can you explain
why urllib.urlencode wouldn't work?
(http://docs.python.org/lib/module-urllib.html)

Thanks,
-Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Greg Miller/NexPress is out of the office.

2007-05-18 Thread gregory . miller

I will be out of the office starting  05/17/2007 and will not return until
05/21/2007.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: A best approach to a creating specified http post body

2007-05-18 Thread Shane Geiger

Why not use scotch.recorder?



Dave Borne wrote:

I need to build a special http post body that consists of :
name=value +\r\n strings.
Problem is that depending on operations the number of  name,value
pairs can increase and decrease.
Values need to be initialized at runtime, so storing premade text
files is not possible.



I'm not completely understanding your problems here. Can you explain
why urllib.urlencode wouldn't work?
(http://docs.python.org/lib/module-urllib.html)

Thanks,
-Dave
  


--
Shane Geiger
IT Director
National Council on Economic Education
[EMAIL PROTECTED]  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy

begin:vcard
fn:Shane Geiger
n:Geiger;Shane
org:National Council on Economic Education (NCEE)
adr:Suite 215;;201 N. 8th Street;Lincoln;NE;68508;United States
email;internet:[EMAIL PROTECTED]
title:IT Director
tel;work:402-438-8958
x-mozilla-html:FALSE
url:http://www.ncee.net
version:2.1
end:vcard

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Alex Martelli
Jarek Zgoda <[EMAIL PROTECTED]> wrote:

> Daniel Nogradi napisa?(a):
> 
> >> For example, it HAS been published elsewhere that YouTube uses lighttpd,
> >> not Apache: .
> > 
> > How do you explain these, then:
> > 
> > http://www.youtube.com/results.xxx
> > http://www.youtube.com/results.php
> > http://www.youtube.com/results.py
> 
> Server signature is usually configurable.

Yeah, but I don't know why it's configured it that way.  A good example
of a question that looks perfectly appropriate for YouTube's OSCON
session.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A best approach to a creating specified http post body

2007-05-18 Thread dzawer
On May 18, 4:57 pm, "Dave Borne" <[EMAIL PROTECTED]> wrote:
> > I need to build a special http post body that consists of :
> > name=value +\r\n strings.
> > Problem is that depending on operations the number of  name,value
> > pairs can increase and decrease.
> > Values need to be initialized at runtime, so storing premade text
> > files is not possible.
>
> I'm not completely understanding your problems here. Can you explain
> why urllib.urlencode wouldn't work?
> (http://docs.python.org/lib/module-urllib.html)
>
> Thanks,
> -Dave

Hmm, I guess I meant something different by using "body"- I meant
request data part and not the thing sent in ulr string.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Jarek Zgoda wrote:
>> I've never used Eclipse (beyond proving that it runs on various
>> computers). Can you please describe what behaviour you're looking for?
>> 
>
> The key is not "Eclipse" itself, but the whole Eclipse Platform.
>
> See http://wiki.eclipse.org/index.php/Rich_Client_Platform
>   
Thank you for helping me out here. I'd just gone on and on about what my 
conception of a RCP is. I think that link just about clarifies it.

W
-- 
http://mail.python.org/mailman/listinfo/python-list


Python for Smartcards on Windows XP (Python 2.4)

2007-05-18 Thread Thin Myrna
Dear all

I headed for for a Smartcard lib for Python and found PyCSC. The zipped
sources do not build [1] and the installer (exe file) wants to see a Python
2.5 installation. Does anyone know of an installer for Python 2.4?

Kind regards
Thin Myrna

[1] "python setup.py install" yields 

F:\Software.Python\PyCSC\PyCSC-0.3>python setup.py install
running install
running bdist_egg
running egg_info
writing .\PyCSC.egg-info\PKG-INFO
writing top-level names to .\PyCSC.egg-info\top_level.txt
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

This is strange, becaus ethere shouldn't be any dep's on .NET. Instead it
should use MSVC6 to compile/link into pycsc.pyd.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
> > >> For example, it HAS been published elsewhere that YouTube uses lighttpd,
> > >> not Apache: .
> > >
> > > How do you explain these, then:
> > >
> > > http://www.youtube.com/results.xxx
> > > http://www.youtube.com/results.php
> > > http://www.youtube.com/results.py
> >
> > Server signature is usually configurable.
>
> Yeah, but I don't know why it's configured it that way.  A good example
> of a question that looks perfectly appropriate for YouTube's OSCON
> session.

Let us know what they say! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
stefaan wrote:
>> To make it short: Is there something like this already?
>
> To make it short again: http://code.enthought.com/ets/
>
>   
Nice, seems very interesting. Bit of a bitch to set up, as it appears 
from scanning the site, but that might be it.
Thanks :)

Now for the everlasting circle of evaluating, feature-wanting, 
to-write-myself-deciding, failing, for-the-next-big-idea-waiting, 
asking, evaluationg, ...

;)


> I also know some people are trying to create something called pyxides,
> but
> also there I am not sure about the status: http://pyxides.stani.be/
>   
Seems interesting as well, if only for the fact that Edward Ream (author 
of LEO) seems to be involved there in some way. But then, I can't quite 
make out what it is really about. The link just brings me to the 
google-group. Seems to be some kind of text-editor effort. I'll keep an 
eye on that, but so far, enthought is the front runner.

Thx to everyone :)
W
-- 
http://mail.python.org/mailman/listinfo/python-list


A Few More Forrester Survey Questions

2007-05-18 Thread Jeff Rush
I'm down to the wire here on answering the Forrester survey but am stumped on
a few questions I hope someone can help me out with.

1) What -existing- examples of the use of Python to create social
   web applications are there?  These include chat, collaboration,
   forum boards, and editable content pages, RSS feeds.

   I know I use a lot of these, but under pressure I'm not coming
   up with a lot of names.  Can you throw a few my way?

2) How easy is it to install an application written in the language?
   How is the application deployed?

   I'm having some trouble understanding the difference between
   "deployment" and "installation".  I suspect those words may
   have a special meaning to Java developers (who designed the survey)
   or to Big Corporate IT developers.  Ideas?

   I can tell the story of distutils, python eggs and PyPI, and py2exe
   and py2mumble for the Mac -- is there more to the story than that?

3) What is the value of the language to developers?

   Yeah, a very common, slippery question.  Toss me some good
   explanations of why  -you- value Python.  Readable, free,
   cross-platform, powerful.  What else?  I'll synthesize
   something out of everyone's answers.


Thanks for any one-line answers you can dash off to me today.

Jeff Rush
Python Advocacy Coordinator

-- 
http://mail.python.org/mailman/listinfo/python-list


Why canNOT import from a local directory ?

2007-05-18 Thread Jia Lu
Hi all

 I created a folder named *lib* and put a py file *lib.py* in it.
 In the upper folder I created a py file as:


import lib.lib

def main():
"""
__doc__
"""
lib.lib.test()


# 
if __name__ == "__main__":
main()


But I got an error :
#.:python main.py
Traceback (most recent call last):
  File "main.py", line 6, in ?
import lib.lib
ImportError: No module named lib.lib

Why ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Peter Wang
On May 18, 10:15 am, Wildemar Wildenburger <[EMAIL PROTECTED]>
wrote:
> stefaan wrote:
> > To make it short again:http://code.enthought.com/ets/
>
> Nice, seems very interesting. Bit of a bitch to set up, as it appears
> from scanning the site, but that might be it.

Actually, just this week, we completed a major SVN reorganization and
from this point forward, all of the libraries in ETS will be released
as eggs.  In fact, eggs have been available for a long time for python
2.4, and now we have them for python 2.5 as well.

The "Eclipse in python" you're looking for is actually called
Envisage, and it is part of ETS: 
https://svn.enthought.com/enthought/wiki/Envisage

The "Dev Guide" has some tutorials etc.: 
https://svn.enthought.com/enthought/wiki/EnvisageDevGuide

Note that Envisage != ETS.  "ETS" is the term for the whole bundle of
various Enthought libraries, including Traits, Chaco, Pyface, etc.
Envisage does require some of these others (notably Traits and
Pyface), but they are all available as eggs.

> Now for the everlasting circle of evaluating, feature-wanting,
> to-write-myself-deciding, failing, for-the-next-big-idea-waiting,
> asking, evaluationg, ...

Chime in on the mailing list if you have any questions.  It's pretty
active and many people on it have lots of experience with Envisage.


-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Istvan Albert
On May 17, 2:30 pm, Gregor Horvath <[EMAIL PROTECTED]> wrote:

> Is there any difference for you in debugging this code snippets?

> class Türstock(object):

Of course there is, how do I type the ü ? (I can copy/paste for
example, but that gets old quick).

But you're making a strawman argument by using extended ASCII
characters that would work anyhow. How about debugging this (I wonder
will it even make it through?) :

class 6자회담관련론조
   6자회 = 0
   6자회담관련 고귀 명=10


(I don't know what it means, just copied over some words from a
japanese news site, but the first thing it did it messed up my editor,
would not type the colon anymore)

i.

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Stef Mientki
Wildemar Wildenburger wrote:
> Jarek Zgoda wrote:
>> There are few GUI frameworks building on various toolkits. I used to use
>> Kiwi for PyGTK, it's mature and stable, although the approach is not the
>> same as, for example, Delphi
> Thanks for the effort, but I think I'm not well understood. I'm not 
> looking for a GUI framework (which, by the way, is most likely to be 
> wxPython), but for a pure plugin architecture. A rich-client-platform, 
> as it is sometimes called. Nothing specific about anythin in particular, 
> just something that runs plugins. Like Eclipse does these days.
> 
> It's beginning to dawn on me that I'll have to cook something up myself. 
> *grumble*
> ;)
> 
> W
I took a look at Eclipse page you mentioned but after reading the first page I 
still don't 
understand what you mean (and I never read beyond the first page ;-).
With a plugin system, I can think of a complete operating system,
or I can think of something like a DTP, or simply Word,
or I can think of something like Signal WorkBench
etc.

I think if you don't express what all of the tasks of that framework will be,
it's not well possible to create one.

Do you want just launching of applications, or do they have to communicate,
exchange data, launch each other, create together one document or more general 
control one process,
and lots of more questions ;-)

cheers,
Stef Mientki


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: progress indicator in a mod_python script

2007-05-18 Thread Larry Bates
Rajarshi wrote:
> Hi, I have a web application built using mod_python.Currently it
> behaves like a standard CGI - gets data from a form, performs a query
> on a backend database and presents a HTML page.
> 
> However the query can sometimes take a bit of time and I'd like to
> show the user some form of indeterminate progress indicator (spinning
> dashes etc). My searching seems to indicate that this is based on some
> form of asynchronous calls (AJAX) and I'm not sure how I can achieve
> this effect in my mod_python app.
> 
> Any pointers to achieve this would be very appreciated.
> 
> Thanks,
> 
If you want "real" progress than you must do it with some asynchronous
communications via XMLRPC or sockets.  You can "simulate" progress by
doing a little client-side javascript and include a progressive GIF.
There are a bunch of them available here:

http://www.ajaxload.info/

-Larry
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why canNOT import from a local directory ?

2007-05-18 Thread Thin Myrna
Jia Lu wrote:

> Hi all
> 
>  I created a folder named *lib* and put a py file *lib.py* in it.
>  In the upper folder I created a py file as:
> 
> 
> import lib.lib
> 
> def main():
> """
> __doc__
> """
> lib.lib.test()
> 
> 
> # 
> if __name__ == "__main__":
> main()
> 
> 
> But I got an error :
> #.:python main.py
> Traceback (most recent call last):
>   File "main.py", line 6, in ?
> import lib.lib
> ImportError: No module named lib.lib
> 
> Why ?

You need to define a file __init__.py in your newly created lib directory.

HTH
Thin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why canNOT import from a local directory ?

2007-05-18 Thread Jia Lu

>
> You need to define a file __init__.py in your newly created lib directory.
>
Thank you very much :)


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Javier Bezos
"Istvan Albert" <[EMAIL PROTECTED]> escribió:

> How about debugging this (I wonder will it even make it through?) :
>
> class 6???
 >   6?? = 0
 >  6? ?? ?=10

This question is more or less what a Korean who doesn't
speak English would ask if he had to debug a program
written in English.

> (I don't know what it means, just copied over some words
> from a japanese news site,

A Japanese speaking Korean, it seems. :-)

Javier
--
http://www.texytipografia.com 


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Paul Boddie
On 18 Mai, 18:42, "Javier Bezos" <[EMAIL PROTECTED]> wrote:
> "Istvan Albert" <[EMAIL PROTECTED]> escribió:
>
> > How about debugging this (I wonder will it even make it through?) :
>
> > class 6???
>
>  >   6?? = 0
>  >  6? ?? ?=10
>
> This question is more or less what a Korean who doesn't
> speak English would ask if he had to debug a program
> written in English.

Perhaps, but the treatment by your mail/news software plus the
delightful Google Groups of the original text (which seemed intact in
the original, although I don't have the fonts for the content) would
suggest that not just social or cultural issues would be involved.
It's already more difficult than it ought to be to explain to people
why they have trouble printing text to the console, for example, and
if one considers issues with badly configured text editors putting the
wrong character values into programs, even if Python complains about
it, there's still going to be some explaining to do.

One thing that some people already dislike about Python is the
"editing discipline" required. Although I don't have much time for
people whose coding "skills" involve random edits using badly
configured editors, trashing the indentation and the appearance of the
code (regardless of the language involved), we do need to consider the
need to bring people "up to speed" gracefully by encouraging the
proper use of tools, and so on, all without making it seem really
difficult and discouraging people from learning the language.

Paul

-- 
http://mail.python.org/mailman/listinfo/python-list


namespace question

2007-05-18 Thread T. Crane
Hi,

If I define a class like so:

class myClass:
import numpy
a = 1
b = 2
c = 3

def myFun(self):
print a,b,c
return numpy.sin(a)


I get the error that the global names a,b,c,numpy are not defined.  Fairly 
straightforward.  But if I am going to be writing several methods that keep 
calling the same variables or using the same functions/classes from numpy, 
for example, do I have to declare and import those things in each method 
definition?  Is there a better way of doing this?

thanks,
trevis 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python-URL! - weekly Python news and links (May 16)

2007-05-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>,
Steve Holden  <[EMAIL PROTECTED]> wrote:
>Steve Holden wrote:
>> Beliavsky wrote:
>>> On May 16, 2:45 pm, "Cameron Laird" <[EMAIL PROTECTED]> wrote:
 QOTW:  "Sometimes you just have to take the path of least distaste". - 
 Grant
 Edwards

 "I want to choose my words carefully here, so I'm not misunderstood.  
>>> 
>>>
>>> I think Cameron Laird does a good job with the Python digest but
>>> blundered here. Why did he highlight a foul comment having nothing to
>>> do with Python?
>>>
>> In fact it *is* peripherally related, since Gartner are currently doing 
>> a "survey" on dynamic languages, and there was a considerable effort 
>> exerted just to make sure that most of the questions actually allowed 
>> sensible comparisons between the various languages.
>> 
>Please accept my apology: it's Forrester who are currently undertaking 
>the study on dynamic languages. Anyone interested in helping might look at
>
>http://python-advocacy.blogspot.com/2007/05/need-help-in-preparing-for-study-of.html
>
>and (now the study is underway)
>
>http://python-advocacy.blogspot.com/2007/05/seeking-four-code-samples-for-forrester.html
.
.
.
I'll make a few personal comments.

I knew the choice of quotes was in questionable taste.  I was
out to be provocative without being offensive, though.  My
apologies to Mr. Beliavsky and anyone else I disappointed.  On
the whole, I still think I constructed the QOTWs appropriately.

I have very little patience with The Analysts as a category.  I
have friends and acquaintances in the business, and I respect
them individually.  I am VERY skeptical about the sausage they
produce at an institutional level, and can only experience its
making for a few minutes at a time.

I know Gartner and Forrester are different--they really are.  
For me, the differences pale in comparison to the dreary simi-
larities.

Many of the questions Forrester asks are ones that recur here
in comp.lang.python (and elsewhere).  I think it's a *great*
time to comment on them in a lasting way, and I've set up http://wiki.python.org/moin/What_applications_that_support_'the_application_lifecycle'_are_available_to_Python_developers%3f
 >
to encourage that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Gregor Horvath
Istvan Albert schrieb:
> On May 17, 2:30 pm, Gregor Horvath <[EMAIL PROTECTED]> wrote:
> 
>> Is there any difference for you in debugging this code snippets?
> 
>> class Türstock(object):
> 
> Of course there is, how do I type the ü ? (I can copy/paste for
> example, but that gets old quick).
> 

I doubt that you can debug the code without Unicode chars. It seems that 
you do no understand German and therefore you do not know what the 
purpose of this program is.
Can you tell me if there is an error in the snippet without Unicode?

I would refuse to try do debug a program that I do not understand. 
Avoiding Unicode does not help a bit in this regard.

Gregor
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: A best approach to a creating specified http post body

2007-05-18 Thread Facundo Batista
[EMAIL PROTECTED] wrote:

> Hmm, I guess I meant something different by using "body"- I meant
> request data part and not the thing sent in ulr string.

You should specify better what you need yes.

See, to send POST information in an http request, you can do the
following...

>>> urllib2.urlopen(myurl, data=postbody)

...being postbody a string with the information you want to send, for
example "Hello world", "a=5&no=yes", or "\n\n\r\tMMalichorhoh829dh9ho2"

So, you need help building a post body, or you need building a string?

Regards,

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Kirk Job Sluder
Stef Mientki <[EMAIL PROTECTED]> writes:

> I took a look at Eclipse page you mentioned but after reading the
> first page I still don't understand what you mean (and I never read
> beyond the first page ;-).
> With a plugin system, I can think of a complete operating system,
> or I can think of something like a DTP, or simply Word,
> or I can think of something like Signal WorkBench
> etc.

The approach taken by Eclipse is exactly like that taken by emacs so
many years ago of creating a minimalist framework that offers a bare
bones user interface and services for running libraries.  Everything
else is a plug-in library that changes the behavior of that interface.
So if you want an editor for language "foo," you would customize a
"view" interface to display foo objects, and an "editor" interface to
display and modify "foo" text.  You might customize other "view"
objects to display documentation, compilation, and debugging
information.

(The fact that Eclipse and emacs are both rather lean programs is
obsucred by the sheer quantity of plug-ins that have become a part
of the standard installation.)



> cheers,
> Stef Mientki
>
>

-- 
Kirk Job Sluder
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List Moderator

2007-05-18 Thread Beliavsky
On May 18, 9:22 am, [EMAIL PROTECTED] wrote:



> You're probably right, but this week has been pretty bad. Every few
> posts there's another porn or boob related link. Sheesh!
>
> Mike

I wish Google Groups were enhanced to let users block messages
according to

(1) "keywords"
(2) average ranking of the message on Google groups.
(3) sender name

There are Python experts who work at Google ...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Michele Simionato
On May 16, 11:04 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote:
>
> Our main requirement for tools we're going to use is rock-solid
> stability. As one of our team-members puts it, "We want to use tools
> that are stable, has many developer-years and thousands of user-years
> behind them, and that we shouldn't worry about their _versions_." The
> main reason for that is that we want to debug our own bugs, but not
> the bugs in our tools.
>
> Our problem is - we yet have to find any example of high-traffic,
> scalable web-site written entirely in Python. We know that YouTube is
> a suspect, but we don't know what specific python web solution was
> used there.
>
> TurboGears, Django and Pylons are all nice, and provides rich features
> - probably too many for us - but, as far as we understand, they don't
> satisfy the stability requirement - Pylons and Django hasn't even
> reached 1.0 version yet. And their provide too thick layer - we want
> something 'closer to metal', probably similar to web.py -
> unfortunately, web.py doesn't satisfy the stability requirement
> either, or so it seems.
>
> So the question is: what is a solid way to serve dynamic web pages in
> python? Our initial though was something like python + mod_python +
> Apache, but we're told that mod_python is 'scary and doesn't work very
> well'.

AFAIK mod_python is solid and works well, but YMMV of course.
If you want rock solid stability, you want a framework where there is
little
development going on. In that case,  I have a perfect match for your
requirements: Quixote. It has been around for ages, it is the most bug
free framework I have seen and it *very* scalable. For instance
http://www.douban.com
is a Quixote-powered chinese site with more than 2 millions of pages
served per
day. To quote from a message on the Quixote mailing list:

"""
Just to report-in the progress we're making with a real-world Quixote
installation: yesterday douban.com celebrated its first 2 million-
pageview day. Quixote generated 2,058,207 page views. In addition,
there're about 640,000 search-engine requests. These put the combined
requests at  around 2.7 millions. All of our content pages are
dynamic, including the help and about-us pages.

We're still wondering if we're the busiest one of all the python/ruby
supported websites in the world.

Quixote runs on one dual-core home-made server (costed us US$1500).
We have three additional servers dedicated to lighttpd and mysql. We
use memcached extensively as well.

Douban.com is the most visible python establishment on the Chinese
web, so there's been quite a few django vs. quixote threads in the
Chinese language python user mailing lists.
"""

Michele Simionato

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: namespace question

2007-05-18 Thread Robert Kern
T. Crane wrote:
> Hi,
> 
> If I define a class like so:
> 
> class myClass:
> import numpy
> a = 1
> b = 2
> c = 3
> 
> def myFun(self):
> print a,b,c
> return numpy.sin(a)
> 
> 
> I get the error that the global names a,b,c,numpy are not defined.  Fairly 
> straightforward.  But if I am going to be writing several methods that keep 
> calling the same variables or using the same functions/classes from numpy, 
> for example, do I have to declare and import those things in each method 
> definition?  Is there a better way of doing this?

Put your imports at the module level. I'm not sure what you intended with a, b,
c so let's also put them at the top level.

import numpy
a = 1
b = 2
c = 4

class myClass:
def myFun(self):
print a, b, c
return numpy.sin(a)


OTOH, if a, b, c were supposed to be attached to the class so they could be
overridden in subclasses, or be default values for instances, you can leave them
in the class definition, but access them through "self" or "myClass" directly.


import numpy

class myClass:
a = 1
b = 2
c = 4

def myFun(self):
print self.a, self.b, myClass.c
return numpy.sin(self.a)

-- 
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: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread Daniel Nogradi
> > >> For example, it HAS been published elsewhere that YouTube uses lighttpd,
> > >> not Apache: .
> > >
> > > How do you explain these, then:
> > >
> > > http://www.youtube.com/results.xxx
> > > http://www.youtube.com/results.php
> > > http://www.youtube.com/results.py
> >
> > Server signature is usually configurable.
>
> Yeah, but I don't know why it's configured it that way.  A good example
> of a question that looks perfectly appropriate for YouTube's OSCON
> session.

Actually, the fact that http://www.youtube.com/results.php returns
legitimate content might be explainable by the fact that youtube was
started as a PHP app so they might provide this URL for backward
compatibility although today there is no PHP at all. See the abstract
of Mike Solomon's OSCON talk: "YouTube began as a small PHP
application. [...]"
http://conferences.oreillynet.com/cs/os2007/view/e_sess/13435
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Stef Mientki wrote:
> I took a look at Eclipse page you mentioned but after reading the first page 
> I still don't 
> understand what you mean (and I never read beyond the first page ;-).
>   
Well, what can I say ...
;)


> With a plugin system, I can think of a complete operating system,
> or I can think of something like a DTP, or simply Word,
> or I can think of something like Signal WorkBench
> etc.
>   
Yes exactly. As I said: Nothing in particular. Just an environment that 
loads and unloads little bits if functionality, whatever those may be.
I think what most people think of when they hear "plugin" is: An 
Application that can be extended.
An RCP provides no more than the next step: No monolithic app, just 
plugins (which can have plugins themselves (which can have plugins 
themselves (which ...))). Write a text editor component and use it in 
your music-sequencer that also monitors your internet-activity, if you must.


> I think if you don't express what all of the tasks of that framework will be,
> it's not well possible to create one.
>
>   
Oh, but it is! Eclipse is such a framework. Pitty is, it's written in 
Java. ;)


> Do you want just launching of applications, or do they have to communicate,
> exchange data, launch each other, create together one document or more 
> general control one process,
> and lots of more questions ;-)
>   
Who knows? Thats the beauty of it. Eclipse has been conceived as an 
IDE/Text-Editor. But now it is just a platform for others to build 
plugins for. Such as an IDE. There are plans to make an eclipse-based 
general PIM (called Haystack, I think). The concept is very simple, but 
for some reason, highly unusual at present. I'm pretty sure that this 
will change sooner or later.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Gregor Horvath
Paul Boddie schrieb:

> Perhaps, but the treatment by your mail/news software plus the
> delightful Google Groups of the original text (which seemed intact in
> the original, although I don't have the fonts for the content) would
> suggest that not just social or cultural issues would be involved.

I do not see the point.
If my editor or newsreader does display the text correctly or not is no 
difference for me, since I do not understand a word of it anyway. It's a 
meaningless stream of bits for me.
It's save to assume that for people who are finding this meaningful 
their setup will display it correctly. Otherwise they could not work 
with their computer anyway.

Until now I did not find a single Computer in my German domain who 
cannot display: ß.

Gregor
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread John Nagle
Bruno Desthuilliers wrote:
> John Nagle a écrit :
> 
>> Victor Kryukov wrote:
>>
>>> Hello list,
>>>
>>> our team is going to rewrite our existing web-site, which has a lot of
>>> dynamic content and was quickly prototyped some time ago.
>>
>> ...
>>
>>> Our main requirement for tools we're going to use is rock-solid
>>> stability. As one of our team-members puts it, "We want to use tools
>>> that are stable, has many developer-years and thousands of user-years
>>> behind them, and that we shouldn't worry about their _versions_." The
>>> main reason for that is that we want to debug our own bugs, but not
>>> the bugs in our tools.
>>
>>
>>You may not be happy with Python, then.
> 
> 
> John, I'm really getting tired of your systemic and totally 
> unconstructive criticism. If *you* are not happy with Python, by all 
> means use another language.

Denying the existence of the problem won't fix it.

Many of the basic libraries for web related functions do have
problems.  Even standard modules like "urllib" and "SSL" are buggy,
and have been for years.  Outside the standard modules, it gets
worse, especially for ones with C components.  Version incompatibility
for extensions is a serious problem.  That's reality.

It's a good language, but the library situation is poor.  Python as
a language is better than Perl, but CPAN is better run than Cheese Shop.

As a direct result of this, neither the Linux distro builders like
Red Hat nor major hosting providers provide Python environments that
just work.  That's reality.

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread Javier Bezos

>> This question is more or less what a Korean who doesn't
>> speak English would ask if he had to debug a program
>> written in English.
>
> Perhaps, but the treatment by your mail/news software plus the
> delightful Google Groups of the original text (which seemed intact in
> the original, although I don't have the fonts for the content) would
> suggest that not just social or cultural issues would be involved.

The fact my Outlook changed the text is irrelevant
for something related to Python. And just remember
how Google mangled the intentation of Python code
some time ago. This was a technical issue which has
been solved, and no doubt my laziness (I didn't
switch to Unicode) won't prevent non-ASCII identifiers
be properly showed in general.

Javier
-
http://www.texytipografia.com



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Wildemar Wildenburger
Peter Wang wrote:
> Actually, just this week, we completed a major SVN reorganization and
> from this point forward, all of the libraries in ETS will be released
> as eggs.  In fact, eggs have been available for a long time for python
> 2.4, and now we have them for python 2.5 as well.
>
>   
I'm not sure, but you guys seem a bit Windows-centric. I have yet to 
find out if the egg-approach actually works for Linux (and Mac, though I 
don't use it) as well. I've seen some mentioning of binary dependencies, 
which makes me frown a bit. We'll just see.


> The "Eclipse in python" you're looking for is actually called
> Envisage, and it is part of ETS: 
> https://svn.enthought.com/enthought/wiki/Envisage
>
> The "Dev Guide" has some tutorials etc.: 
> https://svn.enthought.com/enthought/wiki/EnvisageDevGuide
>
>   
Yeah, I've been reading through that for the past couple of hours, seems 
pretty sweet and reasonably simple.
I can see your reorg, by the way: The example .py files are not where 
they're advertised to be. Better be quick with that, even solid software 
with buggy documentation is buggy software ... ;)


> Chime in on the mailing list if you have any questions.  It's pretty
> active and many people on it have lots of experience with Envisage.
>   
I'm almost sure I will :)

c.u.
/w
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regexes: How to handle escaped characters

2007-05-18 Thread Torsten Bronger
Hallöchen!

Charles Sanders writes:

> Torsten Bronger wrote:
>
> [...]
>
 Example string: u"Hollo", escaped positions: [4].  Thus, the
 second "o" is escaped and must not be found be the regexp
 searches.

 Instead of re.search, I call the function guarded_search(pattern,
 text, offset) which takes care of escaped caracters.  Thus, while
>
>   I'm still pretty much a beginner, and I am not sure
> of the exact requirements, but the following seems to work
> for at least simple cases when overlapping matches are not
> considered.
>
> def guarded_search( pattern, text, exclude ):
>   return [ m for m in re.finditer(pattern,text)
> if not [ e for e in exclude if m.start() <= e < m.end() ] ]

Yes, this seems to do the trick, thank you!

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
  (See http://ime.webhop.org for ICQ, MSN, etc.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread John Nagle
Alex Martelli wrote:
> Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> 
> 
>>Daniel Nogradi napisa?(a):
>>
>>
For example, it HAS been published elsewhere that YouTube uses lighttpd,
not Apache: .
>>>
>>>How do you explain these, then:
>>>
>>>http://www.youtube.com/results.xxx
>>>http://www.youtube.com/results.php
>>>http://www.youtube.com/results.py
>>
>>Server signature is usually configurable.
> 
> 
> Yeah, but I don't know why it's configured it that way.  A good example
> of a question that looks perfectly appropriate for YouTube's OSCON
> session.

YouTube's home page is PHP.  Try "www.youtube.com/index.php".
That works, while the obvious alternatives don't.
If you look at the page HTML, you'll see things like

  Log In

So there's definitely PHP inside YouTube.

If you look at the HTML for YouTube pages, there seem to be two
drastically different styles.  Some pages begin with "",
and have their CSS stored in external files. Those seem to be generated
by PHP.  Other pages start with
"",
with no "machine ID".  It looks like the stuff associated with
accounts and logging in is on the second system (Python?) while the
search and view related functions are on the PHP system.

Shortly after Google bought YouTube, they replaced YouTube's search
engine (which was terrible) with one of their own.  At that time,
Google search syntax, like "-", started working.  That's probably
when the shift to PHP happened.

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


Anti-Aliasing in wxPython?

2007-05-18 Thread Alexander D�nisch
Hi everybody

i'm wondering if there's a way to enable
Anti-Aliasing for the Graphics Object in wxPython.

in Java i do this:

((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, 
RenderingHints.VALUE_ANTIALIAS_ON);

i haven't found anything like this in wxPython yet.
Thanks

Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Web Programming - looking for examples of solid high-traffic sites

2007-05-18 Thread John Nagle
John Nagle wrote:

>YouTube's home page is PHP.  Try "www.youtube.com/index.php".
> That works, while the obvious alternatives don't.
> If you look at the page HTML, you'll see things like
> 
>onclick="_hbLink('LogIn','UtilityLinks');">Log In
> 
> So there's definitely PHP inside YouTube.

 Not sure; that "next" field is just the URL of the page you're on,
inserted into the output HTML.  It's "index.php" because the page was
"index.php".

 But it's an Apache server, with all the usual Apache messages.

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Rob Wolfe
Paul Rudin <[EMAIL PROTECTED]> writes:

> I can't get the gdb fringe interaction functionality to work with
> either pdb or pydb. Any hints as to versions or incantations I should
> try?

It works for me on Debian Etch and GNU Emacs 21.4.1.
I'm using this settings:

(setq pdb-path '/usr/lib/python2.4/pdb.py
  gud-pdb-command-name (symbol-name pdb-path))  

(defadvice pdb (before gud-query-cmdline activate)
  "Provide a better default command line when called interactively."
  (interactive
   (list (gud-query-cmdline pdb-path
(file-name-nondirectory buffer-file-name)


-- 
HTH,
Rob
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: namespace question

2007-05-18 Thread T. Crane
"Robert Kern" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> T. Crane wrote:
>> Hi,
>>
>> If I define a class like so:
>>
>> class myClass:
>> import numpy
>> a = 1
>> b = 2
>> c = 3
>>
>> def myFun(self):
>> print a,b,c
>> return numpy.sin(a)
>>
>>
>> I get the error that the global names a,b,c,numpy are not defined. 
>> Fairly
>> straightforward.  But if I am going to be writing several methods that 
>> keep
>> calling the same variables or using the same functions/classes from 
>> numpy,
>> for example, do I have to declare and import those things in each method
>> definition?  Is there a better way of doing this?
>
> Put your imports at the module level. I'm not sure what you intended with 
> a, b,
> c so let's also put them at the top level.

If you put them at the top level, and suppose you saved it all in a file 
called test.py, then when you type

ln [1]: from test import myClass

does it still load a,b,c and numpy into the namespace?

>
> import numpy
> a = 1
> b = 2
> c = 4
>
> class myClass:
>def myFun(self):
>print a, b, c
>return numpy.sin(a)
>
>
> OTOH, if a, b, c were supposed to be attached to the class so they could 
> be
> overridden in subclasses, or be default values for instances, you can 
> leave them
> in the class definition, but access them through "self" or "myClass" 
> directly.

Yeah, they don't need to be accessed anywhere other than within the class 
itself and I won't need to overwrite them, so I'll try just putting them in 
the top level.

thanks,
trevis


>
>
> import numpy
>
> class myClass:
>a = 1
>b = 2
>c = 4
>
>def myFun(self):
>print self.a, self.b, myClass.c
>return numpy.sin(self.a)
>
> -- 
> 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: pyhdf

2007-05-18 Thread Joshua J. Kugler
On Wednesday 16 May 2007 09:36, [EMAIL PROTECTED] wrote:

> Has anyone had success installing the pyhdf library with python 2.4
> under linux 2.6.18 (debian)? I have installed the HDF library and
> development package from apt and have downloaded the pyhdf
> installation files.

I've had success with PyTables, which is a wrapper for HDF5.  Or are we not
talking about the same HDF? :)

j

-- 
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE

-- 
Posted via a free Usenet account from http://www.teranews.com

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Paul Rudin
Rob Wolfe <[EMAIL PROTECTED]> writes:

> Paul Rudin <[EMAIL PROTECTED]> writes:
>
>> I can't get the gdb fringe interaction functionality to work with
>> either pdb or pydb. Any hints as to versions or incantations I should
>> try?
>
> It works for me on Debian Etch and GNU Emacs 21.4.1.
> I'm using this settings:
>
> (setq pdb-path '/usr/lib/python2.4/pdb.py
>   gud-pdb-command-name (symbol-name pdb-path))
>
> (defadvice pdb (before gud-query-cmdline activate)
>   "Provide a better default command line when called interactively."
>   (interactive
>(list (gud-query-cmdline pdb-path
>   (file-name-nondirectory buffer-file-name)

Unfortunately this doesn't make any difference for me, with either
emacs 22 or 21. I guess I'll just have to dig deeper into the code. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Python compared to other language

2007-05-18 Thread scott
Hi all,

I have been looking at the various programming languages available.  I 
have programed in Basic since I was a teenager and I also have a basic 
understanding of C, but I want something better.

Can anybody tell me the benefits and weaknesses of using Python?

-- 
Your friend,
Scott

Sent to you from a Linux computer using Kubuntu Version 7.04 (Feisty Fawn)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Rob Wolfe
Paul Rudin <[EMAIL PROTECTED]> writes:

> Unfortunately this doesn't make any difference for me, with either
> emacs 22 or 21. I guess I'll just have to dig deeper into the code. 

So what happens after M-x pdb?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compared to other language

2007-05-18 Thread Beliavsky
On May 18, 3:04 pm, scott <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have been looking at the various programming languages available.  I
> have programed in Basic since I was a teenager and I also have a basic
> understanding of C, but I want something better.
>
> Can anybody tell me the benefits and weaknesses of using Python?

That question has been asked hundreds of times here -- read the
archives of this group and language comparisons on the web, for
example the one by Eric Raymond at 
http://www.faqs.org/docs/artu/languageschapter.html
.

Even better, try the language and draw your own conclusions.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compared to other language

2007-05-18 Thread Michael Bentley

On May 18, 2007, at 2:04 PM, scott wrote:
>
>   I have been looking at the various programming languages  
> available.  I
> have programed in Basic since I was a teenager and I also have a basic
> understanding of C, but I want something better.
>
>   Can anybody tell me the benefits and weaknesses of using Python?

Hi Scott,

I think it is best that you learn Python's benefits and weaknesses  
for yourself.  I don't mean to sound dismissive -- it's just that a  
list of benefits and weaknesses will be little more than hollow words  
until you have your own personal experiences.

http://docs.python.org/tut/tut.html is a pretty good place to start.

hth,
Michael

---
Debugging is twice as hard as writing the code in the first place.   
Therefore, if you write the code as cleverly as possible, you are, by  
definition, not smart enough to debug it. --Brian W. Kernighan


-- 
http://mail.python.org/mailman/listinfo/python-list


PAMELA DAVID

2007-05-18 Thread g - a - l - l - e - r - y
PAMELA   DAVID 


www.alphasearch.gr -- 
http://mail.python.org/mailman/listinfo/python-list

  1   2   >