ANN: MoinMoin 1.5.1 (advanced wiki engine) released

2006-01-22 Thread Alexander Schremmer

   __
   /\/\   ___ (_)_ __   /\/\   ___ (_)_ __
  /\ / _ \| | '_ \ /\ / _ \| | '_ \   __
 / /\/\ \ (_) | | | | / /\/\ \ (_) | | | | |  /| |_
 \/\/\___/|_|_| |_\/\/\___/|_|_| |_|   |.__)

 
==
 MoinMoin 1.5.1 advanced wiki engine released
==

MoinMoin is an easy to use, full-featured and extensible wiki software
package written in Python. It can fulfill a wide range of roles, such as
a personal notes organizer deployed on a laptop or home web server,
a company knowledge base deployed on an intranet, or an Internet server
open to individuals sharing the same interests, goals or projects.

A wiki is a collaborative hypertext environment with an emphasis
on easy manipulation of information.


MoinMoin 1.5.1 is a bug fix release. It mainly addresses the issues that
slipped through the 1.5 release cycle. The 1.5 branch brings you
several new features such as the GUI editor, which allows the users
to edit pages in a WYSIWYG environment, and many bug fixes. The download
page: http://moinmoin.wikiwikiweb.de/MoinMoinDownload

Major bug fixes in 1.5.1

 * A race condition in the code, that conflicted with a broken copy.py in
   the std lib, was worked around in order to avoid DeepCopyErrors.
 * Unzipping was broken in 1.5.0.
 * Fixed the docutils version check.
 * Fixed a few Internet Explorer issues.

Major new features in 1.5
=

 * The WYSIWYG editor for wiki pages allows you to edit pages without 
   touching the markup. Furthermore, the wiki page is not stored as
   HTML after editing but kept as wiki markup in order to simplify
   the editing process for users that cannot or do not want to use the
   new editor.
 
 * AutoAdmin security policy allows users to gain admin permissions on 
   particular pages.
   
 * The new authentication system allows to add short methods that check the
   credentials of the user. This allowed us to add eGroupware single sign 
   on support.
   
 * Separation of homepages into a separate wiki (in a farm) and having a 
   single user database is supported.
   
 * A DeSpam action to allow mass-reverting of spam attacks.

 * PackageInstaller support for simplified installation of plugins, themes
   and page bundles. This enables you to decide in which languages help
   pages should be installed.

Note that Python 2.3.0 or newer is required.
For a more detailed list of changes, see the CHANGES file in the 
distribution or http://moinmoin.wikiwikiweb.de/MoinMoinRelease1.5/CHANGES

MoinMoin History


MoinMoin has been around since year 2000. The codebase was initally
started by Jürgen Hermann; it is currently being developed by a growing 
team. Being originally based on PikiPiki, it has evolved heavily since then 
(PikiPiki and MoinMoin 0.1 consisted of just one file!). Many large 
enterprises have been using MoinMoin as a key tool of their intranet, some 
even use it for their public web page. A large number of Open Source 
projects use MoinMoin for communication and documentation. Of course there 
are also many private installations.


More Information


 * Project site: http://moinmoin.wikiwikiweb.de/
 * Feature list: http://moinmoin.wikiwikiweb.de/MoinMoinFeatures
 * Download: http://moinmoin.wikiwikiweb.de/MoinMoinDownload
  * DesktopEdition: http://moinmoin.wikiwikiweb.de/DesktopEdition
 * This software is available under the GNU General Public License v2.
 * Changes: http://moinmoin.wikiwikiweb.de/MoinMoinRelease1.5/CHANGES
 * Known bugs: 
  * http://moinmoin.wikiwikiweb.de/KnownIssues
  * http://moinmoin.wikiwikiweb.de/MoinMoinBugs

sent by Alexander Schremmer for the MoinMoin team
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: New Python.org website?

2006-01-22 Thread Obaid R.
Terry Hancock wrote:
 On 18 Jan 2006 18:05:18 -0800
 Obaid R. [EMAIL PROTECTED] wrote:
  I hope it is not counted against me that I am the first
  one to point out that the logo is shaped like a cross.
 [...]

 Hey, looks more like a Yin-Yang symbol to me. ;-)


True. But I hope you are not arguing that since it looks to you like a
Yin-Yang that it makes it therefore not look like a cross. For even
Steve did say that there is no point arguing against what appears like
a matter of fact.


  And why ask with any trepidation, Steve? People of
  different backgrounds have dissimilar sensitivities. I
  hope you agree that it would be unfair to blame people for
  such deeply personal affairs. If trepidation on the part
  of even the Red Cross was enough to cancel such
  sensitivities, we would not have had a Red Crescent or a
  cooperation between them. If not proving one's
  subscription to some set of beliefs, such symbols at least
  disprove the same for others.

 No, I'm sorry, intolerance is bad, no matter who practices
 it. And what may be forgiveable on a battlefield is not
 forgiveable in my workplace.  I can understand that there
 were specific circumstances leading to the Red Cross/Red
 Crescent schism, and that it had to do with long standing
 religious intolerance on both sides. It doesn't make it an
 example to follow.



It is apparent that you know only part of the story. Kindly allow me to
comment here. Contrary to what you might have heard there was never
organized religious intolerance of Christianity by the Muslim side. To
give just one easy to follow fact of history, consider this: to this
day there are Arabic and Aramaic speaking Christians of Catholic,
Orthodox, and Coptic origins living in the Middle East. Some say about
twenty million or so. The Muslims who lived in modern day Spain, on the
other hand, were either wiped out or forcibly made to convert to
Christianity. And their numbers were in the hundreds of thousands if
not millions. And this is just one example.


 But sheesh, if I objected to every picture of the moon I
 see (or pictures that vaguely resemble a moon), I would be
 in a very sad state.  Come to think of it, I have a crescent
 as a background on my company website (it's Neptune, not
 Luna, but it certainly resembles a crescent moon more than
 that Python thing resembles a cross). Nevertheless, I am not
 Muslim.



But you see Terry, the point is not that it is just a picture. And
let's not forget that as far as we know the moon has always been a
natural part of all human life on this earth before and after Islam,
and even for those who never heard of Islam. And so the moon is not a
Muslim monopoly.

If the crescent was dropped altogether as an identifying symbol no
Muslim will lose sleep over it. Do you know why? Because it is not an
object of worship, Terry.

Here is Almighty God's command to us concerning the sun and moon:

