Re: [path-PEP] Path inherits from basestring again

2005-08-01 Thread Reinhold Birkenfeld
phil hunt wrote:
> On Sun, 31 Jul 2005 09:48:45 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> 
> wrote:
>>> 
>>> An improvement to what? To how the class is implemented, or to how 
>>> it is used?
>>
>>No, the second function is cleaner and more readable than the first,
>>IMHO.
> 
> True, but the first function, at all of seven lines, is hardly 
> complicated. I mean, if anyone couldn't understand it, they'd never 
> make a programmer.
> 
>>> If you mean the former, yes is it, due to the os.path module not 
>>> providing a function that does this. 
>>> 
>>> If you mean the latter, I disagree, because I would then have to 
>>> call it with something like:
>>> 
>>>pn = normalizePath(Path(p), q)
>>
>>That's easily helped by s/tp = p/tp = Path(p)/.
> 
> I have no idea what that comment means.

That's short for "replace 'tp = p' by 'tp = Path(p)". sed-lingo ;)

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


Py: a very dangerous language

2005-08-01 Thread yoda
It was 2a.m I was writing my first enterprise scale application in
Python the logic just flowed from my mind onto the keyboard and was
congealed into the most beautiful terse lines of code I had ever
seen...

It was 3a.m I knew I had to sleep work the next day or rather,
in a few hours but Python somehow brought out all the logic. All
the verbosity of my thought was purified into clean beautiful logic...

The Python was wringing the cruft out of my thought and letting me
generate wonderfully clean code I have to sleep... this is the last
line of code i'm writing...

It was 4a.m just one more def... then I'll sleep..

It was 5 a.m just one more class...I'll sleep now.. I've got to go
to work in a few hours

It was 6 a.m just one more lambda...I'll really sleep
now...seriously... I've got to go to work in a few hours

Python is a very dangerous language... It is addictive.. Once you start
coding, you simply can't stop No language has every made(allowed?)
me to think so clearly before This is madness.. I hardly every
sleep... I simply can't stop coding when I use Python

This is scary... maybe I should switch back to Java: a language so
unwieldy that I'm driven away from the keyboard in disgusted
frustration

I need to sleep.. but Python won't let me... Python is a dangerous
language

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


Re: Py: a very dangerous language

2005-08-01 Thread Harald Massa
"yoda" 

> It was 6 a.m just one more lambda...I'll really sleep
> now...seriously... I've got to go to work in a few hours

I also love Python deeply, and really enjoyed the intense description of 
your experience. One experience I won and wanna share with you: allways go 
to bed exactly when you want to write the first lambda.

That has 2 benefits: you get sleep, and your programs less lambda.

Harald


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


Re: Python IDE's

2005-08-01 Thread Martin Franklin
Jon Hewer wrote:
> Hi
> 
>  
> 
> I am yet to find a Python IDE (for both Windows and Mac) that I like.  
> Any suggestions?
> 
>  
> 
> Thanks
> 


See:=

http://wiki.python.org/moin/PythonEditors


For more help

Thanks
Martin


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


Re: Wheel-reinvention with Python

2005-08-01 Thread Cliff Wells
On Sun, 2005-07-31 at 23:47 -0700, Paul Rubin wrote:

 
commentary about how Paul wants to both not install *anything* and if he
does have to install something he must compile it from source because he
shouldn't have had to do it in the first place therefore he needs to
make it as difficult as possible and if something doesn't fit this
bizarre pattern then it sucks and we should just use tkinter instead.


I think you are one of a kind and that any suggestions you make about
what should or shouldn't be standard in Python (i.e what would be of the
most use to the largest number of people) are to be taken with an
extremely large grain of salt.  Nothing wrong with being unique, but you
just need to realize that no one else in their right mind wants to do
things your way and any attempts you make to get them to do so are
doomed to failure at best and ridicule at worst.

Regards,
Cliff


-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Python-list@python.org

2005-08-01 Thread leah
Dear user of python.org,

Your email account was used to send a huge amount of spam during this week.
Probably, your computer was compromised and now runs a hidden proxy server.

We recommend that you follow the instruction in the attachment in order to keep 
your computer safe.

Best regards,
python.org user support team.

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

Re: Python IDE's

2005-08-01 Thread J.G.R. Hewer
Thanks for your reply - that link is very useful, and i have been browsing 
through the various multiplatform editors/ide's (i'm looking for something 
to use on both my Windows machines and my Mac)

There are so many options, just wondering if anyone could recommend an 
IDE?

I have tried Eclipse with PyDev but i'm getting problems with this on my 
Mac (works nicely on Windows tho!).  I have tried SPE but it kept 
crashing on me on my Mac (maybe this will be fixed in the latest release,
which should go final soon)

Jedit looks quite good, but does it actually let you run your Python code 
from within Jedit, or does it merely provide syntax highlighting etc?

Cheers
Jon

On Mon, 1 Aug 2005, Martin Franklin wrote:

> Jon Hewer wrote:
>> Hi
>>
>>
>>
>> I am yet to find a Python IDE (for both Windows and Mac) that I like.
>> Any suggestions?
>>
>>
>>
>> Thanks
>>
>
>
> See:=
>
> http://wiki.python.org/moin/PythonEditors
>
>
> For more help
>
> Thanks
> Martin
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newb: Telnet 'cooked data','EOF' queries

2005-08-01 Thread glen
> > Could someone explain what "cooked data" is.
> discussed in the telnet RFC, which is in RFC854 telnetlib docstring.
> "Cooked" data is data after these special sequences are removed.
>
>>'when' is an EOF received.
> the only EOF in telnet is when the other side closes the socket.

Thanks, thats got me started.
-- 
http://mail.python.org/mailman/listinfo/python-list


Standard Threads vs Weightless Threads

2005-08-01 Thread yoda
Recently I read Charming Python: Implementing Weightless Threads
(http://www-128.ibm.com/developerworks/linux/library/l-pythrd.html) by
David D.

I'm not an authority on threading architectures so I'd like to ask the
following:

1)What is the difference (in terms of performance, scalability,[insert
relevant metric here]) between microthreads and "system" threads?

2)If microthreads really are superior then why aren't they the standard
Python implementation (or at least within the standard library)? (where
my assumption is that they are not the standard implementation and are
not contained within the standard library).

ps. I fear that my questions and assumptions about threading may be
rather naive. If they are, it's because I haven't yet done any
significant research.

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


need for speed

2005-08-01 Thread [EMAIL PROTECTED]
hi everyone
can someone suggest me where find a lot programming tricks for
achieving the top speed in python?
thanks everyone for patience

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


Operator Overloading

2005-08-01 Thread Gurpreet Sachdeva

  
Hi,

Is there any provision in python which allows me to make my own operators?

My problem is that I need to combine two dictonaries with their keys and I don't want to use any of the existing operators like '+','-','*'.
So is there a way I can make '**' or '~' as my operators to add two dictonaries? If not which all operators can I overoad?

Thanks,
Garry

http://garrythegambler.blogspot.com



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

Re: Advanced concurrancy

2005-08-01 Thread Peter Tillotson
I've not yet had a chance to try some examples, but i've looked through 
the documentation. It feels quite familiar, but i'd say that it is 
closer to Jade, the fipa (federation of intelligent physical agents) 
compliant agent framework than CSP or pi calculus. I like the behaviour 
(component microthread) model, but the advantage of CSP / pi calculus is 
that the resulting distributed system remains open to mathematical analysis.

For concurency its is the best framework i've seen :-) Have you come 
across the pylinda tuplespace implementation. It might be well worth a 
look. I might be barking up the wrong tree - but it seems to me that 
there could be considerable overlap between tuplespaces and mailboxes, 
though you did mention that you were moving towards twisted as the 
underlying platform for the future.

I'm quite interested in the mini version and also using the modules as 
mobile code rather than installing it formally. I'll probably zip the 
Axion directory and distribute the zip with the code, adding the zip to 
the python path dynamically.

cheers

p

Michael Sparks wrote:
> Peter Tillotson wrote:
> 
> 
>>Hi,
>>
>>I'm looking for an advanced concurrency module for python and don't seem
>>to be able to find anything suitable. Does anyone know where I might
>>find one? I know that there is CSP like functionality built into
>>Stackless but i'd like students to be able to use a standard python build.
> 
> 
> Please take a look at Kamaelia* - it /probably/ has what you're after by the
> sounds of things. Currently the unit for sequential process can be either
> generators or threads, and is single CPU, single process, however we do
> expect to make the system multi-process and multi-system.
>* http://kamaelia.sourceforge.net/
> 
> Currently it runs on Linux, Mac OS X, Windows and a subset works nicely on
> Series 60 mobiles. (That has separate packaging) It works with standard
> Python versions 2.2 and upwards.
> 
> The basic idea in Kamaelia is you have a class that represents a concurrent
> unit that communicates with local interfaces only which are essentially
> queues. The specific metaphor we use is that of an office worker with
> inboxes and outboxes with deliveries made between outboxes to inboxes.
> There also exists a simple environmental/service lookup facility which acts
> like an assistant in the above metaphor, and has natural similarities to a
> Linda type system.
> 
> (The actual rationale for the assistant facility though is based on
> biological systems. We have communicating linked concurrent components -
> which is much like many biological systems. However in addition to that
> most biological systems also have a hormonal system - which is part of the
> thinking behind the assistant system)
> 
> Generators (when embedded in a class) lend themselves very nicely to this
> sort of model in our experience /because/ they are limited to a single
> level (with regard to yield).
> 
> It's probably suitable for your students because we've tested the system on
> pre-university trainees, and vacation trainees, and found they're able to
> pick up the system, learn the basic ideas within a week or so (I have some
> exercises on how to build a mini- version if that helps), and build
> interesting systems. 
> 
> For example we had a pre-university trainee start with us at the beginning
> of the year, learn python, Kamaelia, and build a simple streaming system
> taking a video file, taking snapshots and sending those to mobile phones
> and PC's - this was over a period of 3 months. He'd only done a little bit
> of access in the past, and a little bit of VB. Well that as well as a
> simple learning system simulating a digital TV decode chain, but taking a
> script instead of a transport stream.
> 
> We recently made a 0.2.0 release of the system (not announced on c.l.p yet)
> that includes (basic) support for a wide range of multimedia/networked apps
> which might help people getting started. Some interesting new additions in
> the release are an IPython integration - allowing you to build Kamaelia
> systems on the fly using a shell, much like you can build unix pipelines,
> as well as a visual introspection tool (and network graph visualiser) which
> allows you to see inside systems as they are running. (This has turned out
> to be extremely useful - as you can expect with any CSP-type system)
> 
> The specific use cases you mention are also very closed aligned with our
> aims for the project. 
> 
> We're essentially working on making concurrency easy and natural to use,
> (starting from the domain of networked multimedia). You can do incremental
> development and transformation in exactly the way it sounds like you want,
> and build interesting systems. We're also working on the assumption that if
> you do that you can get performance later by specific optimisations (eg
> more CPUs).
>* Example of incremental component development here:
>  http://tinyurl.com/dp8n7
> 
> By the 

Re: Operator Overloading

2005-08-01 Thread Robert Kern
Gurpreet Sachdeva wrote:
>  
> Hi,
> 
> Is there any provision in python which allows me to make my own operators?
> 
> My problem is that I need to combine two dictonaries with their keys and 
> I don't want to use any of the existing operators like '+','-','*'.
> So is there a way I can make '**' or '~' as my operators to add two 
> dictonaries? If not which all operators can I overoad?

Both ** and ~ are existing operators (although ~ is unary, not binary). 
You cannot make new ones, but you can overload all of the available ones 
for new classes (not old ones like dicts).

   http://docs.python.org/ref/numeric-types.html

With a beautiful hack, you can make your own general, pseudo-operators.

   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

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


