Pydev and Pydev Extensions 1.0.6 release

2006-04-25 Thread Fabio Zadrozny
Hi All,

Pydev and Pydev Extensions 1.0.6 have been released

Check http://www.fabioz.com/pydev for details on Pydev Extensions

and http://pydev.sf.net for details on Pydev

Release Highlights in Pydev Extensions:
-

- New Feature: Show hierarchy (F4) -- Still in a beta state (currently only looks for subclasses on the same project).
- Analysis happens in a Thread, so, you should now always have the
latest parse without any halts (this happened only when the option was
set to analyze only on save).
- Class variable marked as error when self ommitted
- when an undefined import is found within a try..except ImportError, it will not be reported.
- Allow changing the keybinding for activating the Interactive Console (Ctrl+Enter)
- Added a simple text-search that looks for in all .py and .pyw files
(will be improved in the future to make a real python-like search).
- The keywords that match the 'simple' keywords completion do not show up.


Release Highlights in Pydev:
--

- Assign variables to attributes (Ctrl+2+a): Contributed by Joel
Hedlund (this is the first contribution using the new jython scripting
engine).
- 3 minor 'quirks' were fixed in the indentation engine
- The debugger had some changes (so, if you had halts with it, please try it again).
- Allow changing the keybinding for activating the Find next problem (Ctrl+.)
- The debugger step-return had its behaviour changed.
- Additional scripts location added to pythonpath in the jython scripting engine
- Transversal of nested references improved
- Fixed problems with compiled modules when they had 'nested' module structures (e.g.: wx.glcanvas)

What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python and
Jython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

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

Pydev Extensions
http://www.fabioz.com/pydev

Pydev - Python Development Enviroment for Eclipse
http://pydev.sf.net
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: PyScript 0.6.0 released

2006-04-25 Thread cochrane
Overview:

  PyScript is a python module for producing high quality postscript 
  graphics. Rather than use a GUI to draw a picture, the picture is 
  programmed using python and the PyScript objects.
  
  Some of the key features are:
  * All scripting is done in python, which is a high level, easy to 
learn, well developed scripting language.
  * All the objects can be translated, scaled, rotated, ... in fact
any affine transformation.
  * Plain text is automatically kerned.
  * You can place arbitrary LaTeX expressions on your figures.
  * You can create your own figure objects, and develop a library of 
figure primitives.
  * Output is publication quality.

License: 

  Released under the GPL

Changes:

  The major change in this release is a complete rewrite of the Talk and
  Poster classes of the presentation library.  There have also been 
  many bug fixes and minor other improvements.  For details see the 
  PyScript web page: 
  a href=http://pyscript.sourceforge.net;pyscript.sourceforge.net/a.

Getting the software:

  One can download the latest version (0.6) from:
  a href=http://pyscript.sourceforge.net;PyScript/a

Requirements:

  * Python 2.2 and above
  * An up-to-date LaTeX distribution

Authors:

  * Alexei Gilchrist [EMAIL PROTECTED]
  * Paul Cochrane [EMAIL PROTECTED]

  If you use this software, have any suggestions, or bug reports, please let
  us know!

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


REMINDER: BayPIGgies: April 26, 7:30pm (Google)

2006-04-25 Thread Aahz
NOTE: Special date of WEDNESDAY April 26 at Google, usual time of 7:30pm

Please show up by 7:15 so we can start the meeting on time!

This does not change the usual May meeting on May 11 at Google; stay
tuned for an announcement of that.


Special meeting!  One of the lead developers of Django is in town!  Jacob
Kaplan-Moss will be talking about Django at Google.  He says he'll be
fine-tuning the talk until the last minute but plans to cover:

* How Django came into being -- a bit about the Journal-World, the
problems that Django was designed to solve, some bits about its
evolution, and a glance at how *we* use Django today.

* What writing Django apps look -- I'll show off some real code and
talk about each of the bits of Django's stack.  This'll be the bulk
of the talk.

* What's in store for the future of Django -- there's some awesome
community work going on, as well as some under-the-radar stuff we're
working on that I'll try to preview or at least talk about.


BayPIGgies meetings alternate between IronPort (San Bruno, California)
and Google (Mountain View, California).  For more information and
directions, see http://baypiggies.net/


Before the meeting, we sometimes meet at 6pm for dinner.  Discussion of
dinner plans is handled on the BayPIGgies mailing list.  

Advance notice:  We have speakers for May.  We are currently setting up
the schedule for the rest of the year.  Please e-mail
[EMAIL PROTECTED] if you want to suggest an agenda (or volunteer to
give a presentation).
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

Argue for your limitations, and sure enough they're yours.  --Richard Bach
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANNOUNCE: kiwi 1.9.8

2006-04-25 Thread Johan Dahlin
New in this released is API documentation which is generated using
epydoc[3]. It's still being written but at this point I feel that
it's good enough to be a very useful resource to help understand
kiwi. Kiwi is a PyGTK framework for building graphical applications loosely
based on MVC Model-View-Controller (MVC) and Allen Holub's Visual proxy
[1]. Think of Kiwi as a high-level, object-oriented layer built on
PyGTK.

Its design is based on real-world experience using PyGTK to develop
large desktop applications, which use many concepts common to most
graphical applications: multiple windows and dialogs, forms, data
persistence, lists and high-level classes that support domain objects
directly.


Download


Grab the latest sources from:

  http://www.async.com.br/projects/kiwi/download/kiwi-1.9.8.tar.gz


What's new since 1.9.7?
===

- distutils.setup() replacement
- date tests
- FileChooser  FileChooserButton
- Rename all proxy widgets to start with Proxy
- Win32 installation fixes
- UI test threading fixes
- Sizegroup merging (Ronaldo)
- Mask improvements (Ronaldo)
- ObjectList improvements (Johan, Ronaldo, Patrick)
- Lots of bug fixes (Johan, Ronaldo, Sidnei)


Features


* An MVC-derived framework of classes:
  * Views, which represent the graphical display
  * Controllers, which handles user interaction with the widgets
in a View.
  * Delegates, combines a View and a Controller.
  * Models, which are special mixins for your domain objects
  * Proxies, special types of Delegate designed to implement forms

* Validation: Kiwi supports validation on different levels:
  data type validation and verification on the Model/Proxy level,
  View validation and hooks for visually displaying validation state.

* ObjectList widget, which provides a higher level abstraction of
  GtkTreeView and all its classes (GtkTreeModel, GtkTreeViewColumn,
  GtkCellRenderer) with hooks to easily integrate into the
  Kiwi Framework.

* Mask suport: You can set a mask on entries to force the input to
  follow a certain standard, such as zip code, social security, ip address

* Gazpacho integration for most (non-deprecated) interactive
  widgets with attributes for handling validation and proxy
  attributes.

* UI Test framework
  Features a recorder and a player. The recorder allows you to record
  different tasks, a script will be saved which will reproduce the
  actions you made in the interface.

* Kiwi Tasklets
  Tasklet is a small coroutines framework written by Gustavo Carneiro,
  it was previously known as gtasklets.

* PyGTK utilities, to make it easier to add signals and properties to
  your objects.

* i18n translation utilities, to help you translate PyGTK applications,
  currently depends on gettext and intltool.

* and many other things!


Requirements


Python 2.3 or higher (2.4 recommended)  http://www.python.org/
PyGTK 2.6.0 or higher (2.8 recommended) http://www.pygtk.org/
gazpacho 0.6.5 (svn recommenced)http://gazpacho.sicem.biz/


Documentation
=
Kiwi provides API documentation generated by epydoc, it can be found at

 http://www.async.com.br/projects/kiwi/api/

Included in the tarball are also a number of examples, which serves as a
good starting point. Keep in mind that most of them require gazpacho to
be installed.


Thanks
==
Christian Robottom Reis: Original author and design
Lorenzo Gil Sanchez: PyGTK 2.x port

Also thanks to the following people which has contributed features
or bug reports:
Ali Afshar, Henrique Romano, Daniel Saran R. da Cunha, Evandro Vale
Miquelito, Gustavo Barbieri, Gustavo Carneiro, Sidnei da Silva
Patrick O'Brien, Ronaldo Maia

Resources
=

Homepage http://www.async.com.br/projects/kiwi/
Download http://www.async.com.br/projects/kiwi/download/
Repository   http://svn.async.com.br/cgi-bin/viewcvs.cgi/kiwi/
Report a bug http://bugs.async.com.br/enter_bug.cgi?product=Kiwi
API docs http://www.async.com.br/projects/kiwi/api/
Open bugshttp://tinyurl.com/cyrms
Mail. list   http://www.async.com.br/mailman/listinfo/kiwi/

[1] http://en.wikipedia.org/wiki/Model-view-controller
[2] http://tinyurl.com/2ccch
[3] http://epydoc.sourceforge.net/

-- 
Johan Dahlin [EMAIL PROTECTED]
Async Open Source





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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


released: RPyC 2.50A

2006-04-25 Thread tomerfiliba
Remote Python Call (RPyC) version 2.50-final is about to be released in
the week or so.
meanwhile, a release candidate (2.50A) has been released to public
review -- please report bugs. i'm still working on real unit-tests for
the library, but i'm sure users can help uncover more bugs.


http://rpyc.wikispaces.com



-tomer

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


ANN: uuid-0.3.1 released

2006-04-25 Thread Jürgen Urner
Happy to announce the release of uuid-0.3.1 (bugfix release)

What is uuid?

uuid is a python module to create RFC 4122 compatible UUIDs
The module supports generation off RFC 4122 compatible time based,
random, sha1
and md5 based UUIDs

Whats new?

x. fixed a bug where a call to uuid_nd5() and uuid_sha1() could
lead to infinite recursion

For download and documentation see http://home.arcor.de/jurner/python/

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: Instruction at 0x00FC3D70 use memory address 0x00000000. Can't be read.

2006-04-25 Thread Jay Parlar

On Apr 24, 2006, at 5:38 PM, Neil Adams wrote:

 How do Ifix memory  message Ox033fc512 at Ox can't be read


You're going to have to provide a LOT more information if you expect 
anyone here to help you with that. What program caused that? For all we 
know, notepad.exe could have crashed and caused that error.

You have to tell us what program (I'm assuming Python, but who knows, 
maybe you sent the message to the wrong list), what your OS is, what 
you were doing, what *exactly* happened, etc. etc. Then maybe someone 
can provide some insight.

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


Re: PyLint results?

2006-04-25 Thread Alexandre Fayolle

Others have answered most of your questions, I won't repeat the answers
here, but only join the choir to stress that pylint needs tuning to
your coding style. An obvious case is camelCaseMethodNames versus
underscored_method_names, but there are also a lot of issues. The
default pylint settings match Logilab's coding standards. The coding
metrics were heavily inspired by Steve McConnell's Code Complete book,
but the figures provided therein have been heavily downscaled to match
for Python's expressivity (Code Complete deals mostly with C/C++/Java
code). 

Le 21-04-2006, Michael [EMAIL PROTECTED] nous disait:

 2) C:  0: Missing required attribute __revision__
What is this? Is that for CVS? I don't use CVS (we use SVN). I have not
seen any sample code which includes this tag yet. But if I include
__revision 1.0  somewhere in the code it will remove that warning?


We generally have a 
__revision__ = '$Id$' 

statement at module top level, which gets replaced a check in time by
CVS, which makes it easy to know who checked in the HEAD revision of the
module. This behaviour can be emulated with subversion properties. 



 5) R:547:readDiscreteData: Too many branches (28/12)
Python doesn't have the switch/case statements that C/C++ have. So I
could have a large block if/elif/else statements.
Is there any way to avoid that?

 6) R:722:waitDiscretes: Too many local variables (38/15)
That's new to me. What is wrong with too many local variables?
Can anything be done to improve that besides having too many globals?

For these two, I strongly recommend giving a look at Martin Fowler's
Refactoring book (published by Addison Wesley). These are typical so
called code smells which can be solved using for instance the Extract
Method refactoring.