Among His Signs are the Night and the Day, and the Sun and the Moon.
Do not prostrate to the sun and the moon, but prostrate to Allah, Who
created them, if it is Him ye wish to serve. (Translation, Glorious
Qur'an, 41: 37)


The crescent found its way on top of domes on Mosques only to point to
the direction of the Qibla in Mecca, where all Muslims face to pray.
When a Mosque is built the crescent on the dome is made to face
parallel to the direction of Qibla. The early Muslims could have chosen
any other symbol to point to the Qibla, but they choose the crescent
only to be different, and hence to be free from the consequences that
other symbols might bring. After all some of these symbols are more or
less worshiped. And here I am thinking of the cross.

I feel I must stress again that there is no intolerance here, brother.
It is hard to deny the fact that many people do kiss the cross, kneel
before the cross, and pray beneath the crucifix, is it not? If that is
not worship then what is? A Muslim who does that to the crescent is
no Muslim. Period. For a Muslim kneels to no one and worships no one
but Almighty God.

And just to point to you the significance of this in case you don't
know, the greatest sin in Islam is the worshiping of others (or things)
besides Almighty God, who has no equals.

Allah forgiveth not that partners should be set up with Him; but He
forgiveth anything else, to whom He pleaseth; to set up partners with
Allah is to devise a sin Most heinous indeed. (Translation, Glorious
Qur'an, 4: 48)


And so to summarize: even if I invent a product and place a crescent on
it, you are (as a non-Muslim) not under any obligation or threat of
confusing your support for your faith (whatever it may be), because the
moon is not a Muslim object of worship nor is it a Muslim monopoly. You
forcing the cross on a product that Muslims might use, on the other
hand, puts them in a difficult position. After all the cross seems like
an object of worship and it seems the indispensable source of identity
for Christianity.


  I do realize that I have no 

Re: Some thougts on cartesian products

2006-01-22 Thread Giovanni Bajo
Christoph Zwerschke wrote:

 Sometimes I was missing such a feature.
 What I expect as the result is the cartesian product of the strings.

I've been thinking of it as well. I'd like it for lists too:

 range(3)**2
[(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)]

-- 
Giovanni Bajo


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


Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
� wrote:
 Steve Holden wrote:
 
Tim Golden wrote:


[Steve Holden]

|   https://svn.python.org/www/trunk/beta.python.org

| but I don't know whether anonymous access is enabled. Maybe you can
let
|me know ...

Doesn't look like it. Asking me for authentication.

 
 
 I've finally gotten to install pyramid and build the very small and
 outdated subset of the beta pydotorg site. Obviously, I'd like to have
 access to the real data in the python.org SVN.
 
 
Rats, thanks for letting me know. As a first step I'd like to open up 
anonymous access to both the content and the site generation software, 
so that people can experiment with local content generation.

Then once someone knows how to use the system they can get a login for 
the SVN system and start editing site content.

I'll get back to the list with instructions ASAP. It may take a while 
due to inter-continental time differences and general overwork.
 
 

Hi,

I'm hopefully catching up with Andrew Kuchling today who can set up the
anonymous access for the data repo. Thanks for installing pyramid! Can
you give me any feedback on what parts of the install process were
painful.. I'm trying my best to improve the help text and make changes
to readme's etc.

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

Re: Arithmetic sequences in Python

2006-01-22 Thread Steve Holden
Paul Rubin wrote:
 Tom Anderson [EMAIL PROTECTED] writes:
 
listx/dictx/setx would be the display forms as well as the constructor forms.

Could these even replace the current forms? If you want the equivalent
of list(sometuple), write list(*sometuple). 
 
 
 The current list function is supposed to be something like a typecast:
 
list() isn't a function, it's a type.

   type(list)
type 'type'

  I'm not happy about the way the documentation represents types as 
functions, as this obscures the whole essence of Python's object 
orientation.


 list() = []
 xlist() = []   # ok
 
 list(list()) = []   # casting a list to a list does nothing
 xlist(xlist()) = [[]]  # make a new list, not the same
 
 list(xrange(4)) = [0,1,2,3]
 xlist(xrange(4)) = [xrange(4)]   # not the same
 
 list((1,2)) = [1,2]
 xlist((1,2)) = [(1,2)]
 
 etc.

I presume that here = means evaluates to?

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

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


Re: Error in Python documentation

2006-01-22 Thread Steve Holden
Peter wrote:
From http://www.python.org/doc/2.4.2/ go to the Library reference
 http://www.python.org/doc/2.4.2/lib/lib.html from there to the index
 (i) at http://www.python.org/doc/2.4.2/lib/genindex.html. In the index
 select 'p' and  click to reach
 http://www.python.org/doc/2.4.2/lib/types.html#l2h-90 . At the foot of
 this page is a link: See About this document... for information on
 suggesting changes. which if you follow takes you to
 http://www.python.org/doc/2.4.2/lib/about.html where there is:
 
  If you find specific errors in this document, either in the content or
 the presentation, please report the bug at the Python Bug Tracker at
 SourceForge.
 
 So you need to add a bug to the Python bug tracker -- at least so it
 seems. 
 
That's somewhat ingenuous, since that sentence is immediately preceded 
by General comments and questions regarding this document should be 
sent by email to [EMAIL PROTECTED] . I should have thought that 
inability to register a bug on Sourceforge would have justified an email 
to [EMAIL PROTECTED]

Did you send such an email? I'm sure that your comments would be actioned.

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

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


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Lawrence Oluyede
J [EMAIL PROTECTED] writes:

 I hope the title of this message indicates my question. I am looking
 for basic
 array functionality in Python and it turns out that there are all these
 packages which
 are somehow related. Some are allegedly discontinued but still seem to
 get updated. 

It's well explained in the homepage: numpy.scipy.org
AFAIK you should use numpy for future use.

-- 
Lawrence - http://www.oluyede.org/blog
Anyone can freely use whatever he wants but the light at the end
of the tunnel for most of his problems is Python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python.org website?

2006-01-22 Thread Steve Holden
Obaid R. wrote:
 Terry Hancock wrote:
 
On 18 Jan 2006 18:05:18 -0800
Obaid R. [EMAIL PROTECTED] wrote:

I hope it is not counted against me that I am the first
one to point out that the logo is shaped like a cross.

[...]

Hey, looks more like a Yin-Yang symbol to me. ;-)
 
 
 
 True. But I hope you are not arguing that since it looks to you like a
 Yin-Yang that it makes it therefore not look like a cross. For even
 Steve did say that there is no point arguing against what appears like
 a matter of fact.
 
 
And why ask with any trepidation, Steve? People of
different backgrounds have dissimilar sensitivities. I
hope you agree that it would be unfair to blame people for
such deeply personal affairs. If trepidation on the part
of even the Red Cross was enough to cancel such
sensitivities, we would not have had a Red Crescent or a
cooperation between them. If not proving one's
subscription to some set of beliefs, such symbols at least
disprove the same for others.

No, I'm sorry, intolerance is bad, no matter who practices
it. And what may be forgiveable on a battlefield is not
forgiveable in my workplace.  I can understand that there
were specific circumstances leading to the Red Cross/Red
Crescent schism, and that it had to do with long standing
religious intolerance on both sides. It doesn't make it an
example to follow.

 It is apparent that you know only part of the story. Kindly allow me to
 comment here.
[...]

Now, this is exactly the reason for the trepidation in my original reply.

Allow me to simply state, regardless of the content of the rest of this 
reply, that such discussions are completely off-topic for this list.

I have no objections to people holding or voicing religious beliefs, nor 
to discussions of history. It's simply that c.l.py is a very 
high-bandwidth list, and every off-topic thread reduces its usefulness 
for people seeking information about and assistance with Python.

Experience shows that this kind of exchange can expand and run on for 
days, so I'd be very grateful if the participants would take this 
discussion to private email or some other forum.

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

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


Re: Firefox bug in webbrowser module on Ubuntu?!

2006-01-22 Thread Jarek Zgoda
Paul Boddie napisał(a):

 There are certain ways to override the autodetection in use within that
 module, and a DESKTOP_LAUNCH environment variable can also be set to
 configure its behaviour further. Unfortunately, attempts to confirm the
 standardisation status of that variable failed to cut through the turf
 wars, newbie-bashing and MIME type hair-splitting on the xdg mailing
 list, but a Google search seemed to suggest that my application of it
 isn't inappropriate.

As this isn't yet actual standard but proposed only, I decided to give
my users ability to select preferred way to open media files, so even
running some exotic desktop (Fluxbox and FVWM are very popular choices
here) they can open urls from my application using either kfmclient,
gnome-open or custom defined command.

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to generate graphics dynamically on the web using Python CGI script?

2006-01-22 Thread Christoph Zwerschke
Xavier Morel wrote:
 Well, some people have been crazy enough lately to generate more or less 
 imageless bar graphs though, see Eric Meyer's Bar Graphs with Style 
 (http://meyerweb.com/eric/thoughts/2005/12/20/bar-graphs-with-style/) 
 for more informations on the subject 
 (http://meyerweb.com/eric/css/edge/bargraph/demo.html for a demo)

I think that can be sometimes a clever solution.
There's even a full VectorGraphics-Library available:
http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm

You don't even need a graphics lib and CGI program on the server to 
create the graphics, and no plug-in on the browser. Just CSS and 
JavaScript; it works with all modern browsers.

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


Re: OT: excellent book on information theory

2006-01-22 Thread Anton Vredegoor
Paul Rubin wrote:

 signal processing, for example.  Perhaps it could be improved by being
 more explicit about what the reader needs to know, and giving
 references to other books where the prerequisites can be found.

There are lots of good explanations, graphs, diagrams and such things
in the margins (I'm a few pages further in the book now) but the main
course seems to be mathematical formulas. The author should reverse the
roles these presentations play, move the archaic math jargon to the
margin, or better to a separate latech document, suitable for those
unwilling to join the rest of humanity.

A separate Python library would be handy too, and if not in the main
text it could still be useful for those who lack training in obscure
scientific dialects and want to understand things without any agreed
upon beforehand gibberish that is mainly meant to exclude those not in
the guild.

 I also don't think presenting the math in Python would make things any
 easier conceptually.  The math in Sussman and Wisdom's Structure and
 Interpretation of Classical Mechanics is all presented in Scheme, but
 it's still the same math that's normally presented as equations, and
 you have to think just as hard to understand it.

The problem for me is that I recognize many of the used concepts, but
they seem to be deliberately put in cryptic greek letters and
undecipherable gibberish. It would not be necessary to present the math
in Python, any reasonably consistent kind of pseudocode (but not Scheme
or math notation) would made things a lot more clear to me.

Something on a related subject with a presentation I like a bit better
(but it has its problems too, while your book has more of these nice
explanations and stuff, although in the margin):

http://www.math.mtu.edu/~kreher/cages.html

The authors of this book also seems to think we cannot do without
obscure math notation, something which I disagree with very much, but
at least they provide some pseudo code and some computer code,
unfortunately in C but still better than nothing. The text of the book
is not downloadable, but the algorithms source codes are.

All of the books writers seem to have not caught up with the idea of
hyperlinks and continue to dwell in neolithical paper dreams :-)

If they only woke up and let someone like me write some Visual Python
code to illustrate the algorithms or even let me just write Python
implementations of the algorithms to accompany the books, I'd probably
have work for years to come.

 Math is a beautiful subject, and is not at all secret or inaccessible.
 Try to broaden your horizons a bit ;-).

I hope you're not trying to outexpertize me. You seem to be thinking
that you know more about math than me, probably because you have a
formal education in the subject?

If so, you're proving my point, and thank you very much.

Anton

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


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Tom Anderson
On Sat, 21 Jan 2006, Robert Kern wrote:

 Tom Anderson wrote:

 Pardon my failure to RTFM, but does NumPy pick up the vecLib BLAS on Macs?

 Yes.

Excellent, thanks.

tom

-- 
forget everything from school -- you are programmer
-- 
http://mail.python.org/mailman/listinfo/python-list


Background/foreground on disabled Tkinter.Entry

2006-01-22 Thread Martyn Quick
If I create a Tkinter.Entry widget, I can adjust the background and the
text colours, using the background and foreground options.  However, if
the state is disabled, then this has no effect and it just appears as
grey on a light grey background.  E.g.,

Tkinter.Entry(root, foreground=black, background=white,
state=disabled).grid()

does not do what I expected.  What is the correct way to adjust the
foreground and background on disabled Entry widgets?

Thanks,

Martyn

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


Re: Background/foreground on disabled Tkinter.Entry

2006-01-22 Thread Fredrik Lundh
Martyn Quick wrote:

 If I create a Tkinter.Entry widget, I can adjust the background and the
 text colours, using the background and foreground options.  However, if
 the state is disabled, then this has no effect and it just appears as
 grey on a light grey background.  E.g.,

 Tkinter.Entry(root, foreground=black, background=white,
 state=disabled).grid()

 does not do what I expected.  What is the correct way to adjust the
 foreground and background on disabled Entry widgets?

tkinter has separate disabledbackground and disableforeground options for
this purpose:

http://www.effbot.org/tkinterbook/entry.htm#Tkinter.Entry.config-method

/F



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


Re: New Python.org website ?

2006-01-22 Thread Fredrik Lundh
   If I see this correctly, Fredrik would volonteer to (help) implement
   something that imports the current python.org content into a Wiki.
 
  Exactly.

 I don't really have time for this tonight, and I've spent more time copying
 and pasting stuff than working on the converter, but I've posted a couple
 of rough auto-conversions over at the moinmoin wiki:

 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg
 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg/CommunityPage
 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg/DevPage

for the curious, I've found a few more spare 15-minute slots, and a more
extensive (but still rough) translation is available here:

http://effbot.org/pydotorg/

the sample site contains ~600 pages.  each page has been automatically
translated from python.org sources to moinmoin markup, and then stored
in a moinmoin 1.5 instance.  a separate component has then extracted the
pages from moinmoin, and converted them XHTML fragments for rendering.

(the sample pages on that page are basically the XHTML fragments as is;
the final site generator should of course use a suitable templating system
and nice CSS for the final product).

(or maybe the entire site should be a run via a web framework with good
support for caching, such as

http://www.djangoproject.com/documentation/cache/

any django hackers around with some cycles to spare ? )

/F



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


Re: Decimal vs float

2006-01-22 Thread Kay Schluehr
Tim Peters wrote:
 [Kay Schluehr]
  I concur and I wonder why CAS like e.g. Maple that represent floating
  point numbers using two integers [1] are neither awkward to use nor
  inefficient.

 My guess is that it's because you never timed the difference in Maple
 -- or, perhaps, that you did, but misinterpreted the results.  You
 don't give any data, so it's hard to guess which.

 BTW, why do you think Maple's developers added the UseHardwareFloats option?

For no good reason at least not as a public interface. But since the
value of UseHardwareFloats is deduced from the accuracy ( Digits
environment variable ) a programmer has seldom to deal explicitely with
UseHardwareFloats. That means he pays for accuracy only, what is the
essential numerical information. I guess an analogy is the use of
integers in Python with the differerence that precision is replaced by
the amount of absolute value. The solution is so nice that I wonder why
floats and decimals could not be unified in a similar way?

  According to the Python numeric experts one has to pay a
  high tradeoff between speed and accuracy.  But as it seems it just
  compares two Python implementations ( float / decimal ) and does not
  compare those to approaches in other scientific computing systems.

 It's easy to find papers comparing the speed of HW and SW floating
 point in Maple.  Have you done that, Kay?

O.K. you are right here.

 For example, read:

 Symbolic and Numeric Scientific Computation in Maple
 K.O. Geddes, H.Q. Le
 http://www.scg.uwaterloo.ca/~kogeddes/papers/ICAAA02.ps

 Keith Geddes is a key figure in Maple's history and development, and
 can hardly be accused of being a Python apologist ;-)  Note that
 Example 1.5 there shows a _factor_ of 47 speed gain from using HW
 instead of SW floats in Maple, when solving a reasonably large system
 of linear equations.  So I'll ask again ;-):  why do you think Maple's
 developers added the UseHardwareFloats option?

 While that paper mentions the facility only briefly, Geddes and Zheng
 give detailed analyses of the tradeoffs in Maple here:

 Exploiting Fast Hardware Floating Point in High Precision Computation
 http://www.scg.uwaterloo.ca/~kogeddes/papers/TR200241.ps

 If you're uncomfortable reading technical papers, one bottom line is
 that they show that the time required by Maple to do a floating-point
 multiplication in software is at least 1000 times larger than doing
 the same with UseHardwareFloats set to true (and Digits:=15 in both
 cases).

No, it's perfect, Tim. Thanks for the links.

  By the way one can also learn from Maple how accuracy can be adjusted
  practically. I never heard users complaining about that.

 It's easy to change the number of digits of precision in Python's
 decimal module.

If I remember correctly it was Steve Holden who complained that
explaining accuracy by means of the decimal module would be a non issue
for beginners in Python. I have nothing to complain here ( o.k. nesting
two levels deep to set prec is less nice than having Digits offered by
the CAS immediately. But this is more cosmetic ).

Kay

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


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Sébastien Boisgérault

Robert Kern wrote:
 J wrote:
  I will just jump in an use NumPy. I hope this one will stick and evolve
  into the mother of array packages.
  How stable is it ? For now I really just need basic linear algebra.
  i.e. matrix multiplication, dot, cross etc

Same concern for me.

I discovered recently that I could not rely on numeric anymore
because 'eigenvalue' is now broken on my platform. This bug
has been referenced but not corrected AFAIK. Too bad that
numeric is not actively maintained anymore. Easy-to-install,
good doc, well-thought interface, really good stuff !

Bye-bye Numeric !

By the way, I tried numpy 0.9.4 10 minutes ago and guess
what ? 'eigenvalue' is broken too ... (hangs forever)

I do really hope the numpy will become the robust, best-of-breed
Python Array/Matrix lib that many people are waiting for. But in
the meantime, it's back to Matlab :(

SB

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


OpenGL

2006-01-22 Thread NaeRey
Hey, I've been searching for something like a PyOpenGL implementation
that allows Python to use OpenGL, found only a few projects and most
are either in beta and dead, or alpha stage.
Anyone knows a package thats currently being worked on and is
functional?
Thanks

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


Re: OpenGL

2006-01-22 Thread Will McGugan
NaeRey wrote:
 Hey, I've been searching for something like a PyOpenGL implementation
 that allows Python to use OpenGL, found only a few projects and most
 are either in beta and dead, or alpha stage.
 Anyone knows a package thats currently being worked on and is
 functional?
 Thanks
 

Something _like_ a PyOpenGL implementation? What about PyOpenGL itself?

http://pyopengl.sourceforge.net/


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


Re: OpenGL

2006-01-22 Thread Fredrik Lundh
NaeRey wrote:

 Hey, I've been searching for something like a PyOpenGL implementation
 that allows Python to use OpenGL, found only a few projects and most
 are either in beta and dead, or alpha stage.

http://pyopengl.sourceforge.net/

/F



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


Re: new.instancemethod as a form of partial()

2006-01-22 Thread Alex Martelli
[EMAIL PROTECTED] wrote:
   ...
 thanks. So in this special case, None is being treated as a flag
 rather than just an instance(I just read the doc) like any other
 instance and the behaviour is intended. Is there any reason why it is
 designed this way ?

I didn't yet know Python back when it was designed (dark ages, really),
but I assume the point was that, back then, we only had what's now the
legacy object model: bound methods could only be bound to instances,
classes were distinct from types, etc.  So, an im_self that wasn't an
instance had no possible normal meaning, and None was a handy
placeholder.  Of course, this design then couldn't be changed (nor can
it be now, until 3.0) to preserve backwards compatibility.

