Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Fredrik Lundh
Lasse Vågsæther Karlsen wrote:

> In other words, what is the difference between a "scripting language"
> and a "programming language".

here's one useful way to look at things:

"Unlike mainstream component programming, scripts usually
do not introduce new components but simply "wire" existing
ones. Scripts can be seen as introducing behavior but no
new state. /.../ Of course, there is nothing to stop a
"scripting" language from introducing persistent state -- it
then simply turns into a normal programming language."

-- Clemens Szyperski, in "Component Software":





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

Re: Jargons of Info Tech industry

2005-10-08 Thread Gordon Burditt
>>HTML enables a heck of a lot of problems:  "web bugs" in email,
>>links to fake sites that appear as real ones in what shows up
>>on the screen, Javascript viruses, denial-of-service attacks
>>(pages that open two windows when you close one), etc.
>>
>>>That is like hating all choirs because televangelists use them.
>>
>>I liken it more to hating all viruses because some of them 
>>install keyloggers.
>
> I take it then you avoid browsers or use Lynx?  

Last time I checked, it was impossible to send me an unsolicited
web site.  It is trivial, however, to send unsolicited email or
post unsolicited articles on USENET.  

No, I don't trust Lynx to read email or USENET articles.

>No you FIX the
>problems 

And how do you fix the problem of unsolicited USENET articles?
(*ALL* of them are unsolicited to someone).  Or unsolicited
email?  

>rather than wear a hair shirt. Same for email. Why should
>rich expressions only be permitted to those with websites.  

Web sites can't send you stuff unsolicited, and most of them have
enough stake in their reputation to keep the obnoxious stuff off
of them, since if they have viruses chances are you can't trust
buying anything from them.  "web bugs" aren't a problem with web
sites since the server logs log *all* the hits, and they don't have
to use hidden ones.  And I don't visit web sites without a good
reason to do so (that excludes seeing the URL in some SPAM).  Oh,
yes, and Javascript is turned off.

>Some people use email PRIMARILY for sharing photos.

And what does sharing photos (attachments) have to do with HTML?
USENET text groups are not the appropriate place for photos.

Gordon L. Burditt
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Continuous system simulation in Python

2005-10-08 Thread phil_nospam_schmidt
Nicholas,

I have a particular interest in this subject as well. I've also used
the Python/Scipy combination, and it is a tantalizing combination, but
I found it to be a bit more clumsy than I'd like. Plus, my need for
continuous-time simulation is not as great as it has been in the past.

That said, I've been down this path before (see
http://custom.lab.unb.br/pub/asme/DYNAMICS/BUFORD1.zip), and I would be
interested in helping to develop something. I agree that Python would
be a great foundation to build upon.

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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Donn Cave
Quoth Lasse_Vgsther_Karlsen <[EMAIL PROTECTED]>:
| Brandon K wrote:
|> Hrm...i find it demeaning to relegate Python to a scripting language 
|> while Visual Basic is in the "software development" section.  Python so 
|> outdoes VB in every way shape and form.

| 
|
| In that respect I would very much like to see a definition of "scripting 
| language" as well :)
|
| In other words, what is the difference between a "scripting language" 
| and a "programming language".

I oculd come up with a definition, but I can't come up with _the_
definition.  The word is used in such broad and vague ways that to
use it is practically a sign of sloppy thinking.

Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes:
> > I read mail over an ssh connection to a Unix shell.  I have no easy
> > way to read html email with a graphics browser.
> 
> You don't need a grahics browser - you just need a browser.

Right, precisely.  I use lynx, as I explained.  It renders the html as
plain text and doesn't violate any standards by doing so.  The html is
nothing but a pain in the neck that lynx removes, so they may as well
send text email in the first place.  Lynx shows that all the fancy
html formatting crap is just advisory at best.  It's perfectly fine
for a browser to ignore it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Mike Meyer
Paul Rubin  writes:
> I read mail over an ssh connection to a Unix shell.  I have no easy
> way to read html email with a graphics browser.

You don't need a grahics browser - you just need a browser. I read
mail in emacs, and use emacs-w3m to view html in the mailer. Works for
most things, and doesn't have the nasty side effect of letting the
sender know I read it by fetching images from their web site.

> I occasionally get html email that I want to read.  I save it in a
> file and read it with lynx, which so far works perfectly well.  I
> find html email to be a PITA and as someone else said, html in email
> is an almost sure sign that it's a message that I want to trash
> without reading it.

Unfortunately, I've found that HTML email comes in two flavors: That
which sets content-type to text/html in the headers, and that which
sets it to some form of multipart in the headers. I used to bounce all
mail of either form. Then I discovered that the AOL client - used by
my relatives - could *not* be set to not send HTML email. At least it
sends text/plain as well. On investigation, most legit email does
sends multipart/mixed, so I only reject mail whose sole content is
text/html.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Paul Rubin
Lasse Vågsæther Karlsen <[EMAIL PROTECTED]> writes:
> But trying to keep your email world into a pure text-based
> no-formatting-whatsoever world, that's a fantasy bubble that is bound
> to burst, sooner rather than later.

I read mail over an ssh connection to a Unix shell.  I have no easy
way to read html email with a graphics browser.  I occasionally get
html email that I want to read.  I save it in a file and read it with
lynx, which so far works perfectly well.  I find html email to be a
PITA and as someone else said, html in email is an almost sure sign
that it's a message that I want to trash without reading it.  But for
the rare exceptions, lynx as far as I know is 100% w3 standards
compliant, and it's plain text (and it works on terminals with no font
control) .  So there's no incompatibility between html and pure
text-based display.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daisy Daisy, give me your answer do