Of course, it all depends on the kind of program you are working, and
sometimes using intermediate variables helps understanding the code (by
providing useful names, for instance). What pylint tells you is there
could be an issue here, you should check.


-- 
Alexandre Fayolle  LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MinGW and Python

2006-04-25 Thread Brian Elmegaard
Robert Kern [EMAIL PROTECTED] writes:

 the gcc project is to provide a portable compiler, not one that
 generates the best code for any given platform. And in that goal, it
 succeeds remarkably well.

Will a python program be slower on the same machine running windows
compared to linux?

What I don't understand is that it is not possible to distribute a
python compiled with gcc for windows. The main reason I saw in this
thread is that python uses mfc. So python requires api access, I
guess. 

Once I asked about distutils here. The answer was that I had access to
the source so I could just extend it. After messing around I found I
couldn't because I don't have msvc.
-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The whitespaceless frontend

2006-04-25 Thread Stelios Xanthakis
Hi,

[EMAIL PROTECTED] wrote:

 but maybe instead of the global.name something to refer to the upper
 namespace (that can be the global one or the namespace of the function
 that contains this one) can be more general:
 upper.x = 1
 upper.upper.x = 1
 

Well, people have been trying to come up with a way to solve the nested
scopes restrictions.  This may work, but in my opinion nested functions
are not so important and I wouldn't spend any time to improve them.
Usually you can do anything with classes (and method makes that 
easier). If we say that closures were invented so that we will avoid
the extra typing in cases like

def f (self):
x = lambda self=self: return self.foo ()

and beyond that perhaps it is a sign that we should rethink our
design we can accept the limitations of python's closures.


 I think that making self a reserved word that can be used only for its
 usual purpose can be positive.
 

I agree. EPL does not have shoot-self-in-the-foot protections yet,
but it will :)

 The $ and method statement seem interesting too, but the first is a
 little perlish (but Ruby has something similar, and people like it),
 and the method statement look a little redundant. I think the $ can be
 acceptable (Mostly to reduce typing), even if it doesn't look very
 nice.


'$' is perlish and rubyish (and I got it from ruby indeed).
It's the cost of a dynamic language :)
In static languages we know at compile-time whether a symbol is local,
instance or global. In dynamic languages where scopes are modified when
the program runs we have to type something. '$' being unused seems like
a good choice.

method is good not only because we avoid the extra typing in the
definition, but also because -after experiments- it seems that
restricting the use of $ in methods, will simplify some confusing
cases.  For example, what happens in:

 def foo (cls):
 def bar (self):
 return $x # what's that? cls.x or self.x?

While now, when you see $ you know it refers to the instance of the
method.  And nested methods in methods are very rare.

Bye,
Stelios

- sorry for the delayed reply. Unexpected easter vacation.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Martin v. Löwis
Robert Kern wrote:
 Oh, that's right, you need an import library for Python24.dll .
 That shouldn't be a problem: that library is included with Python.
 
 For mingw, too? I.e. a .a not a .lib?

Right.

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


Re: MinGW and Python

2006-04-25 Thread Martin v. Löwis
Brian Elmegaard wrote:
 What I don't understand is that it is not possible to distribute a
 python compiled with gcc for windows. The main reason I saw in this
 thread is that python uses mfc. So python requires api access, I
 guess. 

You misunderstood. Python does not use MFC. PythonWin (for example)
does. That has a lot of implications which are hard to understand
if you are not familiar with Windows programming and the C library
mess on Windows.

It would certainly be possible to distribute a gcc-compiled python.
However, what is the point in doing so? Cygwin already includes
a gcc-compiled Python, for Windows:

http://cygwin.com/packages/python/

 Once I asked about distutils here. The answer was that I had access to
 the source so I could just extend it. After messing around I found I
 couldn't because I don't have msvc.

That is simply not true. You can build the entire Python interpreter
with Cygwin (but you don't need to, because there is a precompiled
version), and you can build extensions for the python.org binary
using MingW.

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


Re: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Robert Kern
Martin v. Löwis wrote:
 Robert Kern wrote:
 
Oh, that's right, you need an import library for Python24.dll .

That shouldn't be a problem: that library is included with Python.

For mingw, too? I.e. a .a not a .lib?
 
 Right.

Woohoo!

-- 
Robert Kern
[EMAIL PROTECTED]

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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

Re: MinGW and Python

2006-04-25 Thread Robert Kern
Brian Elmegaard wrote:
 Robert Kern [EMAIL PROTECTED] writes:
 
the gcc project is to provide a portable compiler, not one that
generates the best code for any given platform. And in that goal, it
succeeds remarkably well.
 
 Will a python program be slower on the same machine running windows
 compared to linux?

Dunno. Depends on the machine. Depends on the program. Depends on how the
interpreter and any extension modules and underlying libraries were built.
Depends on which Linux and which Windows.

I'm sorry, but your question is a non sequitur. I don't understand its relevance
to this thread.

 What I don't understand is that it is not possible to distribute a
 python compiled with gcc for windows. The main reason I saw in this
 thread is that python uses mfc. So python requires api access, I
 guess. 

It is possible. People have done it.

  http://jove.prohosting.com/iwave/ipython/pyMinGW.html

 Once I asked about distutils here.

Okay. Again, what's the relevance here?

 The answer was that I had access to
 the source so I could just extend it. After messing around I found I
 couldn't because I don't have msvc.

I'm not sure why this matters since distutils is pure Python.

If you meant writing extension modules for Python instead of extending
distutils, then you're in luck! You can indeed build extension modules with
mingw for the standard Python distribution. Please see my post in the thread MS
VC++ Toolkit 2003, where?.

-- 
Robert Kern
[EMAIL PROTECTED]

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: Probability Problem

2006-04-25 Thread Elliot Temple
I think I got it. I noticed my code is essentially the same as Tim  
Peter's (plus the part of the problem he skipped). I read his code 20  
minutes before recreating mine from Alex's hints. Thanks!

def main():
 ways = ways_to_roll()
 total_ways = float(101**10)
 running_total = 0
 for i in range(1000-390+1):
 j = i + 390
 running_total += ways[i] * ways[j]
 print running_total / total_ways**2
 print ways[:10]

def ways_to_roll():
 result = [1]
 for i in xrange(10):
 result = combine([1] * 101, result)
 return result

def combine(a, b):
 results = [0] * (len(a) + len(b) - 1)
 for i, ele in enumerate(a):
 for j, ele2 in enumerate(b):
 results[i+j] += ele * ele2
 return results

main()
# output: 3.21962542309e-05 and
# [1, 10, 55, 220, 715, 2002, 5005, 11440, 24310, 48620]
# 3.21962542309e-05 is 32 out of a million