Guido has mused about abolishing unbound methods (in 3.0, I guess), so
there's hope for the future.  But a more complete 'partial' is likely to
be acceptable sooner than any fix to bound/unbound methods: I suspect
the only ingredient that's missing is a generous helping of irrefutable
use cases.


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


Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
I am running the following code:

import socket

host = '9.9.45.103'
port = 10001

conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect((host, port))

When conn.connect() is run, there can be two different exceptions:

socket.error: (10061, 'Connection refused')
socket.error: (10060, 'Operation timed out')

How can I set up exceptions for each of these differently? Normally I
would use:

except socket.error:
code goes here...

Of course, though, these are two separate error messages under the same
error handler though. I've tried:

except socket.error, (10061, 'Connection refused'):
and
except (socket.error, 10061, 'Connection refused'):

to no avail. What do I need to do to catch each one specifically?

Thanks,

Harlin Seritt

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


Re: New Python.org website ?

2006-01-22 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim Parkin wrote:
 [...] Thanks for installing pyramid! Can
 you give me any feedback on what parts of the install process were
 painful..

There was nothing particularly painful.

I tried to avoid having to install everything manually and to use the
packages that my system (Ubuntu 5.10) provides where possible. In the
end, this were only the Zope Interfaces and Twisted. Everything else was
either in too old versions in Ubuntu or not packaged.

- -- Gerhard
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD06YldIO4ozGCH14RAkJzAJ9SXjcDRnUIdkAVQIGCWiJyWKZHVwCgpsj6
irzdJP0rSR+IE81f5cAGkTU=
=u3i0
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some thougts on cartesian products

2006-01-22 Thread Kay Schluehr

Giovanni Bajo wrote:
 Christoph Zwerschke wrote:

  Sometimes I was missing such a feature.
  What I expect as the result is the cartesian product of the strings.

 I've been thinking of it as well. I'd like it for lists too:

  range(3)**2
 [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)]

 --
 Giovanni Bajo

But why isn't this interpreted as [0, 1, 4] like it is in Mathematica?

I would prefer a polymorphic distribute(*args) function ( or generator
) that acts on tuples of listlike objects of equal size. It could be
extended to distribute(*args[,default]) by a single default argument
that is inserted in the distribution table when two listlike objects
have not the same size. 

Kay

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


Concatinating PDF files

2006-01-22 Thread sophie_newbie
I am converting TIFF images of patents to PDF files. Each patent comes
in about 20 seperate TIFF images and I want to put them all in the one
PDF file. Is there a way to do this? Using the Image library I think
you can only convert individual TIFF images to PDF?

Maybe there is a way of concatinating these files or maybe there is a
way to create the PDF from the TIFFs in the first place?

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


Re: OpenGL

2006-01-22 Thread NaeRey
If you notice the project died, being latest release Jan2 2005. Thats
over a year old.

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


Re: Dynamic website content

2006-01-22 Thread sophie_newbie
Flushing to stdout doesn't seem to work anyway.

Honestly have no idea how you'd implement it in Javascript so might
have an ask on one of their forums...

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


Re: OpenGL

2006-01-22 Thread Fredrik Lundh
NaeRey wrote:

 If you notice the project died, being latest release Jan2 2005. Thats
 over a year old.

so?  OpenGL itself hasn't had a release since 2004.  that's even more dead.

/F



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


Re: New Python.org website ?

2006-01-22 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


I've also done some experimentation this weekend, and my solution would
be based on MoinMoin and KID.

Fredrik Lundh wrote:
 [...] and a more
 extensive (but still rough) translation is available here:
 
 http://effbot.org/pydotorg/
 
 the sample site contains ~600 pages.  each page has been automatically
 translated from python.org sources to moinmoin markup, and then stored
 in a moinmoin 1.5 instance.  a separate component has then extracted the
 pages from moinmoin, and converted them XHTML fragments for rendering.

Great.

This sounds a lot like the ugly hacked script I produced that would dump
all MoinMoin contents to XHTML in one directory, and the raw MoinMoin
sources to another directory:

http://ghaering.de/pydotorg/dumpwiki.py

 (the sample pages on that page are basically the XHTML fragments as is;
 the final site generator should of course use a suitable templating system
 and nice CSS for the final product). [...]

The other part of my experiment was a stupid build system that
recursively looks for KID files in a directory tree and renders them to
HTML.

My idea is that for each KID file there would be a corresponding
content.xml file that would come from the MoinMoin dump-to-XHTML (*).

As for the navigation, my solution would look like this:

  - each KID file uses a master KID template
  - the normal KID files do look about like this:

html py:extends='templates/layout.kid'
xmlns:py=http://purl.org/kid/ns#;

head
titleThe page title/title
/head

body

div py:replace=document('src/content.xml') /

/body
/html

i. e. all they do is define the page title, and include the content
XML file created from MoinMoin.

  - the make-like generator script will give each template its name as
a parameter, so that the template (and in particular the master
template) know what the current path is. Using this information, it can
render the left-side navigation bar appropriately.

  - If there really is a need to, additional processing instructions can