2005-10-08 Thread James Stroud
On Saturday 08 October 2005 16:26, Sam wrote:
> Xah Lee writes:
> > Dear Michael Goettsche,
> >
> > why don't you lead the pack to be on-topic for a change, huh?
>
> Why don't you:
>
> 1.  Learn how to properly format messages for posting to Usenet, so that
> your scribblings don't read like stream-of-consciousness babbling
> (see http://en.wikipedia.org/wiki/Top-posting).
>

Sam:

His scribblings *are* babbling, as I am sure you are quite aware. (Your 
predisposition for congeniality is showing through here.) Formatting would 
not help...unless, of course, he marks it up with "Rich Backspace 
Formatting" (RBF). Ideally, he would backspace once for every character.

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Matt Garrish

"John Bokma" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Rich Teer <[EMAIL PROTECTED]> wrote:
>
>> On Sun, 9 Oct 2005, Lasse Vågsæther Karlsen wrote:
>>
>>> But trying to keep your email world into a pure text-based
>>> no-formatting-whatsoever world, that's a fantasy bubble that is bound to
>>> burst, sooner rather than later.
>>
>> Not here.  I've configured my email server to reject HTML emails
>> before I even see them, and more often tham not I'll delete any
>> others that sneak through the gate.
>
> Good for you. If I do that, I lose some customers. Your private war is a
> joke, and one day you'll wake up. What a waste of energy.
>

LOL! Maybe this inane thread can finally die now...

Matt 


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

Re: Jargons of Info Tech industry

2005-10-08 Thread Paul Boddie
Roedy Green wrote:
> Just how long do you want to stall evolution?  Do you imagine people
> 200 years from now will be still be using pure ASCII text unable to
> find a solution to JavaScript viruses (turn off JS), pop-up( disable
> popups) etc.?

People in their sky-cars turning off JavaScript in their browsers: what
a thought!

But to suggest a seemingly endless list of "user customisations" to
prevent heightened exposure to irritating advertisers, phishing
attempts, malware and so on is to miss the point, just as Bill Gates
smugly does so (and I say this at the risk of sounding like a certain
other "contributor" to this newsgroup) by saying that computer software
isn't good enough and could be better/more secure/more stable, despite
running a software monopoly for the past decade or so and having an
unparalleled opportunity to do something about the situation instead of
just "milking it".

Every so often, discussions like these remind me of some ancient work I
once did on the topic of avoiding some of the issues raised by mobile
code and mobile content. Despite the likes of Mr Gates who will
probably try and persuade you that we're on the cutting edge
(presumably before demanding a premium to "sort it all out"), many of
the issues have been known about for a good while. Of course, that
doesn't mean that the software industry is in any hurry to do anything
about it.

Paul

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


Re: how do you pronounce wxpython

2005-10-08 Thread Paul Boddie
George Sakkis wrote:
> I am sure it is pronounced the same way as wxWidgets .

Which is in turn pronounced the same way as wxWindows. As to how that's
pronounced, I'd suggest asking Microsoft's lawyers whose actions in
"defending" an arguably dubious trademark possibly involved
investigating this issue in more depth.

Paul

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


Re: [regex] case-splitting strings in unicode

2005-10-08 Thread Micah Elliott
On Oct 09, John Perks and Sarah Mount wrote:
> I have to split some identifiers that are casedLikeThis into their
> component words. In this instance I can safely use [A-Z] to represent
> uppercase, but what pattern should I use if I wanted it to work more
> generally? I can envisage walking the string testing the
> unicodedata.category of each char, but is there a regex'y way to
> denote "uppercase"?

Not sure what your output should look like but something like this could
work:

>>> import re
>>> re.sub(r'([A-Z])', r' \1', 'theFirstTest theSecondTest')
'the First Test the Second Test'

This can be adapted for multiline, etc, but maybe '[A-Z]' is
sufficiently general.  The regex module does have an understanding of
unicode (but I don't, sorry); you could add (?u) make it unicode aware.
For programming language identifiers I wouldn't think that unicode
should be an issue.  Sorry I'm no help with unicode specifics.

Some useful links:

http://www.python.org/doc/2.4.2/lib/module-re.html
http://www.amk.ca/python/howto/regex/regex.html

-- 
Micah Elliott
<[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Book "Python and Tkinter Programming"

2005-10-08 Thread Dick Moores
DaveInSidney wrote at 15:55 10/8/2005:
>Check out BestBookBuys:
>http://www.bestwebbuys.com/Python_and_Tkinter_Programming-ISBN_1884777813.html?isrc=b-search

Or even better, BestBookDeal.com:


Dick Moores

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


Re: New Python book

2005-10-08 Thread hrh1818
The title is very misleading.  The book is a nice introduction to
Python, covers the high lights of Python without getting bogged down in
detail and the author has a lively writing style. But the book has very
litle to entice professional programmers.

Dick Moores wrote:
> (Sorry, my previous post should not have had "Tutor" in the subject header.)
>
> Magnus Lie Hetland's new book, _Beginning Python: From Novice to
> Professional_ was published by Apress on Sept. 26 (in the U.S.). My copy
> arrived in the mail a couple of days ago. Very much worth a look, IMHO.
> But what do the experts here think?
>
> 
> 
> Dick Moores
> [EMAIL PROTECTED]

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


Re: Jargons of Info Tech industry

2005-10-08 Thread Mike Meyer
Roedy Green <[EMAIL PROTECTED]> writes:
> This is one of the marvels of CSS once you get the hang of it.  If you
> don't like bright red letters on green backgrounds, you can CHANGE
> that. You can change the fonts, sizes etc etc. You can if you want get
> something very like plain ASCII text.

Show us *examples*! Do you create a style sheet for every site you
visit that overrides there classes? What?

> So from an aesthetic point of view, once people learn how it works,
> CSS lets sender and receiver compromise on what the message looks
> like. No other medium gives ANY control to the receiver about how a
> message is formatted.

Sorry, but that's bullshit. The receiver controls the viewer software,
and hence ultimately has complete control over *everything*. If I use
ghostscript as the viewer for ps and pdf files, I can install font map
files to replace all the standardd sans serif fonts with serifed
fonts, and so on. Some viewer applications may require editing the
magic .c, .cpp, etc. configuration files, but that's possible so long
as you're sending something other than pictures of words.

> There is also the philosophical question. When my nephew sends me a
> message, do I have a right to warp his intent even if I don't like the
> aesthetics?  That is part of his message.

If HTML is a medium, only someone really ignorant of the medium will
think that their presentation is preserved. As has been pointed out,
moving the file from Windows to other platforms changes the font
sizes. The physical monitor size, the screen size, the readers window
size, the dpi on the monitor, even the color depth on low-end devices
all change the presentation. The fonts you use may not be installed on
the recipients platform - I particularly like the idea that if you use
a font installed by some application, the only person who'll see it
the way you intended is the guy who bought the other copy of that
application.

So what you're really asking is if you have the right to read his
message on anything but his favorite rendering agent configured the
way he likees it, on his favorite computer configured the way he likes
it.

> Should my email reader fix the spelling mistakes in the emails sent me
> by angry US soldiers?  Or is that part of the message?

I say let Harlan Ellison decide.

> There are three different issues getting muddled together:
>
> 1. avoiding spam

I think what you mean here is "avoiding malware". Spam should be dealt
with before it gets to your mail reader.

> 2. making mail from well meaning but inept friends more readable.
>
> 3. what constitutes a good general style for general correspondence.
> How should you use rich text appropriately.

Well, if you want your presentation preserved, you don't send rich
text, you send pictures of words.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


[regex] case-splitting strings in unicode

2005-10-08 Thread John Perks and Sarah Mount
I have to split some identifiers that are casedLikeThis into their
component words. In this instance I can safely use [A-Z] to represent
uppercase, but what pattern should I use if I wanted it to work more
generally? I can envisage walking the string testing the
unicodedata.category of each char, but is there a regex'y way to denote
"uppercase"?

Thanks

John


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


Re: Jargons of Info Tech industry

2005-10-08 Thread Mike Meyer
Roedy Green <[EMAIL PROTECTED]> writes:

> On Sat, 08 Oct 2005 17:41:38 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote
> or quoted :
>>If you've got a browser with a better solution, what's the browser,
>>and what's the solution?
> Try Opera. You can merge the two. 

Merge the two CSS files? Most browsers do that - that's why they call
them "cascading" style sheets. Got a sample style sheet that you use
that prevernts authors from overriding things?

For the font size problem, Camino has a simple solution: a "minimum
size" for fonts. That's why it's my default OS X browser (well, that
and that Terminal sucks as a scripting tool). I'm not sure you can do
that with CSS.

   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread John Bokma
Rich Teer <[EMAIL PROTECTED]> wrote:

> On Sun, 9 Oct 2005, Lasse Vågsæther Karlsen wrote:
> 
>> But trying to keep your email world into a pure text-based
>> no-formatting-whatsoever world, that's a fantasy bubble that is bound to
>> burst, sooner rather than later.
> 
> Not here.  I've configured my email server to reject HTML emails
> before I even see them, and more often tham not I'll delete any
> others that sneak through the gate.

Good for you. If I do that, I lose some customers. Your private war is a 
joke, and one day you'll wake up. What a waste of energy.

> If people want me to read their email, they should send it to me
> in an open, universal format, which for email is plain text.  It's
> as simple as that.

Is Unicode allowed, or is 7 bit ASCII the only right way?

-- 
John   Small Perl scripts: http://johnbokma.com/perl/
   Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)

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

Re: Jargons of Info Tech industry

2005-10-08 Thread John Bokma
Rich Teer <[EMAIL PROTECTED]> wrote:

> On Sat, 8 Oct 2005, Roedy Green wrote:
> 
>> Some people use email PRIMARILY for sharing photos.
> 
> WHat the hell has that got to do with HTML email?

The photo doesn't have to be included (as in attached)? with the email?

> Sending photos
> is an example of what attachments are for.

Yeah, yeah, and 640K is enough for everybody. Same song, different tune.

-- 
John   Small Perl scripts: http://johnbokma.com/perl/
   Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)

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


Re: Jargons of Info Tech industry

2005-10-08 Thread Rich Teer
On Sun, 9 Oct 2005, Lasse Vågsæther Karlsen wrote:

> But trying to keep your email world into a pure text-based
> no-formatting-whatsoever world, that's a fantasy bubble that is bound to
> burst, sooner rather than later.

Not here.  I've configured my email server to reject HTML emails
before I even see them, and more often tham not I'll delete any
others that sneak through the gate.

If people want me to read their email, they should send it to me
in an open, universal format, which for email is plain text.  It's
as simple as that.

-- 
Rich Teer, SCNA, SCSA, OpenSolaris CAB member

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Rich Teer
On Sat, 8 Oct 2005, Roedy Green wrote:

> Some people use email PRIMARILY for sharing photos.

WHat the hell has that got to do with HTML email?  Sending photos
is an example of what attachments are for.

> --
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Again taking new Java programming contracts.
>

-- 
Rich Teer, SCNA, SCSA, OpenSolaris CAB member

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daisy Daisy, give me your answer do

2005-10-08 Thread Sam

Xah Lee writes:


Dear Michael Goettsche,

why don't you lead the pack to be on-topic for a change, huh?


Why don't you:

1.  Learn how to properly format messages for posting to Usenet, so that 
your scribblings don't read like stream-of-consciousness babbling

(see http://en.wikipedia.org/wiki/Top-posting).

2.  Explain why such an important and famous ubergeek like yourself (judging 
by your web site) has to beg others to write code for him.


3.  Make sure the door handle doesn't hit your ass on the way out.




pgpPbnLZqTCxN.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: CSV like file format featured recently in Daily Python URL?

2005-10-08 Thread Alex Willmer
On Thu, 2005-10-06 at 07:44 -0800, EP wrote:
> Was it something like ARFF?  http://www.cs.waikato.ac.nz/~ml/weka/arff.html

Yes that was it thankyou. Although it would seem there isn't a general
python module, rather a Cookbook script to perform conversion to SQL. I
must have confused ARFF with HDF.

> Google "ARFF Python":  http://www.google.com/search?q=arff+python

Curiously, when I just performed that search, this thread was on the
first page of results as a supplemental result.

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


Re: how do you pronounce wxpython

2005-10-08 Thread George Sakkis
"Alex" <[EMAIL PROTECTED]> wrote:

> My native language is not English so I just wonder how you pronounce
> wxPython.
>
> vi-ex python
> double-you-ex python
> wax-python
>
> or something else
>
> Thanks

I am sure it is pronounced the same way as wxWidgets .

George


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


Pyzine article Python and MIDI

2005-10-08 Thread Gorlon the Impossible
ok, here's a long shot:
would anyone here who subscribes to Pyzine be willing to send me the
article on Python and MIDI from Issue #6? I would be eternally
grateful as I am strapped for funds and cannot justify spending the
money for a 1 yr subscription when i am only interested in this one
article. Thanks.

here's the link...

http://www.pyzine.com/Issue006/index.html


please?
pretty please?
with sugar on top?

Bri
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Book "Python and Tkinter Programming"

2005-10-08 Thread DaveInSidney
Check out BestBookBuys:
http://www.bestwebbuys.com/Python_and_Tkinter_Programming-ISBN_1884777813.html?isrc=b-search

-- 
..
Remove NOSPAM. before replying

Pursuant to U.S. code, title 47, Chapter 5, Subchapter II, Section 227
Any and all unsolicited commercial E-mail sent to this address is
subject to a fee of US $500.00. E-Mailing denotes acceptance of these
terms. Consult  for
details.




"striker" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Does anyone who has this book willing to sell it.  Please e-mail me the
> condition and any other details if you are interested.
> Thanks,
> Kevin
> 


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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Brandon K

> In other words, what is the difference between a "scripting language" 
> and a "programming language".
> 

Good point.


== Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups 
==
Get Anonymous, Uncensored, Access to West and East Coast Server Farms! 
== Highest Retention and Completion Rates! HTTP://WWW.NEWSGROUPS.COM ==


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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Lasse Vågsæther Karlsen
Brandon K wrote:
> Hrm...i find it demeaning to relegate Python to a scripting language 
> while Visual Basic is in the "software development" section.  Python so 
> outdoes VB in every way shape and form.
> 


In that respect I would very much like to see a definition of "scripting 
language" as well :)

In other words, what is the difference between a "scripting language" 
and a "programming language".

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread John Bokma
Roedy Green <[EMAIL PROTECTED]> wrote:

> On Tue, 04 Oct 2005 17:57:13 -, [EMAIL PROTECTED] (Gordon
> Burditt) wrote or quoted :
> 
>>
>>HTML enables a heck of a lot of problems:  "web bugs" in email,
>>links to fake sites that appear as real ones in what shows up
>>on the screen, Javascript viruses, denial-of-service attacks
>>(pages that open two windows when you close one), etc.
> 
> Just how long do you want to stall evolution?  Do you imagine people
> 200 years from now will be still be using pure ASCII text unable to
> find a solution to JavaScript viruses (turn off JS), pop-up( disable
> popups) etc.?

I've already the impression that a lot of people are moving from email to 
IM. I prefer email, but some of my customers prefer IM.

Also, with Unicode support in a plain text environment it's also possible 
to make links to fake sites. It's even possible with pure ASCII I mean:

HTTP://WWW.G00GLE.COM/ or even: http://www.goog1e.com/.

-- 
John   Small Perl scripts: http://johnbokma.com/perl/
   Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)

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


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Sun, 09 Oct 2005 00:03:05 +0200, Lasse Vågsæther Karlsen
<[EMAIL PROTECTED]> wrote or quoted :