On Apr 24, 2006, at 9:14 PM, Alex Martelli wrote:

 Elliot Temple [EMAIL PROTECTED] wrote:

 On Apr 24, 2006, at 8:24 PM, Alex Martelli wrote:

 Lawrence D'Oliveiro [EMAIL PROTECTED] wrote:

 In article [EMAIL PROTECTED],
  Elliot Temple [EMAIL PROTECTED] wrote:

 Problem: Randomly generate 10 integers from 0-100 inclusive,  
 and sum
 them. Do that twice. What is the probability the two sums are 390
 apart?

 I think the sum would come close to a normal distribution.

 Yes, very close indeed, by the law of large numbers.

 However, very close (in a math course at least) doesn't get the  
 cigar.

 You can compute the requested answer exactly with no random number
 generation whatsoever: compute the probability of each result from
 0 to
 1000, then sum the probabilities of entries that are exactly 390
 apart.

 That was the plan, but how do I get the probability of any given
 result? (in a reasonable amount of time)

 BTW I'm not in a math course, just curious.

 OK, I'll trust that last assertion (sorry for the hesitation, but it's
 all too easy to ``help'' somebody with a homework assignment and
 actually end up damaging them by doing it FOR them!-).


 I'm still going to present this in a way that stimulates thought,  
 rather
 than a solved problem -- humor me...!-)


 You're generating a uniformly distributed random number in 0..100 (101
 possibilities), 10 times, and summing the 10 results.

 How do you get a result of 0?  Only 1 way: 0 at each attempt --
 probability 1 (out of 1010 possibilities).

 How do you get a result of 1?  10 ways: 1 at one attempt and 0 at each
 of the others - probability 10 (again in 1010'ths;-).

 How do you get a result of 2?  10 ways for '2 at one attempt and 0 at
 each of the others', plus, 10*9/2 ways for '1 at two attempts and 0 at
 each of the others' -- probability 55 (ditto).

 ...and so forth, but you'd rather not work it out...


 So, suppose you start with a matrix of 101 x 10 entries, each of  
 value 1
 since all results are equiprobable (or, 1/1010.0 if you prefer;-).

 You want to compute the number in which you can combine two rows.  How
 could you combine the first two rows (each of 101 1's) to make a  
 row of
 201 numbers corresponding to the probabilities of the sum of two  
 throws?

 Suppose you combine the first entry of the first row with each  
 entry of
 the second, then the second entry of the first row with each entry of
 the second, etc; each time, you get a sum (of two rolls) which  
 gives you
 an index of a entry (in an accumulator row starting at all zeros) to
 increment by the product of the entries you're considering...


 Can you generalize that?  Or, do you need more hints?  Just ask!


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


-- Elliot Temple
http://www.curi.us/blog/



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


Re: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Fredrik Lundh
Robert Kern wrote:

 Martin v. Löwis wrote:
  Robert Kern wrote:
 
 Oh, that's right, you need an import library for Python24.dll .
 
  That shouldn't be a problem: that library is included with Python.

 For mingw, too? I.e. a .a not a .lib?

last time I tinkered with mingw, it could link directly against the DLL
file.  see the last two minutes in mingw from scratch in 20 minutes
post:

http://article.gmane.org/gmane.comp.python.general/388046

the MinGW FAQ says that you can use reimp in cases like this:

http://www.mingw.org/mingwfaq.shtml#faq-msvcdll

but that didn't seem to be necessary (I assume reimp or something
is now integrated in mingw, or maybe I have a magic computer...)

however, note that the FAQ entry says that you can use an existing
LIB file as well, so Python's standard import library should work.

/F



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

Re: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Ron Adam
Alex Martelli wrote:
 Ron Adam [EMAIL PROTECTED] wrote:
...
 I still get the following with the tinyurl link:

 ~~~
 The download you requested is unavailable. If you continue to see this
 message when trying to access this download, go to the Search for a 
 Download area on the Download Center home page.
 ~~~


 Pasting the above tinyurl into firefox results in the following link.

 http://www.microsoft.com/downloads/details.aspx?familyid=272BE09D-40BB-4d
 isplaylang=en

 Which appears to still be truncated. :-/
 
 True, but here's the kicker: using the full URL, which I just dblchecked
 from Rushby's original message as being (enclosing in ...)...:

Yes, I tried the full url also, but was hoping I did something wrong. 
Sigh... guess not.

 http://www.microsoft.com/downloads/details.aspx?FamilyId=272BE09D-40BB-
 49FD-9CB0-4BFA122FA91Bdisplaylang=en
 
 NOW gives me the same error page too.  When Rushby suggested it
 yesterday I immediately used it, and it allowed me to download the
 Toolkit 2003 just fine -- so, I guess Microsoft must have killed that
 possibility shortly thereafter (who said they can't move fast?-).
 
 As of now, I don't know any more of a URL that's usable to download
 this, therefore:-(

And with a new version of windows due at the end of this year, it's 
likely those who upgrade to Vista, will also need to upgrade to visual 
studio 2005 or later.

I've seen this pattern before.  :-/

Ron

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


Re: python application ideas.

2006-04-25 Thread Tim Parkin
Anthony Greene wrote:
 Hello, I know this isn't really a python centric question, but I'm seeking
 help from my fellow python programmers. I've been learning python for the
 past year and a half, and I still haven't written anything substantial nor
 have I found an existing project which blows my hair back. Python is my
 first language, and I plan on learning lisp within the next week but
 before I do so I'd like to write something meaningful, does anyone have
 any suggestions? Something they always needed, but never got around to
 writing it? Without an imagination you pretty much stagnate your whole
 learning process. Thanks in advance.
 

How about writing a standalone wiki markup parser? I know a *lot* of
people who would find this useful..

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


Re: MinGW and Python

2006-04-25 Thread Fredrik Lundh
Brian Elmegaard wrote

  the gcc project is to provide a portable compiler, not one that
  generates the best code for any given platform. And in that goal, it
  succeeds remarkably well.

 Will a python program be slower on the same machine running windows
 compared to linux?

a better optimizer usually results in programs that run faster, not slower.

/F



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


Re: Why new Python 2.5 feature class C() return old-style class ?

2006-04-25 Thread Bengt Richter
On Sun, 23 Apr 2006 22:12:01 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
[...]
(IMO the proper way to indicate the you don't have a tuple is to use None or 
some other sentinel,
not abuse a perfectly legal tuple value).

  dis.dis(compile('class X:pass','','exec'))
   1   0 LOAD_CONST   0 ('X')   --+-- ought to be 
 LOAD_CONST 0 (None)
Oops, leave the 'X' of course, just replace the next line
   3 BUILD_TUPLE  0 --'
   6 LOAD_CONST   1 (code object X at 02EE7EA0, file 
 , line 1)
   9 MAKE_FUNCTION0
  12 CALL_FUNCTION0
  15 BUILD_CLASS
  16 STORE_NAME   0 (X)
  19 LOAD_CONST   2 (None)
  22 RETURN_VALUE

vs code for class x(something):pass

  dis.dis(compile('class X(object):pass','','exec'))
   1   0 LOAD_CONST   0 ('X')
   3 LOAD_NAME0 (object)
   6 BUILD_TUPLE  1
   9 LOAD_CONST   1 (code object X at 02EFB9A0, file 
 , line 1)
  12 MAKE_FUNCTION0
  15 CALL_FUNCTION0
  18 BUILD_CLASS
  19 STORE_NAME   1 (X)
  22 LOAD_CONST   2 (None)
  25 RETURN_VALUE


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


A QFB agent: how to catch C-level crashes and last Python stack ?

2006-04-25 Thread robert
When employing complex UI libs (wx, win32ui, ..) and other extension 
libs, nice only Python stack traces remain a myth.

Currently I'm hunting again a rare C-level crash bug of a Python based 
Windows app with rare user reports - and still in the dark (I get 
snippets of machine stack traces / screenshots with random mem. access 
error / python caused the runtime to terminate in an unusual way / ..)

I'd like to hook a kind of quality feedback agent a C-level to enable 
the user transfer a report (similar to what Mozilla/Netscape has), e.g. 
in a changed python.exe stub. Next to the machine stack/regs it should 
grab the relevant last Python thread stack(s), if any, and maybe other 
useful status and python global vars.
(There are also Python threads going on. )

Is that possible?

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


Re: MS VC++ Toolkit 2003, where?

2006-04-25 Thread Edward Elliott
Alex Martelli wrote:
 OK, I've placed on http://www.aleax.it/Python/ the files that pybench
 writes (with the -file option) for each machines, the names are
 onmbp.txt and onwin2k.txt -- just 20k each (I'm not sure their format is
 documented, but I guess that, worst case, one just needs to study
 pybench's sources).

Nice, thank you.  The files just contain pickled data, but you need pybench
installed to unpickle the classes.  I used the command
  pybench -s win2k.txt -c osx.txt
to compare the data sets.  Here are the results.  Left two columns are
Windows times, right column is change from OS X time.  I resorted the tests
by percentage change (win2k slowest-fastest) to provide a better picture
of what's going on:

PYBENCH 1.0
Benchmark: /home/ed/python-w2k.txt (rounds=10, warp=20)
measured against: /home/ed/python-osx.txt (rounds=10, warp=20)
Tests:  per runper oper.diff

(slower on win2k)
StringMappings: 309.33 ms2.46 us  +112.53%
 ConcatUnicode: 157.47 ms1.05 us   +77.43%
 ConcatStrings: 103.57 ms0.69 us   +44.86%
 DictWithFloatKeys: 169.10 ms0.28 us   +21.52%
 UnicodeProperties:  86.00 ms0.43 us+6.69%
   PythonFunctionCalls:  85.83 ms0.52 us+1.22%
UnicodeSlicing:  85.64 ms0.49 us+0.16%
(faster on win2k)
IfThenElse:  70.38 ms0.10 us-2.45%
SmallLists:  76.98 ms0.30 us-4.44%
CompareUnicode:  85.22 ms0.23 us-4.72%
  StringPredicates:  87.25 ms0.31 us-6.13%
NestedForLoops:  38.47 ms0.11 us-8.07%
CompareInternedStrings:  59.12 ms0.12 us-8.12%
SimpleListManipulation:  41.93 ms0.16 us-8.55%
   CreateStringsWithConcat:  35.02 ms0.18 us-9.16%
TryRaiseExcept:  49.62 ms3.31 us-9.53%
 StringSlicing:  63.61 ms0.36 us-9.77%
   SmallTuples:  68.65 ms0.29 us   -12.77%
 CompareFloatsIntegers:  72.31 ms0.16 us   -13.72%
 Recursion:  45.88 ms3.67 us   -16.20%
 CompareFloats:  51.26 ms0.11 us   -17.05%
CompareStrings:  76.14 ms0.15 us   -17.51%
 PythonMethodCalls:  60.74 ms0.81 us   -17.75%
   CreateUnicodeWithConcat:  90.22 ms0.45 us   -17.76%
  BuiltinFunctionCalls:  39.38 ms0.31 us   -17.79%
 SimpleFloatArithmetic:  57.72 ms0.10 us   -19.44%
  SecondImport:  29.59 ms1.18 us   -19.71%
   CreateInstances:  63.02 ms1.50 us   -21.08%
  SimpleIntFloatArithmetic:  55.92 ms0.08 us   -21.78%
   SimpleComplexArithmetic:  42.40 ms0.19 us   -22.84%
   BuiltinMethodLookup:  78.26 ms0.15 us   -24.54%
 UnicodePredicates:  56.17 ms0.25 us   -24.75%
  SpecialInstanceAttribute: 117.49 ms0.20 us   -24.97%
DictWithStringKeys:  62.30 ms0.10 us   -26.18%
  TupleSlicing:  73.63 ms0.70 us   -26.34%
   NormalInstanceAttribute:  65.19 ms0.11 us   -26.50%
   UnicodeMappings:  65.20 ms3.62 us   -27.68%
   SecondPackageImport:  31.25 ms1.25 us   -28.74%
 SpecialClassAttribute:  65.94 ms0.11 us   -30.30%
   ListSlicing:  50.75 ms   14.50 us   -31.37%
 SecondSubmoduleImport:  39.39 ms1.58 us   -31.98%
SimpleDictManipulation:  37.88 ms0.13 us   -32.24%
  NormalClassAttribute:  66.37 ms0.11 us   -33.40%
  DictCreation:  36.66 ms0.24 us   -34.25%
   DictWithIntegerKeys:  54.73 ms0.09 us   -35.76%
  SimpleLongArithmetic:  27.03 ms0.16 us   -39.80%
 TryExcept:  62.54 ms0.04 us   -42.17%
   SimpleIntegerArithmetic:  42.88 ms0.06 us   -42.52%
   CompareIntegers:  42.81 ms0.05 us   -45.54%
  ForLoops:  25.72 ms2.57 us   -53.99%
  CompareLongs:  25.45 ms0.06 us   -63.04%

Average round time:3847.99 ms  -12.61%


None of these tests look to me like anything virtualization would affect. 
Beyond that, I'm not sure what to make of it.  The fastest gains on win2k
(39%) seem to come from branching and arithmetic tests.  Maybe the ms
compiler has significantly better branch prediction (might explain why
ForLoops and TryExcept have such large gains while NestedForLoops and
TryRaiseExcept are more modest).  I can't 

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King

hawkesed wrote:
 If I have a list, say of names. And I want to count all the people
 named, say, Susie, but I don't care exactly how they spell it (ie,
 Susy, Susi, Susie all work.) how would I do this? Set up a regular
 expression inside the count? Is there a wildcard variable I can use?
 Here is the code for the non-fuzzy way:
 lstNames.count(Susie)
 Any ideas? Is this something you wouldn't expect count to do?
 Thanks y'all from a newbie.
 Ed

Dare I suggest using REs?  This looks like something they'de be good
for:

import re

def countMatches(names, namePattern):
  count = 0
  for name in names:
if namePattern.match(name):
  count += 1
  return count

susie = re.compile(Su(s|z)(i|ie|y))

print countMatches([John, Suzy, Peter, Steven, Susie,
Susi], susie)


some other patters:

iain = re.compile((Ia(i)?n|Eoin))
steven = re.compile(Ste(v|ph|f)(e|a)n)
john = re.compile(Jo(h)?n)


Iain

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


Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 3:15 PM, Edward Elliott wrote:
  Phoneme matching seems overly complex and might
 grab things like Tsu-zi.

It might *only* if somebody had a rush of blood to the head and devised 
yet another phonetic key algorithm. Tsuzi does *not* give the same 
result as any of Suzi, Suzie, Susi, and Susie when pushed through any of 
the following; Soundex, NYSIIS, Metaphone, Dolby, and Caverphone. None 
of them throw away the 'T' sound.

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


Re: Instruction at 0x00FC3D70 use memory address 0x00000000. Can't be read.

2006-04-25 Thread bruno at modulix
 On Apr 24, 2006, at 5:38 PM, Neil Adams wrote:
 
 How do Ifix memory  message Ox033fc512 at Ox can't be read

OP
I think the first think to do would be to read this:
http://www.catb.org/~esr/faqs/smart-questions.html
/OP

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python application ideas.

2006-04-25 Thread bruno at modulix
Tim Parkin wrote:
 Anthony Greene wrote:
 
Hello, I know this isn't really a python centric question, but I'm seeking
help from my fellow python programmers. I've been learning python for the
past year and a half, and I still haven't written anything substantial nor
have I found an existing project which blows my hair back. Python is my
first language, and I plan on learning lisp within the next week but
before I do so I'd like to write something meaningful, does anyone have
any suggestions? Something they always needed, but never got around to
writing it? Without an imagination you pretty much stagnate your whole
learning process. Thanks in advance.

 
 
 How about writing a standalone wiki markup parser? I know a *lot* of
 people who would find this useful..

+1


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple hierarchies and method overloading

2006-04-25 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED],
 Ben Cartwright [EMAIL PROTECTED] wrote:

Philippe Martin wrote:

 I renamed A_Func(self) to fix that ... but is there a cleaner way around ?

When using multiple inheritence, the order of the base classes matters!

When you have to start worrying about complications like this, isn't 
that a sign that you're taking the whole OO thing a little too seriously?

After all, technology is supposed to _solve_ problems, not create them. 
If the complications of OO are making you lose sight of your original 
problem, then maybe you should put them aside.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-25 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED],
 bruno at modulix [EMAIL PROTECTED] wrote:

Lawrence D'Oliveiro wrote:
(snip)
 I think you're taking Python's OO-ness too seriously. One of the 
 strengths of Python is that it can _look_ like an OO language without 
 actually being OO.

According to which definition of OO ?

Isn't there one?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple hierarchie and method overloading

2006-04-25 Thread bruno at modulix
Philippe Martin wrote:
 Hi,
 
 
 
 
 I have something like this:
 
 Class A:
 def A_Func(self, p_param):
  .
 Class B:
 def A_Func(self):
  .
 
 Class C (A,B):
 A.__init__(self)

If that's really your code, you should have an exception right here.
Else, please post real code.


 B.__init__(self)


 .
 
 self.A_Func() #HERE I GET AN EXCEPTION ... takes at least 2 
 arguments (1
 given).


 
 I renamed A_Func(self) to fix that ... but is there a cleaner way around ?

Perhaps should you read these texts:

http://diveintopython.org/object_oriented_framework/defining_classes.html
http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm
http://docs.python.org/tut/node11.html


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need a thread to keep a socket connection alive?

2006-04-25 Thread Ben Sizer
[EMAIL PROTECTED] wrote:
 the data comming in is alway in 158 bytes though.

And one day it may not. :)  Consider yourself warned! (In a friendly
manner.)