be put as comments in MoinMoin at the top of a wiki page, like:

## RENDER hideNav(/dev); expandNav(/about)

  As we also have access to the dumped raw MoinMoin sources, we could
parse these comments and handle them while rendering the KID templates.

IMO this system would be flexible enough to do all that the current one
can do, and integrate nicely with MoinMoin.

It would be not *ALL* dynamic via MoinMoin, but at least the contents
can be editied through a Wiki. Site structure would still be editied via
 the filesystem.

What do you think of an approach like this?

- -- Gerhard

(*) MoinMoin dumps do not always produce valid XHTML, so eventually I
still need a cleanup step.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD062EdIO4ozGCH14RAhoRAJ9pumD9LpKRohngbacHXSaub+zYtQCgmyHd
m9cCT2pXdRRIX0Qg+qdgMDM=
=hljf
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: new.instancemethod as a form of partial()

2006-01-22 Thread bonono

Alex Martelli wrote:
 Guido has mused about abolishing unbound methods (in 3.0, I guess), so
 there's hope for the future.  But a more complete 'partial' is likely to
 be acceptable sooner than any fix to bound/unbound methods: I suspect
 the only ingredient that's missing is a generous helping of irrefutable
 use cases.
So long the new partial() has this case covered, it is fine. As it
seems that this recipe
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 also
forgot this special case(down to the bottom, the current curry code).

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


Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Kay Schluehr [EMAIL PROTECTED] wrote:
   ...
   range(3)**2
  [(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2)]
   ...
 But why isn't this interpreted as [0, 1, 4] like it is in Mathematica?

Since range(3)*2 is [0, 1, 2, 0, 1, 2], it would be horribly, painfully
inconsistent if **2 was interpreted as square each item.


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


Re: Catching very specific exceptions

2006-01-22 Thread Alex Martelli
Harlin Seritt [EMAIL PROTECTED] wrote:

 except socket.error:
 code goes here...
 
 Of course, though, these are two separate error messages under the same
 error handler though. I've tried:
 
 except socket.error, (10061, 'Connection refused'):
 and
 except (socket.error, 10061, 'Connection refused'):
 
 to no avail. What do I need to do to catch each one specifically?

what I've done in such situations is

except socket.error, e:
  if e.errno == 10061:
 ...
  elif e.errno == 10060:
 ...
  else:
raise

Not sure the code in a socket.error has attributename 'errno', but I
hope you get the general idea.


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


Re: [Python for .NET] Any plans for supporting CLR2.0?

2006-01-22 Thread F. GEIGER
Terry Reedy wrote:

 
 F. GEIGER [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 I'm on .NET/CLR2.0 and would like to use some stuff from w/i Python. The
 Python for .NET file name suggests that CLR1.1 is needed. Is that
 right? Any known plans to change this?
 
 Most responders here use CPython.  The IronPython users mailing list,
 mirrored as gmane.comp.python.ironpython.users (see gmane.org) would more
 likely give you an authoritative answer.

Sorry, for not being precise about Python for .NET: I didn't mean
IronPython, which I'am aware of, I meant
http://www.zope.org/Members/Brian/PythonNet

 
 Terry J. Reedy

Kind regards
Franz GEIGER


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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Kay Schluehr schrieb:
 But why isn't this interpreted as [0, 1, 4] like it is in Mathematica?

Because we are thinking of a cartesian product. If you have lists of 
numbers, then there are mane more ways to define a product: tensor 
product, vector product, scalar product, componentwise product...

The cartesian product is a much more generic concept, you can have it 
already for sets:

class sset(set):

 def __mul__(self, other):
 return sset((a,b) for a in self for b in other)

 def __pow__(self, other):
 if isinstance(other, int) and other  0:
 if other == 1:
 return self
 elif other == 2:
 return self*self
 else:
 return sset(a + (b,) \
 for a in self**(other-1) for b in self)

Example:

for x in sorted(sset(ACGU)**3):
 print ''.join(x)

AAA
AAC
AAG
AAU
ACA
ACC
.
.
.
UGU
UUA
UUC
UUG
UUU

Now as I'm thinking about it, wouldn't it be nice to have the cartesian 
products on Python sets? Maybe also a method that returns the power set 
of a set (the set of all subsets), or the set of all subsets with a 
given length. You could get a 6/49 lotto tip with something like:

choice(set(range(49)).powerset(6))

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


Re: [Python for .NET] Any plans for supporting CLR2.0?

2006-01-22 Thread Ziga Seilnacht
F. GEIGER wrote:

 Sorry, for not being precise about Python for .NET: I didn't mean
 IronPython, which I'am aware of, I meant
 http://www.zope.org/Members/Brian/PythonNet

 Kind regards
 Franz GEIGER

Python for .NET has a separate list, see:
http://mail.python.org/mailman/listinfo/pythondotnet .

Ziga Seilnacht

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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Alex Martelli wrote:
 Kay Schluehr [EMAIL PROTECTED] wrote:
 range(3)**2
 But why isn't this interpreted as [0, 1, 4] like it is in Mathematica?
 
 Since range(3)*2 is [0, 1, 2, 0, 1, 2], it would be horribly, painfully
 inconsistent if **2 was interpreted as square each item.

Yes. Python does not interpreate the product of a list with a number as 
a scalar product. Otherwise range(3)*2 should be [0, 1, 4] as well.

For doing such things I would use a vector subtype of list.

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


Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke [EMAIL PROTECTED] wrote:
   ...
 given length. You could get a 6/49 lotto tip with something like:
 
 choice(set(range(49)).powerset(6))

And that would be better than the current random.sample(range(49),6) in
WHAT ways, exactly...?


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


Re: timeout a process

2006-01-22 Thread iapain
Thanks Tim, Yeah win32api is working normally.

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


Re: Some thougts on cartesian products

2006-01-22 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes:
  given length. You could get a 6/49 lotto tip with something like:
  choice(set(range(49)).powerset(6))
 
 And that would be better than the current random.sample(range(49),6) in
 WHAT ways, exactly...?

I think the first one would be incorrect since it samples with
replacement.  At least, it looks like it does.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote:

 Alex Martelli wrote:
 Kay Schluehr [EMAIL PROTECTED] wrote:
 range(3)**2
 But why isn't this interpreted as [0, 1, 4] like it is in Mathematica?
 
 Since range(3)*2 is [0, 1, 2, 0, 1, 2], it would be horribly, painfully
 inconsistent if **2 was interpreted as square each item.
 
 Yes. Python does not interpreate the product of a list with a number as 
 a scalar product. Otherwise range(3)*2 should be [0, 1, 4] as well.
 
 For doing such things I would use a vector subtype of list.

Not everything needs to be a separate class! Why create a magic class for
every piece of functionality you want? Just create functions that operate
on existing classes!

Instead of a class that supports cartesian products, make a function that
takes two sequences and returns the cartesian product of them. (This will
likely be best implemented as a generator.) If you write it properly,
which is to say if you don't go out of your way to break it, this function
will *automatically* work on any sequence type, lists, tuples, strings,
and things you and I haven't even thought of.

What advantage is there to creating a list with cartesian product
subclass of list?



-- 
Steven.

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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Alex Martelli schrieb:
 Christoph Zwerschke [EMAIL PROTECTED] wrote:
...
 given length. You could get a 6/49 lotto tip with something like:

 choice(set(range(49)).powerset(6))

 And that would be better than the current random.sample(range(49),6) in
 WHAT ways, exactly...?

You're right, random.sample(range(49),6) does the same and much faster. 
I just didn't think of it (it is new since Python 2.3).

What if you need 12 different tips for your lotto ticket?

s = set(range(49)).powerset(6)
for x in range(10):
 print s.pop()

But the real disadvantage of this idea is the memory consumed and the 
time to set up that memory: set(range(49)).powerset(6) has a cardinality 
of about 13 million entries! You PC would start to swap just for getting 
a lotto tip...

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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote:
 On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote:
 For doing such things I would use a vector subtype of list.
 
 Not everything needs to be a separate class! Why create a magic class for
 every piece of functionality you want? Just create functions that operate
 on existing classes!
 
  What advantage is there to creating a list with cartesian product
  subclass of list?

Principally, you're right (see also my example with iterators).

But I can still see two reasons for classes:

1) That function would have to make a lot of case distinctions (check 
the types of operands). If you have a class, you already know the type 
of the operands (at least one).

2) It allows you to write a*b instead of mul(a,b) which looks nicer.

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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Paul Rubin schrieb:
 [EMAIL PROTECTED] (Alex Martelli) writes:
 given length. You could get a 6/49 lotto tip with something like:
 choice(set(range(49)).powerset(6))
 And that would be better than the current random.sample(range(49),6) in
 WHAT ways, exactly...?
 
 I think the first one would be incorrect since it samples with
 replacement.  At least, it looks like it does.

No, the elements of the powerset would be sets with 6 elements each, not 
tuples. So technically, it would be correct. Just horribly inefficient.

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


Re: ConfigParser: writes a list but reads a string?

2006-01-22 Thread Jeffrey Barish
funkyj wrote:

 making the config file XML and using xml.dom is another option,
 although XML is a bit ugly to edit by hand.
   --jfc
 
I am seriously intrigued by ConfigObj.  I am currently using an crude
improvisation involving tab-delimited fields to store metadata for
recordings -- not configuration data -- in text files.  I had been planning
to convert to XML, but now I am wondering whether ConfigObj would be
easier.  I would like for the metadata files to be editable, but editing
does not have to be easy as it needs to be done rarely.  I've never used
XML, so I am wondering whether there are other tradeoffs between that
approach and ConfigObj that I should be aware of.  I was thinking of XML
mainly to have a more robust format.  For example, it would be nice if it
were possible to add fields without obsoleting early versions of the
reader.  Crossplatform compatibility is also desirable.
-- 
Jeffrey Barish

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


Re: Concatinating PDF files

2006-01-22 Thread [EMAIL PROTECTED]
ReportLab maybe?

http://www.reportlab.org/rl_toolkit.html

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


Re: Background/foreground on disabled Tkinter.Entry

2006-01-22 Thread Martyn Quick
Thanks v. much.
I'd missed that in the documentation I have access to.

Martyn

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


Re: New Python.org website ?

2006-01-22 Thread Adrian Holovaty
Fredrik Lundh wrote:
 (or maybe the entire site should be a run via a web framework with good
 support for caching, such as

 http://www.djangoproject.com/documentation/cache/

 any django hackers around with some cycles to spare ? )