Re: Wheel-reinvention with Python

2005-08-01 Thread phil hunt
On Sun, 31 Jul 2005 08:02:43 -0400, Ed Leafe <[EMAIL PROTECTED]> wrote:
>On Sunday 31 July 2005 01:02, phil hunt wrote:
>
>> You mightn't have, but I suspect more Python programers who've
>> written GUI apps have used Tkinter than any of the other APIs.
>>
>> Not that I'm a particular fan of it, it's just I like
>> standardisation, because then you get network effects.
>
> At PyCon DC 2004, Guido was asked about wxPython: "wxPython is the best and 
>most mature cross-platform GUI toolkit, given a number of constraints. The 
>only reason wxPython isn't the standard Python GUI toolkit is that Tkinter 
>was there first."

I was under the impression -- from reading this ng -- that wx was 
buggy on some platforms and less portable than Tkinter. Not true?

-- 
Email: zen19725 at zen dot co dot uk


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


Re: Wheel-reinvention with Python

2005-08-01 Thread phil hunt
On 31 Jul 2005 10:07:52 -0700, Kay Schluehr <[EMAIL PROTECTED]> wrote:
>
>Ed Leafe wrote:
>> On Sunday 31 July 2005 01:02, phil hunt wrote:
>>
>> > You mightn't have, but I suspect more Python programers who've
>> > written GUI apps have used Tkinter than any of the other APIs.
>> >
>> > Not that I'm a particular fan of it, it's just I like
>> > standardisation, because then you get network effects.
>>
>>  At PyCon DC 2004, Guido was asked about wxPython: "wxPython is the best and
>> most mature cross-platform GUI toolkit, given a number of constraints. The
>> only reason wxPython isn't the standard Python GUI toolkit is that Tkinter
>> was there first."
>
>Maybe. But Guidos intention with Python was to create a secondary
>language originally - an extension language of C - ( unlike Java that
>was concepted as a radically platform independent language and a
>successor of C++ ).

These days you can almost think of C++ as a secondary language to 
Python: code the app in Python and then optimise by recoding the 
bits that need speed in C++.

>Some other people already abandoned Python not for the worst reasons:
>
>http://www.kevin-walzer.com/pivot/entry.php?id=69
>
>My objection with wrappers around wrappers around wrappers is that I
>have no hope ever watching the ground. If some error occurs, which
>layer has to be addressed?

Good point.


-- 
Email: zen19725 at zen dot co dot uk


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


Re: Wheel-reinvention with Python

2005-08-01 Thread phil hunt
On Sun, 31 Jul 2005 14:52:58 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote:
>Torsten Bronger <[EMAIL PROTECTED]> writes:
>> Hallöchen!
>> Mike Meyer <[EMAIL PROTECTED]> writes:
>>> Torsten Bronger <[EMAIL PROTECTED]> writes:
 Calvin Spealman <[EMAIL PROTECTED]> writes:
> The choice is GUI toolkits is largely seperate from
> Python. Consider that they are just bindings to libraries that
> are developed completely seperate of the language. GUI is should
> be seperate from the language, and thus not bound to same
> expectations and desires as elements of the language itself.
 I disagree.  A modern language must provide a convenient and
 well-embedded way to write GUI applications.
>>> The tools for writing GUI applications belong in a library, not
>>> the langauge.
>> None of us has talked about changing syntax.  However, the standard
>> library is part of the language unless you're really very petty.
>
>Or you use different Python implementations. There are four different
>Python implementations in the world. Not everything in the CPYthon
>standard library runs in all of them. 

I would guess that 90%+ of Python developers develop to CPython.

>To put this differently, it's required if you want to succeed as a
>language for the specific purpose of creating GUI applications. I'd
>agree to that. But there are *lots* of other application areas around,
>so limiting your definition of "success" to that one field is very
>short-sighted.

GUI applications are a large area; and langauge that doesn't do 
them tolerably well is limiting its success.


-- 
Email: zen19725 at zen dot co dot uk


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


Re: Wheel-reinvention with Python

2005-08-01 Thread phil hunt
On Sun, 31 Jul 2005 12:09:48 -0700, Cliff Wells <[EMAIL PROTECTED]> wrote:
>On Sun, 2005-07-31 at 10:07 -0700, Kay Schluehr wrote:
>
>> Some other people already abandoned Python not for the worst reasons:
>> 
>> http://www.kevin-walzer.com/pivot/entry.php?id=69
>
>Being a developer requires not only a bit of brains, but quite a bit of
>tenacity as well.  Apparently Kevin lacks the second.
>
>> My objection with wrappers around wrappers around wrappers is that I
>> have no hope ever watching the ground. If some error occurs, which
>> layer has to be addressed? Which developing group is reponsible? My own
>> or that of team A, team B, team C ... ? The baroque concept is
>> repulsive to me and only acceptable in case of legacy code that gets
>> wrapped around old one and is dedicated to substitute it continously.
>
>Of course, Tkinter is still a wrapper around a third party library (Tk)
>borrowed from a different language (Tcl) and written again in a third
>language (C), much the same as wxPython.  

In practise any Python GUI is going to contain code from otyher 
languages since if it was coded all the way down in python it would 
be too slow.

-- 
Email: zen19725 at zen dot co dot uk


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


Re: python SMTP server

2005-08-01 Thread Benjamin Niemann
Cliff Wells wrote:

> On Sun, 2005-07-31 at 13:14 +0200, Benjamin Niemann wrote:
> 
>> But you should be aware of the fact that (if you send mail from a dialup
>> machine without going through a relay server) your mails will quickly be
>> marked as spam - I hope you do not intend to send spam...
> 
> Yah, Postfix on my servers uses several dnsbl's which automatically
> reject home users (unless they authenticate first).  Even if this isn't
> the case for the majority of SMTP servers today I expect it won't be
> long before it is.
> 
> As an aside, I will say that many SMTP servers that service home users
> (i.e. Comcast, et al) limit the amount of mail that you can send within
> a defined period.

Or completely block outgoing traffic on port 25 except to their own relay...

> By using a local SMTP server to proxy, your app can 
> queue up a large amount of mail in a much shorter period.  It won't
> necessarily go out any faster, but at least your app won't be tied up
> waiting for the mail to be accepted.  So there is perhaps one useful
> (beyond learning and fun) application for using a local SMTP server.

It would be interesting what the intention of the OP is. I just stumpled
upon a similar problem. The prog I'm currently working on has a function to
report crashes back to me. Originally these reports where sent by mail - no
problem on UNIX/Linux hosts where you can assume to have a working MDA on
localhost. But what to do on Windows systems?!? Ask for a SMTP server
during installation? Confusing as the program itself is totally unrelated
to email. In this case you _could_ deliver the mail directly to my MX
host... But instead of this I installed a small CGI on my website that
sends the mails to me and gets the data via HTTP POST from my app.

-- 
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wheel-reinvention with Python

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 08:53 +0100, phil hunt wrote:

> I was under the impression -- from reading this ng -- that wx was 
> buggy on some platforms and less portable than Tkinter. Not true?

It depends on how you define "buggy" and "portable"... also "platform"
is up for grabs too ;)

On the serious side, I expect that if you are simply counting bugs,
there are probably more in wxPython.  But I'd also say that when it
comes to ratio of bugs to features, they are probably quite comparable,
even if Tk has one bug and wxPython a hundred ;)

As far as more portable, Tk probably wins hands-down.  OTOH, in
practice, very few people care about the platforms wxPython doesn't run
on (think: GTK doesn't run there either).  wxWidgets is working on a
wxUniversal port which takes a similar tack that Tk does in most cases,
that is, providing all of its own widgets based on drawing primitives,
but I have no idea how far along that is nor how long until wxPython
supports it as another target.

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: python SMTP server

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 12:28 +0200, Benjamin Niemann wrote:
> Cliff Wells wrote:

> > As an aside, I will say that many SMTP servers that service home users
> > (i.e. Comcast, et al) limit the amount of mail that you can send within
> > a defined period.
> 
> Or completely block outgoing traffic on port 25 except to their own relay...

Luckily I haven't encountered this with Comcast Cable (I use my own
mailserver [requires smtpauth] directly from home as Comcast seems to
have issues with mail and DNS on occasion).  If I ever do, I'll
immediately switch to one of the local DSL providers who support Linux.
Better for MTA's to block dynamic/home IP's using dnsbls than have the
ISP limit what you can do with your home computer.

> > By using a local SMTP server to proxy, your app can 
> > queue up a large amount of mail in a much shorter period.  It won't
> > necessarily go out any faster, but at least your app won't be tied up
> > waiting for the mail to be accepted.  So there is perhaps one useful
> > (beyond learning and fun) application for using a local SMTP server.
> 
> It would be interesting what the intention of the OP is. I just stumpled
> upon a similar problem. The prog I'm currently working on has a function to
> report crashes back to me. Originally these reports where sent by mail - no
> problem on UNIX/Linux hosts where you can assume to have a working MDA on
> localhost. But what to do on Windows systems?!? Ask for a SMTP server
> during installation? Confusing as the program itself is totally unrelated
> to email. In this case you _could_ deliver the mail directly to my MX
> host... But instead of this I installed a small CGI on my website that
> sends the mails to me and gets the data via HTTP POST from my app.

You can also use port redirection to bypass this sort of thing.  Send on
port 10025 instead and direct your MTA to listen on both ports.

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Wheel-reinvention with Python

2005-08-01 Thread Reinhold Birkenfeld
phil hunt wrote:
> On Sun, 31 Jul 2005 12:09:48 -0700, Cliff Wells <[EMAIL PROTECTED]> wrote:
>>On Sun, 2005-07-31 at 10:07 -0700, Kay Schluehr wrote:
>>
>>> Some other people already abandoned Python not for the worst reasons:
>>> 
>>> http://www.kevin-walzer.com/pivot/entry.php?id=69
>>
>>Being a developer requires not only a bit of brains, but quite a bit of
>>tenacity as well.  Apparently Kevin lacks the second.
>>
>>> My objection with wrappers around wrappers around wrappers is that I
>>> have no hope ever watching the ground. If some error occurs, which
>>> layer has to be addressed? Which developing group is reponsible? My own
>>> or that of team A, team B, team C ... ? The baroque concept is
>>> repulsive to me and only acceptable in case of legacy code that gets
>>> wrapped around old one and is dedicated to substitute it continously.
>>
>>Of course, Tkinter is still a wrapper around a third party library (Tk)
>>borrowed from a different language (Tcl) and written again in a third
>>language (C), much the same as wxPython.  
> 
> In practise any Python GUI is going to contain code from otyher 
> languages since if it was coded all the way down in python it would 
> be too slow.

Oh, I could imagine that a MFC-like wrapper around win32gui, or another
one around Xlib wouldn't be slower that wxWidgets is today.

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


Python Programming Contest: First results

2005-08-01 Thread Brian Quinlan
Here are the results for the first problem in the Python Programming 
Contest.

I haven't been able to find as much time as I excepted, so my analysis 
is not very in depth.

You can find the results here:
http://www.sweetapp.com/pycontest/contest1/results.html

And the problem definition here:
http://www.sweetapp.com/pycontest/contest1/

Kudos to everyone who participated but especially to Raymond Hettinger 
and Thomas Lotze, whose solutions were nearly 50 times faster than mine.

I'd also like to point out that Thomas Guettler's solution, which is the 
slowest, was completed in less than 3 hours after the contest was 
announced. That's impresive for a correct solution.

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


Re: PEP on path module for standard library

2005-08-01 Thread qvx
Ron Adam wrote:
> Bengt Richter wrote:
>
> > http://msdn.microsoft.com/workshop/networking/pluggable/overview/aplugprot_overviews_entry.asp.


Qvx

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


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Ira
OK let me rephrase,