>On one side you got control freaks who condemn everyone who dares send 
>an email with something other than what you've got your own email set up 
>to use. "You dare specify the font sized when I finally figured out that 
>10 is just right? Infidel!"

This is one of the marvels of CSS once you get the hang of it.  If you
don't like bright red letters on green backgrounds, you can CHANGE
that. You can change the fonts, sizes etc etc. You can if you want get
something very like plain ASCII text.

So from an aesthetic point of view, once people learn how it works,
CSS lets sender and receiver compromise on what the message looks
like. No other medium gives ANY control to the receiver about how a
message is formatted.

One of the most important changes in the ability to select special
fonts for the those without prefect vision and larger fonts.

There is also the philosophical question. When my nephew sends me a
message, do I have a right to warp his intent even if I don't like the
aesthetics?  That is part of his message.

Should my email reader fix the spelling mistakes in the emails sent me
by angry US soldiers?  Or is that part of the message?

There are three different issues getting muddled together:

1. avoiding spam

2. making mail from well meaning but inept friends more readable.

3. what constitutes a good general style for general correspondence.
How should you use rich text appropriately.
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Brandon K
[EMAIL PROTECTED] wrote:
> I've launched a new forum not too long ago, and I invite you all to go
> there: www.wizardsolutionsusa.com (click on the forum link).  We offer
> all kinds of help, and for those of you who just like to talk, there's
> a chit chat section just for you...Just remember that forum
> communication is much easier, safer, and faster.
> 

[.section Blurb]

About me:
My name is James (Cantley) Sheppard. I am a North Carolina resident, at 
the age of 16. I have been programming since the age of 12, and enjoy it 
as lifes[sic] greatest passion. In the future, I would love to become 
the leading Software Engineer at a fairly large company, and maybe 
someday own my own business. As of right now, I am currently in high 
school and planning on going to a four year college somewhere around the 
country. Well, that is my life story, and about all I got to say!


[.section Commentary]

Hrm, obviously hasn't had enough programming experience in 4 years to 
quite know what he's talking about.  Before making random "assertions" 
James, you might want to take into account the community you're talking 
to.  I don't know about you guys, but I've had enough teen start up 
webpages.  They clog the web.  No offense of course to the younger 
readers, its just...it's like E/N sites...junk most of the time.


== Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups 
==
Get Anonymous, Uncensored, Access to West and East Coast Server Farms! 
== Highest Retention and Completion Rates! HTTP://WWW.NEWSGROUPS.COM ==


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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Brandon K
Hrm...i find it demeaning to relegate Python to a scripting language 
while Visual Basic is in the "software development" section.  Python so 
outdoes VB in every way shape and form.


> I've launched a new forum not too long ago, and I invite you all to go
> there: www.wizardsolutionsusa.com (click on the forum link).  We offer
> all kinds of help, and for those of you who just like to talk, there's
> a chit chat section just for you...Just remember that forum
> communication is much easier, safer, and faster.
> 


== Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups 
==
Get Anonymous, Uncensored, Access to West and East Coast Server Farms! 
== Highest Retention and Completion Rates! HTTP://WWW.NEWSGROUPS.COM ==


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


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Sat, 08 Oct 2005 17:41:38 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote
or quoted :

>If you've got a browser with a better solution, what's the browser,
>and what's the solution?

Try Opera. You can merge the two. 
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Tue, 04 Oct 2005 17:57:13 -, [EMAIL PROTECTED] (Gordon
Burditt) wrote or quoted :

>
>HTML enables a heck of a lot of problems:  "web bugs" in email,
>links to fake sites that appear as real ones in what shows up
>on the screen, Javascript viruses, denial-of-service attacks
>(pages that open two windows when you close one), etc.

Just how long do you want to stall evolution?  Do you imagine people
200 years from now will be still be using pure ASCII text unable to
find a solution to JavaScript viruses (turn off JS), pop-up( disable
popups) etc.?
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Mike Meyer
Roedy Green <[EMAIL PROTECTED]> writes:

> On Tue, 04 Oct 2005 17:57:13 -, [EMAIL PROTECTED] (Gordon
> Burditt) wrote or quoted :
>
>>HTML enables a heck of a lot of problems:  "web bugs" in email,
>>links to fake sites that appear as real ones in what shows up
>>on the screen, Javascript viruses, denial-of-service attacks
>>(pages that open two windows when you close one), etc.
>>
>>>That is like hating all choirs because televangelists use them.
>>
>>I liken it more to hating all viruses because some of them 
>>install keyloggers.
>
>  I take it then you avoid browsers or use Lynx?

It's not quite that bad. You run multiple browsers: your default
browser turns off all the crap that can run code on your machine. You
use a second browser that has most of that turned on, and bookmark the
sites that need those features that you now trust. Maybe your browser
lets you have multiple profiles, in which case you can use those
instead of multiple browsers. Unless your goat browser is IE (or
Mozilla on Unix), you should keep a copy of IE (Mozilla on Unix)
around, with an untouched configuration, for the sites that either
enforce their belief that they only work on IE, or are one of those
rare sats where correctly believe that. Finally, you configure your
mail and news readers to *not* decode MIME messages unless given an
explicit command to do so.

I understand some browsers now let you enable dangers features on a
site-by-site basis. I'll check those out one of these days.

FWIW, I like w3m as a default browser, because it has the ability to
launch external browsers on a page or link.

> No you FIX the problems rather than wear a hair shirt. Same for
> email. Why should rich expressions only be permitted to those with
> websites.

The technial problems have been solved for over a decade. NeXT shipped
systems that used text/richtext, which has none of the problems that
HTML has.  The problems are *social* - you've got to arrange for
people to use mail/news readers that understand a rich text format
that isn't a vector for viruses.

> Some people use email PRIMARILY for sharing photos.

That doesn't take HTML. I get - and send - pictures via email all the
time, with nary a tag of HTML in sight.

http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Lasse Vågsæther Karlsen
Mike Meyer wrote:
> If you've got a browser with a better solution, what's the browser,
> and what's the solution?

There is no single solution.

On one side you got control freaks who condemn everyone who dares send 
an email with something other than what you've got your own email set up 
to use. "You dare specify the font sized when I finally figured out that 
10 is just right? Infidel!"

On the other side you got people who would like to have slightly more 
control over their email formatting than the ability to hit enter to 
denote a line break. "Whaddya mean I can't specify bold text to 
emphasize a point?"

As long as you got something called a feature, there will always be 
people who will be able to abuse it.

Now, if you want to get into a big huff because someone you knows use a 
font that is "slightly oversized" because of Windows, then I think you 
missed the point of the email altogether, which was probably to convey a 
message.

Just the same as people that sends bright red text on green background 
seems to miss the whole issue of "appropriate".

It doesn't matter what is used, decided, controlled, allowed, removed, 
whatever. Some people will always like it, some will hate it, some will 
abuse it, but most of all there will always be people that will discuss it.

Hopefully most people will use it for what it is.

In any case, html email is here to stay. Or perhaps I should remove html 
and say "richly formatted", whatever that might mean in the future.

But trying to keep your email world into a pure text-based 
no-formatting-whatsoever world, that's a fantasy bubble that is bound to 
burst, sooner rather than later.

Deal with it.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Mike Meyer
Roedy Green <[EMAIL PROTECTED]> writes:

> On Wed, 05 Oct 2005 09:38:49 +1000, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote or quoted :
>
>>Yes it is. HTML means that after I've specified my email client use my
>>favourite font, in the size I like, people send me emails that over-ride
>>my choice. Invariably they use a font I don't even have. 
>
> I would suggest then a better solution is to implement CSS in email,
> the way you do in browsers to deal with that same problem.

The only way I've seen a browser fix this is to ignore the clients CSS
completely. That breaks a lot of HTML, becuase CSS has turned "tag
soup" authors into "div soup" authors.

If you've got a browser with a better solution, what's the browser,
and what's the solution?

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daisy Daisy, give me your answer do

2005-10-08 Thread Xah Lee
Dear Michael Goettsche,

why don't you lead the pack to be on-topic for a change, huh?

 Xah

Michael Goettsche wrote:
> On Saturday 08 October 2005 22:10, Xah Lee wrote:
> > there is a MacPerl program posted in 1998 that uses Mac's speech synth
> > to sing Daisy Bell.
> > See:
> >
> > http://bumppo.net/lists/macperl/1998/11/msg00412.html
> >
> > can anyone modify it so it runs out of the box on today's OS X?
> >
> > PS i'm posting this also in python and lisp group, i hope it'd be some
> > general interest. For some background of this song, see
> >   http://xahlee.org/Periodic_dosage_dir/sanga_pemci/daisy_bell.html
> >
> > i'm interested in getting versions that can sing the song in Windows,
> > Mac, Linux using whatever speech synth each OS may provide. Thanks.
> >
> >  Xah
> >  [EMAIL PROTECTED]
> > ∑ http://xahlee.org/
>
> You're asking "tech geekers" and "morons" to do this job? Isn't that a task
> for somebody more professional like you?

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

Re: Continuous system simulation in Python