Yeah, I or other Django folks would be quite happy to set that up. Just
let me know!

Adrian

-- 
Adrian Holovaty
holovaty.com | chicagocrime.org | djangoproject.com

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


Re: Some thougts on cartesian products

2006-01-22 Thread Paul Rubin
Christoph Zwerschke [EMAIL PROTECTED] writes:
 No, the elements of the powerset would be sets with 6 elements each,
 not tuples. So technically, it would be correct. Just horribly
 inefficient.

Oh I see, not the Cartesian product.  Yeah, it would be silly in
practice.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python.org website ?

2006-01-22 Thread Shalabh Chaturvedi
Fredrik Lundh wrote:
 If I see this correctly, Fredrik would volonteer to (help) implement
 something that imports the current python.org content into a Wiki.
 Exactly.
 I don't really have time for this tonight, and I've spent more time copying
 and pasting stuff than working on the converter, but I've posted a couple
 of rough auto-conversions over at the moinmoin wiki:

 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg
 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg/CommunityPage
 http://moinmoin.wikiwikiweb.de/FredrikLundh/PythonOrg/DevPage
 
 for the curious, I've found a few more spare 15-minute slots, and a more
 extensive (but still rough) translation is available here:
 
 http://effbot.org/pydotorg/
 

This is awesome. Any chance we can get our hands on the scripts or the 
MM markup files?

Shalabh

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


Tkinter Mouse Cursor

2006-01-22 Thread gregarican
Checking a couple of examples I tried changing the Tkinter mouse cursor
to indicate a busy state while my app is pushing/pulling xmlrpc data.
It doesn't seem to make a difference as I don't notice the cursor
actually change in the span of the 3-5 second transaction. I tried
changing the cursor of the root widget, the toplevel widget, etc. all
to no avail. Is there something really basic I'm overlooking?  Is it
enough to just change the state and that's it, or do I have to
explictly refresh things?

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


Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Steven D'Aprano [EMAIL PROTECTED] wrote:
   ...
 What advantage is there to creating a list with cartesian product
 subclass of list?

Essentially, syntax sugar -- for some people, being able to code a*b
rather than product(a,b) takes on a huge significance; Python chooses to
support this syntax variation by special methods in classes, and thus
encourages people to create classes if they're keen on the syntax.


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


Re: Some thougts on cartesian products

2006-01-22 Thread Alex Martelli
Christoph Zwerschke [EMAIL PROTECTED] wrote:

 Alex Martelli schrieb:
  Christoph Zwerschke [EMAIL PROTECTED] wrote:
 ...
  given length. You could get a 6/49 lotto tip with something like:
 
  choice(set(range(49)).powerset(6))
 
  And that would be better than the current random.sample(range(49),6) in
  WHAT ways, exactly...?
 
 You're right, random.sample(range(49),6) does the same and much faster.
 I just didn't think of it (it is new since Python 2.3).

Yep, it's one of 2.3's many little gems.  Still, builtin set is new in
2.4, so it's hardly a more classic approach;-).


 What if you need 12 different tips for your lotto ticket?

You probably want random ones, then...

 s = set(range(49)).powerset(6)
 for x in range(10):
  print s.pop()

This is very systematic, not random;-).  Still, using random.sample on s
would indeed produce 12 random different tips!-)

 But the real disadvantage of this idea is the memory consumed and the
 time to set up that memory: set(range(49)).powerset(6) has a cardinality
 of about 13 million entries! You PC would start to swap just for getting
 a lotto tip...

Well then, you need a new PC, 64-bit and with as many GB of RAM as
required, no?-)

Until you get such a PC, something like:

tips = set()
while len(tips)  10:
  tip = frozenzet(random.sample(range(49), 6))
  tips.add(tip)

will have to suffice, I guess;-).


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


Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
Gerhard Häring wrote:


 The other part of my experiment was a stupid build system that
 recursively looks for KID files in a directory tree and renders them to
 HTML.

 My idea is that for each KID file there would be a corresponding
 content.xml file that would come from the MoinMoin dump-to-XHTML (*).

 As for the navigation, my solution would look like this:

   - each KID file uses a master KID template
   - the normal KID files do look about like this:

 html py:extends='templates/layout.kid'
 xmlns:py=http://purl.org/kid/ns#;

 head
 titleThe page title/title
 /head

 body

 div py:replace=document('src/content.xml') /

 /body
 /html

 i. e. all they do is define the page title, and include the content
 XML file created from MoinMoin.

   - the make-like generator script will give each template its name as
 a parameter, so that the template (and in particular the master
 template) know what the current path is. Using this information, it can
 render the left-side navigation bar appropriately.

   - If there really is a need to, additional processing instructions can
 be put as comments in MoinMoin at the top of a wiki page, like:

 ## RENDER hideNav(/dev); expandNav(/about)

   As we also have access to the dumped raw MoinMoin sources, we could
 parse these comments and handle them while rendering the KID templates.

 IMO this system would be flexible enough to do all that the current one
 can do, and integrate nicely with MoinMoin.

 It would be not *ALL* dynamic via MoinMoin, but at least the contents
 can be editied through a Wiki. Site structure would still be editied via
  the filesystem.

 What do you think of an approach like this?

 -- Gerhard

 (*) MoinMoin dumps do not always produce valid XHTML, so eventually I
 still need a cleanup step.

It sounds very similar to what we have already built!! What we have also
parses yaml files, rest files, inline rest content, has special
renderers for navigation and breadcrumbs and handles cacheing of built
data to speed generation. It also keeps the format of all original
documents intact and can handle the differences in encodings that exist
in the current content. It will also include static html files (such as
some of the summaries and a lot of the pycon content), data structures
(the sigs and some other sections of the site), custom functionality
needed to remove emails from certain documents and the render some
custom data elements (peps) and the ability to add custom sidebar
elements. It also retains the ability to render complex page layouts on
the occasion they are needed. There is also a module being added that
will parse the current docs and rerender them within the site framework
adding a hierarchical navigation system.

With regards to integrating wiki content, it also has a beta directive
to include content from a wiki so there could be a good overlap here
between keeping the data stored in text files in subversion (a
requirement) and using moinmoin to help manage the content.

The goal will be to add a wiki-like rest editor that could also handle
the non-wiki/non-rest like content (such as sigs, peps, mirrors,
donations, jobs, members, psf meeting minutes, etc).

Tim



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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Generally, if you could multiply strings in the above fashion, you could 
spare one more more sub loops, as in this example:

for f in ('index', 'default')*('.html', '.htm', '.shtml'):
if exists(f):
break

In this case, it would be not really be better than that:

for f in 'index', 'default':
for e in '.html', '.htm', '.shtml':
if exists(f+e):
break

The password cracking was already a better example.

But this would be only efficient if the product of two strings is 
returned as a generator, not a list. And I don't know if you really 
would expect that, since multiplying a string or a list with a number 
does not change its type.

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


Re: Catching very specific exceptions

2006-01-22 Thread Peter Hansen
Alex Martelli wrote:
 what I've done in such situations is
 
 except socket.error, e:
   if e.errno == 10061:
  ...
   elif e.errno == 10060:
  ...
   else:
 raise
 
 Not sure the code in a socket.error has attributename 'errno', but I
 hope you get the general idea.

If it does not, or as a more generally applicable solution (though less 
readable), one can use the args attribute:

except socket.error, e:
if e.args[0] == 10061:
   ...
elif e.args[0] == 10060:
   ...

args is just the tuple formed from the positional arguments passed to 
the __init__() of the exception object when it is created, as if you did:

class Exception:
def __init__(self, *args):
   self.args = args


-Peter

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


Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 10:41:39 -0800, Alex Martelli wrote:

 Steven D'Aprano [EMAIL PROTECTED] wrote:
...
 What advantage is there to creating a list with cartesian product
 subclass of list?
 
 Essentially, syntax sugar -- for some people, being able to code a*b
 rather than product(a,b) takes on a huge significance; Python chooses to
 support this syntax variation by special methods in classes, and thus
 encourages people to create classes if they're keen on the syntax.

I beg to differ: Python *allows* people to create classes if they're keen
on the syntax (and I can sympathise with that like), but Python
*encourages* by example generic tools that operate on as many different
types as makes sense.


-- 
Steven.

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


Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote:
 I beg to differ: Python *allows* people to create classes if they're keen
 on the syntax (and I can sympathise with that like), but Python
 *encourages* by example generic tools that operate on as many different
 types as makes sense.

But these generic tools (say the pow function) in turn simply use the 
methods defined by the classes.

-- Christoph

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


Re: Tkinter Mouse Cursor

2006-01-22 Thread gregarican
Please disregard. I just issued an update() method call to refresh the
GUI. This in turn displayed the proper mouse cursor that was being set
with the config(cursor=xxx) method.

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


Re: New Python.org website ?

2006-01-22 Thread Fredrik Lundh
Tim Parkin wrote:

 It sounds very similar to what we have already built!! What we have also
 parses yaml files, rest files, inline rest content, has special
 renderers for navigation and breadcrumbs and handles cacheing of built
 data to speed generation.

except that it isn't: you're talking about a modernized version of
the current HT2HTML/make system, we're talking about a purely
wiki-driven system.

if we add django to the mix, the pages shown to the user won't
even exist on disk.

/F



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


Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Alex Martelli) wrote:

 Harlin Seritt [EMAIL PROTECTED] wrote:
 
  except socket.error:
  code goes here...
  
  Of course, though, these are two separate error messages under the same
  error handler though. I've tried:
  
  except socket.error, (10061, 'Connection refused'):
  and
  except (socket.error, 10061, 'Connection refused'):
  
  to no avail. What do I need to do to catch each one specifically?
 
 what I've done in such situations is
 
 except socket.error, e:
   if e.errno == 10061:
  ...
   elif e.errno == 10060:
  ...
   else:
 raise

This is not portable, however.  I'm guessing you're running on Windows, 
because the 10061 corresponds to:

{WSAECONNREFUSED, Connection refused},

in Python-2.3.4/Modules/socketmodule.c:set_error().  See 
http://tinyurl.com/gth2 for more winsock error codes.

It would be nice if the socket library threw more specific exceptions, but 
given that the underlying operating systems export such a wide variety of 
system-level errors, it's not clear it's feasible, even if one wanted to 
put the effort into it.  Which brings us back to having to resort to 
unportable tricks like the above to decipher the inner meaning.