-- 
Ben Sizer

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


Re: Multiple hierarchie and method overloading

2006-04-25 Thread bruno at modulix
Philippe Martin wrote:
 Hi,
 
 I have something like this:
 
 Class A:
 def A_Func(self, p_param):
  .
 Class B:
 def A_Func(self):
  .
 
 Class C (A,B):
 A.__init__(self)
 B.__init__(self)
 
 .
 
 self.A_Func() #HERE I GET AN EXCEPTION ... takes at least 2 
 arguments (1
 given).

Ho, yes, also: A.A_Func() really takes 2 arguments (self, and p_param).
When called from an instance of A, the first argument (ie: self) will be
automagically feed with the instance itself - but you still have to pass
the second one.

 
 I renamed A_Func(self) to fix that ... but is there a cleaner way around ?

Yes : passing the second argument.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python application ideas.

2006-04-25 Thread momolulu
   That's really the right thing I want to know , I am a Python newbie
,and learn to know that python is very strong ability in large scale
application , as a beginner , what is the first useful and meaningful
widget can we create through Python ?

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


Re: catching doctype using xml.sax -- please

2006-04-25 Thread Diez B. Roggisch
Sakcee wrote:

 Hi
 
 I would really appreciate if soemone can point me to the direction. how
 can I use xml.sax to catch doctype entities.
 
 there is a xml.sax.DTDHandler , but how should i use it?

As all other handlers:

XMLReader.setDTDHandler(handler)


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


Re: test assignmet problem

2006-04-25 Thread bruno at modulix
Paolo Pantaleo wrote:
(snip)
 Thnx for the help,
 actually the problme is not solved
 
 i have [well I want to do...] something like:
 
 if a=b():
do stuff with a
 else if a=c():
do stuff with b

where does this 'b' come from ?

 else:
do other stuff
 
 well, two solutions are
 
 a1=b()
 a2=c()
 
 if a1:
do stuff with a1
 else if a2:
do stuff with a2
 else:
do other stuff

if the call to b() returns a non-false value, the call to c() is useless.

 
 the other is
 
 
 if b():
a=b()
do stuff with a
 else if c():
a=c()
do stuff with b
 else:
do other stuff

You still have useless function calls.

 Even if none is exactly the same about:
  * the number of times the b() and c() functions are executed
  * the final value of a
 
 I think the right one is:
 
 a=b()
 if a:
do stuff with a
 else:
a=c()
if a=c():
do stuff with b
else:
 do other stuff

Almost :

a = b()
if a:
  do_stuff_with_b(a)
else:
  a = c()
  if a:
do_stuff_with_c(a)
  else:
do_other_stuff()


Now there are probably better ways to write this, but this would require
more knowledge about your real code.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 6:26 PM, Iain King wrote:
 hawkesed wrote:
 If I have a list, say of names. And I want to count all the people
 named, say, Susie, but I don't care exactly how they spell it (ie,
 Susy, Susi, Susie all work.) how would I do this? Set up a regular
 expression inside the count? Is there a wildcard variable I can use?
 Here is the code for the non-fuzzy way:
 lstNames.count(Susie)
 Any ideas? Is this something you wouldn't expect count to do?
 Thanks y'all from a newbie.
 Ed
 
 Dare I suggest using REs?  This looks like something they'de be good
 for:
 
 import re
 
 def countMatches(names, namePattern):
   count = 0
   for name in names:
 if namePattern.match(name):
   count += 1
   return count
 
 susie = re.compile(Su(s|z)(i|ie|y))
 
 print countMatches([John, Suzy, Peter, Steven, Susie,
 Susi], susie)
 
 
 some other patters:
 
 iain = re.compile((Ia(i)?n|Eoin))
 steven = re.compile(Ste(v|ph|f)(e|a)n)

What about Steffan, Etienne, Esteban, István, ... ?

 john = re.compile(Jo(h)?n)
 

IMHO, the amount of hand-crafting that goes into a *general-purpose* 
phonetic matching algorithm is already bordering on overkill. Your 
method using REs would not appear to scale well at all.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-25 Thread bruno at modulix
Lawrence D'Oliveiro wrote:
 In article [EMAIL PROTECTED],
  bruno at modulix [EMAIL PROTECTED] wrote:
 
 
Lawrence D'Oliveiro wrote:

(snip)
I suppose this is an instance of the more general rule: using OO when 
you don't have to.

Lawrence, I'm afraid you're confusing OO with statically-typed
class-based. FWIW, dynamic typing is part of OO since Smalltalk.
 
 
 I wasn't talking about dynamic typing, I was talking about subclassing, 
 which is very much a part of OO.

What you wrote implies (well, at least I understand it that way) that
polymorphic dispatch *not* based on subclassing is not OO. Hence my
reaction : the need to use subclassing (inheritance) for subtyping
(polymorphic dispatch) is not a requirement of object orientation and
has never been - it's only a limitation of languages with declarative
static typing (C++, Java, C# etc).

 Unless you subscribe to the OO is whatever looks like a good 
 programming idea definition http://www.paulgraham.com/reesoo.html.

Not really !-)



-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RESOLVED Re: PYTHONPATH

2006-04-25 Thread bruno at modulix
Brian van den Broek wrote:
 Hi all,
 
 As a fairly new linux user running ubuntu 5.10 I'd had problems
 persistently setting my PYTHONPATH environment variable. bruno and
 Edward got me most of the way (thanks!); I'm posting what worked for
 future googling.
 
(snip)
 The syntax that worked for me was *almost* what bruno suggested. It
 didn't work here until I used ':' rather than bruno's ';' as the path
 element separator. 

oops, my bad :(
Sorry for the typo - it's of course ':'.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: test assignmet problem

2006-04-25 Thread Duncan Booth
bruno at modulix wrote:

 Almost :
 
 a = b()
 if a:
   do_stuff_with_b(a)
 else:
   a = c()
   if a:
 do_stuff_with_c(a)
   else:
 do_other_stuff()
 
 
 Now there are probably better ways to write this, but this would require
 more knowledge about your real code.

if there are more than a couple of options you can generalise code such as 
this to use a for loop:

for guard, action in [
(b, do_stuff_with_b),
(c, do_stuff_with_c),
]:
if guard():
action(a)
break
else:
do_other_stuff()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple hierarchies and method overloading

2006-04-25 Thread bruno at modulix
Lawrence D'Oliveiro wrote:
 In article [EMAIL PROTECTED],
  Ben Cartwright [EMAIL PROTECTED] wrote:
 
 
Philippe Martin wrote:


I renamed A_Func(self) to fix that ... but is there a cleaner way around ?

When using multiple inheritence, the order of the base classes matters!
 
 
 When you have to start worrying about complications like this, isn't 
 that a sign that you're taking the whole OO thing a little too seriously?
 
 After all, technology is supposed to _solve_ problems, not create them. 
 If the complications of OO are making you lose sight of your original 
 problem, then maybe you should put them aside.


def fun(arg1, arg2):
  pass

fun()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: fun() takes exactly 2 arguments (0 given)

If the complication of functions are making you loose sight of your
original problem, then maybe you should put them aside ?-)


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The whitespaceless frontend

2006-04-25 Thread bearophileHUGS
Stelios Xanthakis:

in my opinion nested functions are not so important and I wouldn't spend any 
time to improve them. Usually you can do anything with classes

Some people like and use them often (like those ones coming from
Pascal-like languages, etc), some other people (like those coming from
C-like languages like Java) use them rarely and like classes more.
Python can choose to have just one way to solve such problems, or to
support both kinds of people. At the moment I think it tries to please
both kind of programmers.


'$' being unused seems like a good choice.

It's less explicit than self. but it's shorter, this improves typing,
and allows to produce more compact code:

return .join([Graph(, repr($o), , , repr($nodeData), )])

Instead of:

return .join([Graph(, repr(self.o), , , repr(self.nodeData),
)])

But note that every time you want to add a new piece of syntax you must
think if the same syntax can be more useful for more common tasks (like
string substitution/templating, in this situation).


 - sorry for the delayed reply. Unexpected easter vacation.

No problem.

Bye,
bearophile

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


Re: The whitespaceless frontend

2006-04-25 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with:
 Some people like and use them often (like those ones coming from
 Pascal-like languages, etc), some other people (like those coming
 from C-like languages like Java) use them rarely and like classes
 more.  Python can choose to have just one way to solve such
 problems, or to support both kinds of people. At the moment I think
 it tries to please both kind of programmers.

If a function X needs a lot of data from the calling function Y, and
it is called only from Y, I tend to implement it as an inner function
of Y. I like classes a lot, but sometimes I simply want the easiest
and cleanest solution.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


OOP / language design question

2006-04-25 Thread cctv . star
I was wondering, why you always have to remember to call bases'
constructors explicitly from the derived class constructor? Why hasn't
this been enforced by the language?

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


Re: python application ideas.

2006-04-25 Thread Daniel Nogradi
 Hello, I know this isn't really a python centric question, but I'm seeking
 help from my fellow python programmers. I've been learning python for the
 past year and a half, and I still haven't written anything substantial nor
 have I found an existing project which blows my hair back. Python is my
 first language, and I plan on learning lisp within the next week but
 before I do so I'd like to write something meaningful, does anyone have
 any suggestions? Something they always needed, but never got around to
 writing it? Without an imagination you pretty much stagnate your whole
 learning process. Thanks in advance.


That's really the right thing I want to know , I am a Python newbie
 ,and learn to know that python is very strong ability in large scale
 application , as a beginner , what is the first useful and meaningful
 widget can we create through Python ?



You guys might find browsing through
http://wiki.python.org/moin/CodingProjectIdeas inspiring.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Probability Problem

2006-04-25 Thread Peter Tillotson
I had a possibly similar problem calculating probs related to premium
bond permutation. With 10^12 memory ran out v quickly. In the end I got
round it by writing a recursive function and quantising the probability
density function.

Elliot Temple wrote:
 Problem: Randomly generate 10 integers from 0-100 inclusive, and sum
 them. Do that twice. What is the probability the two sums are 390 apart?
 
 I have code to do part of it (below), and I know how to write code to do
 the rest. The part I have calculates the number of ways the dice can
 come out to a given number. The problem is the main loop has 9
 iterations and it takes about 2.5 minutes to begin the 4th one, and each
 iteration is about 101 times longer than the previous one. So:
 
 x = 2.5 * 101**6
 x /= (60*24*365.25)
 x
 5045631.5622908585
 
 It'd take 5,000 millennia. (If my computer didn't run out of memory
 after about 4 minutes, that is.)
 
 Any suggestions? Either a way to do the same thing much more efficiently
 (enough that I can run it) or a different way to solve the problem.
 
 Code:
 
 li = range(101)
 li2 = []
 range101 = range(101)
 for x in xrange(9):
 print x is %s % x
 li2 = []
 for y in li:
 for z in range101:
 li2 += [y+z]
 li = li2
 print li.count(800)
 # prints how many ways the dice can add to 800
 
 
 This link may help:
 http://www.math.csusb.edu/faculty/stanton/m262/intro_prob_models/calcprob.html
 
 
 -- Elliot Temple
 http://www.curi.us/blog/
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread Rene Pijlman
[EMAIL PROTECTED]:
I was wondering, why you always have to remember to call bases'
constructors explicitly from the derived class constructor? Why hasn't
this been enforced by the language?