2005-10-08 Thread Nicolas Pernetty
Simulink is well fitted for small simulators, but when you run into big
projects, I find many shortcomings appears which made the whole thing
next to unusable for our kind of projects.

That's why I'm interested in Python by the way, it is not a simple clone
like Scilab/Scicos. It is a real language which bring its own
advantages, and its own shortcomings, which I find well suited for our
activity.

If you want, I can send you a paper I wrote last year, detailing all
Simulink shortcomings. I doubt that this mailing list is interested in
such things...(and it's in French...).

Concerning Scilab/Scicos, I'm not really interested in a technology
primarily developed (INRIA and ENSPC) and used by France. Python and all
its libraries and communities are so much more dynamic !
And also I've heard that Scilab was developed in Fortran in a way which
make it rigid and that the sources are poorly documented, not a good
sign for an open source software (and Scilab isn't 'Free' for the FSF).

Regards,


*** REPLY SEPARATOR  ***

On 8 Oct 2005 11:06:25 -0700, "Sébastien Boisgérault"
<[EMAIL PROTECTED]> wrote :

> 
> Simulink is a framework widely used by the control engineers ...
> It is not *perfect* but the ODEs piece is probably the best
> part of the simulator. Why were you not convinced ?
> 
> You may also have a look at Scicos and Ptolemy II. These
> simulators are open-source ... but not based on Python.
> 
> Cheers,
> 
> SB
> 
> 
> 
> 
> 
> Nicolas Pernetty a écrit :
> 
> > Hello Phil,
> >
> > Yes I have considered Octave. In fact I'm already using Matlab and
> > decided to 'reject' it for Python + Numeric/numarray + SciPy because
> > I think you could do more in Python and in more simple ways.
> >
> > Problem is that neither Octave, Matlab and Python offer today a
> > framework to build continuous system simulator (in fact Matlab with
> > Simulink and SimMechanics, do propose, but I was not convinced at
> > all).
> >
> > Regards,
> >
> > *** REPLY SEPARATOR  ***
> >
> > On 7 Oct 2005 11:00:54 -0700, [EMAIL PROTECTED] wrote :
> >
> > > Nicholas,
> > >
> > > Have you looked at Octave? It is not Python, but I believe it can
> > > talk to Python.
> > > Octave is comparable to Matlab for many things, including having
> > > ODE solvers. I have successfully used it to model and simulate
> > > simple systems. Complex system would be easy to model as well,
> > > provided that you model your dynamic elements with (systems of)
> > > differential equations.
> > >
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socketServer questions

2005-10-08 Thread Paul Rubin
rbt <[EMAIL PROTECTED]> writes:
> Off-topic here, but you've caused me to have a thought... Can hmac be
> used on untrusted clients? Clients that may fall into the wrong hands?
> How would one handle message verification when one cannot trust the
> client? What is there besides hmac? Thanks, rbt

I don't understand the question.  HMAC requires that both ends share a
secret key; does that help?  What do you mean by verification?  Do you
mean you want to make sure that's really Bob logging into your
computer, even when Bob might have intentionally given his password to
someone else?  It sounds like you want something like DRM.  What
exactly are you trying to do?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Wed, 05 Oct 2005 09:38:49 +1000, Steven D'Aprano
<[EMAIL PROTECTED]> wrote or quoted :

>Even more invariably, they set the point size directly rather than in
>relative terms, and they are on Windows, where point sizes are about 20%
>oversized.

 that is like giving up Java because there was a bug in the Windows
JVM. FIX THE BUG.
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Wed, 05 Oct 2005 09:38:49 +1000, Steven D'Aprano
<[EMAIL PROTECTED]> wrote or quoted :

>Yes it is. HTML means that after I've specified my email client use my
>favourite font, in the size I like, people send me emails that over-ride
>my choice. Invariably they use a font I don't even have. 

I would suggest then a better solution is to implement CSS in email,
the way you do in browsers to deal with that same problem.
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Jargons of Info Tech industry

2005-10-08 Thread Roedy Green
On Tue, 04 Oct 2005 17:57:13 -, [EMAIL PROTECTED] (Gordon
Burditt) wrote or quoted :

>HTML enables a heck of a lot of problems:  "web bugs" in email,
>links to fake sites that appear as real ones in what shows up
>on the screen, Javascript viruses, denial-of-service attacks
>(pages that open two windows when you close one), etc.
>
>>That is like hating all choirs because televangelists use them.
>
>I liken it more to hating all viruses because some of them 
>install keyloggers.

 I take it then you avoid browsers or use Lynx?  No you FIX the
problems rather than wear a hair shirt. Same for email. Why should
rich expressions only be permitted to those with websites.  

Some people use email PRIMARILY for sharing photos.
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daisy Daisy, give me your answer do

2005-10-08 Thread Lasse Vågsæther Karlsen
Leave Xah Lee alone, he's a troll, he got no interested in doing 
anything but to provoke people on usenet.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Daisy Daisy, give me your answer do

2005-10-08 Thread Michael Goettsche
On Saturday 08 October 2005 22:10, Xah Lee wrote:
> there is a MacPerl program posted in 1998 that uses Mac's speech synth
> to sing Daisy Bell.
> See:
>
> http://bumppo.net/lists/macperl/1998/11/msg00412.html
>
> can anyone modify it so it runs out of the box on today's OS X?
>
> PS i'm posting this also in python and lisp group, i hope it'd be some
> general interest. For some background of this song, see
>   http://xahlee.org/Periodic_dosage_dir/sanga_pemci/daisy_bell.html
>
> i'm interested in getting versions that can sing the song in Windows,
> Mac, Linux using whatever speech synth each OS may provide. Thanks.
>
>  Xah
>  [EMAIL PROTECTED]
> ∑ http://xahlee.org/

You're asking "tech geekers" and "morons" to do this job? Isn't that a task 
for somebody more professional like you? 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Weighted "random" selection from list of lists

2005-10-08 Thread Scott David Daniels
Jesse Noller wrote:

> Once main_list is populated, I want to build a sequence from items
> within the lists, "randomly" with a defined percentage of the sequence
> coming for the various lists. For example:
> 60% from list 1 (main_list[0]), 30% from list 2 (main_list[1]), 10% from list 
> 3 (main_list[2])


import bisect, random
main_list = [['a', 'b', 'c'],
  ['dog', 'cat', 'panda'],
  ['blue', 'red', 'green']]
weights = [60, 30, 10]

cumulative = []
total = 0
for index, value in enumerate(weights):
 total += value
 cumulative.append(total)

for i in range(20):
 score = random.random() * total
 index = bisect.bisect(cumulative, score)
 print random.choice(main_list[index]),


-- 
-Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Daisy Daisy, give me your answer do

2005-10-08 Thread Xah Lee
there is a MacPerl program posted in 1998 that uses Mac's speech synth
to sing Daisy Bell.
See:

http://bumppo.net/lists/macperl/1998/11/msg00412.html

can anyone modify it so it runs out of the box on today's OS X?

PS i'm posting this also in python and lisp group, i hope it'd be some
general interest. For some background of this song, see
  http://xahlee.org/Periodic_dosage_dir/sanga_pemci/daisy_bell.html

i'm interested in getting versions that can sing the song in Windows,
Mac, Linux using whatever speech synth each OS may provide. Thanks.

 Xah
 [EMAIL PROTECTED]
∑ http://xahlee.org/

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

Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Lasse Vågsæther Karlsen
Fredrik Lundh wrote:
> Lasse Vågsæther Karlsen wrote:
> 
> 
>>Don't think so matey.
> 
> 
> oh, come on.  a site run by some random guy in North Carolina has to be
> safer, faster and more reliable than a distributed communication system that
> has been around since that guy was born...

Yes, of course, my mistake, it's rather obvious now that you point it out.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Grant Edwards
On 2005-10-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I've launched a new forum not too long ago, and I invite you all to go
> there: www.wizardsolutionsusa.com (click on the forum link).  We offer
> all kinds of help, and for those of you who just like to talk, there's
> a chit chat section just for you...Just remember that forum
> communication is much easier, safer, and faster.

I disagree 100% with that last assertion.  Usenet is much,
much, easier, safer and faster.

-- 
Grant Edwards   grante Yow!  BARRY... That was
  at   the most HEART-WARMING
   visi.comrendition of "I DID IT
   MYWAY" I've ever heard!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how do you pronounce wxpython

2005-10-08 Thread Grant Edwards
On 2005-10-08, Alex <[EMAIL PROTECTED]> wrote:
> My native language is not English so I just wonder how you pronounce
> wxPython.
>
> vi-ex python
> double-you-ex python
> wax-python

The second one.

-- 
Grant Edwards   grante Yow!  HELLO, everybody,
  at   I'm a HUMAN!!
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help creating extension for C function

2005-10-08 Thread Fredrik Lundh
>seq = PySequence_Fast(data, "expected a sequence");
>if (!seq)
>return NULL;

here's some more information on the PySequence_Fast API:

http://www.effbot.org/zone/python-capi-sequences.htm

 



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


Re: noob question Letters in words?

2005-10-08 Thread Rob Cowie
Well.. that put me in my place!

Fredrik Lundh - I hadn't realised that 'is' does not test for
equivalence. Thanks for the advice.

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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Fredrik Lundh
Michael Goettsche wrote:

> Besides that, it's cheap advertising. Would it have been harder to post the
> direct forum link than to link to his company's website?

company?

 



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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Fredrik Lundh
Lasse Vågsæther Karlsen wrote:

> Don't think so matey.

oh, come on.  a site run by some random guy in North Carolina has to be
safer, faster and more reliable than a distributed communication system that
has been around since that guy was born...

 



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

Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Michael Goettsche
On Saturday 08 October 2005 21:15, Lasse Vågsæther Karlsen wrote:
> [EMAIL PROTECTED] wrote:
> > I've launched a new forum not too long ago, and I invite you all to go
> > there: www.wizardsolutionsusa.com (click on the forum link).  We offer
> > all kinds of help, and for those of you who just like to talk, there's
> > a chit chat section just for you...Just remember that forum
> > communication is much easier, safer, and faster.
>
> Easier than what? Having to look into each forum to see if something is
> new? That's easier?
> Safer than what? Using a web browser? That's safe?
> Faster? That page loads 10 posts in the same speed I get 700 posts with
> usenet.

Besides that, it's cheap advertising. Would it have been harder to post the 
direct forum link than to link to his company's website?
-- 
http://mail.python.org/mailman/listinfo/python-list


Geocoding and python

2005-10-08 Thread Andrew Gwozdziewycz
Does anyone know of a python module that can read and search the  
tiger line data for geolocation?

Currently, I can use xmlrpc to query geocoder.us but I'd rather not  
be querying their server if I don't have to.

Thanks


---
Andrew Gwozdziewycz
[EMAIL PROTECTED]
http://ihadagreatview.org
http://plasticandroid.org


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


Re: Contest snub?

2005-10-08 Thread [EMAIL PROTECTED]

Will McGugan wrote:
> [EMAIL PROTECTED] wrote:
> > Notice anything strange here? The Python entry seems to have edged the PHP
> > entries, but is not declared the victor. Source is missing as well (the 
> > archive
> > is empty.)
> >
> > http://www.apress.com/promo/fractal/seesource.html
> >
> > H... an irrational fear of snakes perhaps?
>
> Its not irrational if you are a gator!

Furthermore, just because you're paranoid doesn't mean people aren't
out
to get you.

>
> Will McGugan
> --
> http://www.willmcgugan.com
> "".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
> "jvyy*jvyyzpthtna^pbz")

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


Re: new forum -- homework help/chit chat/easy communication

2005-10-08 Thread Lasse Vågsæther Karlsen
[EMAIL PROTECTED] wrote:
> I've launched a new forum not too long ago, and I invite you all to go
> there: www.wizardsolutionsusa.com (click on the forum link).  We offer
> all kinds of help, and for those of you who just like to talk, there's
> a chit chat section just for you...Just remember that forum
> communication is much easier, safer, and faster.
> 

Easier than what? Having to look into each forum to see if something is 
new? That's easier?
Safer than what? Using a web browser? That's safe?
Faster? That page loads 10 posts in the same speed I get 700 posts with 
usenet.

Don't think so matey.

Nice try though.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


new forum -- homework help/chit chat/easy communication

2005-10-08 Thread csheppard91
I've launched a new forum not too long ago, and I invite you all to go
there: www.wizardsolutionsusa.com (click on the forum link).  We offer
all kinds of help, and for those of you who just like to talk, there's
a chit chat section just for you...Just remember that forum
communication is much easier, safer, and faster.

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


Re: Weighted "random" selection from list of lists

2005-10-08 Thread Peter Otten
Jesse Noller wrote:

> I'm probably missing something here, but I have a problem where I am
> populating a list of lists like this:
> 
> list1 = [ 'a', 'b', 'c' ]
> list2 = [ 'dog', 'cat', 'panda' ]
> list3 = [ 'blue', 'red', 'green' ]
> 
> main_list = [ list1, list2, list3 ]
> 
> Once main_list is populated, I want to build a sequence from items
> within the lists, "randomly" with a defined percentage of the sequence
> coming for the various lists. For example, if I want a 6 item
> sequence, I might want:
> 
> 60% from list 1 (main_list[0])
> 30% from list 2 (main_list[1])
> 10% from list 3 (main_list[2])
> 
> I know how to pull a random sequence (using random()) from the lists,
> but I'm not sure how to pick it with the desired percentages.


If the percentages can be normalized to small integral numbers, just make a
pool where each list is repeated according to its weight, e. g.
list1 occurs 6, list2 3 times, and list3 once:

pools = [list1, list2, list3]
weights = [6, 3, 1]
sample_size = 10

weighted_pools = []
for p, w in zip(pools, weights):
weighted_pools.extend([p]*w)

sample = [random.choice(random.choice(weighted_pools))
for _ in xrange(sample_size)]


Another option is to use bisect() to choose a pool:

pools = [list1, list2, list3]
sample_size = 10

def isum(items, sigma=0.0):
for item in items:
sigma += item
yield sigma

cumulated_weights = list(isum([60, 30, 10], 0))
sigma = cumulated_weights[-1]

sample = []
for _ in xrange(sample_size):
pool = pools[bisect.bisect(cumulated_weights, random.random()*sigma)]
sample.append(random.choice(pool))

(all code untested)

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


Re: Python's Performance

2005-10-08 Thread Fredrik Lundh
Dave wrote:

> Yes, I would like to know how many internal string operations are done inside
> the Python interpreter.

when you're doing what?

how do you define "internal string operations", btw?

 



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


Re: Function decorator that caches function results

2005-10-08 Thread Lasse Vågsæther Karlsen
George Sakkis wrote:

> Cool, you re-invented the memoization pattern:
> http://en.wikipedia.org/wiki/Memoization
> http://aspn.activestate.com/ASPN/search?query=memoize&x=0&y=0§ion=PYTHONCKBK&type=Subsection
> 
> Yes, it's kinda discouraging that most interesting ideas have already been 
> conceived, implemented
> and used by others...


I know, I've been scouring over the ASPN recipes and digging through 
code like there's no tomorrow.

But, I don't view it as pointless even though there are existing 
implementations and solutions out there.

First of all, I don't like to stuff a lot of what is obviously library 
type of code into a project, unless I can reference a library that got 
that function or class or whatnot. Creates a rather big maintenance 
nightmare :)