But, the real question is, WHY do you want to differentiate between these?  
The only reason to want to know which kind of connection failure you got is 
because you want to do something different on some errors.  What are you 
going to do differently when you get one of these?

socket.error: (10061, 'Connection refused')
socket.error: (10060, 'Operation timed out')

Operationally, they're pretty much the same.  One might guess that on a 
timeout, it's worth waiting a while and trying again, but it may be worth 
doing that on a refusal as well.  Perhaps you caught the remote system 
right after a reboot when the kernel network code is up, but the particular 
service you're trying to connect to hasn't started yet?  Perhaps there's 
some kind of load-limiting in use?  Perhaps the remote system is validating 
connections by reverse DNS checks, and inconsistent DNS caches are causing 
some connections to fail while others succeed?  Any of these might deserve 
a retry.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some thougts on cartesian products

2006-01-22 Thread Steven D'Aprano
On Sun, 22 Jan 2006 19:12:49 +0100, Christoph Zwerschke wrote:

 Steven D'Aprano wrote:
 On Sun, 22 Jan 2006 18:29:45 +0100, Christoph Zwerschke wrote:
 For doing such things I would use a vector subtype of list.
 
 Not everything needs to be a separate class! Why create a magic class for
 every piece of functionality you want? Just create functions that operate
 on existing classes!
  
   What advantage is there to creating a list with cartesian product
   subclass of list?
 
 Principally, you're right (see also my example with iterators).
 
 But I can still see two reasons for classes:
 
 1) That function would have to make a lot of case distinctions (check 
 the types of operands). If you have a class, you already know the type 
 of the operands (at least one).

If you are happy to always return a list of tuples regardless of what the
two operands are, generators make it so easy it is shameful. Even if you
want a special case of two string arguments returning a string, it is
hardly any more difficult:

def cartprod(A, B):
if type(A) == type(B) == str:
convert = lambda obj: .join(list(obj))
else:
convert = lambda obj: obj  # do nothing
for a in A:
for b in B:
yield convert((a, b))

Notice that the *only* reason we look at the type of the arguments is
because we want two strings to return a string. If we don't care about
that, the generator is less than half the size:

def cartprod(A, B):
for a in A:
for b in B:
yield (a, b)



That's a generator giving you the products one at a time. For the
benefit of anyone out there who doesn't know about generators, you use it
like this:

 cprods = cartprod([1,2,3], abc)
 for t in cprods:
... print t
...
(1, 'a')
(1, 'b')
(2, 'a')
(2, 'b')
(3, 'a')
(3, 'b')

If you want them all at once, memory allowing, you do this:

 cprods = cartprod([1,2,3], abc)
 list(cprods)
[(1, 'a'), (1, 'b'), (2, 'a'), (2, 'b'), (3, 'a'), (3, 'b')]




 2) It allows you to write a*b instead of mul(a,b) which looks nicer.

But not as clear as cartprod(a,b) or even cartesian_product(a,b).


-- 
Steven.

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


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Robert Kern
Sébastien Boisgérault wrote:

 By the way, I tried numpy 0.9.4 10 minutes ago and guess
 what ? 'eigenvalue' is broken too ... (hangs forever)

On what platform? Are you linking against an optimized BLAS? We can't fix
anything without details. I'll be happy to work with you on this bug over on the
numpy-discussion list.

-- 
Robert Kern
[EMAIL PROTECTED]

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

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

Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Carl Cerecke
Bengt Richter wrote:
 On Thu, 19 Jan 2006 23:16:57 -0500, Peter Hansen [EMAIL PROTECTED] wrote:

 How about something like
 
   actions = dict(
  ...a=compile('print A; state=b','','exec'),
  ...b=compile('print B; state=c','','exec'),
  ...c=compile('print C; state=None','','exec')
  ... )
   state = 'a'
   while state: eval(actions[state])
  ...
  A
  B
  C

Good idea. But we can eliminate the dictionary lookup:

a1 = compile('print A; state=b1','','exec')
b1 = compile('print B; state=c1','','exec')
c1 = compile('print C; state=None','','exec')

state = a1
while state:
 eval(state)


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


Dominant color PIL

2006-01-22 Thread Sebastjan Trepca
Hi!I was wondering is it possible to find out which colour is dominant in an image using PIL? It would be very easy to create interesting mozaic images with that :)Thanks, Sebastjan
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Some thougts on cartesian products

2006-01-22 Thread Christoph Zwerschke
Steven D'Aprano wrote:
 If you are happy to always return a list of tuples regardless of what the
 two operands are, generators make it so easy it is shameful. Even if you
 want a special case of two string arguments returning a string, it is
 hardly any more difficult:
 
 def cartprod(A, B):
 if type(A) == type(B) == str:
 convert = lambda obj: .join(list(obj))
 else:
 convert = lambda obj: obj  # do nothing
 for a in A:
 for b in B:
 yield convert((a, b))

I didn't deny that it's handy; my imul example was pretty much the 
same. If you don't want to use the a*b syntax, it's a good solution.

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


Re: [XML-SIG] Howto create this XML string?

2006-01-22 Thread Sbaush
Thanks all, i've perfectly undestand the way. Thanks again.2006/1/19, Luis Miguel Morillas [EMAIL PROTECTED]:
2006/1/19, Sbaush [EMAIL PROTECTED]:

Hi all.I've this XML:manager request append mode=INPUT method type=GOOD/ source address=



127.0.0.1/ action option=OK/ /append /request/managerHow can i write this in a Python String? I would like use a xml.dom



 implementation and not a banal print...print...I can't do it... Is there anyone that can explain me what is the way?Thank you!Another taste with amara:import amara
doc = amara.create_document
(umanager)doc.manager.xml_append(doc.xml_create_element(u'request'))doc.manager.request.xml_append(doc.xml_create_element( u'append', attributes={u'mode':u'INPUT'}))doc.manager.request.append.xml_append