Probably because the language doesn't know whether the subclass wants to
override its base class's constructor, or enhance it.

-- 
René Pijlman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread Heiko Wundram
Am Dienstag 25 April 2006 12:34 schrieb [EMAIL PROTECTED]:
 I was wondering, why you always have to remember to call bases'
 constructors explicitly from the derived class constructor? Why hasn't
 this been enforced by the language?

Because sometimes you don't want to call the base classes constructors? The 
Python zen says: Better explicit than implicit, and in this case it hits 
the nail on the head. Better to see right away what your code does (the 
explicit call to the base class), than to have to work around calling a bases 
constructor if you don't want to call it.

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


Re: OOP / language design question

2006-04-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote:

 I was wondering, why you always have to remember to call bases'
 constructors explicitly from the derived class constructor? Why hasn't
 this been enforced by the language?

I have another question for you: why does JAVA enforce that a constructor of
a base-class must be called prior to everything else in the derived class's
constructor? No way to do some computing for parameters that I want to pass
to the parent constructor...


Besides, this automatically base-constructor-calling only happens for the
most trivial of cases - the no-argument-constructors.

Regards,

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


Re: MinGW and Python

2006-04-25 Thread Brian Elmegaard
Martin v. Löwis [EMAIL PROTECTED] writes:

 It would certainly be possible to distribute a gcc-compiled python.
 However, what is the point in doing so? Cygwin already includes
 a gcc-compiled Python, for Windows:

Interesting.

 That is simply not true. 

Actually, you answered me then too. I misunderstood after reading
http://sebsauvage.net/python/mingw.html.

Is the information on that page not correct? Has it never been? 

 You can build the entire Python interpreter with Cygwin (but you
 don't need to, because there is a precompiled version), and you can
 build extensions for the python.org binary using MingW.

Great, then I tend to agree that there is no reason for building it
with mingw.


-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King

John Machin wrote:
 On 25/04/2006 6:26 PM, Iain King wrote:
  hawkesed wrote:
  If I have a list, say of names. And I want to count all the people
  named, say, Susie, but I don't care exactly how they spell it (ie,
  Susy, Susi, Susie all work.) how would I do this? Set up a regular
  expression inside the count? Is there a wildcard variable I can use?
  Here is the code for the non-fuzzy way:
  lstNames.count(Susie)
  Any ideas? Is this something you wouldn't expect count to do?
  Thanks y'all from a newbie.

snip

  steven = re.compile(Ste(v|ph|f)(e|a)n)

 What about Steffan, Etienne, Esteban, István, ... ?


well, obviously these could be included:
(Ste(v|ph|f)(e|a)n|Steffan|Etienne|Esteban), but the OP never said he
wanted to translate anything into another language.  He just wanted to
catch variable spellings.

  john = re.compile(Jo(h)?n)
 

 IMHO, the amount of hand-crafting that goes into a *general-purpose*
 phonetic matching algorithm is already bordering on overkill. Your
 method using REs would not appear to scale well at all.

Iain

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


Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-25 Thread ToddLMorgan
Thanks for those ... just by looking at the colour of the links in my
browser I'd only found 4 of those already so I appreciate the heads up
:- )

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


Re: MinGW and Python

2006-04-25 Thread Brian Elmegaard
Robert Kern [EMAIL PROTECTED] writes:

 If you meant writing extension modules for Python instead of extending
 distutils, 

I thought about extending distutils to make non-python installers. I
may have misunderstood the answers I got.
http://groups.google.com/group/comp.lang.python/browse_thread/thread/3f721b5a38fbc2d1/7af1aea19aa187b6?lnk=stq=author%3Aelmegaard+distutilsrnum=1#7af1aea19aa187b6


 mingw for the standard Python distribution. Please see my post in the thread 
 MS
 VC++ Toolkit 2003, where?.

Thanks, I will.
-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MinGW and Python

2006-04-25 Thread Brian Elmegaard
Fredrik Lundh [EMAIL PROTECTED] writes:

 a better optimizer usually results in programs that run faster, not slower.

Got it the wrong after some editing ;-(
-- 
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread cctv . star
Diez B. Roggisch wrote:
 I have another question for you: why does JAVA enforce that a constructor of
 a base-class must be called prior to everything else in the derived class's
 constructor?
Well, I can imagine it's done to make sure that the base(s) are
properly constructed. Sound s sensible to me.

 No way to do some computing for parameters that I want to pass
 to the parent constructor...

Try this:

Derived::Dreived() : Base(calcParam1(), calcParam2())
...

 Besides, this automatically base-constructor-calling only happens for the
 most trivial of cases - the no-argument-constructors.

Well, the language can at least ensure that theconstructor is called -
i.e. either call it automatically if it can be called without
parameters, or fail with error.

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


Re: OOP / language design question

2006-04-25 Thread cctv . star

Heiko Wundram wrote:
 Because sometimes you don't want to call the base classes constructors?
Sounds strange to me at the moment, but I'll try to adjust to this
thought.

 Python zen says: Better explicit than implicit, and in this case it hits
 the nail on the head. Better to see right away what your code does (the
 explicit call to the base class), than to have to work around calling a bases
 constructor if you don't want to call it.
Thanks, that explains it somehow - at least, it's consistent with
explicit self.
I think I'll need some shift in thinking after C++.

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


Re: OOP / language design question

2006-04-25 Thread Rene Pijlman
[EMAIL PROTECTED]:
I think I'll need some shift in thinking after C++.

+1 qotw

-- 
René Pijlman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread Diez B. Roggisch
 Well, I can imagine it's done to make sure that the base(s) are
 properly constructed. Sound s sensible to me.

It often is - there are popular examples in python where missing a
constructor will cause a program to fail spectacular. But is it _always_ a
sensible thing to do? No. If you only want some code inherited, but set up
the required constraints to do so yourself. Such things can't be expressed
in C++/JAVA, but that doesn't mean they aren't the sensible solution in
some cases.

 No way to do some computing for parameters that I want to pass
 to the parent constructor...
 
 Try this:
 
 Derived::Dreived() : Base(calcParam1(), calcParam2())
 ...

Oh, I know about that. however, there are limits to this. For example, you
can't do anything that depends on constructors called before in case of
multiple inheritance. And you are forced to create a static method to do
so, which can be viewed as ugly as well.

 Well, the language can at least ensure that theconstructor is called -
 i.e. either call it automatically if it can be called without
 parameters, or fail with error.

Yes, it can do that because of static typing - in fact it will fail on a lot
more of occasions with a compilation error. 

The question here is if you are willing to trade freedom of expressiveness
against the proposed security of static typing. I found that I favor the
former and can live without the latter.

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


Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 8:51 PM, Iain King wrote:
 John Machin wrote:
 On 25/04/2006 6:26 PM, Iain King wrote:
 hawkesed wrote:
 If I have a list, say of names. And I want to count all the people
 named, say, Susie, but I don't care exactly how they spell it (ie,
 Susy, Susi, Susie all work.) how would I do this? Set up a regular
 expression inside the count? Is there a wildcard variable I can use?
 Here is the code for the non-fuzzy way:
 lstNames.count(Susie)
 Any ideas? Is this something you wouldn't expect count to do?
 Thanks y'all from a newbie.
 
 snip
 
 steven = re.compile(Ste(v|ph|f)(e|a)n)
 What about Steffan, Etienne, Esteban, István, ... ?

 
 well, obviously these could be included:
 (Ste(v|ph|f)(e|a)n|Steffan|Etienne|Esteban), but the OP never said he
 wanted to translate anything into another language.

Neither did I. But if you have to cope with a practical situation like 
where the birth certificate says István and the job application says 
Steven and the foreman calls him Steve, you won't be stuffing about with 
hand-crafted REs, one per popular given name. Could be worse: the punter 
could have looked up a dictionary and changed his surname from Kovács to 
Smith; believe me -- it happens.

Oh and if you cast your net as wide as the Pacific islands, chuck in 
Sitiveni. That's enough examples. We won't go near Benjamin :-)

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


Re: OOP / language design question

2006-04-25 Thread Duncan Booth
[EMAIL PROTECTED] wrote:

 Heiko Wundram wrote:
 Because sometimes you don't want to call the base classes constructors?
 Sounds strange to me at the moment, but I'll try to adjust to this
 thought.

It makes sense in more static languages such as C++. The base class is 
initialised by the constructor, so you have to do everything possible to 
ensure that initialisation is done before you actually try to use any part 
of the base class. Weird things can still happen in C++ if you start 
calling methods too soon (e.g. to calculate some of the base constructor's 
parameters): you can find uninitialised member variables and you might not 
get exactly the virtual methods you expected.

Python is more laid back about these things. The object itself already 
exists when __init__ is first called. It already has a type, which 
(unlike C++) isn't going to change part way through. All that is missing 
are a few attributes, and if you try to access them too soon you'll get an 
exception rather than a random value.

It makes sense therefore to give the programmer the scope to override the 
expected sequence of initialisation for those rare cases where it actually 
matters. The programmer also gets enough scope to shoot themselves in the 
foot, but Python programmers are expected to be intelligent enough not to 
do that accidentally.

Usually though, if a subclass doesn't immediately call the base class 
constructors as the first thing it does in __init__ it indicates poor code 
and should be refactored.

BTW, the same arguments apply to destructors: if you have a __del__ method 
and need to call the base __del__ methods you have to do that manually as 
well.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Accessing Parallel Port in Python Error : Priviledged Instruction

2006-04-25 Thread your
type your message here
-- 
http://mail.python.org/mailman/listinfo/python-list


Zope 3

2006-04-25 Thread Derick van Niekerk
I have been developing in PHP for some time now and needed to look into
application frameworks to speed up my development. I was looking into
Horde and CakePHP before I was introduced to Python. I started learing
python and within a few *hours* I already wrote my first small program
and I still use it!

I love Python! Then I was introduced to Zope by freak accident. While
Zope looked like the answer to my dillemma, I still can't get my head
wrapped around it. Is it because I don't know Python well enough? Or is
it just that difficult to learn?

I would like to start my next web project (a database of demographic
info on scientists in Africa)  on Zope 3. Could anybody point me in the
right direction? Where should I start?

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


Re: Hooking things up in GUI application

2006-04-25 Thread sturlamolden

Ryan Ginstrom wrote:

 Apropos recent threads about GUI editors, coming from a Win32/WTL C++
 background, I actually like the idea of being able to (easily) create GUIs
 programmatically.

 But I still see a lot of the same tedium: hooking up events to handlers, and
 getting data into and out of dialogs. In C++, this is generally handled
 through code generation and/or macros, but IMO these are brittle and ugly.

 So my question: Is there a Pythonic way to make these tedious hookups easier?


If you use PyGTK (it also runs on Windows), you can design the GUI with
GLADE and then use libglade to import the gui as an xml-resource. You
have to write all handlers (you do anyway), but the GUI design becomes
entirely visual and the hookup becomes one single like of code. It
doesn't get easier than that. As a bonus you get an hardware
accelerated GUI (Cairo takes care of that, currently through OpenGL but
a DirectX backend is planned). I.e. a hardware accelerated GUI
represented as an XML resource. Isn't that Microsoft's next 'big thing'
codenamed 'Avalon'? I wonder where they got the idea.

This should illustrate the level of tediousness when using PyGTK:

import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade

class MyGUI:

   def __init__(self):
  win1 = libglade.GladeXML('mygui.glade','window1')
  win1.signal_autoconnect(self)   # hook event handlers, pass any
class or dictionary
  win1.maximize()

   def on_win1_destroy(self):
  gtk.main_quit()

if __name__ == '__main__'
   gui = MyGUI()
   gtk.main()