So, I would have to stuff that into a library, which is what I did with 
my "own" function (thank you for helping btw). The recipe on ASPN is 
probably better than what I got, but... I understand how my solution 
came about and what makes it tick.

Secondly, I've been "programming" Python for, what, about 11 days now or 
so, so I want to re-implement as much as possibly right now, even to the 
point where I create a worse solution than an existing one, as long as 
it works for me, just to be able to learn the nuances of Python, because 
Python is ... different than what I'm used to.

For instance, in C# and .NET you got attributes, but they don't actually 
do anything on their own, in other words you can't tag a method and have 
the operation of that method deviate from a similar method without the 
attribute, unless you pick one of the attributes the compiler knows 
about, so it's just meta-data that sits silent until some other method 
goes around to look for it.

In Python I've now learned that a function is just an object like 
everything else and I can wrap a new object around it to modify its 
behaviour, and I can use the decorator pattern to do it.

I'm probably going to be back here in a few days or even hours with 
another "task" where you can probably cough up dozens of existing source 
code solutions that I could use.

For instance, there's this thing I've heard of called the "wheel".

:)

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread George Sakkis
"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote:

> George Sakkis wrote:
> 
> > Just added a recipe at 
> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440673. You can
try
> > both and see if there's any significant performance difference for your 
> > data.
> 
>
> Thanks, will take a look at it later. The sort solution seems to work
> nicely. Might be a big difference if I have a lot of sources though as I
> bet the overhead in doing a sort of N items gets higher than doing a
> manipulation of a heap to place an item in the right spot, but with 4-5
> or a few more sources might not make an impact at all.

Unless you're talking about hundreds or thousands sources, it probably
won't. I would still go for the heap solution since IMO the resulting
code it's more readable and easier to understand.

George

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


Re: Python's Performance

2005-10-08 Thread Fredrik Lundh
Paul Boddie wrote:

>> There are benchmarks testing the *real performance* of Python.
>>
>> For example: http://www.osnews.com/story.php?news_id=5602
>
> Just the observation that there are 166 comments to that article would
> suggest that the methodology employed was somewhat debatable. (I don't
> need to read them all - it is OSNews, after all.)
>
> As for the "real performance" of Python, what do we learn from these
> benchmarks which "...didn't test string manipulation, graphics, object
> creation and management (for object oriented languages), complex data
> structures, network access, database access, or any of the countless
> other things that go on in any non-trivial program"? That Python
> doesn't perform well executing loops involving mathematical operations?

fwiw, if you leave out the environments that compile to native machine code,
CPython is the fastest runtime in this floating-point benchmark:

http://www.fourmilab.ch/fbench/fbench.html

(I recently translated some satellite navigation code from a Python prototype
to C, and was a bit surprised to find that I only got a 7x speedup...)

 



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


Re: Jargons of Info Tech industry

2005-10-08 Thread David H Wild
In article <[EMAIL PROTECTED]>,
   Tim Tyler <[EMAIL PROTECTED]>  wrote:
> Plain text is a badly impoverished medium for explaining things in.

> For one thing, code on my web site tends to get syntax highlighted.
> There's no way I could do that in plain text.

On your web site the use of additional features is often, but not always,
justified - but we were talking about emails where the use of HTML bulks up
the email for very little gain.

-- 
David Wild using RISC OS on broadband
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Will python never intend to support private, protected and public?

2005-10-08 Thread Robert Brewer
Title: RE: Will python never intend to support private, protected and public?






Alex Martelli wrote:
> I used to like [double-underscore private names], but as time
> goes by have come to like it less and less; right now,
> unless I have to respect existing coding standards,
> I entirely avoid the double-underscore usage,
> while single-underscores are OKish).

Hear, hear. I've been seriously considering a ban on double-underscore names as part of the coding standard for CherryPy.

And I am also glad you're back! I must say I opened several of your recent posts on topics which I would not otherwise have read. ;)


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]



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

Re: Function decorator that caches function results

2005-10-08 Thread George Sakkis
"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote:

> [snip]
>
> Ok, so I thought, how about creating a decorator that caches the
> function results and retrieves them from cache if possible, otherwise it
> calls the function and store the value in the cache for the next invokation.
>
> [snip]

Cool, you re-invented the memoization pattern:
http://en.wikipedia.org/wiki/Memoization
http://aspn.activestate.com/ASPN/search?query=memoize&x=0&y=0§ion=PYTHONCKBK&type=Subsection

Yes, it's kinda discouraging that most interesting ideas have already been 
conceived, implemented
and used by others...

George


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

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread Lasse Vågsæther Karlsen
George Sakkis wrote:

> Just added a recipe at 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440673. You can try
> both and see if there's any significant performance difference for your data.