(doc.xml_create_element( u'method', attributes={u'type':u'GOOD'}))doc.manager.request.append.xml_append(doc.xml_create_element( u'source', attributes={u'source':u'

127.0.0.1'}))doc.manager.request.append.xml_append(doc.xml_create_element( u'action', attributes={u'option':u'OK'}))print doc.xml(indent='yes') 

--Luis Miguel

___XML-SIG maillist - XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig-- Sbaush
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website?

2006-01-22 Thread Tony Meyer
 But sheesh, if I objected to every picture of the moon I
 see (or pictures that vaguely resemble a moon), I would be
 in a very sad state.

 But you see Terry, the point is not that it is just a picture. And
 let's not forget that as far as we know the moon has always been a
 natural part of all human life on this earth before and after Islam,
 and even for those who never heard of Islam. And so the moon is not a
 Muslim monopoly.

Perhaps you're not aware of this, but the 'plus' shape existed before  
Christianity, too.

=Tony.Meyer
-- 
http://mail.python.org/mailman/listinfo/python-list


Multiplication Station (wxPython/PyGame/OpenSource GPL)

2006-01-22 Thread ccosse
Hello,

just to announce a new version of Multiplication Station available at
http://www.asymptopia.org. Multiplication Station is an OpenSource math
education game. It will teach your child basic maths, guaranteed. It is
multi-user, has a countdown timer and tracks high scores.  All
parameters are configurable through the simple admin interface.  Please
visit to download a copy today. Certified GPL OpenSource.

Asymptopia Software | [EMAIL PROTECTED]

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


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Szabolcs Nagy

 Basically all I need is vectors and 3x3 matrices.

hmm
is numpy really efficient for 3x3 (or 4x4) matrices and vectors?

IMHO an optimized matrix4x4 class can be much faster (i'm just guessing
here)

eg cgtypes is a simple c++ implementation with boost-python wrapper:
http://cgkit.sourceforge.net/

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


yet another list compr. suggestion

2006-01-22 Thread palo
I appologize for suggesting (though very humbly) a syntax extension
(maybe particularly idiotic) but just as a wild fantasy, what would you
think about this:
as a substitute for filter, people often use
[x for x in y if z(x)]
The suggestion is that the same result could be achieved by
[x in y if z(x)]

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


Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Thanks for the effort on this last post, Roy. You asked what I was
hoping to do differently on these two very minutely different error
messages. What I have been trying to do for some time is to write a
ping client (for Win32 platform -- Yes, I develop almost exclusively
for Win32 environment, unfortunately) that would be a bit less buggy
than ones already written, avoid Twisted, and not even involve myself
in pynms (way overkill for what I want and need).

I am finding that with the many quirks (and really bad foundation for
Win32 APIs) that I am having to write a lot of voodoo code so to speak.
If I use a dummy port... let's say port 10001 for example... I can
attempt to connect to a machine at this port. If I get an error that
says Connection refused, I know that the node is up but is just not
going to allow a connection. On the other hand, if I try to connect to
a node and it's really not up, I'll get a Connection timed out error.
In this manner I can really tell if a node is up or not (providing a
TCP/IP stack is installed there). This really what I've wanted. I am
not so concerned whether or not the node pongs back in a certain amount
of time.

Yeah normally it's annoying when people ask what you're trying to do
when you ask a specific question, but in this case it's probably
necessary to explain myself before some are willing to help out. I'm
really not interested in even negotiating a successful connection on a
specific port, but this is just a way to tell if something is up or
down (and perhaps the only real way to do it running from a Win32
platform). Thanks for the help. However, if you do have suggestions on
how to get this done better, I am more than glad to hear it!

Thanks,

Harlin Seritt

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


Re: yet another list compr. suggestion

2006-01-22 Thread Alan Franzoni
palo on comp.lang.python said: 

 The suggestion is that the same result could be achieved by
 [x in y if z(x)]

It's just a special case... and it saves very few carachters... I don't
think it would justify an update to the parser. What if you want to do
something like:

[str(x) for x in y if z(x)]

You've got to stick to the present syntax.

-- 
Alan Franzoni [EMAIL PROTECTED]
-
Togli .xyz dalla mia email per contattarmi.
Rremove .xyz from my address in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
-- 
http://mail.python.org/mailman/listinfo/python-list


calling python from C#...

2006-01-22 Thread Mr BigSmoke
Hi everybody,
I need write an application in c#, but i wnat to use some functions
that i have already written in python. Is there an easy way to call
my python code from c#? I must use COM or there are other ways? And, if
COM is the only way, where can i find some tutorials or examples? I've
never wrote com server and i really don't know where and how to
start
tnx
Fabio

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


Re: yet another list compr. suggestion

2006-01-22 Thread palo
you'd save more characters in
[not_very_convenient_name for not_very_convenient_name in y if z]
(just kidding)

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


Re: yet another list compr. suggestion

2006-01-22 Thread palo
you'd save more in

[not_very_convenient_name for not_very_convenient_name in y if z]

(just kidding)

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


Re: New Python.org website ?

2006-01-22 Thread Paul Boddie
Fredrik Lundh wrote:

 for the curious, I've found a few more spare 15-minute slots, and a more
 extensive (but still rough) translation is available here:

 http://effbot.org/pydotorg/

I've also been messing around with different content sources, and the
results can be viewed here:

http://www.boddie.org.uk/python/python-site/index.html

The infrastructure isn't that impressive: I just take some RSS feeds
and XBEL bookmarks files, add some results from parsing the
PythonEvents page on the Wiki, put them into an XML document, and then
render the different pages using some XSLT-based templates. Not exactly
a top-end portal solution, but does it have to be?

Of course, the above works for simple portal-like overview pages, but
for the real textual content you'd have to make use of more
sophisticated sources than feeds and bookmarks. Arguably, organising,
retrieving and presenting such content is the hard part of a project
like this, and it would be interesting to see how the Wiki could be
used for such purposes whilst maintaining a certain level of coherency
lacking in parts of the current site (try finding definitive copyright
and licence information) and in the Wiki itself (try finding anything
very quickly without doing a search).

Paul

P.S. The events make use of the hCalendar microformat, meaning that you
can export them from the page given the appropriate tools.

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


Re: calling python from C#...

2006-01-22 Thread Ravi Teja
Writing COM Servers is not hard
http://www.python.org/windows/win32com/QuickStartServerCom.html

IronPython is the other way.

Choose COM Server approach if you are using the a lot of standard
library functions (as I recall IronPython is not complete here, yet).
Definitely choose this approach if you are using C extensions to
Python.

IronPython is good for simpler Python tasks at this moment. Expect this
to change in the future. Of course, there is always XML-RPC, SOAP,
CORBA etc for language independence if you don't mind Client/Server
setup.

You can also write code in C# and drive it from Python. Check Python
for .NET.

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


Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Petr Jakes
Sorry, I can't get in. Can you please show me, how to use your approach
on the simple push/push ON/OFF button for example please?

PS: seriously it is not a homework :) and I feel it like a shame I am
asking such a simple questions :(

States: ON, OFF
Transition event: push, lift

transition diagram:
=

   ___ lift
  |   |
 _V___|__
 ,-|  ON|__
 |  ||  |
lift |  | push
 |      |
 '--|  OFF   |-'
||
  ^   |
  |___|push

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


Re: OT: excellent book on information theory

2006-01-22 Thread val bykoski
Anton Vredegoor wrote:
 Paul Rubin wrote():

[...]

 All of the books writers seem to have not caught up with the idea of
 hyperlinks and continue to dwell in neolithical paper dreams :-)
 
 If they only woke up and let someone like me write some Visual Python
 code to illustrate the algorithms or even let me just write Python
 implementations of the algorithms to accompany the books, I'd probably
 have work for years to come.
 
 
Math is a beautiful subject, and is not at all secret or inaccessible.
Try to broaden your horizons a bit ;-).
 
 
 I hope you're not trying to outexpertize me. You seem to be thinking
 that you know more about math than me, probably because you have a
 formal education in the subject?
 
 If so, you're proving my point, and thank you very much.
 
 Anton
 

Well, to me it is not a matter of formal education, or math, or Python.
There should be a *fresh thought/idea* how to handle the unknown 
reality.  The existing (formal) language, being helpful, was created 
hundreds years ago and of course needs an update.  But again, the point 
is not a new tool, even very flexible like Python.  I think the *direct* 
sensor/data-driven techniques based on parsing/understanding 
observations (images, fields, etc) might be a step in promising 
direction.  Any thoughts?

respectful-ly y'rs,
val
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
Harlin Seritt [EMAIL PROTECTED] wrote:
 I am finding that with the many quirks (and really bad foundation for
 Win32 APIs) that I am having to write a lot of voodoo code so to speak.

Yeah, tell me about it.  My current project at work is porting our IPv6 
management package (including ICMP ping) to windows; many quirks would be 
a good way to describe it!

 If I use a dummy port... let's say port 10001 for example... I can
 attempt to connect to a machine at this port. If I get an error that
 says Connection refused, I know that the node is up but is just not
 going to allow a connection.

Maybe.  It could be that some firewall between you and the target is 
blocking things.  Depending on how the firewall is programmed, this may 
show up as a timeout or as a connection refused (although the former would 
be more common).

It's also not always a clear-cut question what up means.  Some operating 
systems can get into modes where for all intents and purposes they've 
crashed, but they're still answering pings and/or actively refusing 
connections.

The traditional way to tell if a node is up is to send it an ICMP echo 
request, rather than trying to connect to a TCP port.  You might want to 
look into using that instead of trying to connect to random ports.  Not 
that that ICMP doesn't have its own problems :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Who is www.python.org for? (was Re: New Python.org website ?)

2006-01-22 Thread Aahz
In article [EMAIL PROTECTED],
JW  [EMAIL PROTECTED] wrote:

Agreed.  The main page should be like a slick book cover.  It should grab
you and leave you wanting more.  I think the beta page does that pretty
well.

  [...]

Of course, I'm a minimalist.  I understand techy types want the details,
but I don't doubt the details will be no more than two clicks away.

Which sort of gets to the heart of the argument: who is www.python.org
for?

I suggested one alternative a long time ago, but we never had the
bandwidth to do the necessary refactor:

The idea is that we make www.python.org even more minimal than the
current beta.python.org; it becomes a portal similar in simplicity to
google.com (with a bit more explanation).  It would lead off to
subdomains such as business.python.org, tech.python.org, help.python.org,
and so on.  That would make it easy for people to bookmark a specific
section that was appropriate for their needs.

If we can't do that, I think we should overall slant the focus toward the
primary users of python.org: people wanting to learn Python and people
doing real work in using Python.  (I have mostly been keeping my mouth
shut during this discussion because I'm one of the [EMAIL PROTECTED]
team and therefore should be contibuting labor to make this happen -- but
I haven't had the bandwidth.)
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

19. A language that doesn't affect the way you think about programming,
is not worth knowing.  --Alan Perlis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python.org website ?

2006-01-22 Thread Aahz
In article [EMAIL PROTECTED],
Fredrik Lundh [EMAIL PROTECTED] wrote:

for the curious, I've found a few more spare 15-minute slots, and a more
extensive (but still rough) translation is available here:

http://effbot.org/pydotorg/

the sample site contains ~600 pages.  each page has been automatically
translated from python.org sources to moinmoin markup, and then stored
in a moinmoin 1.5 instance.  a separate component has then extracted the
pages from moinmoin, and converted them XHTML fragments for rendering.

That looks pretty good.  The most serious bug I've found so far in your
conversion is the missing form for grabbing SF bugs/patches on
http://www.python.org/dev/
just after Links for Developers

I'm curious what you plan to do for handling sidebar links, especially
context-sensitve ones that change as you switch between sections of the
site.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

19. A language that doesn't affect the way you think about programming,
is not worth knowing.  --Alan Perlis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numarray, numeric, NumPy, scpy_core ??!!

2006-01-22 Thread Tim Hochberg
Szabolcs Nagy wrote:
Basically all I need is vectors and 3x3 matrices.
 
 
 hmm
 is numpy really efficient for 3x3 (or 4x4) matrices and vectors?
 
 IMHO an optimized matrix4x4 class can be much faster (i'm just guessing
 here)
 
 eg cgtypes is a simple c++ implementation with boost-python wrapper:
 http://cgkit.sourceforge.net/
 

If you're operating on a single 3x3 or 4x4 matrix, nothing you do in 
Python will be efficient, by which I assume you mean not all that far 
from C speed; the interpreter overhead is simply too high. If you can 
operate on large blocks of small arrays and vectors at the same time, 
which one can usually do after consuming sufficient coffee, then yes 
numpy can be fast if you're careful.

-tim

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


Re: calling python from C#...

2006-01-22 Thread Mr BigSmoke
I use python for .NET in some applications... I've always used it for
using c# code from python (but i had some problems using it with py2exe
and win2000).  I'll try using it the other way (c# calling python).
I also thought about trying ironpython, but it's too young for my work
projects...
The COM aproach seemed more stable to me what do u think?

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


Re: LocaWapp: localhost web applications (v.03 - 2005 Dec 31)

2006-01-22 Thread Runsun Pan

On 1 Jan 2006 08:15:42 -0800, LocaWapp [EMAIL PROTECTED] wrote:
http://cheeseshop.python.org/packages/source/L/LocaWapp/locawapp-03.tar.gz




Not Found
The requested URL /packages/source/L/LocaWapp/locawapp-03.tar.gz was not found on this server.

-- ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~Runsun Pan, PhD[EMAIL PROTECTED]
Nat'l Center for Macromolecular Imaginghttp://ncmi.bcm.tmc.edu/ncmi/~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ 
-- 
http://mail.python.org/mailman/listinfo/python-list

Making dir's

2006-01-22 Thread yawgmoth7
Hello, I am writing a script that will organize all the code in the
given directory. Well, currently I have it make dir's with something
like:

os.mkdir(C)
os.mkdir(Python)
os.mkdir(ASM)

And so on. That is not very practical, and I wish to change it. I was
wondering if there were any other methods to which I could do this, I
was thinking maybe I could put the dir names in a dictionary then have
something like:
os.mkdir(thedictname)

This doesn't sound like it would work, maybe with a bit of tweaking to
my idea. So, anyone that has any idea's on how I could do this...that
would be great...

Thanks for your help.
--
gurusnetwork.org
Gurus'Network - Are you a guru?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Python.org website ?

2006-01-22 Thread Tim Parkin
Fredrik Lundh wrote:

Tim Parkin wrote:

  

It sounds very similar to what we have already built!! What we have also
parses yaml files, rest files, inline rest content, has special
renderers for navigation and breadcrumbs and handles cacheing of built
data to speed generation.



except that it isn't: you're talking about a modernized version of
the current HT2HTML/make system, we're talking about a purely
wiki-driven system.
  

Fred, It's not a updated ht2html, just as it's not a web framework and
it's also not a database backed content management system. It is what it
is, text files with content on disk that get delivered as flat css/xhtml
files (via a simple xml based templating system) and stored in a
subversion repository.

The way people edit content can be via any tool capable of editing text
files. That includes, but is not limited to, textareas (via a wiki if
you will) or gedit or vim or notepad.

I would like your help, if you are willing, to suggest ways of parsing
wiki markup into valid, semantic html that can be used on the website. I
would also like you help in integrating the documentation into the
website. If you want to help, send me an email, if you don't want to
help but would like to continue the discussion, I'm happy to do so in
private and then we can both come back and post our conclusions on the
mailing list.

Thanks

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


Re: Concatinating PDF files

2006-01-22 Thread avishay

sophie_newbie wrote:
 I am converting TIFF images of patents to PDF files. Each patent comes
 in about 20 seperate TIFF images and I want to put them all in the one
 PDF file. Is there a way to do this? Using the Image library I think
 you can only convert individual TIFF images to PDF?

 Maybe there is a way of concatinating these files or maybe there is a
 way to create the PDF from the TIFFs in the first place?

There is a way, but you don't have to do it. Go to the site
http://free.patentfetcher.com/Patent-Fetcher-Form.php, enter the patent
number, and it will create a PDF you can download. If for some reason
the site does not work, search google for fetch patent and you'll
find some more.

Avishay

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


Re: Dynamic website content

2006-01-22 Thread Peter Maas
sophie_newbie schrieb:
 Flushing to stdout doesn't seem to work anyway.
 
 Honestly have no idea how you'd implement it in Javascript so might
 have an ask on one of their forums...
 

I think you need HTTP push to update the client page. See
http://wp.netscape.com/assist/net_sites/pushpull.html for
information about HTTP push.

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


Re: Concatinating PDF files

2006-01-22 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], sophie_newbie
wrote:

 I am converting TIFF images of patents to PDF files. Each patent comes
 in about 20 seperate TIFF images and I want to put them all in the one
 PDF file. Is there a way to do this? Using the Image library I think
 you can only convert individual TIFF images to PDF?
 
 Maybe there is a way of concatinating these files or maybe there is a
 way to create the PDF from the TIFFs in the first place?