You cannot make it less tedious in C++. Even if you use Visual Studio
and all sorts of 'wizards' to autogenerate code. Actually, if you do
use C, C++ or Ada, GLADE can autogenerate code just like Visual Studio.
But since an XML resource us much easier to modify and maintain, it is
not recommended.

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


Re: OOP / language design question

2006-04-25 Thread bruno at modulix
Duncan Booth wrote:
(snip)
 Usually though, if a subclass doesn't immediately call the base class 
 constructors as the first thing it does in __init__ it indicates poor code 
 and should be refactored.

Not necessarily. It's a common case to have some computations to do/some
attributes to set in the derived class's __init__ before calling the
superclass's.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread bruno at modulix
[EMAIL PROTECTED] wrote:
 I was wondering, why you always have to remember to call bases'
 constructors 

pedantic
s/constructors/__init__/

the __init__() method is *not* the constructor. Object's instanciation
is a two-stage process:  __new__() is called first, then __init__().
/pedantic

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-25 Thread bruno at modulix
Lawrence D'Oliveiro wrote:
 In article [EMAIL PROTECTED],
  bruno at modulix [EMAIL PROTECTED] wrote:
 
 
Lawrence D'Oliveiro wrote:
(snip)

I think you're taking Python's OO-ness too seriously. One of the 
strengths of Python is that it can _look_ like an OO language without 
actually being OO.

According to which definition of OO ?
 
 
 Isn't there one?

Your claim that Python _look_ like an OO language without actually
being OO implicitely relies on a definition of OO - or is just
meaningless. So I ask you: what definition of OO do you use to support
your claim ?

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MinGW and Python

2006-04-25 Thread sturlamolden

Martin v. Löwis wrote:

 - there is no build process available to do that

In MSYS:

$ ./configure --prefix=/c/mingw
$ make
$ make install

This should be obvious to any with Unix experience.

MinGW actually distribute precompiled Python binaries as well (in
MSYS-DTK).

 - people building extensions to Python must be able to do so with
   Microsoft C++, since some of these extensions are written using MFC.

MinGW can compile MFC. Download Windows Platform SDK and you get the
MFC source.

 - developing Python itself in Visual Studio is quite convenient; in
   particular, the debugger works better than gdb.

Eclipse is an excellent IDE that works with MinGW.

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


PIL / libjpeg install problem

2006-04-25 Thread mikko . koivunen
Hello all,

I am installing the Python Imaging Library (1.1.5). Following the
README that came with PIL sources, I ran path/to/python setup.py
build_ext -i which informed me that JPEG support is OK.

However when I run path/to/python selftest.py from the same package,
I get an IOError: decoder jpg not available.

This is a RHEL4 server and I am building PIL for a selfcompiled Python
2.3.5 install.

Libjpeg and libjpeg-devel are installed via RPM.

Any help appreciated.

Full error here:

Failure in example: _info(Image.open(Images/lena.jpg))
from line #24 of selftest.testimage
Exception raised:
Traceback (most recent call last):
  File ./doctest.py, line 499, in _run_examples_inner
exec compile(source, string, single) in globs
  File string, line 1, in ?
  File ./selftest.py, line 21, in _info
im.load()
  File PIL/ImageFile.py, line 180, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File PIL/Image.py, line 328, in _getdecoder
raise IOError(decoder %s not available % decoder_name)
IOError: decoder jpeg not available
1 items had failures:
   1 of  55 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 55 failed.

-- 
Mikko Koivunen

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


Re: Zope 3

2006-04-25 Thread bruno at modulix
Derick van Niekerk wrote:
 I have been developing in PHP for some time now and needed to look into
 application frameworks to speed up my development. I was looking into
 Horde and CakePHP before I was introduced to Python. I started learing
 python and within a few *hours* I already wrote my first small program
 and I still use it!
 
 I love Python! Then I was introduced to Zope by freak accident. While
 Zope looked like the answer to my dillemma, I still can't get my head
 wrapped around it. Is it because I don't know Python well enough? Or is
 it just that difficult to learn?

Zope is a world in itself - and is certainly not the simplest tool to
learn (nor the most pythonic). You may want to consider other options
like Django, Pylon or Turbogears.

My 2 cents.
-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing XML/XSLT

2006-04-25 Thread Stefan Behnel
veracon wrote:
 I'm looking to use XML and XSLT for templates in a system I'm writing,
 however I'm not really sure which parser is the best. Basically,
 which library has the most features, and which is the most supported?

lxml arguably has the most features by now, as it is based on libxml2 and
libxslt (libexslt support is in SVN) and wraps most of their features into
easy-to-use Python APIs.

At least lxml's API is also arguably the most supported as it mostly
compatible to ElementTree (which made it into Python 2.5).

http://codespeak.net/lxml

Beware though, I'm somewhat biased as I'm one of the authors.

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


Re: MinGW and Python

2006-04-25 Thread sturlamolden

Robert Kern wrote:

 - gcc does not optimize particularly well.

That is beyond BS. The more recent gcc releases optimize as well as any
commercial compiler. GCC 4 may even optimize better than MSVC.

GCC is the compiler used to build the Linux kernel and MacOSX. If it
can deal with this I say it can handle Python as well. My guess is you
will not notice any performance difference for the Python interpreter.
Doesn't Python run well on Linux? GCC is used to build Python on Linux.
MinGW is GCC. MinGW on Windows creates the same binary code as GCC on
Linux.

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


Re: How to search HUGE XML with DOM?

2006-04-25 Thread Stefan Behnel
Sullivan WxPyQtKinter wrote:
 My search needs:
 1. Search and return all the record (an element) with specific id.
 2. Search and return all the record whose child nodes has a specific id
 or attribute.

Try lxml, which is based on the libxml2 library. The current SVN version has
support for xml:id through the XMLDTDID function. It simply returns an XML
tree and an ID dictionary.

http://codespeak.net/lxml

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


Re: OOP / language design question

2006-04-25 Thread Carl Banks
[EMAIL PROTECTED] wrote:
 Heiko Wundram wrote:
  Because sometimes you don't want to call the base classes constructors?
 Sounds strange to me at the moment, but I'll try to adjust to this
 thought.

In Java and C++, classes have private members that can only be accessed
by the class itself (and, in C++, friends).  In those languages, a base
constructor needs to be called to initialize the base class's private
members.

Python has no private members (except for the double underscore
thingies, which aren't that common).  Unlike C++ and Java, the derived
class's __init__ can usually initialize all the base class's members,
and it's occasionally useful to do so.

I would agree it's a mistake to not call the base class's __init__
unless you're doing it deliberately.  If you want a tool to catch those
mistakes, have a look at pychecker.  It can inform you whenever the
base class __init__ is not called.

(However, I totally disagree that it's a good idea to always call it
first, though.  I've written base class __init__s that expected the
subclass to provide initialization methods, and some of those methods
needed some subclass members to exist before they were called.)

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


Re: MinGW and Python

2006-04-25 Thread sturlamolden

Robert Kern wrote:

 Dunno. Depends on the machine. Depends on the program. Depends on how the
 interpreter and any extension modules and underlying libraries were built.
 Depends on which Linux and which Windows.

 I'm sorry, but your question is a non sequitur. I don't understand its 
 relevance
 to this thread.


The relevance: Python is built with GCC on Linux. Do you or do you not
see a performance hit on Linux?

MinGW is GCC. Will you get a performance hit when building Python with
MinGW?

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


Re: need a thread to keep a socket connection alive?

2006-04-25 Thread nephish
yeah, he he

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


Re: OOP / language design question

2006-04-25 Thread Duncan Booth
bruno at modulix wrote:

 Duncan Booth wrote:
 (snip)
 Usually though, if a subclass doesn't immediately call the base class
 constructors as the first thing it does in __init__ it indicates poor
 code and should be refactored.
 
 Not necessarily. It's a common case to have some computations to
 do/some attributes to set in the derived class's __init__ before
 calling the superclass's.
 

I did only say 'usually'. Can you actually think of any good examples where 
you have to set a derived attribute before you can call the base class 
constructor? I can't, which is why I was a bit vague.

The base class is unlikely to depend on the derived class attributes, and 
unless it does there should be no reason which you can't just call the base 
__init__ straight away. Perhaps if the base __init__ calls an overridden 
method, but at that point it sounds to me like something wants refactoring.

I can think that you might have to do some computations to calculate 
parameters for the base __init__, but that is a separate issue.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MinGW and Python

2006-04-25 Thread sturlamolden

I forgot to mention that C libraries built with Visual C++ and MinGW
are binary compatible. MinGW can link libararies and object files from
Visual C++. Although Python may be build with Visual C++, you can still
compile and link your C extensions with MinGW.

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


RE: MinGW and Python

2006-04-25 Thread Ames Andreas
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 g] On Behalf Of sturlamolden
 Sent: Tuesday, April 25, 2006 2:27 PM
 Subject: Re: MinGW and Python
 
 
 Robert Kern wrote:
 
  - gcc does not optimize particularly well.
 
 That is beyond BS. The more recent gcc releases optimize as 
 well as any
 commercial compiler. GCC 4 may even optimize better than MSVC.

Not to talk of standard compliance (msvc-c99 anyone?).


cheers,

aa

-- 
Andreas Ames | Programmer | Comergo GmbH |
Voice:  +49 69 7505 3213 | ames AT avaya . com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread Carl Banks

bruno at modulix wrote:
 [EMAIL PROTECTED] wrote:
  I was wondering, why you always have to remember to call bases'
  constructors

 pedantic
 s/constructors/__init__/

 the __init__() method is *not* the constructor. Object's instanciation
 is a two-stage process:  __new__() is called first, then __init__().
 /pedantic

You know, Python's __init__ has almost the same semantics as C++
constructors (they both initialize something that's already been
allocated in memory, and neither can return a substitute object).  I
actually think constructors are misnamed in C++, they should be called
initializers (and destructors finalizers).  The only thing is that C++
doesn't always call operator new when constructing objects, whereas
Python always calls __new__, so you can put some initialization in
__new__ if you want.

Other than that I'd say that Python __init__ is analogous to Java and
C++ constructors, but is not a constructor because C++ and Java
constructors are not constructors. :)  And Java has pointers, not
references. :)

A-rose-by-any-other-name-ly yr's,

Carl Banks

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


Re: python application ideas.

2006-04-25 Thread Fredrik Lundh
momolulu wrote:

   That's really the right thing I want to know , I am a Python newbie
 ,and learn to know that python is very strong ability in large scale
 application , as a beginner , what is the first useful and meaningful
 widget can we create through Python ?

What makes you think that the first useful and meaningful widget is the
same thing for everyone ?

The first thing I built as a Python beginner was a high-volume fault-tolerant
distributed image production system for heterogenous environments.  The
most recent thing I built is a small script that takes an infogami comment
and reposts it as an article.

What kind of applications and systems do you usually work on ?

/F 



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


EuroPython 2006: Call for papers

2006-04-25 Thread Armin Rigo
Hi all,

A shameless plug and reminder for EuroPython 2006 (July 3-5):

* you can submit talk proposals until May 31st.

* there is a refereed papers track; deadline for abstracts: May 5th.
  See the full call for papers below.


A bientot,

Armin Rigo  Carl Friedrich Bolz




   EuroPython 2006
   CERN, Geneva, 3-5 July

   Refereed Track: Call for Paper

 http://www.europython.org


EuroPython is the only conference in the Python world that has a
properly prestigious peer-reviewed forum for presenting technical and
scientific papers. Such papers, with advanced and highly innovative
contents, can equally well stem from academic research or industrial
research. We think this is an important function for EuroPython, so we
are even making some grants available to help people with travel costs.

For this refereed track, we will be happy to consider papers in subject
areas including, but not necessarily limited to, the following:

* Python language and implementations
* Python modules (in the broadest sense)
* Python extensions
* Interoperation between Python and other languages / subsystems
* Scientific applications of Python
* Python in Education
* Benchmarking Python