Thanks, will take a look at it later. The sort solution seems to work 
nicely. Might be a big difference if I have a lot of sources though as I 
bet the overhead in doing a sort of N items gets higher than doing a 
manipulation of a heap to place an item in the right spot, but with 4-5 
or a few more sources might not make an impact at all.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


What about letting x.( ... ? ... ) be equivalent to ( ... x ... )

2005-10-08 Thread ddelay




Hello everybody,

I just like to know what all of you think of adding this functionnality
to python language, or  any other object oriented language in fact.

(English is not my natural language so please e-mail if you can improve this text...)

 x.( ... ? ... )  could be equivalent to ( ... x ... ) 

So an _expression_ such as :
(1)  html.stringtohtml(''.join(a.strip().split('/n')[:-1])).lower()

could be replaced with :
(2)   a.strip().split('/n')[:-1].(''.join(?)).(html.stringtohtml(?)).lower()

(in this example html would be a module containing the function stringtohtml) 
The advantages of such a notation :

- The order of operations always follows the (occidental?) reading
order, from left to right.  (in the formulation (1), we have a
mixed of right-to-left reading and left-to-right reading.)

- The number of nested levels  - limited to 2 levels of
parenthesis - does not grow with the number of successive operations
(it  soon gives problems with formulation (1)). 
This is a bit like in math you improve readability replacing
f(g(h(j(x))) with f o g o h o j (x), except here this would be roughly
looking like x.(j).(h).(g).(h)

Then you get other advantages :

- The growth of complexity in formulation (1) leads to the use of
intermediates computations which introduces unusefull intermediates
variables (they are just used once)
b = a.strip().split('/n')[:-1]
c = ''.join(b)
d = html.stringtohtml(c).lower()
These 3 intermediate variables used to improve readability can
introduce bugs : you have to check that b, c and d are not used
anywhere else in the code.
With notation (2), you minimise the use of unusefull intermediate variables.

- Builtins classes do not have to have many mumber fonctions. For
example, though string class does not have any member function "tohtml"
giving the ability to write s.tohtml() , you can still write
s.(html.texttohtml(?)) or simplier  s.(texttohtml(?)) after
an  import html.texttohtml

I'd like to have your opinions about that...

Daniel Delay.
 







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

Codetags (also Pylint/Pychecker + Variable declarations)

2005-10-08 Thread Fried Egg
* Codetag PEP:

**  I would like to comment on the codetags PEP, which I give a 0+.
 I think the end "<>" is bad; I would be in favor of a block system or
something that looks more like regular Python (e.g. "#
:FIXME(line_count=10, date='2005-08-09', ...) ").

**  As to the comments that say "Trac does the same functionality"
or "Eclipse/Eric/Emacs... has the same functionality" I think codetags
are orthogonal to that.  Also, some of us still use the old vi to edit
a system script in an emergency, and relying on bloated silliness like
Eclipse for documenting code seems, well, against all that is good and
true.

* Pylint:

**  I also agree that a lint system is the place to enforce or
otherwise use things like codetags.  A useful implementation would go a
long way to creating a standard organically.

* Variable declarations--a synthesis of codetags and lint:

** Perhaps a codetag system is the place to put variable
declarations, type checking, and the like.   The lint system could grab
these and evaluate the code with them without messing with the compiler
or quick and dirty code styles.  (Inferring properties of code from
static listings is for geniuses--not for me--so forgive any unrealistic
examples below).  As an added benefit, there wouldn't be any
non-explicit checking to impede performance (but if you want, you can
always add assert's to your heart's content when it really matters,
which is rarely).

** Example


str_var = '' # :DECLARE(type='string')
flt_var = 0 # :DECLARE(type='float')
line_index = 0 # :DECLARE(type='int', min=0, max=10)
for line_index in range(-10, 10) # "maximum exceeded" warning
mispelled_flt_var = 1ine_index / 2.5 # "undeclared variable"
warning
str_var = var + 1  # "type mismatch" warning


Thanks for everyone's patience in reading this--I hope it helps further
the Pythonic cause of graceful programming.

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


Re: os.access with wildcards

2005-10-08 Thread mike
ugly. i guess this thread shows that you are clueless regarding your
thread crapping.

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


Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread George Sakkis
"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote:

> Alex Martelli wrote:
> > George Sakkis <[EMAIL PROTECTED]> wrote:
> 
> >>Yes, it's a little inconvenient that the builtin heap doesn't take a
> >>comparison operation but you can easily roll your own heap by transforming
> >>each item to a (key,item) tuple. Now that I'm thinking about it, it might
> >>be a good addition to the cookbook.
> >
> >
> > I believe Python 2.5 adds a key= argument to heapq's functions...
> 
>
> I will revisit the heapq solution when 2.5 is released then.
>
> Thanks for the heads up. For the moment I will stay with the list
> solution that Mike came up with slightly changed to accomodate tips and
> pointers from others in this thread.

Just added a recipe at 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440673. You can try
both and see if there's any significant performance difference for your data.

George


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

socket.setdefaulttimeout()

2005-10-08 Thread rtilley
Perhaps this is a dumb question... but here goes. Should a socket client 
and a socket server each have different values for 
socket.setdefaulttimeout() what happens? Does the one with the shortest 
timeout period end first?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Continuous system simulation in Python

2005-10-08 Thread Sébastien Boisgérault

Simulink is a framework widely used by the control engineers ...
It is not *perfect* but the ODEs piece is probably the best
part of the simulator. Why were you not convinced ?

You may also have a look at Scicos and Ptolemy II. These
simulators are open-source ... but not based on Python.

Cheers,

SB





Nicolas Pernetty a écrit :

> Hello Phil,
>
> Yes I have considered Octave. In fact I'm already using Matlab and
> decided to 'reject' it for Python + Numeric/numarray + SciPy because I
> think you could do more in Python and in more simple ways.
>
> Problem is that neither Octave, Matlab and Python offer today a
> framework to build continuous system simulator (in fact Matlab with
> Simulink and SimMechanics, do propose, but I was not convinced at all).
>
> Regards,
>
> *** REPLY SEPARATOR  ***
>
> On 7 Oct 2005 11:00:54 -0700, [EMAIL PROTECTED] wrote :
>
> > Nicholas,
> >
> > Have you looked at Octave? It is not Python, but I believe it can talk
> > to Python.
> > Octave is comparable to Matlab for many things, including having ODE
> > solvers. I have successfully used it to model and simulate simple
> > systems. Complex system would be easy to model as well, provided that
> > you model your dynamic elements with (systems of) differential
> > equations.
> >

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


Re: Weighted "random" selection from list of lists

2005-10-08 Thread Ron Adam
Jesse Noller wrote:


> 60% from list 1 (main_list[0])
> 30% from list 2 (main_list[1])
> 10% from list 3 (main_list[2])
> 
> I know how to pull a random sequence (using random()) from the lists,
> but I'm not sure how to pick it with the desired percentages.
> 
> Any help is appreciated, thanks
> 
> -jesse

Just add up the total of all lists.

 total = len(list1)+len(list2)+len(list3)
 n1 = .60 * total# number from list 1
 n2 = .30 * total# number from list 2
 n3 = .10 * total# number from list 3

You'll need to decide how to handle when a list has too few items in it.

Cheers,
Ron
-- 
http://mail.python.org/mailman/listinfo/python-list


dis.dis question

2005-10-08 Thread Ron Adam

Can anyone show me an example of of using dis() with a traceback?

Examples of using disassemble_string() and distb() separately if 
possible would be nice also.


I'm experimenting with modifying the dis module so that it returns it's 
results instead of using 'print' it as it goes.  I want to make sure it 
works for all the current use cases (or as many as possible), but I 
haven't been able to find any examples of using dis with tracebacks 
using google.  I keep getting various copies of the current and older 
Python doc pages when I search, and not much else.

How much other python code depends on the dis() and disassembly() 
functions?  Is it used by other modules or is it meant to be a stand 
alone tool?

The changes I've made (for my own use so far) is to have disassembly() 
return a bare unformatted table, (list of list), that can easily be 
examined with python, and then to use a dis2str() function to return a 
nice formatted output-string from the table.  In order to have dis() 
display properly in an interactive shell as well as printing, I have 
dis() return a disassembly list object with a  __repr__() method to call 
dis2str().

class disobj(list):
 """ A disassembly list object """
 def __init__(self, dislist, name=None, lasti=-1):
 self[:] = dislist
 self.name = name
 self.lasti = lasti
 def __repr__(self):
 return dis2str(self, self.name, self.lasti)

That seems to work well in both the shell and with 'print'.  And it 
still allows direct table introspection without having to parse the 
output.  ;-)

For example the get_labels() function used was reduced to ...

def getlabels(dislist):
 """ Get labels from disassembly list table. """
 return [x[4] for x in dislist if type(x[4]) is str]

Another benefit, is to be able to get the results without having to 
redirect, capture, and then reset sys.stdout.

But I still need to rewrite disassemble_string() and need to test it 
with tracebacks.

Cheers,
Ron

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


Re: Jargons of Info Tech industry

2005-10-08 Thread Tim Tyler
Alan Balmer <[EMAIL PROTECTED]> wrote or quoted:
> On Tue, 04 Oct 2005 17:14:45 GMT, Roedy Green

> >I try to explain Java each day both on my website on the plaintext
> >only newsgroups. It is so much easier to get my point across in HTML.
> >
> >Program listings are much more readable on my website.
> 
> My copy of javac seems to prefer plain text, and so do I ;-)

Plain text is a badly impoverished medium for explaining things in.

For one thing, code on my web site tends to get syntax highlighted.
There's no way I could do that in plain text.
-- 
__
 |im |yler  http://timtyler.org/  [EMAIL PROTECTED]  Remove lock to reply.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python's Performance

2005-10-08 Thread Dave
Yes, I would like to know how many internal string operations are done inside the Python interpreter.
 
Thanks. Laszlo Zsolt Nagy <[EMAIL PROTECTED]> wrote:
Dave wrote:> Hello All,> > I would like to gather some information on Python's runtime > performance. As far as I understand, it deals with a lot of string > objects. Does it require a lot string processing during program > execution? How does it handle such time-consuming operations? Is there > a way to find out how many string operations (perhaps in the > underlying system) ) it does during program execution?Do you want to know how many internal string operations are done inside the Python interpreter? I believe it is not a useful information. There are benchmarks testing the *real performance* of Python.For example: http://www.osnews.com/story.php?news_id=5602Les
		 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-08 Thread Phillip J. Eby