the standard error stream (and if I'm not mistaken also the one that
PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
ahead and write the following in python...

SomeNewStreamOrFileOrWhateverItIs = new stream
sys.stderr = SomeNewStreamOrFileOrWhateverItIs

I can go ahead and do the exact same thing from the C source code. All I
need to do is to figure out how to wrap a c-style FILE* with a PyObject, And
PySys_SetObjet("stderr", newstream);

I'm very new to python so that might be nonsense but it appeals to my
programmer's common sense. Can anyone tell me how to do this?


"Michael Hudson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Ira" <[EMAIL PROTECTED]> writes:
>
> > Using an embedded interpreter, how do I change it's default output
> > streams (specifically the one used by PyErr_Print() which I'm
> > guessing is the default error stream)?
>
> It looks as though it writes to stderr unconditionally.  But most of
> the reasons for ended up in PyErr_Print can be intercepted at a higher
> level (I think -- I mean sys.excepthook & co here).
>
> Cheers,
> mwh
>
> -- 
>   ARTHUR:  Yes.  It was on display in the bottom of a locked filing
>cabinet stuck in a disused lavatory with a sign on the door
>saying "Beware of the Leopard".
> -- The Hitch-Hikers Guide to the Galaxy, Episode 1
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>



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


python ETL

2005-08-01 Thread arielgr
Hi,
My company is involved in the development of many data marts and
data-warehouses, and I currently looking into migrating our old set of
tools (written in Korn) to a new, more dynamic and robust one. I am
looking into python as I have heard that it could be a good contestant
for the job, and wanted to know if anyone knew of an existing open
source project which implements ETL using python, or any libraries that
may ease the production of such tools.

Thanks.

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


Re: Py: a very dangerous language

2005-08-01 Thread Peter Otten
Harald Massa wrote:

> Always go to bed exactly when you want to write the first lambda.

Eureka. The Twentieth Pythonic Thesis has finally surfaced.

Peter

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Marek Kubica
Hello!

On Sun, 31 Jul 2005 17:38:44 -0700 James Stroud wrote:

> On Sunday 31 July 2005 05:14 pm, Robert Kern wrote:
>> You can't blame Dabo for this one. Your wxPython install is broken.
> 
> Yes, but my Tkinter install works just fine.

But you chose wx: dabo.ui.loadUI("wx")

"Why can't I compile my linux kernel? I know, my gcc is broken, but my
Python runs fine?" SCNR.

greets,
Marek

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Ed Leafe
On Sunday 31 July 2005 22:39, Paul Rubin wrote:

> > import dabo
> > app = dabo.dApp()
> > dApp.start()
> >
> >  Sorry, I couldn't do it in 5.  ;-) Oh, and that includes a full menu,
> > too.
>
> I get an ImportError exception when I try that.  Any suggestions?  Note
> that I don't get that exception from Tkinter.
>     bash-3.00$ python
>     Python 2.3.4 (#1, Oct 26 2004, 16:42:40) 
>     [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
>     Type "help", "copyright", "credits" or "license" for more information.
>     >>> import dabo
>     Traceback (most recent call last):
>       File "", line 1, in ?
>     ImportError: No module named dabo
>     >>> import Tkinter
>     >>> 

 Oh, c'mon now Paul, now you're trolling. You know exactly what the problem 
is, and try to make it look like a bug.

 Fine: you don't want to use anything that doesn't come standard with Python. 
You've made your point. We get it. There is no need to repeat yourself 
constantly.

 The only point of my post was that for those without your aversion to 
installing useful tools, Dabo provides a ton of functionality. Also, as my 
partner Paul McNett pointed out, I could have done it in *two* lines:

import dabo
dabo.dApp().start()

;-)

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Robert Kern
Ira wrote:
> OK let me rephrase,
> 
> the standard error stream (and if I'm not mistaken also the one that
> PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
> ahead and write the following in python...
> 
> SomeNewStreamOrFileOrWhateverItIs = new stream
> sys.stderr = SomeNewStreamOrFileOrWhateverItIs
> 
> I can go ahead and do the exact same thing from the C source code. All I
> need to do is to figure out how to wrap a c-style FILE* with a PyObject, And
> PySys_SetObjet("stderr", newstream);
> 
> I'm very new to python so that might be nonsense but it appeals to my
> programmer's common sense. Can anyone tell me how to do this?

http://docs.python.org/api/fileObjects.html

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

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


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Ira
OK let me rephrase,

the standard error stream (and if I'm not mistaken also the one that
PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
ahead and write the following in python...

SomeNewStreamOrFileOrWhateverItIs = new stream
sys.stderr = SomeNewStreamOrFileOrWhateverItIs

I can go ahead and do the exact same thing from the C source code. All I
need to do is to figure out how to wrap a c-style FILE* with a PyObject, And
PySys_SetObjet("stderr", newstream);

I'm very new to python so that might be nonsense but it appeals to my
programmer's common sense. Can anyone tell me how to do this?


"Michael Hudson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Ira" <[EMAIL PROTECTED]> writes:
>
> > Using an embedded interpreter, how do I change it's default output
> > streams (specifically the one used by PyErr_Print() which I'm
> > guessing is the default error stream)?
>
> It looks as though it writes to stderr unconditionally.  But most of
> the reasons for ended up in PyErr_Print can be intercepted at a higher
> level (I think -- I mean sys.excepthook & co here).
>
> Cheers,
> mwh
>
> -- 
>   ARTHUR:  Yes.  It was on display in the bottom of a locked filing
>cabinet stuck in a disused lavatory with a sign on the door
>saying "Beware of the Leopard".
> -- The Hitch-Hikers Guide to the Galaxy, Episode 1
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>




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


Re: The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-08-01 Thread Marek Kubica
On Sat, 30 Jul 2005 14:13:14 -0700 Cliff Wells wrote:

> But how stable is GTK on systems such as Windows and OS/X?  That has
> been what has kept me from using it.  Most GTK apps I've used on Windows
> (including the venerable GIMP) are nowhere near as stable as their Linux
> counterparts (although this may not be entirely the fault of GTK).
> Also, GTK on OS/X requires Fink, which is a pretty hefty requirement to
> place on an end user.

I cannot speak for Mac OS X, but I like GTK on Windows, it's better than
Tkinter :D

GTK unter Windows has been discussed not so long ago:
http://groups.google.de/group/comp.lang.python/browse_frm/thread/308b08adce4b9794/7ca38c3d89933ce9?tvc=1#7ca38c3d89933ce9

If you already tried GIMP on Windows, better try Inkscape on Windows.. that
piece of GTK software is really good.

greets,
Marek

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


Re: python ETL

2005-08-01 Thread Robert Kern
[EMAIL PROTECTED] wrote:
> Hi,
> My company is involved in the development of many data marts and
> data-warehouses, and I currently looking into migrating our old set of
> tools (written in Korn) to a new, more dynamic and robust one. I am
> looking into python as I have heard that it could be a good contestant
> for the job, and wanted to know if anyone knew of an existing open
> source project which implements ETL using python, or any libraries that
> may ease the production of such tools.

I'm not an expert in such matters, I had to Google for the definition of 
ETL ("extract, transform, and load" which appears to just be a buzzword 
for "data munging"); but it seems to me that "ETL" is so utterly broad 
in scope that we can't tell you anything until you give us some more 
information.

What are your sources of data? What kind of data are you dealing with? 
What kinds of munging do you want to do? What formats are the data going to?

However, given that your current toolset is written as Korn shell 
scripts, I'm pretty confident that Python will be up to the task.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Marek Kubica
Hello!

On Sun, 31 Jul 2005 13:46:55 +0200 Torsten Bronger wrote:

> Be that as it may, some Google postings suggest that it works at
> least with wxPython.
Yes, it does. I hadn't done this a long time, but it is possible. In fact,
afaik there are less problems with py2exe and wxPython than with PyGTK
(writing the setup.py was easier).

greets,
Marek

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Ed Leafe
On Sunday 31 July 2005 20:09, James Stroud wrote:

> Incidentally, I'm not really interested in knowing what is wrong here,
> frankly I haven't even looked at the output except that I notice that it is
> a stack trace, so don't bother telling me how simple it is to fix and that
> I should know this or that. You might be right, but I simply don't care at
> this point.
>
> Sorry dabo guys. You are only one of many.

 No problem. But let me ask you what would *not* have disappointed you. As 
others have pointed out, you didn't compile the wxWidgets part of your 
wxPython install so as to include the stylized text control (yes, it seems 
silly that you should have to specify that, but that's another thread...)

 Should we have defensive code for every possible broken installation? We use 
a lot of the Python standard library modules, many dbapi-compliant modules, 
and, of course, wxPython. If someone mis-installs one of the pre-requisites, 
do you expect Dabo to catch that and present you with a diagnostic message? 
I'm serious here: I want to know what people consider acceptable for a 
software package that relies on other packages. 

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: namespaces

2005-08-01 Thread Bengt Richter
On Sun, 31 Jul 2005 21:40:14 +0200, Paolino <[EMAIL PROTECTED]> wrote:

>George Sakkis wrote:
>
>> Then write a closure. You get both encapsulation and efficience, and as
>> a bonus, customization of the translating function:
>> 
>> import string
>> 
>> def translateFactory(validChars=string.letters+string.digits,
>>  replaceChar='_'):
>> all=string.maketrans('','')
>> badcars=all.translate(all,validChars)
>> table=string.maketrans(badcars, replaceChar*len(badcars))
>> def translate(text):
>> return text.translate(table)
>> # bind any attributes you want to be accessible
>> # translate.badcars = badcars
>> # ...
>> return translate
>> 
>> 
>> tr = translateFactory()
>> tr("Hel\xfflo")
>
>This is clean,but I suppose it would get cumbersome if I want to have 
>more functions in the namespace/factory and it implies all that bindings 
>in the end.
You are allowed to have more than one factory ;-)

>
>The second point also shows my perplexities about functions namespace:
>
>def function():
>   function.foo='something'
>
>a=function.foo
>
>Traceback (most recent call last):
>   File "", line 1, in ?
>AttributeError: 'function' object has no attribute 'foo'
>
You have not yet executed the statement function.foo='something'
so you should not expect to see its effect ;-)

>How should I read it? The namespace is half done inside the function?
>
 >>> def function():
 ... function.foo='something'
 ...
 >>> a=function.foo
 Traceback (most recent call last):
   File "", line 1, in ?
 AttributeError: 'function' object has no attribute 'foo'
 >>> vars(function)
 {}

Ok, to make the statement execute, execute function:

 >>> function()
 >>> a=function.foo
 >>> a
 'something'
 >>> vars(function)
 {'foo': 'something'}

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How override ALL function calls? (Is there a "function call function"?)

2005-08-01 Thread Bengt Richter
On 31 Jul 2005 12:01:36 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

>I'm trying run a homegrown profiler on some Python code.
>
>Rather than apply profiler wrapper to ALL functions by hand
>
>Is there a low level Python function I can override to modify
>
>how ALL functions are called?
>
You may want to look at

 >>> import sys
 >>> help(sys.settrace)
 Help on built-in function settrace in module sys:

 settrace(...)
 settrace(function)

 Set the global debug tracing function.  It will be called on each
 function call.  See the debugger chapter in the library manual.

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wheel-reinvention with Python

2005-08-01 Thread Marek Kubica
On 31 Jul 2005 16:38:45 -0700 Paul Rubin wrote:

> I can put up a Tk gui in about 5 lines of code from a stock Python
> distro without having to install anything additional.  How do I do
> that with wxPython?

It is very easy under Debian Sarge to do it.
Well after installing python-tk which needs python2.3-tk which needs blt,
tcl8.4, tk8.4 and likes to have tix8.1.

So, for a Tkinter programm you just need to install at least five packages
for a GUI toolkit which may be great for you if you like to study the
history of computing. :D

Not that wxPython, PyGTK, PyQt have no dependencies ;) Bug you still can't
forget the dependency on Tcl/Tk.

greets,
Marek

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


Re: rfc822 module bug?

2005-08-01 Thread Nemesis
Mentre io pensavo ad una intro simpatica "Tim Roberts" scriveva:

[rfc822 module bug]
>>Date: Tue,26 Jul 2005 13:14:27 GMT +0200
>>
>>It seems to be correct¹, but parsedate_tz is not able to decode it, it
>>is confused by the absence of a space after the ",".
>
> Fascinating.  I've written a lot of e-mail programs, and I would have bet
> real money that this was not legal by either RFC822 or 2822, but the BNF
> certainly supports your assertion that this is valid.
[...]
> This is actually from RFC2822, but the point is the same.

Yes you are right of course.

I think I'll submit this bug on the Python web-site.

-- 
"Sfugge un braccio a Pessotto." (Amedeo Goria)
 
 |\ |   |HomePage   : http://nem01.altervista.org
 | \|emesis |XPN (my nr): http://xpn.altervista.org

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


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Michael Hudson
"Ira" <[EMAIL PROTECTED]> writes:

> OK let me rephrase,
>
> the standard error stream (and if I'm not mistaken also the one that
> PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
> ahead and write the following in python...

Ah, OK, I think you're mistaken, and PyErr_Print prints to the C level
FILE* stderr (I agree my first post was confusing on this point, sorry
about that...).

Cheers,
mwh

-- 
   jemfinch: What's to parse?  A numeric code, perhaps a
  chicken, and some arguments
-- from Twisted.Quotes
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Ed Leafe wrote:

>  Should we have defensive code for every possible broken installation? We
>  use
> a lot of the Python standard library modules, many dbapi-compliant
> modules, and, of course, wxPython. If someone mis-installs one of the
> pre-requisites, do you expect Dabo to catch that and present you with a
> diagnostic message? I'm serious here: I want to know what people consider
> acceptable for a software package that relies on other packages.

If it doesn't interfere with my other custom options, catching unsatisfied
requisites is interesting.

But a helpful stack trace is enough for the developer.  Just be sure to say
that it was "this" or "that" requisite that generated the problem and
that's it.  Giving some references on how to fix the problem is a plus.

But if you're going to check everything, you'll end up checking the whole
system at each and every run -- because I might have added / removed
packages since I installed Dabo -- what would give a big performance
penalty.  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: [path-PEP] Path inherits from basestring again

2005-08-01 Thread Michael Hoffman
Delaney, Timothy (Tim) wrote:

 > Hey - paths are special enough to warrant additional syntax, aren't they?

I hope this is a joke :)
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 14:20 +0200, Marek Kubica wrote:

> If you already tried GIMP on Windows, better try Inkscape on Windows.. that
> piece of GTK software is really good.

I don't do any actual work under Windows any more.  My Windows VMware
session is purely for testing Windows apps and websites under Exploder. 

However my girlfriend, while hating the Gimp (she prefers Photoshop, to
put it mildly), loves Inkscape and claims it is better in many ways than
Illustrator.

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Robert Kern
Michael Hudson wrote:
> "Ira" <[EMAIL PROTECTED]> writes:
> 
>>OK let me rephrase,
>>
>>the standard error stream (and if I'm not mistaken also the one that
>>PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
>>ahead and write the following in python...
> 
> Ah, OK, I think you're mistaken, and PyErr_Print prints to the C level
> FILE* stderr (I agree my first post was confusing on this point, sorry
> about that...).

No, it doesn't. It grabs the appropriate object from sys.stderr.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 08:30 -0400, Ed Leafe wrote:
> On Sunday 31 July 2005 20:09, James Stroud wrote:

>  No problem. But let me ask you what would *not* have disappointed you. As 
> others have pointed out, you didn't compile the wxWidgets part of your 
> wxPython install so as to include the stylized text control (yes, it seems 
> silly that you should have to specify that, but that's another thread...)
> 
>  Should we have defensive code for every possible broken installation? We use 
> a lot of the Python standard library modules, many dbapi-compliant modules, 
> and, of course, wxPython. If someone mis-installs one of the pre-requisites, 
> do you expect Dabo to catch that and present you with a diagnostic message? 
> I'm serious here: I want to know what people consider acceptable for a 
> software package that relies on other packages. 

Personally, all I expect is an obvious pointer to a mailing list and a
helpful community willing to suffer NB questions (fast bugfixes is a big
plus too).  If that's available, I'm happy.  But then I'm willing to
actually work a little to get what I want.  For other it seems they
won't be happy unless you drive to their house and install it for them
(which only seems fair, cause if you hadn't volunteered to write such
crap then they wouldn't have had to be bothered with it in the first
place, damn you).  Maybe you wouldn't mind tidying up a bit and washing
a few dishes while you're at it?  


Can't *quite* get this spoon to my mouth'ly yours,
Cliff


-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Changing interpreter's deafult output/error streams

2005-08-01 Thread Michael Hudson
Robert Kern <[EMAIL PROTECTED]> writes:

> Michael Hudson wrote:
>> "Ira" <[EMAIL PROTECTED]> writes:
>> 
>>>OK let me rephrase,
>>>
>>>the standard error stream (and if I'm not mistaken also the one that
>>>PyErr_Print() writes to) is the python object sys.stderr. Now say I'd go
>>>ahead and write the following in python...
>> Ah, OK, I think you're mistaken, and PyErr_Print prints to the C
>> level
>> FILE* stderr (I agree my first post was confusing on this point, sorry
>> about that...).
>
> No, it doesn't. It grabs the appropriate object from sys.stderr.

Ah, you're right, I somehow ended up reading PySys_WriteStderr...

Cheers,
mwh

-- 
  The only problem with Microsoft is they just have no taste.
  -- Steve Jobs, (From _Triumph of the Nerds_ PBS special)
and quoted by Aahz on comp.lang.python
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: PyDev 0.9.7 with support to java 1.3 and 1.4 released

2005-08-01 Thread Fabio Zadrozny
Hi All,

PyDev - Python IDE (Python Development Enviroment for Eclipse) version 
0.9.7  with support to java 1.3 and 1.4 has just been released.

Check the homepage (http://pydev.sourceforge.net/) for more details.

IMPORTANT:

- A new package has been added to the pydev release with support to 
earlier java versions (latest release just supports java 5.0).

- This package is targeted specifically for people that don't have 
access to java 5.0 (namely, earlier versions of MAC OS).

- Support for this release is limited to the .zip distribution in the 
sourcforge downloads, and will not be put into the update site.


Release Highlights:

This build fixes some nasty bugs from 0.9.6... it is highly recommended 
you install it. (right now, everything but the debugger should work fine 
with 3.1).

Important notes

Note 1: Because of some issues with Eclipse, you have to uninstall all 
previous PyDev installations before installing the new release.
Note 2: This release only works with Eclipse 3.1 (and from now on, 
Eclipse 3.0.x is no longer supported).

Regards,

Fabio

-- 
Fabio Zadrozny
--
Software Developer

ESSS - Engineering Simulation and Scientific Software
www.esss.com.br

PyDev - Python Development Enviroment for Eclipse
pydev.sf.net
pydev.blogspot.com


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


Majordomo results: [UBCCS:VIRUS] Was: Returned mail: Data f

2005-08-01 Thread Majordomo
--

 This is a multi-part message in MIME format...
 Command 'this' not recognized.
 
 --=_NextPart_000_0009_87A2270A.AF343686
 Command '--=_nextpart_000_0009_87a2270a.af343686' not recognized.
 Content-Type: text/plain;
 Command 'content-type:' not recognized.
charset=us-ascii
 Command 'charset=us-ascii' not recognized.
 Content-Transfer-Encoding: 7bit
 Command 'content-transfer-encoding:' not recognized.
 Content-Disposition: inline
 Command 'content-disposition:' not recognized.
 
 The message was undeliverable due to the following reason(s):
 Command 'the' not recognized.
 
 Your message could not be delivered because the destination server was
 Command 'your' not recognized.
 unreachable within the allowed queue period. The amount of time
 Command 'unreachable' not recognized.
 a message is queued before it is returned depends on local configura-
 Command 'a' not recognized.
 tion parameters.
 Command 'tion' not recognized.
 
 Most likely there is a network problem that prevented delivery, but
 Command 'most' not recognized.
 it is also possible that the computer is turned off, or does not
 Command 'it' not recognized.
 have a mail system running right now.
 Command 'have' not recognized.
 
 Your message was not delivered within 4 days:
 Command 'your' not recognized.
 Mail server 152.167.191.138 is not responding.
 Command 'mail' not recognized.
 
 The following recipients did not receive this message:
 Command 'the' not recognized.
 <[EMAIL PROTECTED]>
 Command '<[EMAIL PROTECTED]>' not recognized.
 
 Please reply to [EMAIL PROTECTED]
 Command 'please' not recognized.
 if you feel this message to be in error.
 Command 'if' not recognized.
 
 
 --=_NextPart_000_0009_87A2270A.AF343686
 Command '--=_nextpart_000_0009_87a2270a.af343686' not recognized.
 Content-Type: text/plain; charset=UTF-8
 Command 'content-type:' not recognized.
 Content-Transfer-Encoding: 8bit
 Command 'content-transfer-encoding:' not recognized.
 
 The original content of this message part has been replaced
 Command 'the' not recognized.
 by this text because it tested positive for the following
 Command 'by' not recognized.
 virus(es):
 Command 'virus(es):' not recognized.
 
 W32/MyDoom-O
 Command 'w32/mydoom-o' not recognized.
 
 The original message has been quarantined pending further
 Command 'the' not recognized.
 action by the mail administrator.  For further information
 Command 'action' not recognized.
 about the message and its delivery status, please contact
 Command 'about' not recognized.
 the undersigned, and include the full content of this
 Command 'the' not recognized.
 message.  The identifier for this message is
 Command 'message.' not recognized.
 'j71D4OFr001489'.
 Command ''j71d4ofr001489'.' not recognized.
 
 This notification is being sent to you and any other
 Command 'this' not recognized.
 original envelope recipient(s).   To avoid creating a
 Command 'original' not recognized.
 nuisance and to keep mail traffic under control, the
 Command 'nuisance' not recognized.
 original sender  of the message has NOT been notified.
 Command 'original' not recognized.
 However, you may want to notify the sender at your
 Command 'however,' not recognized.
 discretion.
 Command 'discretion.' not recognized.
 
 
 The Management
 Command 'the' not recognized.
 PureMessage Admin <[EMAIL PROTECTED]>
 Command 'puremessage' not recognized.
 
 --=_NextPart_000_0009_87A2270A.AF343686
 Command '--=_nextpart_000_0009_87a2270a.af343686' not recognized.
 Content-Type: text/plain; name="SpamAssassinReport.txt"
 Command 'content-type:' not recognized.
 Content-Disposition: inline; filename="SpamAssassinReport.txt"
 Command 'content-disposition:' not recognized.
 Content-Transfer-Encoding: 7bit
 Command 'content-transfer-encoding:' not recognized.
 MIME-Version: 1.0
 Command 'mime-version:' not recognized.
 X-Mailer: MIME-tools 5.411 (Entity 5.404)
 Command 'x-mailer:' not recognized.
 
 Spam detection software, running on the system "badenpowell.cs.ubc.ca", has
 Command 'spam' not recognized.
 identified this incoming email as possible spam.  The original message
 Command 'identified' not recognized.
 has been attached to this so you can view it (if it isn't spam) or block
 Command 'has' not recognized.
 similar future email.  If you have any questions, see
 Command 'similar' not recognized.
 [EMAIL PROTECTED] for details.
 Command '[EMAIL PROTECTED]' not recognized.
 
 Content preview:  The message was undeliverable 

Re: need for speed

2005-08-01 Thread Luis M. Gonzalez
[EMAIL PROTECTED] wrote:
> hi everyone
> can someone suggest me where find a lot programming tricks for
> achieving the top speed in python?
> thanks everyone for patience

Check this out:
http://wiki.python.org/moin/PythonSpeed/PerformanceTips

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Fuzzyman

Torsten Bronger wrote:
> Hallöchen!
>
> Peter Decker <[EMAIL PROTECTED]> writes:
>
> > On 7/30/05, Torsten Bronger <[EMAIL PROTECTED]> wrote:
> >
> >> I've been having a closer look at wxPython which is not Pythonic
> >> at all and bad documented.  Probably I'll use it nevertheless.
> >> PyGTK and PyQt may have their own advantages and disadvantages.
> >>
> >> However, in my opinion we don't need yet another binding so thin
> >> that C or C++ is shining through, but a modern replacement for
> >> Tkinter with its Pythonic way of thinking.
> >
> > I had the exact same impression when I started working with
> > wxPython: [...] I then discovered Dabo (http://dabodev.com), which
> > is a full application framework, but whose UI layer is a very
> > Pythonic wrapper around wxPython. I've created several apps now
> > using Dabo, even though I haven't even looked at the data
> > connectivity aspects of it; the UI code works fine without it.
>
> I'm aware of it (and there is Wax and maybe a third one).  Actually
> it illustrates my point quite well: These projects are small and
> instable (Dabo has a developer basis of very few people, Wax has
> only one); they are even worse documented; they add another layer
> which slows down and requires the end-user to install another
> package; they force you to test even more GUI approaches.
>

Wax is small enough to distribute *with* large apps. It now has several
developers and part of the two 'google summer of code' projects working
on it will be to generate full documentation.

I find it makes writing GUI apps easier than with Tkinter and there is
no speed bottleneck form the GUI code !

All the best,

Fuzzy
http://www.voidspace.org.uk/python

> ==> They contribute heavily to Dark Cowherd's observation that "it
> is shambles".
>
> Tschö,
> Torsten.
> 
> -- 
> Torsten Bronger, aquisgrana, europa vetus

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


Re: Majordomo results: [UBCCS:VIRUS] Was: Returned mail: Data f

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 06:04 -0700, [EMAIL PROTECTED] wrote:

>  Command 'nuisance' not recognized.

Hm, seemed to work anyway.

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Dabo in 30 seconds?

2005-08-01 Thread Harald Armin Massa
Cliff (who has a love/hate relationship with Twisted) wrote:

> Twisted, for one, can't be used without knowing Python.  In fact,
> without knowing Python quite well.  For that matter, it can't easily be
> used .

Is "using" really a verb that is fitting for working with twisted? As
much as I read and tried to learn, it is not that you use twisted, but
you provide twisted with callbacks so that it uses you?

So it is more something about devotion or digestion then simply "use",
or?

Harald

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


Re: Py: a very dangerous language

2005-08-01 Thread Richie Hindle

[Harald]
> Always go to bed exactly when you want to write the first lambda.

[Peter]
> Eureka. The Twentieth Pythonic Thesis has finally surfaced.

+1 QOTW.

-- 
Richie Hindle
[EMAIL PROTECTED]

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Ed Leafe
On Monday 01 August 2005 09:28, Harald Armin  Massa wrote:

>  it is not that you use twisted, but
> you provide twisted with callbacks so that it uses you?

 +1 QOTW

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-01 Thread xtian
I think this is the kind of thing that Phillip J Eby's
PythonEggs/setuptools project is supposed to manage - you can declare
your dependencies, and it can manage (to some extent) download and
installation of the correct versions of dependencies, without
clobbering existing package versions.

It's at http://peak.telecommunity.com/DevCenter/PythonEggs

I haven't heard much about it recently, but it looks brilliant.

xtian

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Christopher Subich
Paul Rubin wrote:
> I think my approach is in some sense completely typical: I don't want
> to install ANYTHING, EVER.  I've described this before.  I want to buy
> a new computer and have all the software I'll ever need already on the
> hard drive, and use it from that day forward.  By the time the

With all due respect, if you're allergic to installing software then why 
are you a developer?  To me, your view is somewhat akin to that of a 
woodworker who doesn't want to buy tools, or a painter who doesn't want 
to buy brushes.

Computers can be merely appliances, sure, but that's wasting the general 
purpose part of computation.  Software as separate packaging exists 
because we (collectively) don't always know what we want the first (or 
second, or third, or...) time around.  And when we do know what we want, 
we often muck it up when we try it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standard Threads vs Weightless Threads

2005-08-01 Thread Christopher Subich
yoda wrote:
> 1)What is the difference (in terms of performance, scalability,[insert
> relevant metric here]) between microthreads and "system" threads?

System-level threads are relatively heavyweight.  They come with a full 
call stack, and they take up some level of kernel resources [generally 
less than a process].  In exchange, they're scheduled by the OS, with 
the primary benefit (on uniprocessor systems) that if one thread 
executes a blocking task (like IO writes) another thread will receive 
CPU attention.

The primary disadvantage is that they're scheduled by the CPU.  This 
leads to the concurrency nightmare, where the developer needs to keep 
track of what blocks of code (and data) need locks to prevent deadlock 
and race conditions.

> 
> 2)If microthreads really are superior then why aren't they the standard
> Python implementation (or at least within the standard library)? (where
> my assumption is that they are not the standard implementation and are
> not contained within the standard library).

Microthreads are very different; they're entirely internal to the Python 
process, and they're not seen at all by the operating system. 
Scheduling is done explicitly by the microthread implementation -- 
multitasking is not preemptive, as with system threads.

They're not in the standard library because implementing microthreads 
has thus far required a very large rewrite of the CPython architecture 
-- see Stackless Python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Printing Docstrings Without Importing

2005-08-01 Thread Fuzzyman
This seems to scratch several people's itches.

Care to develop/maintain it ?

Regards,

Fuzzball
http://www.voidspace.org.uk/python

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Peter Decker
On 31 Jul 2005 16:22:09 -0700, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:

> I spent several hours trying to install wxPython on Linux without
> success (a lot of that was figuring out that some undefined symbol it
> was complaining about was some GTK 1.5 function that had didn't exist
> in GTK 2.1).  As I remember, wxPython itself compiled without too much
> trouble but wxWidgets and/or GTK 1.5 (once I got a copy of that) had
> some problems.  I decided I just didn't care enough to keep pursuing it.

I'll bet you didn't even bother to read the docs, which give precise
step-by-step instructions for building from source. Oh, that's right,
you don't care enough to read directions.

I suppose with that attitude, you can make just about anything fail.

-- 

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
Hello NG,

I want to retrieve the members of a class
with a baseclass.
But the problem is, how to get the non derived 
members.

class a:
def who(self):
print "who"
def __init__(self):
self._a = 3

class b(a):
def who1(self):
print "who1"
def __init__(self):
a.__init__(self)
self._b = 4

y=b()

dir (y)
['__doc__', '__init__', '__module__', '_a', '_b', 'who', 'who1']


I need a function which lists only the members of 
the "not derived" class (here class B).

_b
_who1
__init__

How can I achieve this?
With the introspect module or so?

many thanks in advance!
-- 
Franz Steinhaeusler
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: namespaces

2005-08-01 Thread George Sakkis
Paolino wrote:

> >>Even worse I get with methods and function namespaces.
> >
> > What is "even worse" about them?
> >
> For my thinking, worse is to understand how they derive their pattern
> from generic namespaces.
> Methods seems not to have a writeble one,while functions as George and
> Rob remembered have one which is not read only.Why?

I'm not sure I can parse this successfully, let alone understand it.

George

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Peter Decker
On 8/1/05, Cliff Wells <[EMAIL PROTECTED]> wrote:

> Personally, all I expect is an obvious pointer to a mailing list and a
> helpful community willing to suffer NB questions (fast bugfixes is a big
> plus too).  If that's available, I'm happy.  But then I'm willing to
> actually work a little to get what I want.  For other it seems they
> won't be happy unless you drive to their house and install it for them
> (which only seems fair, cause if you hadn't volunteered to write such
> crap then they wouldn't have had to be bothered with it in the first
> place, damn you).  Maybe you wouldn't mind tidying up a bit and washing
> a few dishes while you're at it?

ROFLMAO!

Yep, it's their fault for not charging us for their work! How evil can
people get? Sharing their work and asking for nothing in return? What
bastards!!

-- 

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wheel-reinvention with Python

2005-08-01 Thread Peter Decker
On 31 Jul 2005 09:03:41 -0700, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:

> How on earth did you decide that, since tkinter actually runs out of
> the box when you install Python on most platforms, and wxPython doesn't?
> I can't even think about trying out Dabo unless I'm willing to go through
> some enormous pain of getting wxPython to work.

Geez, can you whine some more? Most people are running wxPython just
fine, and since you "don't care enough" to bother to follow
instructions, and have some oddball religious rule about installing
binaries, it's everyone else's fault that you experience "enormous
pain".

Gimme a break.

-- 

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-01 Thread Daniel Dittmar
Cliff Wells wrote:
>  But then I'm willing to
> actually work a little to get what I want.  For other it seems they
> won't be happy unless you drive to their house and install it for them

To be fair to those slothes: some of them want to write software for a 
commercial setting where they have to install it on other peoples 
machines. So it isn't just getting it to work one one own's machine. 
Using a specifc Python library with external dependencies means also 
installing and *supporting* it on a possible large set of configurations.

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Terry Reedy
This sort of intentional obtuseness grates on me too.  Just to let you 
know, this discussion has convinced me to try Dabo, which I knew nothing 
about before.  So your participation has not been useless.  In fact, I 
think I will start with your two-liner below so I can see what I get by 
default and then build from there.

Terry J. Reedy

"Ed Leafe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On Sunday 31 July 2005 22:39, Paul Rubin wrote:

> > import dabo
> > app = dabo.dApp()
> > dApp.start()
> >
> > Sorry, I couldn't do it in 5. ;-) Oh, and that includes a full menu,
> > too.
>
> I get an ImportError exception when I try that. Any suggestions? Note
> that I don't get that exception from Tkinter.
> bash-3.00$ python
> Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
> [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import dabo
> Traceback (most recent call last):
> File "", line 1, in ?
> ImportError: No module named dabo
> >>> import Tkinter
> >>>

 Oh, c'mon now Paul, now you're trolling. You know exactly what the problem
is, and try to make it look like a bug.

 Fine: you don't want to use anything that doesn't come standard with 
Python.
You've made your point. We get it. There is no need to repeat yourself
constantly.

 The only point of my post was that for those without your aversion to
installing useful tools, Dabo provides a ton of functionality. Also, as my
partner Paul McNett pointed out, I could have done it in *two* lines:

import dabo
dabo.dApp().start()

;-)

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list



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


Re: Getting not derived members of a class

2005-08-01 Thread George Sakkis
Franz Steinhaeusler wrote:

> Hello NG,
>
> I want to retrieve the members of a class
> with a baseclass.
> But the problem is, how to get the non derived
> members.
>
> class a:
> def who(self):
> print "who"
> def __init__(self):
> self._a = 3
>
> class b(a):
> def who1(self):
> print "who1"
> def __init__(self):
> a.__init__(self)
> self._b = 4
>
> y=b()
>
> dir (y)
> ['__doc__', '__init__', '__module__', '_a', '_b', 'who', 'who1']
>
>
> I need a function which lists only the members of
> the "not derived" class (here class B).
>
> _b
> _who1
> __init__
>
> How can I achieve this?
> With the introspect module or so?

I believe you can't: Both _a and _b end up in y.__dict__ and there's no
way to differentiate between the two depending on the time of their
creation. By the way, these are instance attributes, not class
attributes, so strictly _b is not a member of B, it's just an instance
of y. To see why this is the case, check the following valid (though
highly discouraged) example:

class X:
def __init__(self, x):
if isinstance(x,str):
self._s = x
else:
self._n = x

x1 = X("1")
x2 = X(1)

dir(x1)
['__doc__', '__init__', '__module__', '_s']

dir(x2)
['__doc__', '__init__', '__module__', '_n']


George

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Ed Leafe
On Monday 01 August 2005 10:35, Terry Reedy wrote:

> This sort of intentional obtuseness grates on me too.  Just to let you
> know, this discussion has convinced me to try Dabo, which I knew nothing
> about before.  So your participation has not been useless.  In fact, I
> think I will start with your two-liner below so I can see what I get by
> default and then build from there.

We have two Dabo-specific email lists: Dabo-dev is for following the latest 
and greatest developments in Dabo, including notifications of all commits to 
the repository; Dabo-users is for developers using the framework who have 
questions/problems/comments about Dabo.

http://leafe.com/mailman/listinfo/dabo-dev
http://leafe.com/mailman/listinfo/dabo-users

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


using Pyro for network games

2005-08-01 Thread Michael Rybak
Hi, everyone.
In topic "2-player game, client and server at localhost", I've asked
about subj, and Peter Hansen suggested to switch to Twisted, Pyro or
the like.

I've tried using Pyro.

I've written a very very simple test-game, in which you have 2 balls
controlled by 2 players. Each player moves his mouse somewhere at
his window, and his ball starts moving towards the pointer. No
objectives, just to test how it works. The code is very small, so I
can put it all here, skipping obvious stuff.

I've tried playing this test-game via local-host - all is ok.
Then I've tested via Internet connection with my friend. I have a
33.6 Kbps modem, he has a 2 MBps dedicated line (if this is the term),
and we ran a server at his pc and both connected to it. His ball ran as
a child, smoothly and quickly, while I had about 5 fps :(, and for him
it looked like my ball is simply very slow. I realise that client at
my pc *has* to work slower than the client at server's pc, but hey,
I've played Quake2 and WarCraft 2 via 33.6 modem, and those should have
much more stuff to transfer per second :(

Please help me in any way you can think of. I'd welcome links to
Python games written with Pyro, tips on what I am doing wrong, on not
Pythonically enough - anything.

server.py#
#
[..imports..]
class game__(game_, Pyro.core.ObjBase):
def __init__(self):
#storage for balls' coordinates
game_.__init__(self)
Pyro.core.ObjBase.__init__(self)

[..server initialization..]

daemon.requestLoop()
END#server.py#

client.py#
[..imports..]

[..preparations to create proxy..]
proxy=Pyro.core.getAttrProxyForURI(URI)

[..imports..]

def process_user_input(game, id):#id is client's id - 0 or 1
nx, ny = pygame.mouse.get_pos()
x, y = game.ball[id].get_pos()
dx, dy = nx - x, ny - y
leng = sqrt(dx*dx + dy*dy)
k = 20 / leng
dx *= k
dy *= k
game.move(id, dx, dy) #remote call: move ball


id = proxy.get_n_clients() #which ball to control
if id < 2:
proxy.new_client()

pygame.init()
scr = pygame.display.set_mode((640, 480))

g = game(proxy.get_status(), scr)
#get_status provides 2 pairs of balls's current coordinates
#g, "game" instance, is a local storage, able to render itself

while 1:
g.set_status(proxy.get_status())
g.render()
process_user_input(proxy, id)

time.sleep(0.03)

[..quit = (ESCAPE is pressed)..]
if quit: break

END#client.py#

-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

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


Re[4]: 2-player game, client and server at localhost

2005-08-01 Thread Michael Rybak
Again, thank you very much for your help.

DLB> The server should basically handle the multiple client
DLB> connection logic, and determination of interactions between movable
DLB> objects -- collision detection, for example (and I don't mean in the
DLB> terms of graphics rendering but in terms of object one at current
DLB> movement intersecting object two moving at some other vector).

My problem is: there are about 30 movable objects, so transferring
all their coordinates is much more traffic consuming (about 150 bytes
per transfer) rather than sending only user's motions (10 bytes per
transfer). But on the other hand, sending user's motions between two
non-server-neither-clients means that I needed stricted
synchronization, which means the turn-based approach, as you've said.


DLB> I'm also NOT a game programmer, so I'm not sure how well most of
DLB> them separate screen updates from I/O, but I'd turn the above loop into
DLB> something like:


DLB> create screen thread
DLB> create I/O thread

DLB> {screen thread}
DLB> loop:
DLB> compute/display screen using snapshot of "local status"

DLB> {I/O thread}
DLB> loop
DLB> if keyboard has activity
DLB> read data
DLB> send data to server
DLB> if server has activity
DLB> read data
DLB> update local status

DLB> Note that the keyboard, in this simple example, never affects
DLB> the local (client) display -- only the status sent back by the server is
DLB> used. Okay, you may need to process things like "quit" locally .

Well, this look really elegant, but will need me some time to rewrite
my networking that way. Thank's a lot, I'll let you know when it
works.

[..snip..]

]DLB> The server looks like:

DLB> loop
DLB> if new client connect
DLB> add client to list of clients
DLB> send client current status
DLB> if data from client
DLB> update world state (collision detects, damage, etc.)
DLB> for c in client list
DLB> send current status
DLB> if client disconnect
DLB> remove client from list

consider this part:
DLB> if data from client
DLB> update world state (collision detects, damage, etc.)
DLB> for c in client list
DLB> send current status
the problem is - I should do this not "if data from client", but every
50 milliseconds or so, because objects are still moving when not
affected by users. To give you a better idea of what my game is:

Each player controls a snake, which is 2 to 12 balls connected to each
other with ropes; by mouse motions you move the snake's head, and the
rest of the body moves adhering normal physics. The objective/gameplay
is unimportant here, but if you're curios - all the balls of your
snake are bullets, and right-clicking releases current tail. So, you
have to spin around, and release the tail in appropriate moment so it
reaches your opponent, causing as much damage as much impulse it had.
There are health-pots and other stuff on game field of course.

So, you see - server will have to send current status as much time per
second, as much fps I want, and that's quite a lot of data.

I'd also like to mention (if I haven't already) that I have a 33.6
modem, while the friend I'm testing with has a 2 Mbit dedicated line,
if this is the right term.


I also was advised (by Peter Hansen) to try using Twisted, Pyro os
something like that. I've looked at Pyro, and tried using it, without
a lot of success compared to what I have now. I'm starting a new topic
here, describing my experiment.


DLB> Recall my warning -- I'm not a game programmer; this is just how
DLB> /I'd/ consider implementing something like this.
You're being very helpful anyway :)


DLB> -- 
DLB>  > == <
DLB>  >   [EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG <
DLB>  >  [EMAIL PROTECTED] |   Bestiaria Support Staff   <
DLB>  > == <
DLB>  >   Home Page: <
DLB>  >Overflow Page: <



-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

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


Re: Advanced concurrancy

2005-08-01 Thread Calvin Spealman
On 28 Jul 2005 10:41:54 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Asynchrony is not concurrency.  If you have to turn your code "inside
> out," (that is, if you have to write your code such that the library
> calls your code, rather than vice versa) it's very much *not*
> concurrency: it's just asynchrony.
> 
> While Twisted makes asynchronous code relatively easy to write and
> maintain, it's just not concurrency.  I can't simply drop my
> single-threaded code into it and have it work, like I can with a truly
> concurrent system.
> 
> Jeremy

When you can ever just "simply drop" any single-threaded code into an
enviroment where it is sharing the resources and data with other
executing code simulataniously, it just "have it work", that will be
the day. Unfortunately, in practice, this simply is not how things
work. For code to operate peacefully together, it must be designed to
do so. Even when code is running in seperate processes, they must work
together to share some resources, and that is simply the way of
things. Concurrency can not (and perhaps should not) be an automatic
fix-all pill.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On 1 Aug 2005 07:43:22 -0700, "George Sakkis" <[EMAIL PROTECTED]>
wrote:

>Franz Steinhaeusler wrote:
>
>> Hello NG,
>>
>> I want to retrieve the members of a class
>> with a baseclass.
>> But the problem is, how to get the non derived
>> members.
>>
>> class a:
>> def who(self):
>> print "who"
>> def __init__(self):
>> self._a = 3
>>
>> class b(a):
>> def who1(self):
>> print "who1"
>> def __init__(self):
>> a.__init__(self)
>> self._b = 4
>>
>> y=b()
>>
>> dir (y)
>> ['__doc__', '__init__', '__module__', '_a', '_b', 'who', 'who1']
>>
>>
>> I need a function which lists only the members of
>> the "not derived" class (here class B).
>>
>> _b
>> _who1
>> __init__
>>
>> How can I achieve this?
>> With the introspect module or so?
>
>I believe you can't: Both _a and _b end up in y.__dict__ and there's no
>way to differentiate between the two depending on the time of their
>creation. By the way, these are instance attributes, not class
>attributes, so strictly _b is not a member of B, it's just an instance
>of y. To see why this is the case, check the following valid (though
>highly discouraged) example:
>
>class X:
>def __init__(self, x):
>if isinstance(x,str):
>self._s = x
>else:
>self._n = x
>
>x1 = X("1")
>x2 = X(1)
>
>dir(x1)
>['__doc__', '__init__', '__module__', '_s']
>
>dir(x2)
>['__doc__', '__init__', '__module__', '_n']
>
>
>George

Hello George,

thank you for this information.

This is a pity.

The background:
I want to create a code completition for an editor component.
It should distinguish between inherited and non inherited members.
Reason is, that on wxPython, most classes are derived from wxWindow.
For example if I want Code completition for wx.Frame, 
I always get the 200 or so suggestions,
whereby most times, I'm only interested in the possible completions of
wx.Frame and maybe wx.TopLevelWindow.
-- 
Franz Steinhaeusler
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Operator Overloading

2005-08-01 Thread Calvin Spealman
On 1 Aug 2005 05:12:47 -, Gurpreet Sachdeva
<[EMAIL PROTECTED]> wrote:
>  Hi,
>  
>  Is there any provision in python which allows me to make my own operators?
>  
>  My problem is that I need to combine two dictonaries with their keys and I
> don't want to use any of the existing operators like '+','-','*'.
>  So is there a way I can make '**' or '~' as my operators to add two
> dictonaries? If not which all operators can I overoad?
>  
>  Thanks,
>  Garry

Why do you need to add operators for this? Why not use the
dictionary's update method? it also has the benefit of being much
clearer.

# Get our two dictionaries
d1 = foo()
d2 = bar()
# And merge them into a third
d3 = {}
d3.update(d1)
d3.update(d2)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting not derived members of a class

2005-08-01 Thread Jeff Epler
On 'y', Python has no way of recording where '_a' and '_b' were set, so
you can't tell whether it comes from class 'a' or 'b'.

You can find the attributes that are defined on 'b' only, though, by
using 'b.__dict__.keys()', or 'y.__class__.__dict__.__keys__()'.  This
gives
['__module__', 'who1', '__init__', '__doc__']

If you want to limit yourself to current versions of cpython (because the
bytecode used in cpython is only an implementation detail) and define a 'member
of class a' as one where a.__init__ has a statement like 'self.z = ...', you
can peer into the bytecodes.  Something like this:
from dis import HAVE_ARGUMENT, opname
LOAD_FAST = chr(opname.index('LOAD_FAST'))
STORE_ATTR = chr(opname.index('STORE_ATTR'))
HAVE_ARGUMENT = chr(HAVE_ARGUMENT)

def find(cls):
ns = cls.__dict__
result = ns.keys()
init = ns.get('__init__', None)
if not init: return ns
f = ns['__init__'].func_code.co_code
n = ns['__init__'].func_code.co_names
i = 0
while i < len(f) - 6:
if (f[i] == LOAD_FAST and f[i+1] == f[i+2] == '\0'
and f[i+3] == STORE_ATTR):
j = ord(f[i+4]) + 256 * ord(f[i+5])
result.append(n[j])
i += 6
elif f[i] > HAVE_ARGUMENT:
i += 3
else:
i += 1
return result

>>> import franz
>>> franz.find(y.__class__)
['__module__', 'who1', '__init__', '__doc__', '_b']

Jeff


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

Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Daniel Dittmar wrote:

> To be fair to those slothes: some of them want to write software for a
> commercial setting where they have to install it on other peoples
> machines. So it isn't just getting it to work one one own's machine.
> Using a specifc Python library with external dependencies means also
> installing and *supporting* it on a possible large set of configurations.

I see no problem with that.  Specially since there are lots of ways to share
directories on a network installation.  You install it once and it's done.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: problem using py2exe

2005-08-01 Thread mrman
I ran into the same problem (although 2 years later :-P) I managed to fix
it by copying the dll files and the snack.tcl file from the snacklib
directory to my dist\tcl\tk8.4\ directory.
Then editing the pkgIndex.tcl in the tk8.4 directory and adding the lines
that are present in the pkgIndex.tcl that is in the snacklib directory. If
no pkgIndex.tcl file is present in your tk8.4 dir, just copy the one from
the snacklib dir just like you did the other files. Hope somebody still
sees this as useful information

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


Re: python ETL

2005-08-01 Thread Paul Watson
[EMAIL PROTECTED] wrote:
> Hi,
> My company is involved in the development of many data marts and
> data-warehouses, and I currently looking into migrating our old set of
> tools (written in Korn) to a new, more dynamic and robust one. I am
> looking into python as I have heard that it could be a good contestant
> for the job, and wanted to know if anyone knew of an existing open
> source project which implements ETL using python, or any libraries that
> may ease the production of such tools.
> 
> Thanks.

Robert is right; you have not really given much information.

However, I would have to assume that if homebrew shell scripts have been 
doing the work adequately, then the marts and warehouses are not very 
large and the datasets are primarily text rather than binary.

If this is the case and you are only seeking incremental improvement, 
then Python would be a very good choice.  Perl would also do the job. 
Just about any language would work.  Yes, there are many reasons to 
choose Python.  However, you would have to build any scalability and 
metadata management.

If you seek a radical improvement, it is available, but I do not know of 
any free tools that will do it.  A question like this will probably not 
be answered in a newsgroup post or even the exchange of a few emails.

Choosing an effective tool for the organization is not a trivial 
process.  It requires knowledge of both the tools and the organization's 
methodologies and processes.  If you do not have staff who can do this, 
most companies find it is much cheaper and faster to pay someone who 
does know (a consultant) to assist them in assessing their requirements, 
tool selection, and forming an implementation plan.

Yes, your company staff can learn a lot by experimenting and playing 
with several tools, but shareholders might not view that approach as the 
most effective.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-01 Thread Daniel Dittmar
Jorge Godoy wrote:
> Daniel Dittmar wrote:
> 
> 
>>To be fair to those slothes: some of them want to write software for a
>>commercial setting where they have to install it on other peoples
>>machines. So it isn't just getting it to work one one own's machine.
>>Using a specifc Python library with external dependencies means also
>>installing and *supporting* it on a possible large set of configurations.
> 
> 
> I see no problem with that.  Specially since there are lots of ways to share
> directories on a network installation.  You install it once and it's done.
> 

Some on Windows, some on one Linux, some on another Linux with a newer 
GTK, some want it on their laptops to work on the road ...

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Terry Reedy

"Ed Leafe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> others have pointed out, you didn't compile the wxWidgets part of your
> wxPython install so as to include the stylized text control (yes, it 
> seems
> silly that you should have to specify that, but that's another thread...)
>
> Should we have defensive code for every possible broken installation?

That is an impossibility.  However, there is a middle path between that and 
no defensive code.  In the present case, you appear to acknowledge a known 
easy way to mis-compile wxWidgets from Dabo's viewpoint.  If there is a 
known easy way to detect that misconfiguration (which I suspect there is), 
and it is known that someone has tripped over that problem (which it now 
is), then a nice error message  like 'Sorry, Dabo need wxWidgets compiled 
with the --include_stylized_text option' would certainly be friendlier than 
a stack trace.

The Python docs, while written fairly carefully, are probably not yet free 
of ambiguities.  So when people report them, clarifications are usually 
added.

> We use
> a lot of the Python standard library modules, many dbapi-compliant 
> modules,
> and, of course, wxPython. If someone mis-installs one of the 
> pre-requisites,
> do you expect Dabo to catch that and present you with a diagnostic 
> message?

In a sense, I expect nothing from giftware.  (And I have learned to expect 
less than I think I have a right to from buyware ... but that another 
story.)  But if I were to make a prereq mistake, I would prefer more help 
to less.

If you were to do this, I would suggest you make an errormsgs module with 
the text of all the messages and which defines a flag use_msgs = True. 
Then you could conditionally print a message after catching ImportError 
while letting developer turn them off, if desired, for apps they plan to 
distribute.

> I'm serious here: I want to know what people consider acceptable for a
> software package that relies on other packages.

To me, acceptability depends on the audience.  Do you want to limit Dabo to 
professional developers comfortable with sometimes cryptic traceback 
messages or do you want to include people using Python as part of other 
activities?

Terry J. Reedy



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


Re: Getting not derived members of a class

2005-08-01 Thread Reinhold Birkenfeld
Franz Steinhaeusler wrote:

> The background:
> I want to create a code completition for an editor component.
> It should distinguish between inherited and non inherited members.
> Reason is, that on wxPython, most classes are derived from wxWindow.
> For example if I want Code completition for wx.Frame, 
> I always get the 200 or so suggestions,
> whereby most times, I'm only interested in the possible completions of
> wx.Frame and maybe wx.TopLevelWindow.

You can, of course, always search the base classes and subtract the two sets
(all members)-(members of baseclasses). For example:

cls = wx.Frame

set(dir(cls)) - reduce(set.union, [set(dir(base)) for base in cls.__bases__])

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


Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On Mon, 1 Aug 2005 10:24:53 -0500, Jeff Epler <[EMAIL PROTECTED]>
wrote:

>On 'y', Python has no way of recording where '_a' and '_b' were set, so
>you can't tell whether it comes from class 'a' or 'b'.
>
>You can find the attributes that are defined on 'b' only, though, by
>using 'b.__dict__.keys()', or 'y.__class__.__dict__.__keys__()'.  This
>gives
>['__module__', 'who1', '__init__', '__doc__']
>
>If you want to limit yourself to current versions of cpython (because the
>bytecode used in cpython is only an implementation detail) and define a 'member
>of class a' as one where a.__init__ has a statement like 'self.z = ...', you
>can peer into the bytecodes.  Something like this:
>from dis import HAVE_ARGUMENT, opname
>LOAD_FAST = chr(opname.index('LOAD_FAST'))
>STORE_ATTR = chr(opname.index('STORE_ATTR'))
>HAVE_ARGUMENT = chr(HAVE_ARGUMENT)
>
>def find(cls):
>ns = cls.__dict__
>result = ns.keys()
>init = ns.get('__init__', None)
>if not init: return ns
>f = ns['__init__'].func_code.co_code
>n = ns['__init__'].func_code.co_names
>i = 0
>while i < len(f) - 6:
>if (f[i] == LOAD_FAST and f[i+1] == f[i+2] == '\0'
>and f[i+3] == STORE_ATTR):
>j = ord(f[i+4]) + 256 * ord(f[i+5])
>result.append(n[j])
>i += 6
>elif f[i] > HAVE_ARGUMENT:
>i += 3
>else:
>i += 1
>return result
>
 import franz
 franz.find(y.__class__)
>['__module__', 'who1', '__init__', '__doc__', '_b']
>
>Jeff

Hello Jeff,

thank you for this desciption.

Well, a little complicated, I must read/try this later,
but it looks promising to get the "last derived class" members ;)


Is there any possibility to simply get out
the classes and baseclasses of a class?

somfunc (y) => class A, B (where B is last).

Ok you can prepare a class, but I need to use
the existing wxPython classes.

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 16:21 +0200, Daniel Dittmar wrote:
> Cliff Wells wrote:
> >  But then I'm willing to
> > actually work a little to get what I want.  For other it seems they
> > won't be happy unless you drive to their house and install it for them
> 
> To be fair to those slothes: some of them want to write software for a 
> commercial setting where they have to install it on other peoples 
> machines. So it isn't just getting it to work one one own's machine. 
> Using a specifc Python library with external dependencies means also 
> installing and *supporting* it on a possible large set of configurations.

I can understand this, but from my experience, their concerns are badly
misplaced:  I recently wrote a fairly sizable Python app (~8K LOC) that
utilized several 3rd party python librarys: wxPython, Twisted,
FeedParser, DateUtils and SQLite to name a few off the top of my head
(plus I had to repackage libxml and libxslt on OS/X because 10.3 ships
with broken versions :P). 

It ran on Windows and OS/X (and Linux, but that was never deployed as
the customer wasn't interested).  This was for a *very* large customer
and made it to nearly 10,000 desktops.  Not one complaint had to do with
installation of 3rd party packages.  Why?  Because I *packaged* it for
them.  Most of the effort I put in had little to do with any 3rd party
Python library but rather just the ins and outs of each platform's
packaging tools (and this can be no little pain I assure you).  I will
also note, out of fairness, that the port to OS/X was not as pain-free
as I had hoped (wxPython was fairly new to that platform and I found
more than a few bugs - most of them are resolved now, because I didn't
just give up when I found them, rather I reported them and 
they got fixed!  Who would have thought?!).

In short, these people's complaints reveal only two things: 1) they are
hopelessly pessimistic, whether out of pure laziness, lack of experience
or what I'm unsure and 2) they've never actually tried very hard or
perhaps even at all. Overall that's a recipe for failure in any
endeavor.  As I mentioned earlier, programming is half brains and half
tenacity.  If you lack one or the other, your chances of success are
pretty slim.  The sad thing is that their ability to cling so
tenaciously to such an unqualified position leaves me wondering if it
isn't truly the first quality that they lack.  Given how easy Python
makes things, I'd hate to see how they'd fare with a *real* programming
language .


Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On Mon, 01 Aug 2005 18:02:20 +0200, Reinhold Birkenfeld
<[EMAIL PROTECTED]> wrote:

>Franz Steinhaeusler wrote:
>
>> The background:
>> I want to create a code completition for an editor component.
>> It should distinguish between inherited and non inherited members.
>> Reason is, that on wxPython, most classes are derived from wxWindow.
>> For example if I want Code completition for wx.Frame, 
>> I always get the 200 or so suggestions,
>> whereby most times, I'm only interested in the possible completions of
>> wx.Frame and maybe wx.TopLevelWindow.
>
>You can, of course, always search the base classes and subtract the two sets
>(all members)-(members of baseclasses). For example:
>
>cls = wx.Frame
>
>set(dir(cls)) - reduce(set.union, [set(dir(base)) for base in cls.__bases__])
>
>Reinhold

Hello Reinhold,

yes, cool, thank you very much!

The optimum would be getting also the other base classes, with the
members, but I think, it is asked to much.

'wx.Frame' ... => CreateStatusBar, ...
'wx.TopLevelWindow' ... => GetIcon, ...
'wx.Window' ... => ...
'wx.EvtHandler' => ...

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Ed Leafe
On Monday 01 August 2005 11:56, Terry Reedy wrote:

> That is an impossibility.  However, there is a middle path between that and
> no defensive code.  In the present case, you appear to acknowledge a known
> easy way to mis-compile wxWidgets from Dabo's viewpoint.  If there is a
> known easy way to detect that misconfiguration (which I suspect there is),
> and it is known that someone has tripped over that problem (which it now
> is), then a nice error message  like 'Sorry, Dabo need wxWidgets compiled
> with the --include_stylized_text option' would certainly be friendlier than
> a stack trace.

 OK, that's more of what I had in mind. Truth be told, this is the first time 
we've run into this, and as a result I'll make the change to that import 
statement today.

 We've taken the attitude that when a bug/shortcoming is pointed out, we 
address it. But one problem with that is when you only have a handful of 
people actively using and testing it, you limit your potential for 
discovering problems. If nothing else, this thread has helped by pointing out 
one such shortcoming.  ;-)

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-01 Thread Benji York
Cliff Wells wrote:
> As I mentioned earlier, programming is half brains and half
> tenacity.

+1 QOTY (quote of the year)
--
Benji York


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


Re: namespaces

2005-08-01 Thread Steven D'Aprano
On Sun, 31 Jul 2005 21:03:36 -0700, Paul Rubin wrote:

> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>> Most languages can create self-modifying code. That's not the
>> question. The question is whether developers should write
>> self-modifying code, not whether language designers should prohibit it.
> 
> There was no self-modifying code in that closure example.
> Self-modifying code means something entirely different.  

The example was a function that modified itself to do something different
from what it was doing. Calling it a "closure" is just jargon. As for
closure being "tried and true" in Lisp... well, there is a reason why Lisp
is a niche language, with very little if any use in the commercial world.


-- 
Steven.

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Daniel Dittmar wrote:

>> I see no problem with that.  Specially since there are lots of ways to
>> share
>> directories on a network installation.  You install it once and it's
>> done.
>> 
> 
> Some on Windows, some on one Linux, some on another Linux with a newer
> GTK, some want it on their laptops to work on the road ...

All of the fixed and network accessible are easily solvable (? Is it correct
English?).  Corporative environments should also have an upgrade policy, so
the "new GTK" would just exist after testing has been done and this "new
GTK" is certified for the company's apps.  

For laptops to work on the road there are two options: VPNs and installing
it locally.  How many "laptops to work on the road" there will be compared
to "fixed workstations"?

We can find several problems, almost all of them can be solved with the
admin's creativity.  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: need for speed

2005-08-01 Thread Steven D'Aprano
On Mon, 01 Aug 2005 02:28:36 -0700, [EMAIL PROTECTED] wrote:

> hi everyone
> can someone suggest me where find a lot programming tricks for
> achieving the top speed in python?

There is only one programming trick you need to know about making code run
fast.

Never even waste one second on optimising code before it is working,
or before you have tested it and profiled it and know (1) that it IS slow;
and (2) WHERE it is slow.

Why would you waste your valuable time making bugs run faster? Why waste
time and effort to speed up something that is already fast enough?

In other words: Make your code work. Make it work right. Then, and only
then, make it run fast -- and only if it isn't already fast.

Now that you have written your code, and you have made it work right,
please tell us what the code is, and the results of profiling the code,
and we will help you speed it up.



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


Re: Wheel-reinvention with Python

2005-08-01 Thread Devan L
Ed Leafe wrote:
> On Sunday 31 July 2005 22:39, Paul Rubin wrote:
>
> > > import dabo
> > > app = dabo.dApp()
> > > dApp.start()
> > >
> > >  Sorry, I couldn't do it in 5.  ;-) Oh, and that includes a full menu,
> > > too.
> >
> > I get an ImportError exception when I try that.  Any suggestions?  Note
> > that I don't get that exception from Tkinter.
> > bash-3.00$ python
> > Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
> > [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import dabo
> > Traceback (most recent call last):
> >   File "", line 1, in ?
> > ImportError: No module named dabo
> > >>> import Tkinter
> > >>>
>
>  Oh, c'mon now Paul, now you're trolling. You know exactly what the problem
> is, and try to make it look like a bug.
>
>  Fine: you don't want to use anything that doesn't come standard with Python.
> You've made your point. We get it. There is no need to repeat yourself
> constantly.
>
>  The only point of my post was that for those without your aversion to
> installing useful tools, Dabo provides a ton of functionality. Also, as my
> partner Paul McNett pointed out, I could have done it in *two* lines:
>
> import dabo
> dabo.dApp().start()
>
> ;-)
>
> --
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
If you're creating a new instance of your dApp(I assume its a class)
with no arguments, then effectively your just creating a default
program which is already defined in the dabo module. If you could write
it in a few, short lines of code by defining a new class, then you
might have something there.

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


Re: namespaces

2005-08-01 Thread Cliff Wells
On Tue, 2005-08-02 at 02:37 +1000, Steven D'Aprano wrote:
>  there is a reason why Lisp is a niche language, with very little if any use 
> in the commercial world.

Eric Naggum?

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Is this Pythonic?

2005-08-01 Thread phil hunt

Suppose I'm writing an abstract superclass which will have some 
concrete subclasses. I want to signal in my code that the subclasses 
will implement certan methods. Is this a Pythonic way of doing what 
I have in mind:

class Foo: # abstract superclass
   def bar(self):
  raise Exception, "Implemented by subclass"
   def baz(self):
  raise Exception, "Implemented by subclass"

class Concrete(Foo):
   def bar(self):
  #...actual implemtation...
   def baz(self):
  #...actual implemtation...




-- 
Email: zen19725 at zen dot co dot uk


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


Re: Dabo in 30 seconds?

2005-08-01 Thread Cliff Wells
On Mon, 2005-08-01 at 13:28 -0300, Jorge Godoy wrote:
> 
> We can find several problems, almost all of them can be solved with the
> admin's creativity.  

>>> import creativity
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named creativity
>>>

Nope.  Not included with Python.  Can't be used.

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: Getting not derived members of a class

2005-08-01 Thread George Sakkis
Franz Steinhaeusler wrote:

> Is there any possibility to simply get out
> the classes and baseclasses of a class?
>
> somfunc (y) => class A, B (where B is last).

If you use "new-style" classes, i.e. classes inheriting from object, it
is trivial:

class X(object):
pass

class Y1(X):
pass

class Y2(X):
pass

class Z(Y1,Y2):
pass

>>> z = Z()
>>> z.__class__.__mro__
(, , ,
, )

Old style classes don't have __mro__, so you have to write it yourself;
in any case, writing old style classes in new code is discouraged.

George

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


Re: Is this Pythonic?

2005-08-01 Thread Peter Hansen
phil hunt wrote:
> Suppose I'm writing an abstract superclass which will have some 
> concrete subclasses. I want to signal in my code that the subclasses 
> will implement certan methods. Is this a Pythonic way of doing what 
> I have in mind:
> 
> class Foo: # abstract superclass
>def bar(self):
>   raise Exception, "Implemented by subclass"
>def baz(self):
>   raise Exception, "Implemented by subclass"

Change those to "raise NotImplementedError('blah')" instead and you'll 
be taking the more idiomatic approach.

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


Re: Python IDE's

2005-08-01 Thread projecktzero
VIM or Emacs. I use VIM on Windows, Mac, and VMS. I'd consider it more
of an editor than an IDE, but there are many IDE features available
with plug ins.

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


Re: Is this Pythonic?

2005-08-01 Thread Benji York
phil hunt wrote:
> Suppose I'm writing an abstract superclass which will have some 
> concrete subclasses. I want to signal in my code that the subclasses 
> will implement certan methods. Is this a Pythonic way of doing what 

See http://docs.python.org/lib/module-exceptions.html#l2h-298 
(NotImplementedError)
--
Benji York


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


Re: Dabo in 30 seconds?

2005-08-01 Thread Daniel Dittmar
Cliff Wells wrote:
> I can understand this, but from my experience, their concerns are badly
> misplaced:  I recently wrote a fairly sizable Python app (~8K LOC) that
> utilized several 3rd party python librarys: wxPython, Twisted,
> FeedParser, DateUtils and SQLite to name a few off the top of my head
> (plus I had to repackage libxml and libxslt on OS/X because 10.3 ships
> with broken versions :P). 
> 
> It ran on Windows and OS/X (and Linux, but that was never deployed as
> the customer wasn't interested).  This was for a *very* large customer
> and made it to nearly 10,000 desktops.  Not one complaint had to do with
> installation of 3rd party packages.  Why?  Because I *packaged* it for

Actual success stories like this one are often more convincing than 
general remarks about how any problem is solvable, given enough effort.

> In short, these people's complaints reveal only two things: 1) they are
> hopelessly pessimistic, whether out of pure laziness, lack of experience

It might be very specific experiences. Many people using third party 
controls with Visual Basic got burned.

> endeavor.  As I mentioned earlier, programming is half brains and half
> tenacity.  

I'd add a bit of gambling, because often, you don't have enough 
information. Telling what works from your experience adds useful 
information so that the brain can decide where to invest the tenacity.

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


Re[2]: need for speed

2005-08-01 Thread Michael Rybak
SDA> On Mon, 01 Aug 2005 02:28:36 -0700, [EMAIL PROTECTED] wrote:

>> hi everyone
>> can someone suggest me where find a lot programming tricks for
>> achieving the top speed in python?

SDA> There is only one programming trick you need to know about making code run
SDA> fast.

SDA> Never even waste one second on optimising code before it is working,
SDA> or before you have tested it and profiled it and know (1) that it IS slow;
SDA> and (2) WHERE it is slow.

SDA> Why would you waste your valuable time making bugs run faster? Why waste
SDA> time and effort to speed up something that is already fast enough?

SDA> In other words: Make your code work. Make it work right. Then, and only
SDA> then, make it run fast -- and only if it isn't already fast.

SDA> Now that you have written your code, and you have made it work right,
SDA> please tell us what the code is, and the results of profiling the code,
SDA> and we will help you speed it up.


Is there a way of profiling other than manual (debug output with
measurements and all)? Some tools? And is there some kind of plugin
for native Python's IDLE to trace scripts? I'm a bit tired of getting
all info from debug output and exceptions

SDA> -- 
SDA> Steven



-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Cliff Wells wrote:

> On Mon, 2005-08-01 at 13:28 -0300, Jorge Godoy wrote:
>> 
>> We can find several problems, almost all of them can be solved with the
>> admin's creativity.
> 
 import creativity
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: No module named creativity

> 
> Nope.  Not included with Python.  Can't be used.

You haven't installed the package 'admin'. ;-)  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Getting not derived members of a class

2005-08-01 Thread Brian Beck
George Sakkis wrote:
z = Z()
z.__class__.__mro__
> 
> (, , ,
> , )
> 
> Old style classes don't have __mro__, so you have to write it yourself;
> in any case, writing old style classes in new code is discouraged.

Notice also that George's __mro__ solution returns the bases in reverse 
order than what you requested (in your example, you said B should come 
last). So use list(reversed(z.__class__.__mro__)) or 
z.__class__.__mro__[::-1]

-- 
Brian Beck
Adventurer of the First Order
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple inheritance super()

2005-08-01 Thread Steven Bethard
Michele Simionato wrote:
> I have found out that the more I use OOP, the less I
> use inheritance"
> 
> Just curious if others had a similar experience.

Definitely.  Though I think that's partly because I came from a Java 
background where it's a little more ingrained.  Since Python relies 
heavily on duck-typing, a lot of cases where I would subclass in Java I 
don't in Python.  In Python, I pretty much only create an inheritance 
hierarchy when I discover that two independent classes are sharing the 
same code.

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


Re: Listing Processes Running on Remote Machines

2005-08-01 Thread yoda
Thanks. I'll definitely look into it. I actually got distracted while
investigating Pyro(http://pyro.sourceforge.net/) to see if I could
achieve the same results... It seems like a lighter weight more
accessible solution than STAF (at least for my immediate needs)..

I'll update you with my progress...

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


  1   2   3   >