We are looking for Python-related scientific and technical papers of
advanced, highly innovative content that present the results of original
research (be it of the academic or industrial research kind), with
proper attention to state of the art and previous relevant
literature/results (whether such relevant previous literature is itself
directly related to Python or not).

We do not intend to let the specific subject area block a paper's
acceptance, as long as the paper satisfies other requirements:
innovative, Python-related, reflecting original research, with proper
attention to previous literature.

Abstracts
=

Please submit abstracts of no more than 200 words to the refereeing
committee. You can send submissions no later than 5 May 2006. We shall
inform you whether your paper has been selected no later than 15 May
2006. For all details regarding the submission of abstracts, please see
the EuroPython website (http://www.europython.org).  Papers

If your abstract is accepted, you must submit your corresponding paper
before 17 June 2006. You should submit the paper as a PDF file, in A4
format, complete, stand-alone, and readable on any standards-compliant
PDF reader (basically, the paper must include all fonts and figures it
uses, rather than using external pointers to them; by default, most
PDF-preparation programs typically produce such valid stand-alone PDF
documents).

Refereeing
==

The refereeing committee, selected by Armin Rigo, will examine all
abstracts and papers. The committee may consult external experts as it
deems fit. Referees may suggest or require certain changes and editing
in submissions, and make acceptance conditional on such changes being
performed. We expect all papers to reflect the abstract as approved and
reserve the right, at our discretion, to reject a paper, despite having
accepted the corresponding abstract, if the paper does not substantially
correspond to the approved abstract.

Presentation


The paper must be presented at EuroPython by one or more of the
authors. Presentation time will be either half an hour or an hour,
including time for questions and answers, depending on each paper's
details, and also on the total number of papers approved for
presentation.

Proceedings
===

We will publish the conference's proceedings in purely electronic
form. By presenting a paper, authors agree to give the EuroPython
conference non-exclusive rights to publish the paper in electronic forms
(including, but not limited to, partial and total publication on web
sites and/or such media as CDROM and DVD-ROM), and warrant that the
papers are not infringing on the rights of any third parties. Authors
retain all other intellectual property rights on their submitted
abstracts and papers excepting only this non-exclusive license.

Subsidised travel
=

We have funds available to subsidise travel costs for some presenters
who would otherwise not be able to attend EuroPython. When submitting
your abstract, please indicate if you would need such a subsidy as a
precondition of being able to come and present your paper. (Yes, this
possibility does exist even if you are coming from outside of
Europe. Papers from people in New Zealand who can only come if their
travel is subsidised, for example, would be just fine with us...).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP / language design question

2006-04-25 Thread Duncan Booth
Carl Banks wrote:

 You know, Python's __init__ has almost the same semantics as C++
 constructors (they both initialize something that's already been
 allocated in memory, and neither can return a substitute object). 

There is a significant difference: imagine B is a base type and C a 
subclass of B:

When you create an object of type C in Python, while B.__init__ is 
executing self is an object of type C (albeit without all the attributes 
you expect on your C).

In C++ when the B() constructor is executing the object is an object of 
type B. It doesn't become a C object until the C() constructor is 
executing.

In other words, the object is constructed in Python before any __init__ is 
called, but in C++ it isn't constructed until after all the base class 
constructors have returned.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python application ideas.

2006-04-25 Thread RK
I need a python source code diagrammer that actually works
out-of-the-box to explore all the code already written out there.

something like SmallWorlds was to java before they got rid of it.

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


RE: Hooking things up in GUI application

2006-04-25 Thread Ryan Ginstrom
 Behalf Of sturlamolden
 If you use PyGTK (it also runs on Windows), you can design 
 the GUI with
 GLADE and then use libglade to import the gui as an xml-resource.

Yes, I've tried something similar with wxGlade. Nice, but it doesn't seem to
remove the most tedious work -- hooking up handlers (although it does help
here, at the cost of some behind-the-scenes magic), and getting data into and
out of GUI widgets. That's the kind of boilerplate code that makes GUI
development a pain in my opinion -- the actual GUI design/layout isn't so
bad, especially with the spacer layout concept.

--
Regards,
Ryan Ginstrom


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


MySQLdb begin() -

2006-04-25 Thread shearichard
Hi - Feeling a bit weird about this but I cannot find the 'begin'
method on a connection object of MySQLdb. Can anyone explain why ?

I'm using version 1.2.0 which is pretty recent and I've read that
'begin' should be a method of connection but it's not there ! Feeling
pretty puzzled !

Below are the details of what I see ...


 import MySQLdb
 c= MySQLdb.Connect(host='localhost', user='a',passwd='b', db='c',compress=1)
 c.begin()
Traceback (most recent call last):
  File stdin, line 1, in ?
AttributeError: 'Connection' object has no attribute 'begin'
 o=MySQLdb
 o.__version__
'1.2.0'
 o.__revision__
'1.37'
 o.apilevel
'2.0'


Be interested in any comments.

regards

Richard.

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


Re: Zope 3

2006-04-25 Thread Benji York
bruno at modulix wrote:
 Zope is a world in itself - and is certainly not the simplest tool to
 learn (nor the most pythonic).

Those statements apply more to Zope 2 than Zope 3 (and Zope 2 is moving 
more and more toward Zope 3 these days).  One of Zope 3's main goals was 
to focus on the Python programmer as a primary target.  That being said 
there /are/ some powerful and novel concepts used in Z3 (the component 
framework).

 You may want to consider other options like Django, Pylon or Turbogears.

It's true that Z3 is not currently focused very well on the 
middle-class developer.  It's more of an industrial-strength kind of 
thing, but considerable thought has been given lately on how to build 
bridges so everyone can benefit without being full-time Zope masters.

Toward that end, I wrote a little quick start guide that might help the 
OP: http://www.benjiyork.com/quick_start
--
Benji York
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on Nintendo DS

2006-04-25 Thread Richard Tew
An update to my Python on Nintendo DS efforts.

Summary:
- Working bug free port of Python for the Nintendo DS.
- Programmers wanted to help write extensions to expose the DS hardware
  to Python.
- Stackless Python supported, but not bug free.

When I last worked on it, it had several remaining bugs including a
broken zipimport, unreliability due to limited stack space and more.

I spent a statutory holiday on it and located and fixed all the bugs,
including the allocation of stack space and the problems with zipimport
(due to a misunderstanding about what seek function API I should
respect).  As it stands now, it seems pretty bug free.

Python itself running on the Nintendo DS with no access to the hardware
features (graphics, microphone, speakers, touchscreen) is not much use.
 As a text-based calculator it serves one purpose I guess. But to
really serve as a useful tool on the DS, it needs to expose these
pieces of hardware.  SDL is one option, as there is a reportedly buggy
port of SDL for the DS, and ideally as PyGame is based on SDL, a port
of that would hopefully be straightforward.

If anyone has an experience writing extension modules in C, and with
programming the DS hardware in C, and wishes to help flesh out some
form of library codebase to make this a useful port of Python, please
let me know! :)

Also, I switched to the Stackless Python code base.   The tasklet
scheduler locks up if invoked, but I haven't had the chance to look
into this yet.  But given that tasklets run and switch in the limited
scenarios I have tried, fixing the scheduler should be a matter of
time.

Richard

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


I have problems with creating the classic game Wumpus. the file: http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-39999a9e36d0

2006-04-25 Thread conny . ledin
Im trying to create a version of the game Wumpus. Mine is called
Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can
some one help me??
here is the file:
http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

What i have the biggest problems with now is between line 8 and 23. How
i can move the character trough the game. Other parts of the game that
have with the movement to do is between line 83-114 and 123-143.

This is part of the spec:
The player walks around in the hallways, finds and tries to kill
Wumpus (Belzebub). The game finishes when the player or Belzebub dies.
 The player has bombs which he can shoot. When he shoots he can
controll th ebombs for three moves, north, south, east or west three
times. If he is not careful he can shoot himself, ex first move: north.
second move south.
 Let every room be represented by the object room. In the object,
information of what exists in the room is stored. (Belzebub,
teleporters, fire traps, acid traps or nothing). and where the halways
leads. (north hallway leads to room 17, the east to room 2 etc.).
Create a list of room objects to represent the hallways (every room
have has a number).
 The content of the rooms shall be randomized in the beginning of
the program. Aproximatly 20% of the rooms should contain traps, 30%
should contain teleporters and in one of the rooms is Belzebub. One
room can not contain more than one danger, no traps and teleporters
together etc.
 Teleporters transports the player from one room to another random
room. If the player encounters a trap o Belzebub he is killed and GAME
OVER.
 The halways should also be randomized in the beginning of the
program. Like this:

* Create a list with all the room numbers and shuffle it so all of the
rooms is in a mixed order. ex. [5 2 12 18 9 1 3 6 14 19 11 7 17 4 20 16
10 15 8 13]

* Connect the rooms in east-west direction so that the east hallway
from room 5 leads to room 2 and the west hallway from room to leads
back to room 5 etc. The last room in the lest should be connected with
the first.

* Shuffle a new list and do the same thing in north-south direction.

once again the file:
http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

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


I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-25 Thread connyledin
Im trying to create a version of the game Wumpus. Mine is called 
Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can 
some one help me??
here is the file:
http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

What i have the biggest problems with now is between line 8 and 23. 
How i can move the character trough the game. Other parts of the game 
that have with the movement to do is between line 83-114 and 123-143.

This is part of the spec:
The player walks around in the hallways, finds and tries to kill 
Wumpus (Belzebub). The game finishes when the player or Belzebub dies.
 The player has bombs which he can shoot. When he shoots he can 
controll th ebombs for three moves, north, south, east or west three 
times. If he is not careful he can shoot himself, ex first move: 
north. second move south.
 Let every room be represented by the object room. In the object, 
information of what exists in the room is stored. (Belzebub, 
teleporters, fire traps, acid traps or nothing). and where the 
halways leads. (north hallway leads to room 17, the east to room 2 
etc.). Create a list of room objects to represent the hallways (every 
room have has a number). 
 The content of the rooms shall be randomized in the beginning of 
the program. Aproximatly 20% of the rooms should contain traps, 30% 
should contain teleporters and in one of the rooms is Belzebub. One 
room can not contain more than one danger, no traps and teleporters 
together etc. 
 Teleporters transports the player from one room to another 
random room. If the player encounters a trap o Belzebub he is killed 
and GAME OVER.
 The halways should also be randomized in the beginning of the 
program. Like this:

* Create a list with all the room numbers and shuffle it so all of 
the rooms is in a mixed order. ex. [5 2 12 18 9 1 3 6 14 19 11 7 17 4 
20 16 10 15 8 13]

* Connect the rooms in east-west direction so that the east hallway 
from room 5 leads to room 2 and the west hallway from room to leads 
back to room 5 etc. The last room in the lest should be connected 
with the first.

* Shuffle a new list and do the same thing in north-south direction.

Once again the file: http://esnips.com/webfolder/b71bfe95-d363-4dd3-
bfad-3a9e36d0





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


Re: Multiple hierarchies and method overloading

2006-04-25 Thread Philippe Martin
Well, the whole point was to clean up my code:

Actually this is what I have:

Class A:
def A_Func(self, p_param):
 .
Class B:
def A_Func(self):
 .

Class C (A,B):
A.__init__(self)
B.__init__(self)

Class D (A,B):
A.__init__(self)
B.__init__(self)


Where A is a wxWidget class and B a Common/utility class which I wanted to
factorize (and yes, inheritance was not mandatory here, just simpler)

My common class does have an A_Func(self) while wxWidget an A_Func(self,
p_param) == I actually got the error calling A_Func(self) as it was
checked against A_Func(self, p_param).

Regards,

Philippe







Lawrence D'Oliveiro wrote:

 In article [EMAIL PROTECTED],
  Ben Cartwright [EMAIL PROTECTED] wrote:
 