Laszlo Zsolt Nagy wrote:
> Dave wrote:
>
> > Hello All,
> >
> > I would like to gather some information on Python's runtime
> > performance. As far as I understand, it deals with a lot of string
> > objects. Does it require a lot string processing during program
> > execution? How does it handle such time-consuming operations? Is there
> > a way to find out how many string operations (perhaps in the
> > underlying system) ) it does during program execution?
>
> Do you want to know how many internal string operations are done inside
> the Python interpreter? I believe it is not a useful information. There
> are benchmarks testing the *real performance* of Python.
>
> For example: http://www.osnews.com/story.php?news_id=5602

Actually, that benchmark shows something rather interesting.  The C and
Java versions of the benchmark are much faster than Python on so-called
"64-bit arithmetic", but only Python computes the *correct* answer to
the benchmark!  The others overflow 64 bits at some point and lose
precision, resulting in a nonsense result that the author failed to
notice.

So, without meaning to, the benchmark author has demonstrated something
important about Python, which is that writing the obvious thing in
Python tends to work correctly, even if it sometimes takes longer to
run than it would take for another language to produce the wrong
answer.  :)

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


Weighted "random" selection from list of lists

2005-10-08 Thread Jesse Noller
Hello -

I'm probably missing something here, but I have a problem where I am
populating a list of lists like this:

list1 = [ 'a', 'b', 'c' ]
list2 = [ 'dog', 'cat', 'panda' ]
list3 = [ 'blue', 'red', 'green' ]

main_list = [ list1, list2, list3 ]

Once main_list is populated, I want to build a sequence from items
within the lists, "randomly" with a defined percentage of the sequence
coming for the various lists. For example, if I want a 6 item
sequence, I might want:

60% from list 1 (main_list[0])
30% from list 2 (main_list[1])
10% from list 3 (main_list[2])

I know how to pull a random sequence (using random()) from the lists,
but I'm not sure how to pick it with the desired percentages.

Any help is appreciated, thanks

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


Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread Lasse Vågsæther Karlsen
Alex Martelli wrote:
> George Sakkis <[EMAIL PROTECTED]> wrote:

>>Yes, it's a little inconvenient that the builtin heap doesn't take a
>>comparison operation but you can easily roll your own heap by transforming
>>each item to a (key,item) tuple. Now that I'm thinking about it, it might
>>be a good addition to the cookbook.
> 
> 
> I believe Python 2.5 adds a key= argument to heapq's functions...


I will revisit the heapq solution when 2.5 is released then.

Thanks for the heads up. For the moment I will stay with the list 
solution that Mike came up with slightly changed to accomodate tips and 
pointers from others in this thread.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for search engine development

2005-10-08 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> Well, Google applies some Python in their implementation, see
> http://www-db.stanford.edu/~backrub/google.html

"Some" is correct.  As for writing a search engine in Python _only_,
hmmm -- I honestly don't know.  You could surely develop a working
implementation, but then, to make it perform well, you'd most likely
want to profile it and retune some CPU-intensive parts using pyrex, or
C.

So, if during your program development process you can find good
open-source C or C++ libraries offering a fast implementation of some of
the CPU-bound stuff you know you'll need, you would probably be better
off by wrapping those libraries (again using pyrex, or maybe SWIG, or
Boost Python for C++, ...) rather than redoing them from scratch in
Python (and probably later having to do some tuning on those parts).
One notably strong point of Python is that it "plays well with others",
and I would advise you to leverage this fact.


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


Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-08 Thread Tim Peters
[Alex Martelli]
>>> try it (and read the Timbot's article included in Python's sources, and the
>>> sources themselves)...

[Kay Schluehr]
>> Just a reading advise. The translated PyPy source
>> pypy/objectspace/listsort.py might be more accessible than the
>> corresponding C code.

[cfbolz]
> indeed. it is at
>
> http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listsort.py

While the Python version is certainly easier to read, I believe Alex
had in mind the detailed English _explanation_ of the algorithm:

http://cvs.sf.net/viewcvs.py/python/python/dist/src/Objects/listsort.txt

It's a complex algorithm, dripping with subtleties that aren't
apparent from staring at an implementation.

Note that if a list has N elements, sorting it requires at least N-1
comparisons, because that's the minimum number of compares needed
simply to determine whether or not it's already sorted.  A heap-based
priority queue never requires more than O(log(N)) compares to push or
pop an element.  If N is small, it shouldn't make much difference.  As
N gets larger, the advantage of a heap grows without bound.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List performance and CSV

2005-10-08 Thread jepler
You'll probably see a slight speed increase with something like
for a in CustomersToMatch:
for b in Customers:
if a[2] == b[2]:
a[1] = b[1]
break
But a really fast approach is to use a dictionary or other structure
that turns the inner loop into a fast lookup, not a slow loop through
the 'Customers' list.  Preparing the dictionary would look like
custmap = {}
for c in Customers:
k = c[2]
if k in custmap: continue
custmap[k] = c
and the loop to update would look like
for a in customerstomatch:
try:
a[1] = custmap[a[2]][1]
except KeyError:
continue

(all code is untested)

In "big-O" terms, I believe this changes the complexity from O(m*n) to O(m+n).

Jeff


pgpiNVhiQU0Jm.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Force flushing buffers

2005-10-08 Thread Robert Wierschke
Madhusudan Singh schrieb:
> Hi
> 
> I have a python application that writes a lot of data to a bunch of 
> files
> from inside a loop. Sometimes, the application has to be interrupted and I
> find that a lot of data has not yet been writen (and hence is lost). How do
> I flush the buffer and force python to write the buffers to the files ? I
> intend to put this inside the loop.
> 
> Thanks.
disable the buffer!

open( filename[, mode[, bufsize]])

open takes an optional 3ed argument set bufsize = 0 means unbuffered. 
see the documentation of the in build file() mehtod as open is just 
another name

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


Re: Python's Performance

2005-10-08 Thread Paul Boddie
Laszlo Zsolt Nagy wrote:
> There are benchmarks testing the *real performance* of Python.
>
> For example: http://www.osnews.com/story.php?news_id=5602

Just the observation that there are 166 comments to that article would
suggest that the methodology employed was somewhat debatable. (I don't
need to read them all - it is OSNews, after all.)

As for the "real performance" of Python, what do we learn from these
benchmarks which "...didn't test string manipulation, graphics, object
creation and management (for object oriented languages), complex data
structures, network access, database access, or any of the countless
other things that go on in any non-trivial program"? That Python
doesn't perform well executing loops involving mathematical operations?
Or something about "research and development" in the big consulting
houses?

Paul

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


Re: noob question Letters in words?

2005-10-08 Thread Ivan Shevanski

Thanks everyone for helping once again, lots of good ideas there

Thanks,

-Ivan

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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

Automatic response to your mail (Error)

2005-10-08 Thread Webmaster
The automatic reply to this e-mail which you should have
received in response to your e-mail to [EMAIL PROTECTED] has not been defined.

Please contact [EMAIL PROTECTED] for assistance.
-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] Dabo 0.4.2 released!

2005-10-08 Thread Ed Leafe
 We are pleased to announce the 0.4.2 release of Dabo, the 3-tier  
application framework for Python.

 The primary focus of our work for this release has been a  
tightening up of the various properties of many of the UI controls to  
create a more consistent interface. Since these controls were  
developed one at a time as needed, they had some subtle but  
significant differences in the way they worked. This release  
addresses a lot of those concerns.

 We've also added auto-binding of methods to events. For example,  
if you want to have your code react to MouseEnter event, all you need  
to do is add a method named onMouseEnter(), and Dabo will bind it to  
that event. Thanks to the PythonCard folks for this idea!

 Work on the Report Writer continues to proceed; it now supports  
groups and report variables. These improvements have been integrated  
it into the wizard-generated apps, too.

 Needless to say, there have also been a few bug fixes. A list of  
all the changes follows my sig. You can grab the latest, as always,  
from http://dabodev.com/download.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dabo-0.4.2 (2005-10-07) (Revision 1418):
Added PrimaryBizobj property to dForm, which can replace calls to  
getPrimaryBizobj().

Added Accepted property to dOkCancelDialog, which gets set  
automatically if the
user pressed "OK".

Added AutoSQL, UserSQL, CurrentSQL, LastSQL properties to dCursor and  
dBizobj.
When time to requery, the SQL will come from UserSQL if set, or  
AutoSQL will
be regenerated.

Fixed a bug that kept changes to a new record from getting committed.

Added DefaultValues property to bizobj.

Added ListSelection and ListDeselection events to dListControl. Added  
properties
MultipleSelect, HitIndex, LastSelectedIndex, HeaderVisible,  
HorizontalRules,
and VerticalRules. Changed the behavior of both dListControl and  
dListBox so that merely selecting an item doesn't raise the Hit  
event; instead, it raises a ListSelection event, and if another item  
had been previously selected, it raises a ListDeselection event. Hit  
is only raised from double-clicking on an item, or by pressing Enter.

Added new property to dTextBox: StrictDateEntry. Changed the code for
interpreting dates entered by the user to allow for some less explicit
formats (MMDD, YYMMDD, and MMDD). If StrictDateEntry is False (the
default), these other formats will be used when interpreting dates
entered by the user.

Added field-level validation to the framework.

Improved support for decimal.Decimal, both at the database level and in
dTextBox.

Added new auto event binding, which automatically binds events based  
on any
defined callback functions. For example, if you have a method  
onMouseEnter()
defined, the dEvents.MouseEnter will automatically be bound to that  
method.
Inspired by PythonCard.

Added RegID property to forms, that allows for object registration
with the form. Not all objects require RegIDs, but if they have one,
they must be unique among all objects in a form. A reference to that
object can then be gotten from any other object by calling
'self.Form.getObjectByRegID()'.