I use `tiffcp` for concatenating and `tiff2pdf` to convert multipage tiffs
to PDF.  Both command line programs are part of `libtiff`:

  http://www.remotesensing.org/libtiff/

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Making dir's

2006-01-22 Thread [EMAIL PROTECTED]
yawgmoth7 wrote:
 And so on. That is not very practical, and I wish to change it. I was
 wondering if there were any other methods to which I could do this, I
 was thinking maybe I could put the dir names in a dictionary then have
 something like:
 os.mkdir(thedictname)

Why not use a loop?

dirs = ['ASM', 'C', 'Python']

for dir in dirs:
os.mkdir(dir)

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


Re: More than you ever wanted to know about objects [was: Is everything a refrence or isn't it]

2006-01-22 Thread rurpy

Steve Holden wrote:
[...snipped a long and very helpful post addressing some
questions I had regarding the nature of an object's value
in python...]

Sorry for the belated reply Steve (I had some access
problems) but did want to let you know I found that post
very informative, and wanted to thank you for it.

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


Re: yet another list compr. suggestion

2006-01-22 Thread Christoph Zwerschke
palo wrote:
  ... what would you think about this:
  as a substitute for filter, people often use
  [x for x in y if z(x)]
  The suggestion is that the same result could be achieved by
  [x in y if z(x)]

In the original syntax, if z(x) is always true,
you can leave the if z(x) part away, which is intuitive.
But in your syntax, the if z(x) is essential.
If you leave it away, you get a completely different
construct, a list with a bool value as element.
You would not expect that an if keyword indicates a loop.

I think the for is absolutely essential to recognize
a list comprehension, not only for the parser, but also
for the human reader. It's already confusing enough.
Just compare the following:

[x in y] - list with one element
[x in y if z(x)] - list comprehension (in your syntax)
[x in y if z(x) else 0] - list with one element (Py 2.5)

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


Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Reasons why it still won't work:

* Firewall
* Unknown-modes-operating-systems-get-into

Yeah, I dont think these things can be avoided. Nonetheless, if I can
come up with some way (via help from this group--thank God!) to find if
the node is up (barring the two aforementioned reasons), I am doing
well. Maybe my standards are not so high. :-|

Nonetheless, thanks for the help and the commentary. I was beginning to
think I was losing my mind.

Harlin

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


Re: Making dir's

2006-01-22 Thread James Stroud
yawgmoth7 wrote:
 Hello, I am writing a script that will organize all the code in the
 given directory. Well, currently I have it make dir's with something
 like:
 
 os.mkdir(C)
 os.mkdir(Python)
 os.mkdir(ASM)
 
 And so on. That is not very practical, and I wish to change it. I was
 wondering if there were any other methods to which I could do this, I
 was thinking maybe I could put the dir names in a dictionary then have
 something like:
 os.mkdir(thedictname)
 
 This doesn't sound like it would work, maybe with a bit of tweaking to
 my idea. So, anyone that has any idea's on how I could do this...that
 would be great...
 
 Thanks for your help.
 --
 gurusnetwork.org
 Gurus'Network - Are you a guru?

Assuming something in the standard library doesn't do this already 
(shutils, os, os.path)

import os

def mkdirs(pths):
   for pth in args:
 os.mkdir(pth)

mkdirs([C,Python, ASM])

Is that what you mean?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Making dir's

2006-01-22 Thread James Stroud
yawgmoth7 wrote:
 Hello, I am writing a script that will organize all the code in the
 given directory. Well, currently I have it make dir's with something
 like:
 
 os.mkdir(C)
 os.mkdir(Python)
 os.mkdir(ASM)
 
 And so on. That is not very practical, and I wish to change it. I was
 wondering if there were any other methods to which I could do this, I
 was thinking maybe I could put the dir names in a dictionary then have
 something like:
 os.mkdir(thedictname)
 
 This doesn't sound like it would work, maybe with a bit of tweaking to
 my idea. So, anyone that has any idea's on how I could do this...that
 would be great...
 
 Thanks for your help.
 --
 gurusnetwork.org
 Gurus'Network - Are you a guru?

Assuming something in the standard library doesn't do this already
(shutils, os, os.path)

import os

def mkdirs(pths):
   for pth in pths:
 os.mkdir(pth)

mkdirs([C,Python, ASM])

Is that what you mean?
-- 
http://mail.python.org/mailman/listinfo/python-list


converting wiki markup to html (or xml)

2006-01-22 Thread Tim Parkin
I'm trying to convert fragments of wiki markup into fragments of html
(specifically using moinmoin markup). I've managed to do this with
MoinMoin but I've had to create a data directory, config file and
underlay. Does anybody know if there a sane way of doing this without
the extra baggage?

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


Re: Making dir's

2006-01-22 Thread Christoph Zwerschke
yawgmoth7 wrote:
 os.mkdir(C)
 os.mkdir(Python)
 os.mkdir(ASM)
 
 And so on. That is not very practical, and I wish to change it. I was
 wondering if there were any other methods to which I could do this, I
 was thinking maybe I could put the dir names in a dictionary then have
 something like:
 os.mkdir(thedictname)

For what do you need a dictionary? A list or a set should suffice:

[os.mkdir(d) for d in C Python ASM.split()]

If some of these directories could already exist, this may be safer:

for d in C Python ASM.split():
 try:
 os.mkdir(d)
 except OSError:
 pass

Another possibility is the following:

os.system(mkdir C Python ASM)

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


Re: Python code written in 1998, how to improve/change it?

2006-01-22 Thread Petr Jakes
Sorry for the typo in my previous posting. Of course it has to be: 
simple liftt/push ON/OFF button

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


Re: another docs problem - imp

2006-01-22 Thread rurpy

Steve Holden wrote:
 [EMAIL PROTECTED] wrote:
[...snip...]
 Well, perhaps if you'd read the intro to the documentation (more
 carefully), or if you were more used to reading programming manuals,
 you'd quickly have recognised

  [, path]

 as meaning precisely that the path argument is optional.

I did realize that. (And I have read enough other
programming manuals that reading more will not
affect my recognition of anything.)  The issue was
not the optionality of the argument, it was the
type of the argument when it was supplied.

[...snip...]

 So you think the docs should be changed if just *one* person can't
 understand them. Or maybe *two*? or *ten*?

I don't know how many people had trouble
with the text.  But there were some postings,
and the number of people is almost certainly
orders of magnitude larger than the number
that post.
I continue to think that the way I interpreted it
was valid, so it *is* ambiguous, even if most
people quickly disambiguate it correctly.  If
you accept that, it should be clarified even if
the number was *one*.

[...snip...]

  How about
  1 - read some clear unambiguous documentation.
  2 - write the code and it works as described.
 
 Excellent. So now you only have to fix the docs and that's what everyone
 will do from now on.

  My grandfather used to own a hardware store.
  He frequently said he took every customer
  complaint very seriously.  For every customer
  who complains, there are a 100 that just take their
  business elsewhere.
  I wonder how many people had a problem with
  this and lost time.  Not as extreme as my case,
  maybe just rereading it a few times.  And of course
  this particular piece of documentation  is not an
  isolated instance.  If you are happy with the status
  quo, if it is good enough fine.   I am not.
 
  ...snipped long anacdote about busses...
 
 Clearly. So get your sleeves rolled up and provide a fix. Then you too
 will get your name in the Python documentation contributors' list.

I would be sufficient reward just to get good, clear,
complete accurate python docs.

 I agree that things that are difficult to understand could usefully be
 fixed. Since this is the open source world I'm unsure as to why you feel
 somebody else should fix it. It's also fairly obvious since you failed
 to find other complaints about this issue in your Google search that it
 isn't a frequent cause of complaint.

I never suggested someone else should fix it.  I am willing
to submit either a doc bug reports, or patches provided
that there is a reasonable chance it will result in a positive
change.  I am not willing to invest a lot of time summiting
things that are ignored or dumped in the bit bucket.  So
in part, my post here was to gauge the reaction to proposed
change.

Frequency of public complaints is a *lousy* criteria.  Very
few people are going to complain publicly, especially here
where suggestions that Python is not perfect are often met
with derision or silence. That was the whole point of the
grandfather story.

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


  1   2   >