Philippe Martin wrote:

 I renamed A_Func(self) to fix that ... but is there a cleaner way around
 ?

When using multiple inheritence, the order of the base classes matters!
 
 When you have to start worrying about complications like this, isn't
 that a sign that you're taking the whole OO thing a little too seriously?
 
 After all, technology is supposed to _solve_ problems, not create them.
 If the complications of OO are making you lose sight of your original
 problem, then maybe you should put them aside.

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


Re: Multiple hierarchie and method overloading

2006-04-25 Thread Philippe Martin
Thanks,

I'll try that.

Philippe


Ben Cartwright wrote:

 Philippe Martin wrote:
 I have something like this:

 Class A:
 def A_Func(self, p_param):
  .
 Class B:
 def A_Func(self):
  .

 Class C (A,B):
 A.__init__(self)
 B.__init__(self)

 .

 self.A_Func() #HERE I GET AN EXCEPTION ... takes at least 2
 arguments (1
 given).


 I renamed A_Func(self) to fix that ... but is there a cleaner way around
 ?
 
 When using multiple inheritence, the order of the base classes matters!
  E.g.:
 
   class A(object):
   def f(self):
   print 'in A.f()'
   class B(object):
   def f(self):
   print 'in B.f()'
   class X(A, B):
   pass
   class Y(B, A):
   pass
 
x = X()
x.f()
   in A.f()
y = Y()
y.f()
   in B.f()
 
 If you want to call B.f() instead of A.f() for an X instance, you can
 either rename B.f() like you've done, or do this:
 
B.f(x)
   in B.f()
 
 --Ben

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


Re: MySQLdb begin() -

2006-04-25 Thread Geoffrey Clements
[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi - Feeling a bit weird about this but I cannot find the 'begin'
 method on a connection object of MySQLdb. Can anyone explain why ?

 I'm using version 1.2.0 which is pretty recent and I've read that
 'begin' should be a method of connection but it's not there ! Feeling
 pretty puzzled !


What exactly do you expect a begin method to do?  Have you read this:
http://www.python.org/dev/peps/pep-0249/

-- 
Geoff 


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


Re: Hooking things up in GUI application

2006-04-25 Thread sturlamolden

Ryan Ginstrom wrote:
  Behalf Of sturlamolden
  If you use PyGTK (it also runs on Windows), you can design
  the GUI with
  GLADE and then use libglade to import the gui as an xml-resource.

 Yes, I've tried something similar with wxGlade. Nice, but it doesn't seem to
 remove the most tedious work -- hooking up handlers (although it does help
 here, at the cost of some behind-the-scenes magic),

It does, there is just *one* line of code for hooking up all the
handlers:

   win.signal_autoconnect(something)

That is one line of code for the entire window, not one line of code
for every widget in the window. Even if your window contains 100
widgets (buttons, sliders, menus, etc), this hooks up the handlers for
every one of them. You just call .signal_autoconnect once. This single
line of code does the job of all the message map macros you would write
in MFC, Fox and wxWidgets. signal_autoconnect does what it says, it
autoconnects the signal handlers. How can that be tedious?

Here is an advice: just be lazy. In particular:

* Don't create write a dictionary mannually and feed it to
signal_autoconnect. Many tutorials do that. It is silly: it is tedious,
it is superfluous bloat, and the job has in fact aldready been done.
Write a class instead. Guido has made sure every class has a
dictionary. Just make sure you have class methods with names
corresponding to the signals. Pass a class reference to
signal_autoconnect.

* Don't grab references for every widget out of the xml. I've seen done
that in many tutorials too. It is silly. Just ask the xml for a
reference when you need one. The xml resources will store the widget
references for you, you don't need to save them anywhere else. Storing
a hundred widget references as class variables is tedious and
superfluous work, and does not do anything except bloating and slowing
your code.


 and getting data into and out of GUI widgets.

It does not save you the job of writing the GUI handlers! It saves you
the job of coding the  GUI (delegate that job to a graphical designer!)
and hooking up the handlers. But you still need to *write* the
handlers.


 That's the kind of boilerplate code that makes GUI
 development a pain in my opinion -- the actual GUI design/layout isn't so
 bad, especially with the spacer layout concept.

At least you get the GUI design out of the rest of your code. The
application logic still need to be there.

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


Re: MinGW and Python

2006-04-25 Thread Alex Martelli
sturlamolden [EMAIL PROTECTED] wrote:

 Robert Kern wrote:
 
  Dunno. Depends on the machine. Depends on the program. Depends on how
  the interpreter and any extension modules and underlying libraries were
  built. Depends on which Linux and which Windows.
 
  I'm sorry, but your question is a non sequitur. I don't understand its
  relevance to this thread.
 
 The relevance: Python is built with GCC on Linux. Do you or do you not
 see a performance hit on Linux?
 
 MinGW is GCC. Will you get a performance hit when building Python with
 MinGW?

I cannot predict this, though it would be great if somebody who does
have both VS2003 and mingw could give it a try.

What I did just post on another thread over the last couple of days is
about MacOSX, which also uses gcc: 14% faster pybench using Python 2.4.3
under Win2000 under Parallels Workstation beta, compared to 2.4.3
Universal directly on MacOSX -- the standard build of 2.4.3 in either
cause, i.e., the one built with MS compilers on Windows, vs the one
built with Apple's gcc on MacOSX.


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


Re: MinGW and Python

2006-04-25 Thread Alex Martelli
sturlamolden [EMAIL PROTECTED] wrote:

 Robert Kern wrote:
 
  - gcc does not optimize particularly well.
 
 That is beyond BS. The more recent gcc releases optimize as well as any
 commercial compiler. GCC 4 may even optimize better than MSVC.
 
 GCC is the compiler used to build the Linux kernel and MacOSX. If it
 can deal with this I say it can handle Python as well. My guess is you
 will not notice any performance difference for the Python interpreter.

That is quite possible, of course: if, for example, the 14% speed
difference I measured with pybench is representative, then you might not
notice it because human beings have a hard time noticing time
differences of that magnitude.  But it might still be there, easy to
measure, even though not to notice.

At the same time, if the 14% slowdown is representative, then it's not
true that the compiler responsible for it optimizes as well as the
other; indeed, does not optimize particularly well, under such a
hypothesis, would be far from a beyond BS assertion.


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


Re: Hooking things up in GUI application

2006-04-25 Thread sturlamolden

Ryan Ginstrom wrote:

 Yes, I've tried something similar with wxGlade.

But GLADE is not wxGlade :-)

wxGlade is a GUI designer for wxWidgets and wxPython. It looks a bit
like GLADE on the surface, but does not share any code with GLADE.

GLADE is a GUI designer for GTK, gtkmm, Mono, GNOME and PyGTK.

http://glade.gnome.org/
http://www.pygtk.org/
http://www.mapr.ucl.ac.be/~gustin/win32_ports/

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


Re: OOP / language design question

2006-04-25 Thread Carl Banks
Duncan Booth wrote:
 In other words, the object is constructed in Python before any __init__ is
 called, but in C++ it isn't constructed until after all the base class
 constructors have returned.

That's true.  Good point.


Carl Banks

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


Re: python application ideas.

2006-04-25 Thread Thomas Bartkus
Anthony Greene [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello, I know this isn't really a python centric question, but I'm seeking
 help from my fellow python programmers. I've been learning python for the
 past year and a half, and I still haven't written anything substantial nor
 have I found an existing project which blows my hair back. Python is my
 first language, and I plan on learning lisp within the next week but
 before I do so I'd like to write something meaningful, does anyone have
 any suggestions? Something they always needed, but never got around to
 writing it? Without an imagination you pretty much stagnate your whole
 learning process. Thanks in advance.

Just what is it, other than programming, that you have expertise in?
What kind of problems do you know how to solve?

 Without an imagination you pretty much stagnate your whole
 learning process.

So true!  Unfortunately, no one can provide you with one.
You have to develop that yourself.

Tis the conundrum of programming in general.  If all you know how to do is
write code - then you truly have nothing to do.  What *other* interests do
you have?  Hobbies? Job Skills?
What *does* blow your hair back ;-)

That's where your programming ideas need to come from.
Thomas Bartkus




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


Re: Zope 3

2006-04-25 Thread Steve Juranich
Derick van Niekerk wrote:

 I love Python! Then I was introduced to Zope by freak accident. While
 Zope looked like the answer to my dillemma, I still can't get my head
 wrapped around it. Is it because I don't know Python well enough? Or is
 it just that difficult to learn?

I've been hacking Python now for 6 years.  I just picked up Zope last month
and found the learning curve to be quite steep.  It's not just you. 
There's a lot of stuff there.

 I would like to start my next web project (a database of demographic
 info on scientists in Africa)  on Zope 3. Could anybody point me in the
 right direction? Where should I start?

After you look through the tutorial (which is simply a Zope product you can
add from the main page of the ZMI (Zope Management Interface), have a peek
at the Zope book
(http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/view).  Don't
worry about the version (2.6) of the book.  It's the latest they have (I
think they're working on a new one for z3).  You can skip the bits about
DTML, but keep them handy.

You should also take a look at the Zope user list:
http://mail.zope.org/mailman/listinfo/zope

Hope this all helps.
-- 
Steve Juranich
Tucson, AZ
USA

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


Re: OOP / language design question

2006-04-25 Thread bruno at modulix
Duncan Booth wrote:
 bruno at modulix wrote:
 
 
Duncan Booth wrote:
(snip)

Usually though, if a subclass doesn't immediately call the base class
constructors as the first thing it does in __init__ it indicates poor
code and should be refactored.

Not necessarily. It's a common case to have some computations to
do/some attributes to set in the derived class's __init__ before
calling the superclass's.

 
 
 I did only say 'usually'. Can you actually think of any good examples where 
 you have to set a derived attribute before you can call the base class 
 constructor? 

class Base(object):
  def __init__(self, arg1):
self.attr1 = arg1
self.dothis()

  def dothis(self):
return self.attr1

class Derived(Base):
  def __init__(self, arg1, arg2=0):
self.attr2 = arg2
Base.__init__(self, arg1)

  def dothis(self):
return self.attr1 + self.attr2

(snip)

 Perhaps if the base __init__ calls an overridden 
 method, but at that point it sounds to me like something wants refactoring.

Why so ? This is a well-known pattern (template method). I don't see
what's wrong with it.

 I can think that you might have to do some computations to calculate 
 parameters for the base __init__, but that is a separate issue.


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Zope 3

2006-04-25 Thread bruno at modulix
Benji York wrote:
 bruno at modulix wrote:
 
 Zope is a world in itself - and is certainly not the simplest tool to
 learn (nor the most pythonic).
 
 
 Those statements apply more to Zope 2 than Zope 3 (and Zope 2 is moving
 more and more toward Zope 3 these days).  One of Zope 3's main goals was
 to focus on the Python programmer as a primary target.  That being said
 there /are/ some powerful and novel concepts used in Z3 (the component
 framework).

While it's true that Zope3 is more 'python-programmer oriented' than
Zope2 - and probably much safer wrt/ developper's sanity -, it's still a
world on it's own, it's still a complex framework, and it's still not
very pythonic (IMHO based on 2+ years experience with Zope2, with or
without the CMF, and some time spent evaluating Zope3).

 You may want to consider other options like Django, Pylon or Turbogears.
 
 
 It's true that Z3 is not currently focused very well on the
 middle-class developer. 

That's an understatement !-)

 It's more of an industrial-strength kind of
 thing, but considerable thought has been given lately on how to build
 bridges so everyone can benefit without being full-time Zope masters.
 
 Toward that end, I wrote a little quick start guide that might help the
 OP: http://www.benjiyork.com/quick_start


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


How do I open a mysql database with python

2006-04-25 Thread Moishy Gluck
How do I open a mysql database with python. I nead a module that is
compatible with windows, and will be on any regular server I singup
with. if you could give me some documentation on the module that would
be good also.

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


  1   2   3   >