Linked RegID to the auto event binding, so that if a form has a method
of onHit_cmdOK(), and has a button with a RegID of 'cmdOK', the
cmdOk's Hit will get bound to the form's callback, automatically.

Improved dGrid and dColumn. Many properties added, and you are now in  
much
finer control over the display of grid column headers, grid cell  
attributes,
grid cell editors and renderers, and the grid itself.

Began work of allowing case-insensitive property values for  
properties that
take string values, and for properties that take a limited number of  
values
where the first letter is unique, you can set the property by just  
using the
first letter. dTextBox.Alignment = "c" sets the property to "Center",  
for
example.

Modified dBizobj, dCursorMixin, and dBackend so that the user can  
specify
the Unicode Encoding to use. Changed the default encoding from  
latin-1 to
utf-8.

Added feature to optionally draw sizer outlines on any form that uses  
dSizers.
This is currently accessible via an option in the View menu when the  
base
menu bar is in use, or you can turn it on/off programatically.

Grids now remember the column that is sorted, and resort when next  
instantiated.

Added support in dReportWriter for report groups and report  
variables, and
dynamic band heights (based on the height of contained objects).  
Added showExpr,
which is an expression that evaluates at runtime and if true, shows  
the object
in the report, and not if false.

Improved the automatic print preview report format in datanav. It now:

 + prints column headers

 + mirrors the font size, column width, cell vertical and horizontal
   alignment, and column height of the grid

 + mirrors the font size, header height, vertica

Re: MD5 Help Page

2005-10-08 Thread Daniel 'Dang' Griffith
Nevermind--chr(0x64) is 'd', as in duh.
--dang

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


Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-08 Thread Steve Holden
Steve Horsley wrote:
[...]
> 
> The one that always makes me grit my teeth is "You have got to, 
> don't you?". Well no, I do NOT got to, actually. Shudder!
> 
Shouldn't that be "I don't have to got to"?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

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


Re: Function decorator that caches function results

2005-10-08 Thread Lasse Vågsæther Karlsen
Fredrik Lundh wrote:

>>k1 = fibonacci(100)
>>k2 = fibonacci(idx = 100)

> whoever writes code like that deserves to be punished.
> 
> I'd say this thread points to a misunderstanding of what keyword arguments
> are, and how they should be used.  the basic rule is that you shouldn't mix 
> and
> match; use positional arguments for things that are documented to be 
> positional


I agree completely.
However, it turns out I have to communicate code with and from people 
that have a coding standard that dictates using keyword arguments for 
all interfaces. Those functions will also benefit from the cache system 
as many of them involves database lookups.

In any case, your response gave me another thing that my solution won't 
handle so I'm going to just leave it as it is and look at it if I ever 
need it for positional arguments, which I honestly don't believe I will.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


MD5 Help Page

2005-10-08 Thread Daniel 'Dang' Griffith
I'm referring to the text in
http://www.python.org/doc/2.4.2/lib/module-md5.html, which shows the
same thing I see in the Windows version of the help.

The two examples show:

'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

as the output, and that is indeed what I see when I run the examples.

But if I use hexdigest() instead of digest(), I get this result:

'bb649c83dd1ea5c9d9dec9a18df0ffe9'

I don't understand the difference.  Specifically, in the output of
digest, it shows a 'd' where I expect to see \x64.  What causes this
difference?

Thanks,
--dang

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


Re: readline installation problem

2005-10-08 Thread Jesper
Hi Jian,

I just struggled with the same problem - seems the python 2.4.2 does
not recognise readline 5

I finally "solved" the problem by installing readline 4.2, and
explicitly pointing out to configure where the readline library is

./configure --with-libs=/usr/local/lib/libreadline.a

That finally made it work ...

Cheers
Jesper

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


Re: Function decorator that caches function results

2005-10-08 Thread Lasse Vågsæther Karlsen
Lasse Vågsæther Karlsen wrote:
> Sam Pointon wrote:
> 
>> What about not storing args at all? Something like this:


Ok, here's my updated version:

class cache(object):
 def __init__(self, timeout=0):
 self.timeout = timeout
 self.cache = {}

 def __call__(self, fn):
 arg_names = inspect.getargspec(fn)[0]
 def cached_result(*args, **kwargs):
 # Update named arguments with positional argument values
 kwargs.update(dict(zip(arg_names, args)))

 # Work out key as a tuple of ('argname', value) pairs
 key = tuple(sorted(kwargs.items()))

 # Check cache and return cached value if possible
 if key in self.cache:
 (value, last_time) = self.cache[key]
 if self.timeout <= 0 or time.time() - last_time <= 
self.timeout:
 return value

 # Work out new value, cache it and return it
 result = fn(**kwargs)

 self.cache[key] = (result, time.time())
 return result

 # Return wrapper function
 return cached_result

Changed from previous versions:
- converted to class, must use () on decorator now
- added timeout, results will be recalculated when it expires
- timeout=0 means no timeout, results will always be reused
- now handles both positional and keyword arguments

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function decorator that caches function results

2005-10-08 Thread Fredrik Lundh
Lasse Vågsæther Karlsen wrote:

> Yeah, but as far as I can see it, this one too fails to recognize
> situations where the function is called twice with essentially the same
> values, except that in one call it uses named arguments:
>
> k1 = fibonacci(100)
> k2 = fibonacci(idx = 100)
>
> this is essentially the same call, except the second one uses a named
> argument, which means the function will be invoked and a second cache
> entry will be stored.

whoever writes code like that deserves to be punished.

I'd say this thread points to a misunderstanding of what keyword arguments
are, and how they should be used.  the basic rule is that you shouldn't mix and
match; use positional arguments for things that are documented to be positional
parameters, and keyword arguments for keyword parameters.  if you don't,
you'll end up with code that depends on implementation details.  and that's
never a good idea...

 



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

List performance and CSV

2005-10-08 Thread Stephan
Hello,

I'm working on a simple project in Python that reads in two csv files
and compares items in one file with items in another for matches.  I
read the files in using the csv module, adding each line into a list.
Then I run the comparision on the lists.  This works fine, but I'm
curious about performance.

Here's the main part of my code:

##
file1 = open("CustomerList.csv")
CustomerList = csv.reader(file1)
Customers = []

#Read in the contents of the CSV file into memory
for CustomerRecord in CustomerList:
Customers.append(CustomerRecord)

#not shown here: the second file CustomersToMatch
#is loaded in a similar manner

#loop through each record and find matches on column 2
#breaking out of inner loop when a match is found
for loop1 in range(len(CustomersToMatch)):
for loop2 in range(len(Customers)):
if (CustomersToMatch[loop1][2] == Customers[loop2][2]) :
CustomersToMatch[loop1][1] = Customers[loop2][1]
break

##

With this code, it takes roughly 10 minutes on a 2Ghz x86 box to
compare two lists of 20,000 records.  Is that good?  Out of curiousity,
I tried psyco and saw no difference.  Is there a better Python synax to
use?

Thanks,
-Stephan

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


Re: Function decorator that caches function results

2005-10-08 Thread Lasse Vågsæther Karlsen
Sam Pointon wrote:
> What about not storing args at all? Something like this:
> 
> def cache_function(func, args_list):
> cache = {}
> def cached_result(*args, **kwargs):
> kwargs.update(dict(zip(args_list, args)))
> if kwargs in cache:
> return cache[kwargs]
> result = func(**kwargs)
> cache[kwargs] = result
> return result
> return cached_result
> 
> args_list is a list of all the argument names, so that they can be
> converted into keyword arguments.
> 

I'll take a look at the zip function, didn't know about that one, but 
your example also has the problem that dictionaries can't be used as 
dictionary keys, but that can be easily solved. I think I can simplify 
my solution with some of yours.

The parameter names can be gotten by doing a inspect.getargspec(fn)[0] 
so that can be done by the decorator function.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function decorator that caches function results

2005-10-08 Thread Lasse Vågsæther Karlsen
[EMAIL PROTECTED] wrote:
> On Sat, Oct 08, 2005 at 01:53:28PM +, Duncan Booth wrote:
> 
>>Unless the results stored in the cache are very large data structures, I 
>>would suggest that you simply store (args,kwargs) as the cache key and 
>>accept the hit that sometime you'll cache the same call multiple times.
> 
> 
> ... except that dicts cannot be dict keys
> 
> Another 'memoize' decorator uses this to get the key:
> kw = kwargs.items()
> kw.sort()
> key = (args, tuple(kw))
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325905
> 
> Jeff

Yeah, but as far as I can see it, this one too fails to recognize 
situations where the function is called twice with essentially the same 
values, except that in one call it uses named arguments:

k1 = fibonacci(100)
k2 = fibonacci(idx = 100)

this is essentially the same call, except the second one uses a named 
argument, which means the function will be invoked and a second cache 
entry will be stored.

Granted, not a big problem in most such cases, but here's my augmented 
function. Bare in mind that I'm 2 weeks into Python so there's bound to 
be room for improvement :)

def cache(fn):
 cache = {}
 arg_names = inspect.getargspec(fn)[0]
 def cached_result(*args, **kwargs):
 # If function is called without parameters, call it without 
using the cache
 if len(args) == 0 and len(kwargs) == 0:
 return fn()

 # Work out all parameter names and values
 values = {}
 for i in range(len(args)):
 values[arg_names[i]] = args[i]
 for key in kwargs:
 values[key] = kwargs[key]
 key = tuple([(key, value) for (key, value) in 
sorted(values.iteritems())])

 # Check cache and return cached value if possible
 if key in cache:
 return cache[key]

 # Work out new value, cache it and return it
 result = fn(*args, **kwargs)
 cache[key] = result
 return result

 # Return wrapper function
 return cached_result


-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function decorator that caches function results

2005-10-08 Thread Sam Pointon
What about not storing args at all? Something like this:

def cache_function(func, args_list):
cache = {}
def cached_result(*args, **kwargs):
kwargs.update(dict(zip(args_list, args)))
if kwargs in cache:
return cache[kwargs]
result = func(**kwargs)
cache[kwargs] = result
return result
return cached_result

args_list is a list of all the argument names, so that they can be
converted into keyword arguments.

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


  1   2   >