Re: invert or reverse a string... warning this is a rant

2006-10-21 Thread Ron Adam
Steven D'Aprano wrote:
> On Thu, 19 Oct 2006 20:07:27 -0400, Brad wrote:
> 
>> Steven D'Aprano wrote:
>>
>>> Gah!!! That's *awful* in so many ways.
>> Thanks... I'm used to hearing encouragement like that. After a while you 
>> begin to believe that everything you do will be awful, so why even 
>> bother trying?
> 
> Well obviously I hit a sore point. I wrote a little hastily, and wasn't
> quite as polite as I could have been -- but it is true, the function you
> wrote isn't good: a seven line function with five problems with it.
> 
> Your function was not at all Pythonic; but it isn't even good style for
> any serious programming language I know of. I'm sorry if I came across as
> abrasive, but I'm even sorrier that you can't take constructive criticism.
> Some techniques are bad practice in any language.

Steven, I think just took things a little out of context, and yes you were a 
bit 
overly harsh.  But I've also read enough of your post to know you most likely 
did not mean any insult either.

Brad's little reminder program was not meant to be actually used in a program 
as 
is of course, but was a small script for him to run so he could see what was 
happening visually. Yes, it could be improved on for that purpose too.  But for 
what it's purpose is, does it really matter that much?  It does what he meant 
it 
to do.

Yes, a small dose of politeness, (tactfulness isn't quite the same as suger 
coating), always helps when pointing out where others can make improvements 
especially while they are still learning their way around.

With that said, If it were me who wrote something that you really thought was 
bad, then blast away! ;) (without insulting me of course.)  I'd probably take a 
second look and agree with you.  But I've been programming python since version 
2.3 and as a more experienced programmer will appreciate the honest feed back.


[You said from an earlier post...]

> (That's a complaint I have about the dis module -- it prints its results,
> instead of returning them as a string. That makes it hard to capture the
> output for further analysis.)

I have a rewritten version of dis just sitting on my hard disk that fixes 
exactly that issue.  It needs to be updated to take into account some newer 2.5 
features and the tests will need to be updated so they retrieve dis's output 
instead of redirecting stdout.  If you'd like to finish it up and submit it as 
a 
patch, I can forward it to you.  It would be good to have a second set of eyes 
look at it also.

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


Re: invert or reverse a string... warning this is a rant

2006-10-21 Thread Steven D'Aprano
On Fri, 20 Oct 2006 16:17:09 +0200, Fredrik Lundh wrote:

> Tim N. van der Leeuw wrote:
> 
>> In practice, the short-term fix would be to add a __str__ method to the
>> 'reversed' object
> 
> so what should
> 
> str(reversed(range(10)))
> 
> do ?

The same as str(range(9, -1, -1)) perhaps?

I notice that reversed() already special-cases lists:

>>> reversed(tuple(range(5)))

>>> reversed("01234")


but:

>>> reversed(range(5))



I'm not sure why it would do such a thing -- something to do with mutable
versus immutable arguments perhaps? It is surprising that x and
reversed(x) aren't the same type. This is even more surprising:

>>> list(reversed(range(5)))
[4, 3, 2, 1, 0]
>>> tuple(reversed(tuple(range(5
(4, 3, 2, 1, 0)

but 

>>> str(reversed("01234"))
''

It could be argued that people shouldn't be reversing strings with
reversed(), they should use slicing. But I'll argue that "shouldn't" is
too strong a prohibition. Python, in general, prefers named methods and
functions for magic syntax, for many good reasons. (e.g. a str.reverse()
method could have a doc string; str[::-1] can't.) reversed() is designed
to work with sequences, and strings are sequences; it is a recent addition
to the language, not a hold-over from Ancient Days; and since nobody seems
to be arguing that reversed shouldn't be used for other sequence types,
why prohibit strings?

This is not an argument *against* slicing -- obviously slicing is too
fundamental a part of Python to be abandoned. But since reversed() exists,
it should do the right thing. Currently it does the right thing on lists
and tuples, but not on strings.

Perhaps the solution is to special case strings, just like lists are
special cased. Ordinary reversed objects needn't change, but reversed(str)
returns a strreverseiterator that has a __str__ method that does the right
thing. That's just a suggestion, I daresay if it is an awful suggestion
people will tell me soon enough.


-- 
Steven.

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


Re: invert or reverse a string... warning this is a rant

2006-10-21 Thread Steven D'Aprano
On Sat, 21 Oct 2006 01:58:33 -0500, Ron Adam wrote:

> [You said from an earlier post...]
> 
>> (That's a complaint I have about the dis module -- it prints its results,
>> instead of returning them as a string. That makes it hard to capture the
>> output for further analysis.)
> 
> I have a rewritten version of dis just sitting on my hard disk that fixes 
> exactly that issue.  It needs to be updated to take into account some newer 
> 2.5 
> features and the tests will need to be updated so they retrieve dis's output 
> instead of redirecting stdout.  If you'd like to finish it up and submit it 
> as a 
> patch, I can forward it to you.  It would be good to have a second set of 
> eyes 
> look at it also.

I'm certainly willing to look at it; as far as submitting it as a patch, I
have no idea what the procedure is. Maybe we can find out together heh? :-)


-- 
Steven.

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


Re: FOR statement

2006-10-21 Thread Lad

[EMAIL PROTECTED] wrote:
> Lad wrote:
> > If I have a list
> >
> > Mylist=[1,2,3,4,5]
> > I can print it
> >
> > for i in Mylist:
> >print i
> >
> > and results is
> > 1
> > 2
> > 3
> > 4
> > 5
> >
> >
> > But how can I  print it in a reverse order so that I get
> > 5
> > 4
> > 3
> > 2
> > 1
> >
> >
> >
> > ?
> >
> >
> > Thanks.
> > L
>
> reverse the list in place with reverse method
>
> l.reverse()
> for i in l:
> print i
> 
> and the reverse it back if needed

Thank you ALL for help.
L.

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


Re: invert or reverse a string... warning this is a rant

2006-10-21 Thread Ron Adam
Steven D'Aprano wrote:
> On Sat, 21 Oct 2006 01:58:33 -0500, Ron Adam wrote:
> 
>> [You said from an earlier post...]
>>
>>> (That's a complaint I have about the dis module -- it prints its results,
>>> instead of returning them as a string. That makes it hard to capture the
>>> output for further analysis.)
>> I have a rewritten version of dis just sitting on my hard disk that fixes 
>> exactly that issue.  It needs to be updated to take into account some newer 
>> 2.5 
>> features and the tests will need to be updated so they retrieve dis's output 
>> instead of redirecting stdout.  If you'd like to finish it up and submit it 
>> as a 
>> patch, I can forward it to you.  It would be good to have a second set of 
>> eyes 
>> look at it also.
> 
> I'm certainly willing to look at it; as far as submitting it as a patch, I
> have no idea what the procedure is. Maybe we can find out together heh? :-)


Sounds good to me.  I email an attachment to you. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Inheriting property functions

2006-10-21 Thread Diez B. Roggisch
Dustan schrieb:
> Looking at this interactive session:
> 
 class A(object):
>   def __init__(self, a):
>   self.a = a
>   def get_a(self): return self.__a
>   def set_a(self, new_a): self.__a = new_a
>   a = property(get_a, set_a)
> 
> 
 class B(A):
>   b = property(get_a, set_a)
> 
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> class B(A):
>   File "", line 2, in B
> b = property(get_a, set_a)
> NameError: name 'get_a' is not defined
 class B(A):
>   b = a
> 
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> class B(A):
>   File "", line 2, in B
> b = a
> NameError: name 'a' is not defined
> 
> B isn't recognizing its inheritence of A's methods get_a and set_a
> during creation.
> 
> Why am I doing this? For an object of type B, it makes more sense to
> reference the attribute 'b' than it does to reference the attribute
> 'a', even though they are the same, in terms of readability.

I think you are having a code smell here. However, this is how you do it:

class B(A):
 b = A.a


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


Re: FOR statement

2006-10-21 Thread Ant

Jordan Greenberg wrote:
...
> >>> def printreverse(lst):
>   if lst:
>   printreverse(lst[1:])
>   print lst[:1][0]

Convoluted way of writing "print lst[0]" !

> >>> printreverse([1,2,3,4])
>
> No good reason at all to do it this way. But recursion is fun.

But there's a good reason not to. Try:

printreverse(range(1000))

Recursion has a maximum depth (of 1000 by default) in Python.

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


Python Source

2006-10-21 Thread ArdPy
I am not sure whether this group is the best place to post my thought.
I will ask neverthless:

Is it possible to hack through the code written by Guido van Rossum
that makes the python interpreter. If yes please let me know how to
begin. If its not then pardon me.

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


Re: FOR statement

2006-10-21 Thread Theerasak Photha
On 21 Oct 2006 00:50:34 -0700, Ant <[EMAIL PROTECTED]> wrote:

> But there's a good reason not to. Try:
>
> printreverse(range(1000))
>
> Recursion has a maximum depth (of 1000 by default) in Python.

I guess Python isn't tail-recursive then?

Well, algorithms seem to be more naturally expressed iteratively in
Python, and to be fair, most uses of recursion you see in e.g., Scheme
textbooks are really just grandstanding in the real world.

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


Good Form

2006-10-21 Thread phez . asap
I am new to Python but come from a C++ background so I am trying to
connect the dots :) . I am really liking what I see so far but have
some nubee questions on what is considered good form. For one thing I
am used to class variables being accessable only through methods
instaed of directly refrenced from the object instence. From what I
have read it looks like when you access a class variable directly in
Python it has something in the background that works similar to a
getter of setter.

Would you normally write methods to retrive and set your class
variables or just refrence them directly?

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


Re: Python Source

2006-10-21 Thread Gabriel Genellina

At Saturday 21/10/2006 05:09, ArdPy wrote:


I am not sure whether this group is the best place to post my thought.
I will ask neverthless:


I doubt any other group would be better...


Is it possible to hack through the code written by Guido van Rossum
that makes the python interpreter. If yes please let me know how to
begin. If its not then pardon me.


Python is free software - you can read, study, and modify it to your 
own taste (as far as you respect the license).

Start at http://www.python.org


--
Gabriel Genellina
Softlab SRL 


__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Good Form

2006-10-21 Thread Theerasak Photha
On 21 Oct 2006 01:17:32 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am new to Python but come from a C++ background so I am trying to
> connect the dots :) . I am really liking what I see so far but have
> some nubee questions on what is considered good form. For one thing I
> am used to class variables being accessable only through methods
> instaed of directly refrenced from the object instence. From what I
> have read it looks like when you access a class variable directly in
> Python it has something in the background that works similar to a
> getter of setter.
>
> Would you normally write methods to retrive and set your class
> variables or just refrence them directly?

It's largely a matter of taste and context I think. For instance, you
can trust the user of your code to leave read-only variables read-only
in most cases. I don't think there really is any absolutely sure way
of introducing private attributes (__ prefix just name-mangles). In
other cases, it seems more logical to have 'virtual' attributes, a few
canonical examples being temperature conversion and exchange rates;
imagine an object that has a number of dollars, Euros, yen, or other
major currency as an attribute and uses methods to give the equivalent
value in other currencies.

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


Re: FOR statement

2006-10-21 Thread bearophileHUGS
Theerasak Photha:
> I guess Python isn't tail-recursive then?

Right.


> Well, algorithms seem to be more naturally expressed iteratively in
> Python, and to be fair, most uses of recursion you see in e.g., Scheme
> textbooks are really just grandstanding in the real world.

Still, some algorithms enjoy some recursivity anyway, like some graph
or tree exploration, structure flattening, and so on, for them I
sometimes use recursivity in Python too. The maximum recursivity level
can be increased too. Stackeless Python probably helps in recursive
code too. Psyco too. New Python versions have some optimizations for
function calling and so on, than help.
Often iterative code is the simpler solution, but sometimes recursivity
is the simpler solution, so a "better" (faster, leaner) recursivity
management may be good for a hi-level language like Python. So maybe in
future people here will improve its recursivity use some more.

Bye,
bearophile

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


Re: Python Source

2006-10-21 Thread Sybren Stuvel
ArdPy enlightened us with:
> Is it possible to hack through the code written by Guido van Rossum
> that makes the python interpreter.

Yes it is.

> If yes please let me know how to begin. If its not then pardon me.

Download the source, start hacking.

Sybren
-- 
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Detect Unused Modules

2006-10-21 Thread Sybren Stuvel
Kamilche enlightened us with:
> DetectUnusedModules.py - Detect modules that were imported but not
> used in a file.  When run directly, this class will check all files
> in the current directory.

Nice as it is, but why not use pylint to check this and many other
coding style issues?

Sybren
-- 
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Form

2006-10-21 Thread Gregor Horvath
[EMAIL PROTECTED] schrieb:

> Would you normally write methods to retrive and set your class
> variables or just refrence them directly?
> 

you start by referencing them directly and ONLY if you need you can add
getters and setters later on without breaking any client code.
see the property function.

An explanation for the motivation behind this and python's thinking can
be found here:

http://tinyurl.com/wfgyw

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


Re: FOR statement

2006-10-21 Thread Theerasak Photha
On 21 Oct 2006 01:31:55 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Theerasak Photha:
> > I guess Python isn't tail-recursive then?
>
> Right.
>
>
> > Well, algorithms seem to be more naturally expressed iteratively in
> > Python, and to be fair, most uses of recursion you see in e.g., Scheme
> > textbooks are really just grandstanding in the real world.
>
> Still, some algorithms enjoy some recursivity anyway, like some graph
> or tree exploration, structure flattening, and so on, for them I
> sometimes use recursivity in Python too.

That's absolutely true. However, it is probably unusual in most
circumstances for such recursions to blow through more than a thousand
stack frames.

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


Re: FOR statement

2006-10-21 Thread Diez B. Roggisch
Theerasak Photha schrieb:
> On 21 Oct 2006 00:50:34 -0700, Ant <[EMAIL PROTECTED]> wrote:
> 
>> But there's a good reason not to. Try:
>>
>> printreverse(range(1000))
>>
>> Recursion has a maximum depth (of 1000 by default) in Python.
> 
> I guess Python isn't tail-recursive then?

Nope. And given that you can decorate every function whenever you want , 
even at runtime, I can't see how that can be implemented easily - or at 
all, to be honest.

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


Re: Good Form

2006-10-21 Thread Travis Vachon
Hi Phez

Generally, most Python programmers I know access and set class 
attributes directly. This is done because of a Python feature called 
property().

In many languages, setting class attributes directly is discouraged 
because additional behavior may need to be associated with that setting, 
and it may be difficult or impossible to later inject this behavior into 
the setting action.

In Python, however, if we have a class like

class A:
a = 1
   
we just get and set a like:

 >>> obj = A()
 >>> obj.a = 2

If we later want to associate additional behavior with setting A.a, we 
can do the following:

class A(object):
_a = 1
def _get_a(self):
  additional_action()
  return self._a
def _set_a(self, val):
  some_other_additional_action()
  _a = val
a = property(_get_a, _set_a)

Now when we do

 >>> obj = A()
 >>> obj.a = 2

obj.a = 2 will call _set_a(self, 2), which in this case will run 
some_other_additional_action() and then set a to 2.

Gregor's post contains prudent advice on when to use this property() 
business (that is, only when definitely needed :) ).

Best,

Travis Vachon


[EMAIL PROTECTED] wrote:
> I am new to Python but come from a C++ background so I am trying to
> connect the dots :) . I am really liking what I see so far but have
> some nubee questions on what is considered good form. For one thing I
> am used to class variables being accessable only through methods
> instaed of directly refrenced from the object instence. From what I
> have read it looks like when you access a class variable directly in
> Python it has something in the background that works similar to a
> getter of setter.
>
> Would you normally write methods to retrive and set your class
> variables or just refrence them directly?
>
>   

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


Re: FOR statement

2006-10-21 Thread Diez B. Roggisch
Theerasak Photha schrieb:
> On 21 Oct 2006 00:50:34 -0700, Ant <[EMAIL PROTECTED]> wrote:
> 
>> But there's a good reason not to. Try:
>>
>> printreverse(range(1000))
>>
>> Recursion has a maximum depth (of 1000 by default) in Python.
> 
> I guess Python isn't tail-recursive then?

To complement my other post: while it isn't tail recursive and can't be 
so automatically, there do exist recipes to make certain functions tail 
recursive by hand:

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


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


Re: Python Source

2006-10-21 Thread Ben Finney
"ArdPy" <[EMAIL PROTECTED]> writes:

> Is it possible to hack through the code written by Guido van Rossum
> that makes the python interpreter.

Hack through it to where? I don't understand the request.

Why, specifically, only the code written by GvR?

-- 
 \  "I busted a mirror and got seven years bad luck, but my lawyer |
  `\ thinks he can get me five."  -- Steven Wright |
_o__)  |
Ben Finney

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


Re: Good Form

2006-10-21 Thread Ben Finney
[EMAIL PROTECTED] writes:

> I am new to Python but come from a C++ background so I am trying to
> connect the dots :)

Welcome, and commiserations on your harsh upbringing :-)

> I am really liking what I see so far but have
> some nubee questions on what is considered good form.

This document is an official proposal for "good style" for code in the
Python standard library. Most consider it a good style reference for
all Python code.



> For one thing I am used to class variables being accessable only
> through methods instaed of directly refrenced from the object
> instence. From what I have read it looks like when you access a
> class variable directly in Python it has something in the background
> that works similar to a getter of setter.

This document was written specifically for those coming from Java, but
many of its points would also be applicable to the C++ mindset.

http://dirtsimple.org/2004/12/python-is-not-java.html>

This one responds to the above, and specifically addresses getters and
setters.

http://simon.incutio.com/archive/2004/12/03/getters>

Here's a couple more, also responding to the same article.

http://naeblis.cx/rtomayko/2004/12/15/the-static-method-thing>
http://naeblis.cx/articles/2005/01/20/getters-setters-fuxors>

-- 
 \   "It is forbidden to steal hotel towels. Please if you are not |
  `\person to do such is please not to read notice."  -- Hotel |
_o__) sign, Kowloon, Hong Kong |
Ben Finney

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


Re: FOR statement

2006-10-21 Thread Theerasak Photha
On 10/21/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> Theerasak Photha schrieb:
> > On 21 Oct 2006 00:50:34 -0700, Ant <[EMAIL PROTECTED]> wrote:
> >
> >> But there's a good reason not to. Try:
> >>
> >> printreverse(range(1000))
> >>
> >> Recursion has a maximum depth (of 1000 by default) in Python.
> >
> > I guess Python isn't tail-recursive then?
>
> To complement my other post: while it isn't tail recursive and can't be
> so automatically, there do exist recipes to make certain functions tail
> recursive by hand:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474088

Wow. That's 1337.

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


Re: Python Source

2006-10-21 Thread Fredrik Lundh
Ben Finney wrote:

> I don't understand the request.

one wonders if someone who's not even capable of finding the code
is capable of "hacking" it, in any sense of that word.



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


Debugging

2006-10-21 Thread Fulvio
***
Your mail has been scanned by InterScan MSS.
***


Hello,

I'm trying out a small utility and my method uses PDB for debugging. I tried 
to read some information regarding the commands of PDB but are rather 
synthetic. Mostly I'd like to understand the use of  "condition" command in 
terms to use breakpoints (BP) with functions.
Simple the first doubt was a counted BP. What variable using that BP and which 
function can be taken from the command line?

10x

F


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


The fastest search

2006-10-21 Thread Fulvio
***
Your mail has been scanned by InterScan MSS.
***


Hello,

I'm poor in knoweledge of python, sorry. What's the fastest result between :

if item in alist:
 do_something

or

if adictionay has_key(item):
 do_something

Is there some trick to apply the best search in wise use of resources while 
using the above said methods?

F

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


Is x.f() <==>MyClass.f(x) a kind of algebraic structure?

2006-10-21 Thread steve
I thought that when read Guido van Rossum' Python tutorial.What can we
think that?

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


Re: The fastest search

2006-10-21 Thread Steven D'Aprano
On Sat, 21 Oct 2006 17:41:04 +0800, Fulvio wrote:

> I'm poor in knoweledge of python, sorry. What's the fastest result between :
> 
> if item in alist:
>  do_something
> 
> or
> 
> if adictionay has_key(item):
>  do_something

Let's find out.

Searches that succeed:

>>> import timeit
>>> search_list_setup = "L = range(1)"
>>> search_list = "L.index(7500)"
>>> timeit.Timer(search_list, search_list_setup).timeit(1)
8.0721840858459473

>>> search_dict_setup = """D = {}
... for i in range(1):
... D[i] = None
... """
>>> search_dict = "D.has_key(7500)"
>>> timeit.Timer(search_dict, search_dict_setup).timeit(1)
0.0079340934753417969

So for searches that succeed, dicts are much faster than lists.

How about searches that fail?


>>> search_dict_fail = "D.has_key(-7500)"
>>> timeit.Timer(search_dict_fail, search_dict_setup).timeit(1)
0.0060589313507080078

>>> search_list_fail = """try:
... L.index(-7500)
... except ValueError:
... pass
... """
>>> timeit.Timer(search_list_fail, search_list_setup).timeit(1)
11.371721982955933

Again, dicts are much faster.

But what if you know the list is sorted, and you can do a binary search?

>>> binary_search_setup = """import bisect
... L = range(1)
... """
>>> binary_search = "bisect.bisect(L, 7500)"
>>> timeit.Timer(binary_search, binary_search_setup).timeit(1)
0.04595494270324707

Still slower than a dict, but much, much faster than a linear search.


> Is there some trick to apply the best search in wise use of resources
> while using the above said methods?

Yes. 

Measure, don't guess. Don't even think about optimising your code until
it is working. Use the data structures which are natural to the task, then
measure to see if it is too slow. Never assume something is too slow until
you've measured it. Measure using realistic data -- don't do all your
tests with lists of ten items if actual working data will have ten
thousand items, and vice versa.

And most importantly, think about whether optimisation is a worthwhile use
of your time: do you really care about saving five milliseconds in a
program that takes 30 seconds to run?


-- 
Steve.

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


Re: Customize the effect of enumerate()?

2006-10-21 Thread Dustan

Paul Rubin wrote:
> "Dustan" <[EMAIL PROTECTED]> writes:
> > Can I make enumerate(myObject) act differently?
>
> No.
>
> > Why the funny behavior, you ask? For my class A, it doesn't make sense
> > to number everything the standard programming way.
>
> Add an enumerate method to the class then, that does what you want.
> Maybe dict.iteritems would be a better example to follow.

That's what I thought. Thanks anyway!

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


Re: curious paramstyle qmark behavior

2006-10-21 Thread Jon Clements

BartlebyScrivener wrote:

> Thanks, Jon.
>
> I'm moving from Access to MySQL. I can query all I want using Python,
> but so far haven't found  a nifty set of forms (ala Access) for easying
> entering of data into MySQL. My Python is still amateur level and I'm
> not ready for Tkinkter or gui programming yet.

Not wanting to start a RDMS war, I'd personally choose PostgreSQL over
MySQL. (Quite interestingly, most Python programmers go for PostgreSQL
and most PHP programmers go for MySQL)... However, only you know what
you really want to do, so it's up to you to evaluate which RDMS to go
for!

In terms of data entry; if you're able to extend the idea of GUI a
little, why not use web forms? The django project, although I've only
played with it, was quite nice to set up and get running straight away:
if your load on the data-entry/browsing side isn't too heavy, you can
use the 'development server' instead of installing a full-blown server
such as Apache (I'm not sure if IIS is supported).

Users need not have any specific software (well, apart from a web
browser), you can change the back-end any time, have authentication,
the database and users can be remote to the actual "GUI" etc

Just some thoughts you can do with as you wish.

Jon.

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


Re: The fastest search

2006-10-21 Thread Gregor Horvath
Fulvio schrieb:
> 
> Is there some trick to apply the best search in wise use of resources while 
> using the above said methods?
> 

measure it:

http://docs.python.org/lib/module-timeit.html

Regarding your debugger question in the seperate thread I don't know
since I am not using a debugger at all.

Most people coming from other languages are looking for a debugger and
are overlooking that in python a interactive interpreter, a good editor,
print statements and the tracebacks are all a lot of python developers need.

Small snippets of code are developed in the interpreter and when they
are working assembled in the editor. If something goes wrong a print on
the suspect place or the traceback is all I need. (of course this is
matter of taste)

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


Re: Pygtk but no gtk?

2006-10-21 Thread Fulvio
***
Your mail has been scanned by InterScan MSS.
***


On Saturday 21 October 2006 03:01, Jonathan Smith wrote:
> my pygtk provides
> /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py, which contains
> the gtk module

Great advice. I've tried >:
$ ls /usr/lib/python2.4/site-packages/gtk-2.0
atk.so  dsextras.py  dsextras.pyc  dsextras.pyo  gobject.so  gtk  
pangocairo.so  pango.so

So, I found some problem related this, would you please post the content of 
that file?

NOTE there's one more directory in that position and has its own __init__.

F


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


Re: help with my first use of a class

2006-10-21 Thread Fulvio
***
Your mail has been scanned by InterScan MSS.
***


On Saturday 21 October 2006 02:01, James Stroud wrote:
> I think the trick is to identify when a class would make more sense than
> a collection of subroutines

I do believe that's a bit of forecasting, in sense to determine whether a 
piece of code may have a future. Usually in hobbistic term I think we can 
bear with copy&pasting pieces of code across programs rather than go for a 
class(es) module.
Only I remembered the mottos when I ran this,py which gives me some good 
points of view.

F

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


Re: SQLAlchemy and py2exe

2006-10-21 Thread Steve Holden
Karlo Lozovina wrote:
> I've installed SQLAlchemy under Windows (strangely, it didn't install 
> inside ../site-packages/ as a directory, but rather as a 
> SQLAlchemy-0.2.8-py2.4.egg file). I can import it with 'import 
> sqlalchemy' and run my program with WingIDE, SPE and ofcourse in plain old 
> Python shell (ipython actually).
> 
> But when I build my .exe using py2exe and run the executable, it fails 
> with 'Cannot import module sqlalchemy' error. Is it because SA is 
> installed inside a .egg file, and can I somehow force it to install like 
> all the other packages?
> 
> Thanks guys...
> 
http://mail.python.org/pipermail/distutils-sig/2005-August/004945.html\

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: Is x.f() <==>MyClass.f(x) a kind of algebraic structure?

2006-10-21 Thread Boris Borcic
steve wrote:
> What can we think that?

When much stretch definitions
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: curious paramstyle qmark behavior

2006-10-21 Thread BartlebyScrivener

Jon Clements wrote:

> However, only you know what
> you really want to do, so it's up to you to evaluate which RDMS to go
> for!

That assumes a lot :) My needs are simple. I'm exploring. My only real
db is a collection of 5,000 quotations, book passages etc. Flat file
would probably even do it. But I like to learn. Converted to sqlite
with no problem. But I'll try Postgres, just for fun. I guess I was
drawn to MySQL only because it's part of a WordPress site/blog I
operate, and the conversion tools from Access to MySQL were a snap.

> In terms of data entry; if you're able to extend the idea of GUI a
> little, why not use web forms?

This never occurred to me. Good idea! I'll explore.

> if your load on the data-entry/browsing side isn't too heavy, you can
> use the 'development server' instead of installing a full-blown server
> such as Apache (I'm not sure if IIS is supported).

What's IIS?

> Users need not have any specific software (well, apart from a web
> browser), you can change the back-end any time, have authentication,
> the database and users can be remote to the actual "GUI" etc
>
> Just some thoughts you can do with as you wish.

Thank you, I shall explore.

Rick

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


ANN: Leo 4.4.2 beta 3 released

2006-10-21 Thread Edward K. Ream
Leo 4.4.2 beta 3 is available at:
http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106

The beta release fixed dozens of bugs and smoothed many rough edges.  There
are no known major bugs in Leo.  This will be the last beta release before
Loo 4.4.2 final.

Leo is a text editor, data organizer, project manager and much more. See:
http://webpages.charter.net/edreamleo/intro.html

The highlights of Leo 4.4.2:

- You can now store settings in myLeoSettings.leo without fear of those
   settings being changed by cvs updates or in future versions of Leo.
- Leo's vnode and tnode classes are now completely independent of the rest
of Leo.
  Some api's have been changed.  This 'big reorg' and may affect scripts and
plugins.
- Leo's vnode and tnode classes can optionally be compatible with ZODB
  databases, i.e., they can optionally derive from
ZODB.Persistence.Persistent.
  See Chapter 17: Using ZODB with Leo for details.
- The leoOPML plugin defines commands to read and write OPML files.
- The slideshow plugin allows Leo to run slideshows defined by @slideshow
  and @slide nodes.
- The leo_to_rtf and leo_to_html plugins create rtf and html files from Leo
outlines.
- Much faster navigation through the outline.
- When focus is in the outline pane, you can move to headlines by typing the
  first letter of headlines.
- The find command now optionally closes nodes not needed to show the node
  containing the present match.
- Numerous changes that make Leo easier to use without using a mouse,
  including new commands and options.
- Many new minibuffer commands now appear in the Cmds menu.
- A sax parser can now optionally read .leo files.
- Fixed numerous bugs.

Quote of the month:
--
For the non-leo python project I'm (supposed to be) working on, I'm
switching from emacs to leo :-)
-- Terry Brown

Links:
--
Leo:http://webpages.charter.net/edreamleo/front.html
What's new: http://webpages.charter.net/edreamleo/new-4-4-2.html
Home:   http://sourceforge.net/projects/leo/
Download:   http://sourceforge.net/project/showfiles.php?group_id=3458
CVS:http://leo.tigris.org/source/browse/leo/
Quotes: http://webpages.charter.net/edreamleo/testimonials.html


Edward K. Ream   email:  [EMAIL PROTECTED]
Leo: http://webpages.charter.net/edreamleo/front.html




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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread sturlamolden

Christophe wrote:

> Nobody mentionned it, but I think you should try PyQT and PyGTK before
> wxPython. Myself, I do not like wx : it looks too much like the MFC.
>
> PyGTK is good, but GTK doesn't work that well on windows.

GTK and PyGTK works well on Windows now. GTK used to be unstable on
Windows, but that has been taken care of. I would not use anything else
but PyGTK for GUI development in Python. Go here to get the Windows
port:

http://www.mapr.ucl.ac.be/~gustin/win32_ports/

With PyGTK and GLADE, the GUI can be designed in GLADE and imported as
an XML-resource (using libglade). It saves us of all the tedious
GUI-programming. All that is needed is the event handlers, which we
obviously have to code. When they are done, we simply put references to
them in a dictionary, and tell libglade to dispacth on it. All the GUI
programming crap is hidden away. Since there is no actual GUI code in
Python, it also makes maintenance and upgrading much easier: The GUI
can be redesigned in GLADE without affecting the Python code. Have you
ever tried to change anything in an MFC project with Visual C++? It's a
nightmare.

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread Kevin Walzer
sturlamolden wrote:
> Christophe wrote:
> 
>> Nobody mentionned it, but I think you should try PyQT and PyGTK before
>> wxPython. Myself, I do not like wx : it looks too much like the MFC.
>>
>> PyGTK is good, but GTK doesn't work that well on windows.
> 
> GTK and PyGTK works well on Windows now. GTK used to be unstable on
> Windows, but that has been taken care of. I would not use anything else
> but PyGTK for GUI development in Python. Go here to get the Windows
> port:
> 
> http://www.mapr.ucl.ac.be/~gustin/win32_ports/
> 
> With PyGTK and GLADE, the GUI can be designed in GLADE and imported as
> an XML-resource (using libglade). It saves us of all the tedious
> GUI-programming. All that is needed is the event handlers, which we
> obviously have to code. When they are done, we simply put references to
> them in a dictionary, and tell libglade to dispacth on it. All the GUI
> programming crap is hidden away. Since there is no actual GUI code in
> Python, it also makes maintenance and upgrading much easier: The GUI
> can be redesigned in GLADE without affecting the Python code. Have you
> ever tried to change anything in an MFC project with Visual C++? It's a
> nightmare.
> 
I'm a Mac developer--Gtk does not run natively on the Mac (i.e. as an
Aqua framework), only under X11. So that's a non-starter for me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread Diez B. Roggisch
> I'm a Mac developer--Gtk does not run natively on the Mac (i.e. as an
> Aqua framework), only under X11. So that's a non-starter for me.


Besides the excellent PyObjc-bridge that of course only works for 
Mac-only-development, you might consider PyQt. Biggest drawback: the 
GPL-license. But feature-wise, it beats IMHO all other toolkits.

It looks pretty well under OSX. Not absolutely perfect, but certainly 
better that the alternatives. Google earth for example is created with 
it, at least in the Mac-incarnation.

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread Wektor

Kevin Walzer wrote:
> sturlamolden wrote:
> > Christophe wrote:
> >
> >> Nobody mentionned it, but I think you should try PyQT and PyGTK before
> >> wxPython. Myself, I do not like wx : it looks too much like the MFC.
> >>
> >> PyGTK is good, but GTK doesn't work that well on windows.
> >
> > GTK and PyGTK works well on Windows now. GTK used to be unstable on
> > Windows, but that has been taken care of. I would not use anything else
> > but PyGTK for GUI development in Python. Go here to get the Windows
> > port:
> >
> > http://www.mapr.ucl.ac.be/~gustin/win32_ports/
> >
> > With PyGTK and GLADE, the GUI can be designed in GLADE and imported as
> > an XML-resource (using libglade). It saves us of all the tedious
> > GUI-programming. All that is needed is the event handlers, which we
> > obviously have to code. When they are done, we simply put references to
> > them in a dictionary, and tell libglade to dispacth on it. All the GUI
> > programming crap is hidden away. Since there is no actual GUI code in
> > Python, it also makes maintenance and upgrading much easier: The GUI
> > can be redesigned in GLADE without affecting the Python code. Have you
> > ever tried to change anything in an MFC project with Visual C++? It's a
> > nightmare.
> >
> I'm a Mac developer--Gtk does not run natively on the Mac (i.e. as an
> Aqua framework), only under X11. So that's a non-starter for me.

You have 2 choices then wxWidgets or Qt.
wx has also graphical editors like Glade (there is a wxGlade project)
giving a xml description of a window and its cross platform.
I know there are graphical for Qt but i dont know if theyre giving xml
or are just code-generators.
You could also do gui in Java or .Net and use python with their native
interpreter (jython is a bit outdated but IronPython is "online")
You can also use a local web app with one of cool Python'ish web
frameworks -- id suggest TurboGears, but you can choose from many ill
mention Django (which is i think the biggest rival for TG)

On the other hand its a pity that there isnt much choice in cross
platform (win mac lin) GUI platforms until now i was a great fan of GTK
but there isnt a proper port for Mac.
Its also a pity that no one didnt do something based on OpenGL with
python (or maybe im wrong) it could be cool and really cross-platform.

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread sturlamolden

Kevin Walzer wrote:

> I'm a Mac developer--Gtk does not run natively on the Mac (i.e. as an
> Aqua framework), only under X11. So that's a non-starter for me.

GTK is skinnable and can look a lot like Aqua. Qt is also just
pretending to be a native Aqua toolkit (or used to), but it is very
good at it.

That leaves you with wxPython (utterly ugly API, remninds me of MFC and
Motif), PyQt (very expensive unless GPL is not a show stopper) or
PyObjC.

http://pyobjc.sourceforge.net/
http://pyobjc.sourceforge.net/doc/tutorial.php

If you are willing to use Jython, you can get a native Aqua GUI from
Java.

Does at GUI really have to be "native"? I never hear anyone complain
about the looks of Microsoft Office or Mozilla Firefox on Windows,
although neither have a "native" GUI.

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


Re: curious paramstyle qmark behavior

2006-10-21 Thread Jon Clements

BartlebyScrivener wrote:

> Jon Clements wrote:
>
> > if your load on the data-entry/browsing side isn't too heavy, you can
> > use the 'development server' instead of installing a full-blown server
> > such as Apache (I'm not sure if IIS is supported).
>
> What's IIS?

It's Internet Information Services: the MS web/ftp server, that's
standard on some window platforms (Control Panel->Add/Remove
Software->Add/Remove Windows Components - or something like that). I
assumed you were on Windows because of you mentioning Access.

Good luck with your project Rick.

All the best,

Jon.

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


Re: iniziare a programmare

2006-10-21 Thread Lemon Tree

Enrico 'Mc Osten' Franchi ha scritto:

> Lemon Tree <[EMAIL PROTECTED]> wrote:
>
> > Non per programmini stupidi.
> > E poi magari ti manca proprio il test che va a coprire una certa parte
> > che, guarda caso...
>
> Allora c'è un problema di sviluppo. I test si scrivono *sempre* e
> comunque. In Python quanto in Java.
>
Allora :)
Tralasciamo tutto il discorso sull'ingegneria del software, test etc.
che io condivido in pieno...
Il mio problema era semplicemente didattico e di ricerca
dell'informazione.

Ho applicato un approccio empirico per vedere cosa riuscivo a tirare
fuori da python.
Premessa: non sono un newbie sulla programmazione perche' so
programmare in Java, C, C++ e conosco bene i concetti su cui questi
linguaggi poggiano. Premessa 2: Mai visto python in vita mia.

Ora do una scorsa alle funzioni dei vari moduli e scopro *a caso* e per
prima questa funzione os.open che mi fa aprire il file (tralasciamo che
non e' il modo piu' conveniente, etc. etc. Fa quello che voglio fare e
mi sta bene per ora)

La documentazione dice:

os.open = open(...)
open(filename, flag [, mode=0777]) -> fd
Open a file (for low level IO).

Scrivo un programma semplicissimo:

fd = os.open("pippo")
os.close(fd)

Lo lancio e... BOOM. Eccezione. Pippo non esiste.

Chiaramente so per esperienza che esiste un meccanismo che consente di
controllare eventuali errori.
Peccato che ne esistono piu' di uno. Ad esempio, un modo potrebbe
essere anche quello di ritornare un fd nullo o negativo. Questo nella
documentazione non e' scritto.

Inoltre l'eccezione che viene sollevata neanche lei e' scritta nella
documentazione di os.open

Quindi a questo punto mi ritrovo con una funzione os.open che so per
esperienza che puo' fallire ma
1) Non so che tipo di meccanismo usa per comunicare il fallimento
2) Dopo averla testata so che genera un'eccezione. Ma questo non basta
perche' ne potrebbe generare piu' di una, magari per diversi tipi di
errori. E questo non lo posso neanche comprendere con i test (anche se
trovo che sarebbe assurdo fare test per scoprire di cosa puo' fallire
una funzione! Dovrebbe essere esplicito)

Quindi alla domanda: cosa scrivo nelle clausole except del blocco in
cui si trova os.open?
Non so dare risposta guardando alla documentazione di os.open.
E questo, IMHO, e` deleterio.

> Ma i manuali sono li per tenere su i tavolini o cosa?
> Sul Nutshell per esempio ci sono tutte le eccezioni standard, la loro
> gerarchia e quello che fanno.
 >
> Lista di eccezioni standard:
> 
>
Questa e` una lista della gerarchia delle eccezioni.
Nulla dice di *quali funzioni* generano *quali eccezioni*
Ci faccio ben poco se voglio rispondere ripondere alla domanda: "Quali
eccezioni cono sollevate dal metodo M"? Qualsiasi sia M.

> Mi sembra che ti stai attancando ad un dettaglio abbastanza
> trascurabile. In primo luogo come sai dove andare a cercare le funzioni,
> ti ho insegnato dove andare a cercare le eccezioni (ma lo avresti potuto
> avere da solo).
>
Quello che hai segnalato non serve per rispondere alle domande che mi
sono posto.

> Poi chiaro che a sboccio più informazione è meglio di meno informazione.
> A meno che non ci siano altri motivi che non mi vengono in mente.
>
Guarda io sono abituato ad i javadoc dove per ogni metodo c'e`

Descrizione dei parametri
Descrizione dei valori di ritorno
Descrizione delle eccezioni eventualmente generate.

Questo da un'informazione completa. Infatti se avessi trovato la
documentazione di os.open scritta in questo modo, lo avrei wrappato
subito con un try except OSError.

> Comunque faccio un follow-up su iclp. È un ambiente molto amichevole che
> ti consiglio di sottoscrivere. Inoltre è il posto giusto per molte delle
> domande che quando qualcuno inizia generalmente fa.
> 
Eccomi qui :)

Ciao

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


Re: Debugging

2006-10-21 Thread R. Bernstein
Fulvio <[EMAIL PROTECTED]> writes:

> ***
> Your mail has been scanned by InterScan MSS.
> ***
> 
> 
> Hello,
> 
> I'm trying out a small utility and my method uses PDB for debugging. I tried 
> to read some information regarding the commands of PDB but are rather 
> synthetic. 

I'm not sure what this means. If you are doing something like an IDE,
that is calling debugger routines from inside a program, then appears
that most of them use bdb, which is not documented but based on the
number times other programs have used it, it doesn't seem to be all
that insurmountable either.

(I have in mind one day to merge in all of the extensions that
everyone has seemed to add in all of those IDEs, along with the
extensions I've added for pydb, and make that a separate package and
add documentation for all of this.)

pdb does not support options, but pydb (http://bashdb.sf.net/pydb)
does. In pdb, if what you wanted to do was run a debugger script, the
way you could do it is to put the commands in .pdbrc. For pydb the
default file read is .pydbrc, but you can turn that *off* with -nx and
you can specify another file of your own using --command=*filename*.

In pydb, instead of listing commands in a file, it's also possible to
give them on a command line like this

pydb --exec='step 2;;where;;quit' python-script python-script-opt1

(Inside both pdb or pydb, ';;' separates commands)

> Mostly I'd like to understand the use of  "condition" command in 
> terms to use breakpoints (BP) with functions.

pydb (and to some extent pdb) follow the gdb command concepts. pydb
has more extensive documentation
(http://bashdb.sourceforge.net/pydb/pydb/lib/index.html) but if this
isn't enough I think the corresponding sections from gdb might be of help.

> Simple the first doubt was a counted BP. What variable using that BP and 
> which 
> function can be taken from the command line?

In pydb as with gdb, the first breakpoint has number 1, the next
breakpoint 2. When breakpoints are deleted, the numbers don't get
reused. 

(I think all of this is the case also with pdb, but someone might
check on this; it's possible breakpoints in pdb start from 0 instead
of 1 as is the  case in gdb/pydb.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZODB and Python 2.5

2006-10-21 Thread Martin v. Löwis
Jean-Paul Calderone schrieb:
> Python 2.5 made quite a changes which were not backwards compatible,
> though.  I think for the case of Python 2.4 -> Python 2.5 transition,
> quite a few apps will be broken, many of them in relatively subtle
> ways (for example, they may have been handling OSError instead of
> WindowsError

That shouldn't cause a problem, though: OSError is a base class
of WindowsError, so if handled OSError, the same exception handlers
will get invoked.

The problem occurs when they had been handling WindowsError, and looked
at errno, treating it as a windows error code: errno is now a real POSIX
error number (with the same values that the errno module uses), and
the windows error number is stored in an additional attribute.

> or it might define a
> slightly buggy but previously working __hash__ which returns the id() of
> an object

That shouldn't cause problems, either. It did cause problems in the beta
release, but IIRC, somebody solved this before the release...

> it might have relied on the atime and mtime fields of a
> stat structure being integers rather than floats).

This was actually changed in 2.3, not in 2.5; 2.5 just changed the
value of os.stat_float_times. Advance warning about this change was
given for quite some time (but certainly, most people have ignored
it).

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread sturlamolden

Wektor wrote:

> wx has also graphical editors like Glade (there is a wxGlade project)
> giving a xml description of a window and its cross platform.

If you are thinking about XRC, then beware that this XML don't solve
any problems, it just creates another. XRC and libglade do not compare.
libglade makes the GUI development easy and the program code clean and
easy to read. XRC makes the GUI development difficult and the program
code convoluted and difficult to read.

Also wxGlade is not GLADE. In particular, wxGlade is unstable and tend
to crash or do stupid things. But if your oalternative is to hand-code
the wxPython GUI, then wxGLADE is nevertheless the better option.

> On the other hand its a pity that there isnt much choice in cross
> platform (win mac lin) GUI platforms until now i was a great fan of GTK
> but there isnt a proper port for Mac.

GTK is being ported to Aqua, but the port it is in its early stages.

> Its also a pity that no one didnt do something based on OpenGL with
> python (or maybe im wrong) it could be cool and really cross-platform.

You are wrong. There are PyOpenGL and there is cross-platform GUI and
game development platforms that use it (PyGTK, wxPython, PyGame). There
are also PyOgre, which are more pythonic than using OpenGL directly.

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread sturlamolden

Wektor wrote:

> wx has also graphical editors like Glade (there is a wxGlade project)
> giving a xml description of a window and its cross platform.

If you are thinking about XRC, then beware that this XML don't solve
any problems, it just creates another. XRC and libglade do not compare.
libglade makes the GUI development easy and the program code clean and
easy to read. XRC makes the GUI development difficult and the program
code convoluted and difficult to read.

Also wxGlade is not GLADE. In particular, wxGlade is unstable and tend
to crash or do stupid things. But if your alternative is to hand-code
the wxPython GUI, then wxGLADE is nevertheless the better option.

> On the other hand its a pity that there isnt much choice in cross
> platform (win mac lin) GUI platforms until now i was a great fan of GTK
> but there isnt a proper port for Mac.

GTK is being ported to Aqua, but the port it is in its early stages.

> Its also a pity that no one didnt do something based on OpenGL with
> python (or maybe im wrong) it could be cool and really cross-platform.

You are wrong. There are PyOpenGL and there is cross-platform GUI and
game development platforms that use it (PyGTK, wxPython, PyGame). There
are also PyOgre, which are more pythonic than using OpenGL directly.

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


Re: Detect Unused Modules

2006-10-21 Thread Kamilche
> Nice as it is, but why not use pylint to check this and many other
> coding style issues?

I made this the first time I mangled some code because pychecker said
some modules were not used when they really were. The module wasn't
that complex, only 302 lines, but it got it wrong.

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


Re: User Access to the docstring of a property

2006-10-21 Thread Colin J. Williams
George,

Thanks to Dietz and yourself.

Yes, I should have referenced the class, rather than the instance. 
However, for methods, the docstring is revealed for an instance.

Colin W.

PS It would help if someone could explain the use of @apply in the 
example Dietz gave.  The documentation gives no reference to @ or to 
decorators.

[EMAIL PROTECTED] wrote:
> Colin J. Williams wrote:
>> Is there some way that the user can access the docstring specified for a
>> property?
> 
> Do keep in mind that the docstring is not guaranteed to be available.
> If
> the application is run with optimization turned on, docstrings are
> usually
> optimized out.  Docstrings are handy for reading code and maybe for
> debugging, but should not be relied upon for "users", as opposed to
> developers.
> 
> -- George Young
> 
>> Please see the example below:
>>
>> # propDocTest
>> class A(object):
>>def __init__(self, value):
>>  self.value= value
>>def vGet(self):
>>  return self.value
>>V= property (fget= vGet, doc="Get Value.")
>>
>> a= A(22)
>> print a.vGet()
>> print a.V
>> print a.V.__doc__ # this gives the docstring for the value returned
>> help(a.V) # this gives the docstring for the class/type of
>> the value returned
>>
>> Colin W.
> 

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


Why doesn't this work?

2006-10-21 Thread Ron Garret
Python 2.3.5 (#1, Jan 30 2006, 13:30:29) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1819)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> class ts(datetime):
...   def __init__(self): pass
... 
>>> ts()
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: function takes at least 3 arguments (0 given)
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: iniziare a programmare

2006-10-21 Thread bearophileHUGS
Lemon Tree:

Interesting discussion, and I agree that having more info about the
exceptions that can be raised is generally useful. You too can improve
python docs, putting more info inside them.
But this is the wrong newgroup, this isn't iclp, this is clp.

Bye,
bearophile

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread [EMAIL PROTECTED]
pygtk can be a pain to install and some of the librarys that are built
on top of it have copyrights and such.  apple for the fonts and there
is one for the images.  It also can be a pain to install..  It would be
nice to see it as a low cost comercial package that is already put
together say $20 or so then to try to workout a distribution for some
of that.  (but then I believe apple should buy borland).  I think
sci-pi (If I have the name right) would be a very good platform to
extend gtk.  A) it is well documentated B) they made it as easy as
possible to install.  pywin might have some acess to graphics but it is
windows only and the documentation is sparce.

http://www.dexrow.com


sturlamolden wrote:
> Wektor wrote:
>
> > wx has also graphical editors like Glade (there is a wxGlade project)
> > giving a xml description of a window and its cross platform.
>
> If you are thinking about XRC, then beware that this XML don't solve
> any problems, it just creates another. XRC and libglade do not compare.
> libglade makes the GUI development easy and the program code clean and
> easy to read. XRC makes the GUI development difficult and the program
> code convoluted and difficult to read.
>
> Also wxGlade is not GLADE. In particular, wxGlade is unstable and tend
> to crash or do stupid things. But if your alternative is to hand-code
> the wxPython GUI, then wxGLADE is nevertheless the better option.
>
> > On the other hand its a pity that there isnt much choice in cross
> > platform (win mac lin) GUI platforms until now i was a great fan of GTK
> > but there isnt a proper port for Mac.
>
> GTK is being ported to Aqua, but the port it is in its early stages.
>
> > Its also a pity that no one didnt do something based on OpenGL with
> > python (or maybe im wrong) it could be cool and really cross-platform.
>
> You are wrong. There are PyOpenGL and there is cross-platform GUI and
> game development platforms that use it (PyGTK, wxPython, PyGame). There
> are also PyOgre, which are more pythonic than using OpenGL directly.

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


Re: Why doesn't this work?

2006-10-21 Thread Larry Bates
Because datetime is a new-style class:

The Constructor __new__

If you are like me, then you probably always thought of the __init__ method as
the Python equivalent of what is called a constructor in C++. This isn't the
whole story.

When an instance of a class is created, Python first calls the __new__ method of
the class. __new__ is a static method that is called with the class as its first
argument. __new__ returns a new instance of the class.

The __init__ method is called afterwards to initialize the instance. In some
situations (think "unplickling"!), no initialization is performed. Also,
immutable types like int and str are completely constructed by the __new__
method; their __init__ method does nothing. This way, it is impossible to
circumvent immutability by explicitly calling the __init__ method after
construction.


I think what you wanted was:

>>> class ts(datetime):
... def __new__(self): pass
... 
>>> a=ts()

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


Screen capture on Linux

2006-10-21 Thread Paolo Pantaleo
Hi,

I need to capture a screen snapshot in Linux. PIL has a module
IageGrab, but in the free version it only works under Windows. Is
there any package to capture the screen on Linux?

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


Re: Screen capture on Linux

2006-10-21 Thread Sai Krishna M
On 10/21/06, Paolo Pantaleo <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I need to capture a screen snapshot in Linux. PIL has a module

Its defaultly provided in the 'actions' menu of the OS.

> IageGrab, but in the free version it only works under Windows. Is
> there any package to capture the screen on Linux?


-- 
I love Freedom
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread sturlamolden

[EMAIL PROTECTED] wrote:

> pygtk can be a pain to install and some of the librarys that are built
> on top of it have copyrights and such.  apple for the fonts and there
> is one for the images.  It also can be a pain to install..  It would be
> nice to see it as a low cost comercial package that is already put
> together say $20 or so then to try to workout a distribution for some
> of that.

On Windows, there are two installers you need to download: One for
PyGTK and one for GLADE + the GTK runtime. Double-click on the
installers and wheeey ... everything works.

http://www.mapr.ucl.ac.be/~gustin/win32_ports/pygtk.html
http://gladewin32.sourceforge.net/modules/news/

If you cannot make this work, your computer skills are at level that
makes me amazed that you have any use for a programming language...



> (but then I believe apple should buy borland).  I think
> sci-pi (If I have the name right) would be a very good platform to
> extend gtk.  A) it is well documentated B) they made it as easy as
> possible to install.  pywin might have some acess to graphics but it is
> windows only and the documentation is sparce.

SciPy is a toolset for scientific programming in Python. It does not
contain any graphics stuff. SciPy depends on NumPy (formerly SciPy
core), which is the "bleeding edge" package for numerical programming
in Python. If you need to scientific datavisualization in Python, you
should take a look at Matplotlib, which also depends on NumPy.
Matplotlib can use a number of backends for displaying graphs,
including PyGTK. I routinely use Matplotlib to draw graphs in my PyGTK
apps on MS Windows. This jus requires two or three installs: NumPy,
Matplotlib and (optionally) SciPy. But you don't need this packages
unless you are doing heavy scientific or numeric programming.

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


silent processing with python+modpython+cheetah

2006-10-21 Thread Sai Krishna M
Hi,

I have been working for some time developing web pages using python,
modpython, cheetah.
I find that this method has come inherent difficulties in it like if
we want to generate a single page we have to write two separate files
( py & tmpl).
Is there any other better way of doing things.?

Also if we want to have partial processing of the pages, i.e, the
value one chooses for a particular field determines the value to be
entered for another field in the same page, how can it be done?

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread Jani Hakala
Kevin Walzer <[EMAIL PROTECTED]> writes:

> For instance, I've developed several Tcl
> applications that use the core Tk widgets, the Tile theming package, the
> Bwidget set (great tree widget and listbox, which allows you to embed
> images), and tablelist (an extremely flexible muti-column listbox
> display). 
> 
I tried to look for a python-library when I started using
tablelist. The only link I found was quite dead.

I spent a day or two while learning how to do a minimal (i.e. only
those methods that I have needed) implementation from scratch :(
It seems to work quite well for my purposes.

> I've found Python wrappers for some of this stuff, but almost
> no documentation on how to use them
>
Is there sufficient documentation for the Tcl/Tk libraries that the
wrappers have been coded for? At least with Tkinter and Tix it is
usually quite obvious what is the corresponding python method if you
know the Tcl/Tk counterpart.

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


Re: Why doesn't this work?

2006-10-21 Thread Ron Garret
In article <[EMAIL PROTECTED]>,
 Larry Bates <[EMAIL PROTECTED]> wrote:

> Because datetime is a new-style class:

Ah.

> The Constructor __new__
> 
> If you are like me, then you probably always thought of the __init__ method 
> as
> the Python equivalent of what is called a constructor in C++. This isn't the
> whole story.
> 
> When an instance of a class is created, Python first calls the __new__ method 
> of
> the class. __new__ is a static method that is called with the class as its 
> first
> argument. __new__ returns a new instance of the class.
> 
> The __init__ method is called afterwards to initialize the instance. In some
> situations (think "unplickling"!), no initialization is performed. Also,
> immutable types like int and str are completely constructed by the __new__
> method; their __init__ method does nothing. This way, it is impossible to
> circumvent immutability by explicitly calling the __init__ method after
> construction.
> 
> 
> I think what you wanted was:
> 
> >>> class ts(datetime):
> ...   def __new__(self): pass
> ...   
> >>> a=ts()
> 
> -Larry

Thanks!

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


Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-21 Thread Peter Decker
On 21 Oct 2006 08:26:56 -0700, sturlamolden <[EMAIL PROTECTED]> wrote:

> That leaves you with wxPython (utterly ugly API, remninds me of MFC and
> Motif), PyQt (very expensive unless GPL is not a show stopper) or
> PyObjC.

I too hated the wxPython API, but loved how it looked. And since I
need things to run cross-platform (in my case, Linux and Windows), I
held my breath and coded in wxPython, because the results were well
worth it.

Now that I've discovered Dabo, which wraps wxPython, hiding the C++
ugliness under a very Pythonic API, I have the best of both worlds. I
get to code naturally, and the results look great.

-- 

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


Re: Screen capture on Linux

2006-10-21 Thread Grant Edwards
On 2006-10-21, Sai Krishna M <[EMAIL PROTECTED]> wrote:
> On 10/21/06, Paolo Pantaleo <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I need to capture a screen snapshot in Linux. PIL has a module

ImageMagick has a command-line program named "import" that you
might be able to use.

> Its defaultly provided in the 'actions' menu of the OS.

No, it isn't.  The OS has no "actions menu".

Your particular desktop configuration might, but it's that's
certainly not a characteristic of the OS.

-- 
Grant Edwards   grante Yow!  After this, I'm going
  at   to BURN some RUBBER!!
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: User Access to the docstring of a property

2006-10-21 Thread Diez B. Roggisch
Colin J. Williams schrieb:
> George,
> 
> Thanks to Dietz and yourself.
> 
> Yes, I should have referenced the class, rather than the instance. 
> However, for methods, the docstring is revealed for an instance.
> 
> Colin W.
> 
> PS It would help if someone could explain the use of @apply in the 
> example Dietz gave.  The documentation gives no reference to @ or to 

The decorator semantics are simple:


@a
@b(argument)
def foo():
pass

get translated to

foo = a(b(argument)(foo))

as a decorator is nothing but function that is called with one thing, 
and returns something else. or the same thing, by the way.

Now apply was important back then before the *args and **keywordargs 
shortcuts where introduced.

It basically takes a function as first argument, and possibly a list 
and/or dict, and invokes the function with that argumens in place.

So

def foo(a):
print a

apply(foo, [10])

works as simple as

foo(10)


locals() is a built-in that returns a dictionary which contains all the 
locally known names.

And property is a descriptor-creation-function, that has this signature:

property(fget, fset, fdel, doc)

Now we have all we need to decompose that neat property-creation-trick 
that doesn't pollute the class' namespace:

class Foo(object):
   @apply
   def bar():
  def fget(self):
  return self._bar
  doc = "bar property"
  return property(**locals())



What happens is this:

the decoration gets translated to this:

bar = apply(bar)

which does simply invoke bar, and assign the result to the name bar in 
the class.

invoking bar executes the property function, which is fed with the 
dictionary of the locals - coincidently named after the named arguments 
property takes.


What I really do love about this: it doesn't pollute the namespace.

Regards,

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


A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread atbusbook
I'm doing a report on the speed of develipment and executionin varius
programing langiuiges. write code for all these tasks in the languige
of your choise if intrestied send code to [EMAIL PROTECTED]

Task 1:
  write a program that prints how many times you repeat all words in a
file passed as a comand line
  paramiter and from STDIN. with the output format being "\"%s\" word
repeated %i times\n"
Task 2:
  write a comand line rpn calculator that has a syntax like forth with
only floats; also it must have these and
  only these operations +, -, *, /, ., .s, rot, dup, swap, pick, roll.
. and .s are pop print and .s print stack in this
  with a new line after each item and the top of the stack at the
bottom.

compiler info

c#: mono 1.1.13.7
perl: perl 5.8.8
python: python 2.4.2
ruby: ruby 1.8.4

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


Strptime Problem with PyLucene

2006-10-21 Thread Kyujin Shim
I want to use time module like this.mydate = time.strptime('17 Jul 2006 07:23:09 GMT', '%d %b %Y %H:%M:%S %Z')But, I have some problem when I run it with PyLucene. Is there someone know about this problem?
(1:351:148)$ pythonPython 2.4.4c0 (#2, Jul 30 2006, 15:43:58) [GCC 4.1.2 20060715 (prerelease) (Debian 4.1.1-9)] on linux2Type "help", "copyright", "credits" or "license" for more information.
>>> import PyLuceneWARNING: Error loading security provider gnu.javax.crypto.jce.GnuCrypto: java.lang.ClassNotFoundException: gnu.javax.crypto.jce.GnuCrypto not found in [file:./, core:/]WARNING: Error loading security provider 
gnu.javax.crypto.jce.GnuSasl: java.lang.ClassNotFoundException: gnu.javax.crypto.jce.GnuSasl not found in [file:./, core:/]WARNING: Error loading security provider gnu.javax.net.ssl.provider.Jessie: java.lang.ClassNotFoundException
: gnu.javax.net.ssl.provider.Jessie not found in [file:./, core:/]WARNING: Error loading security provider gnu.javax.security.auth.callback.GnuCallbacks: java.lang.ClassNotFoundException: gnu.javax.security.auth.callback.GnuCallbacks
 not found in [file:./, core:/]>>> import time>>> mydate = time.strptime('17 Jul 2006 07:23:09 GMT', '%d %b %Y %H:%M:%S %Z')Traceback (most recent call last):  File "", line 1, in ?
  File "/usr/lib/python2.4/_strptime.py", line 293, in strptimeraise ValueError("time data did not match format:  data=""  fmt=%s" %ValueError: time data did not match format:  data="" Jul 2006 07:23:09 GMT  fmt=%d %b %Y %H:%M:%S %Z
>>> --This works fine.--Type "help", "copyright", "credits" or "license" for more information.
>>> import time>>> time.strptime('17 Jul 2006 07:23:09 GMT', '%d %b %Y %H:%M:%S %Z')(2006, 7, 17, 7, 23, 9, 0, 198, 0)>>> -
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread Paul Lutus
[EMAIL PROTECTED] wrote:

> I'm doing a report on the speed of develipment and executionin varius
> programing langiuiges. write code for all these tasks in the languige
> of your choise if intrestied send code to [EMAIL PROTECTED]

What you should be doing is learning basic literacy.

Life works like this:

1. Write your magnum opus article, become famous, retire to a Greek island.

2. But first, learn how to assemble paragraphs into articles.

3. But first, learn how to assemble sentences into paragraphs.

4. But first, learn how to assemble words into sentences.

5. But first, learn how to assemble letters into words.

Start at the bottom, work to the top. Whatever you do, do not presume to
start at the top.

Also, don't post your homework assignment word-for-word. It makes you look
craven and inexperienced.

-- 
Paul Lutus
http://www.arachnoid.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread Scott M.
Perhaps you should do your own work so you'll understand the concept and 
learn something?

Also, widely posting your real (unaltered) email address in forums like this 
is a sure way to get noticed by spammers.

Good luck.

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I'm doing a report on the speed of develipment and executionin varius
> programing langiuiges. write code for all these tasks in the languige
> of your choise if intrestied send code to [EMAIL PROTECTED]
>
> Task 1:
>  write a program that prints how many times you repeat all words in a
> file passed as a comand line
>  paramiter and from STDIN. with the output format being "\"%s\" word
> repeated %i times\n"
> Task 2:
>  write a comand line rpn calculator that has a syntax like forth with
> only floats; also it must have these and
>  only these operations +, -, *, /, ., .s, rot, dup, swap, pick, roll.
> . and .s are pop print and .s print stack in this
>  with a new line after each item and the top of the stack at the
> bottom.
>
> compiler info
>
> c#: mono 1.1.13.7
> perl: perl 5.8.8
> python: python 2.4.2
> ruby: ruby 1.8.4
> 


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


Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I'm doing a report on the speed of develipment and executionin varius
> programing langiuiges. write code for all these tasks in the languige
> of your choise if intrestied send code to [EMAIL PROTECTED]
>
> Task 1:
>  write a program that prints how many times you repeat all words in a
> file passed as a comand line
>  paramiter and from STDIN. with the output format being "\"%s\" word
> repeated %i times\n"
> Task 2:
>  write a comand line rpn calculator that has a syntax like forth with
> only floats; also it must have these and
>  only these operations +, -, *, /, ., .s, rot, dup, swap, pick, roll.
> . and .s are pop print and .s print stack in this
>  with a new line after each item and the top of the stack at the
> bottom.
>
> compiler info
>
> c#: mono 1.1.13.7
> perl: perl 5.8.8
> python: python 2.4.2
> ruby: ruby 1.8.4
>

yer dreemin sorry not intrestied due yer onn homework 


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


What About Next Laptop Computers?

2006-10-21 Thread Joe
L International Reveals Plans for High-Tech
Next-Generation Laptop Computer Systems

L International Computers Inc. "L" renowned manufacturer of
high-performance computers and personal/business technologies, revealed
plans for its next generation high-end laptop and ultra-portable
computer systems.

To read this articles, go to:
http://www.contactomagazine.com/laptopcomputers1006.htm

More Business and Computer News:
http://www.contactomagazine.com/business.htm

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


Re: What About Next Laptop Computers?

2006-10-21 Thread John Purser
On Sat, 2006-10-21 at 11:51 -0700, Joe wrote:
> L International Reveals Plans for High-Tech
> Next-Generation Laptop Computer Systems
> 
> L International Computers Inc. "L" renowned manufacturer of
> high-performance computers and personal/business technologies, revealed
> plans for its next generation high-end laptop and ultra-portable
> computer systems.
> 
> To read this articles, go to:
> http://www.contactomagazine.com/laptopcomputers1006.htm
> 
> More Business and Computer News:
> http://www.contactomagazine.com/business.htm
> 

Golly Joe, why would any member of a mailing list be interested in
products advertised by spamming their mailing list?

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


Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread sturlamolden

[EMAIL PROTECTED] wrote:

> c#: mono 1.1.13.7
> perl: perl 5.8.8
> python: python 2.4.2
> ruby: ruby 1.8.4

And why would any of this tell you anything about static versus dynamic
languages? The languages you list are all dependent on different
runtimes, and your results will simply reflect that. It would not tell
you anything about how the dynamic or static nature of the language
affects the execution speed.

Common Lisp is dynamic just like Python, and there are interpreted and
compiled implementations of it. It is common knowledge that interpreted
Lisp is "slow". Fewer know that compiled Lisp runs nearly at the speed
of C, albeit being a dynamic language. So how would you conclude if you
added a compiled implementation of Common Lisp to your list?

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


Re: why does this unpacking work

2006-10-21 Thread Bruno Desthuilliers
John Salerno a écrit :
> [EMAIL PROTECTED] wrote:
> 
>> It's just sequence unpacking.  Did you know that this works?:
>>
>> pair = ("California","San Francisco")
>> state, city = pair
>> print city
>> # 'San Francisco'
>> print state
>> # 'California'
> 
> 
> Yes, I understand that. What confused me was if it had been written like 
> this:
> 
> pair = (("California","San Francisco"))


Python 2.4.1 (#1, Jul 23 2005, 00:37:37)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on 
linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> (("California","San Francisco")) == ("California","San Francisco")
True
pair = "California","San Francisco"
 >>> pair
('California', 'San Francisco')
 >>> t = 1,
 >>> t
(1,)
 >>> t = 1, 2
 >>> t
(1, 2)
 >>>

HTH



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


Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-21 Thread Anna Ravenscroft
On 10/20/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
> At the beginning of the month the PSF Infrastructure committee announced
> that we had reached the decision that JIRA was our recommendation for the
> next issue tracker for Python development.  Realizing, though, that it was a
> tough call between JIRA and Roundup we said that we would be willing to
> switch our recommendation to Roundup if enough volunteers stepped forward to
> help administer the tracker, thus negating Atlassian's offer of free managed
> hosting.
>
> Well, the community stepped up to the challenge and we got plenty of
> volunteers!  In fact, the call for volunteers has led to an offer for
> professional hosting for Roundup from Upfront Systems.  The committee is
> currently evaluating that offer and will hopefully have a decision made
> soon.  Once a decision has been made we will contact the volunteers as to
> whom we have selected to help administer the installation (regardless of who
> hosts the tracker).  The administrators and python-dev can then begin
> working towards deciding what we want from the tracker and its
> configuration.
>
> Once again, thanks to the volunteers for stepping forward to make this
> happen!
>
> -Brett Cannon
> PSF Infrastructure committee chairman

Interestingly enough, the quote of the day from Google on this email was:

Never doubt that a small group of thoughtful, committed citizens can
change the world; indeed, it's the only thing that ever has.
Margaret Mead

It just seems highly appropriate. I'm very glad we decided to go with
Roundup. I've been impressed with its usability when I've had the
opportunity to use it.
-- 
cordially,
Anna
--
It is fate, but call it Italy if it pleases you, Vicar!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good Form

2006-10-21 Thread bruno de chez modulix en face

[EMAIL PROTECTED] a écrit :

> I am new to Python but come from a C++ background so I am trying to
> connect the dots :) . I am really liking what I see so far but have
> some nubee questions on what is considered good form. For one thing I
> am used to class variables

I assume you mean "instance attributes". In Python, "class attributes"
are attributes that belong to the class object itself, and are shared
by all instances.

>being accessable only through methods
> instaed of directly refrenced from the object instence.

C++ have "access restriction" on attributes, which default is
"private". Also, C++ makes a strong distinction between fonctions and
data. Python's object model is very different here:
1/ There's no language-inforced access restriction. Instead, there's a
naming convention stating that names starting with an underscore are
implementation detail - ie : not part of the public interface - and as
such *should* not be accessed by client code.
2/ Since Python is 100% object, functions (and methods) are objects too
- so there's no strong "member variable vs method" distinction : both
are attributes.

> From what I
> have read it looks like when you access a class variable directly in
> Python it has something in the background that works similar to a
> getter of setter.

That's not technically true. *But* since Python has support for
computed attributes, it's quite easy to turn a raw attribute into a
computed one without the client code noticing it. So from a conceptual
POV, you can think of  direct attribute acces as a computed attribute
acces with implicit getter/setter...

> Would you normally write methods to retrive and set your class
> variables or just refrence them directly?

Depends. Languages like C++ or Java not having support for computed
attributes, the tradition is to have a "public methods==behaviour" /
"private data==state" mindset. With Python's support for both computed
attributes and functions as first class objects, thinks are quite
differents. The best approach IMHO is to think in terms of "public
interface vs implementation", and choose to use attribute or method
syntax based on semantic - how it will be effectively implemented being
an orthogonal concern.

To make things short : if it's obviously an attribute (ie : person's
name etc), start by making it a public attribute and access it
directly. If and when you need to control access to this attribute
(either to compute it or make it read-only or whatever), then turn it
into a property (aka computed attribute).

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


Re: silent processing with python+modpython+cheetah

2006-10-21 Thread Bruno Desthuilliers
Sai Krishna M a écrit :
> Hi,
> 
> I have been working for some time developing web pages using python,
> modpython, cheetah.
> I find that this method has come inherent difficulties in it like if
> we want to generate a single page we have to write two separate files
> ( py & tmpl).
> Is there any other better way of doing things.?

If you need to write specific python module and template for each and 
any page of your site/app, it may be time to google for "content 
management system" and "model view controller".

> Also if we want to have partial processing of the pages, i.e, the
> value one chooses for a particular field determines the value to be
> entered for another field in the same page, how can it be done?

Stop thinking in terms of "page", and you'll be on the way. Or switch to 
Pylons:
http://www.pylonshq.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Inheriting property functions

2006-10-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit :
(snip)
> The trouble is that get_a and set_a are attributes of the _class
> object_ A.  Instances of A (and hence, instances of B) will see them,
> but the class B will not,

Yes it does:

 >>> class A(object):
... aa = "aa"
...
 >>> class B(A):pass
...
 >>> B.aa
'aa'
 >>>


> so you have to point to them explicitly with
> A.get_a and A.set_a.

Actually, while the solution is good, the explanation is wrong.

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


Re: Decorators and how they relate to Python - A little insight please!

2006-10-21 Thread Bruno Desthuilliers
Jerry a écrit :
> Thanks to everyone that resonded.  I will have to spend some time
> reading the information that you've provided.
> 
> To Fredrik, unfortunately yes.  I saw the examples, but couldn't get my
> head wrapped around their purpose.  Perhaps it's due to the fact that
> my only experience with programming is PHP, Perl and Python and to my
> knowledge only Python supports decorators (though it could be that I
> just didn't encounter them until I came across Python).

Python's "decorators" are just a possible use of "higher order 
functions" (aka HOFs) - functions that takes functions as arguments 
and/or return functions. HOFs are the base of functional programming 
(Haskell, ML, Lisp, etc), and rely on functions being first class 
citizens (which is the case in Python where functions are objects). 
While Python is not truly a functional language, it has a good enough 
support for functional programing, and happily mixes functional 
programming and OO concepts.

If you have no prior exposure to a functional language, it's not 
surprinsing you have some hard time understanding decorators and their 
possible uses. I suggest you read David Mertz's articles on FP in Python:
http://www-128.ibm.com/developerworks/library/l-prog.html

While these articles predate the @decorator syntax (and FWIW makes 
absolutely no mention of decorators), it should help you grasping basic 
Python's functional idioms.

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


Re: Decorators and how they relate to Python - A little insight please!

2006-10-21 Thread Fuzzyman

Fredrik Lundh wrote:
> Jerry wrote:
>
> > even though I've read the PEP
>
> even the examples section?
>
>  http://www.python.org/dev/peps/pep-0318/#examples
>

The second example of which shows :

Define a class with a singleton instance. Note that once the class
disappears enterprising programmers would have to be more creative to
create more instances. (From Shane Hathaway on python-dev.)

def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance

@singleton
class MyClass:
...


:-o

Fuzzyman
http://www.voidspace.org.uk/


> if you want more examples, see the cookbook
>
> http://www.google.com/search?q=+site%3Aaspn.activestate.com+decorator+cookbook
> 
> 

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


Re: silent processing with python+modpython+cheetah

2006-10-21 Thread Steve Holden
Sai Krishna M wrote:
> Hi,
> 
> I have been working for some time developing web pages using python,
> modpython, cheetah.
> I find that this method has come inherent difficulties in it like if
> we want to generate a single page we have to write two separate files
> ( py & tmpl).
> Is there any other better way of doing things.?
> 
> Also if we want to have partial processing of the pages, i.e, the
> value one chooses for a particular field determines the value to be
> entered for another field in the same page, how can it be done?
> 
> Thanks,
> Sai krishna.

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

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: Decorators and how they relate to Python - A little insight please!

2006-10-21 Thread [EMAIL PROTECTED]
Jerry wrote:
> Thanks to everyone that resonded.  I will have to spend some time
> reading the information that you've provided.
>
> To Fredrik, unfortunately yes.  I saw the examples, but couldn't get my
> head wrapped around their purpose.

You're probably looking at the newfangled @decorator syntax.

Things were a lot clearer when decorators were called explicitly:

class foo(object):
   def bar(self):
  ...
   bar = classmethod(bar)

That makes it a lot more obvious that classmethod is simply a
higher-order function (that is, it takes a function as an argument and
returns a function).

It is equivalent to the newer:

class foo(object):
   @classmethod
   def bar(self):
  ...

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


print dos format file into unix format

2006-10-21 Thread [EMAIL PROTECTED]
Suppose I have a dos format text file. The following python code will
print ^M at the end. I'm wondering how to print it in unix format.

fh = open(options.filename)
for line in fh.readlines()
  print line,

Thanks,
Peng

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


Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread Gerrit Holl
On 2006-10-21 20:41:42 +0200, Scott M. wrote:
> Also, widely posting your real (unaltered) email address in forums like this 
> is a sure way to get noticed by spammers.

This newsgroup is mirrored by a mailing-list, so many people use their real
address. The solution to spam is spamfiltering (spambayes), not hiding ones
address on the internet.

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


Re: ZODB and Python 2.5

2006-10-21 Thread Andrew McLean
Robert Kern wrote:
> I would suggest, in order:
> 
> 1) Look on the relevant mailing list for people talking about using ZODB 
> with Python 2.5.

Been there, didn't find anything. Except that recently released versions 
of Zope (2.9.5 and 2.10.0) aren't compatible with Python 2.5. [Being 
pedantic 2.9.5 "doesn't work" under Python 2.5, 2.10.0 is merely 
"unsupported".]

> 2) Just try it. Install Python 2.5 alongside 2.4, install ZODB, run the 
> test suite.

Now if ZODB had been pure Python, or I was using a Unix(ish) platform I 
would have tried that. Getting set up to compile C extensions under 
Windows is a bit too much hassle. I can wait ;-).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: print dos format file into unix format

2006-10-21 Thread Steve Holden
[EMAIL PROTECTED] wrote:
> Suppose I have a dos format text file. The following python code will
> print ^M at the end. I'm wondering how to print it in unix format.
> 
> fh = open(options.filename)
> for line in fh.readlines()
>   print line,
> 
> Thanks,
> Peng
> 
open(outfile, "wb").write(open(infile, "rb").read().replace("\r", ""))

Or something like that ... :)

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: A Comparison Of Dynamic and Static Languiges

2006-10-21 Thread sturlamolden

Gerrit Holl wrote:

> This newsgroup is mirrored by a mailing-list, so many people use their real
> address. The solution to spam is spamfiltering (spambayes), not hiding ones
> address on the internet.

The answer to spam here in Norway is incredibly simple. It seems that
all spam originates in the US or South Korea. The following filter can
thus be applied:

1. Create a white-list of all valid contacts in the US.
(There is no need to create a white list for Korea, as it will be empty
anyway.)

2. Do a reverse nslookup of the sender on zz.countries.nerd.dk. If the
return value is 127.0.3.72 or 127.0.1.154, and the sender is not in the
whitelist, flag the mail as spam.

3. Accept all other mail.

Do you think spambayes can beat this filter?

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


Re: Python with MPI enable C-module

2006-10-21 Thread [EMAIL PROTECTED]
Mitko,

Thank you for your response.

You understand the problem correctly. The Python module uses MPI calls
in its implementation. The idea of the project is to create an
abstraction for a distributed memory computer. In doing so, the user is
mostly isolated from a need to understand and use MPI calls.

After my post, I was able to find some more information on the subject.
I think you are right in that mpiexec (or equivalents) would not work
without some extra work. However it seems that using an additional
module (such as http://datamining.anu.edu.au/~ole/pypar/";>Pypar) would allow
me to use Python with mpiexec.

Thank you,
~doug

On Oct 20, 7:13 pm, Mitko Haralanov <[EMAIL PROTECTED]> wrote:
> On 19 Oct 2006 06:51:00 -0700
>
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > 1) Would setting up an environment like this require modifying the
> > Python interpreter or the C++ module that is being wrapped? What I'm
> > hoping is that the C++ module can go on happily doing MPI operations
> > despite the fact that it is actually being called by the Python
> > interpreter.If I am understanding you correctly, you have a Python module 
> > which
> calls into the C++ library to do the actual MPI operations. If that is
> the case, then there should be any problems just calling the Python
> wrappers. The MPI library should be unaffected. It would be the same as
> having your node programs call into the C++ library, now you just have
> one more layer of abstraction.
>
> > 2) Would it be possible to spawn these Python processes using mpiexec
> > (or something similar), or would I need to use some of the MPI-2
> > features to dynamically set up the MPI environment?If you are writing a 
> > Python wrapper to the MPI library, then the
> wrapper will be just like a module and not a self sustained program. If
> that is the case, mpiexec/mpirun/mpd would not be able to do anything
> since they expect to start a program that has main()/__main__.
>
> > 3) Has anyone accomplished something like this already? I know there
> > are extensions and modules that add MPI functionality to Python, but
> > I'm hoping they could be avoided, since the Python code itself should
> > never really have to be aware of MPI, only the C++ module that has
> > already been written.Haven't done it but from what I know about MPI and 
> > Python, it is
> possible.
>
> --
> Mitko Haralanov  [EMAIL PROTECTED]
> Senior Software Engineer 650.934.8064
> System Interconnect Group  http://www.qlogic.com

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


Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Tim Roberts
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote:

>[EMAIL PROTECTED] schrieb:
>> I just want to upgrade my python version from 2.4.3 to 2.4.4,do I need
>> to uninstall python 2.4.3 first ?
>> 
>> I'd rather not to do so, because I have installed some other python
>> packages for python2.4.3.
>
>You don't have to uninstall. Installing "on top" will work just fine;
>both on Windows and Unix (not sure about Mac).

However, the original poster should note that this will NOT work when going
from 2.4.x to 2.5.x.  Versions where the second digit differs will get
installed into a different directory, so you must re-install all of your
add-in packages.

Having learned that lesson the hard way, I now keep a directory with zips
and tarballs for all of the add-ins I have installed, and I maintain a
single batch file that will install all of them.  This also makes it
trivially easy to install my environment on a different computer.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: print dos format file into unix format

2006-10-21 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>Suppose I have a dos format text file. The following python code will
>print ^M at the end. I'm wondering how to print it in unix format.
>
>fh = open(options.filename)
>for line in fh.readlines()
>  print line,

Are you running this on Unix or on DOS?

On Unix, you can do:

for line in open(options.filename).readlines():
print line.rstrip()

Perhaps quicker is:

sys.stdout.write( open(options.filename).read().replace('\r\n','\n') )
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: silent processing with python+modpython+cheetah

2006-10-21 Thread grahamd

Sai Krishna M wrote:
> Hi,
>
> I have been working for some time developing web pages using python,
> modpython, cheetah.
> I find that this method has come inherent difficulties in it like if
> we want to generate a single page we have to write two separate files
> ( py & tmpl).
> Is there any other better way of doing things.?

It sounds like you are actually using mod_python.publisher and hand
crafting the code to render the template file in each instance. Using
mod_python.publisher is not the same as using basic mod_python handlers
directly. If you were using basic mod_python handlers directly, you
certainly could write your own dispatcher which encapsulates in one
place the code needed to render a Cheetah template file, thereby
avoiding the need to create .py file corresponding to every Cheetah
template file.

> Also if we want to have partial processing of the pages, i.e, the
> value one chooses for a particular field determines the value to be
> entered for another field in the same page, how can it be done?

That sounds like an internal issue of how you use Cheetah templates
itself. Cheetah templates have flow control abilities, blocks etc such
that one can control what parts of a page are actually used.

Since mod_python inherently means you start out working at a low level,
and that you don't perhaps fully appreciate the different levels of
functionality in mod_python and how to use them, you are possibly
better off using a high level framework such as Django or TurboGears
where someone else has done all the hard work of making it simple to
use.

Graham

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


Re: What About Next Laptop Computers?

2006-10-21 Thread [EMAIL PROTECTED]
I might be intrested The company is on the pink sheets lill or somesuch
thing and the guy is posting everywhere plus he talks about fidel
castro in spanish...


John Purser wrote:
> On Sat, 2006-10-21 at 11:51 -0700, Joe wrote:
> > L International Reveals Plans for High-Tech
> > Next-Generation Laptop Computer Systems
> >
> > L International Computers Inc. "L" renowned manufacturer of
> > high-performance computers and personal/business technologies, revealed
> > plans for its next generation high-end laptop and ultra-portable
> > computer systems.
> >
> > To read this articles, go to:
> > http://www.contactomagazine.com/laptopcomputers1006.htm
> >
> > More Business and Computer News:
> > http://www.contactomagazine.com/business.htm
> >
>
> Golly Joe, why would any member of a mailing list be interested in
> products advertised by spamming their mailing list?

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


Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-21 Thread beliavsky
BJörn Lindqvist wrote:
> On 10/20/06, Brett Cannon <[EMAIL PROTECTED]> wrote:
> > At the beginning of the month the PSF Infrastructure committee announced
> > that we had reached the decision that JIRA was our recommendation for the
> > next issue tracker for Python development.

I wonder if the committee has really decided on a PROBLEM or BUG
tracker, not an "issue" tracker. For some silly reason, "issue" has
become a euphemism for "problem" nowadays. It is worth keeping in mind
the difference. Questions about the future direction of Python, such as
(for example) whether there should be optional static typing, are
"issues". Python crashing for some reason would be a "problem".

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


Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Kenneth Long

>   Okay if one builds such from sources... but us poor
> Windows flunkies
> without a build environment have to wait for some
> kindly soul to build
> the installer compatible with the new Python
> version.
> 
especially since I havent got MS visual studio...
and mingw is not supported... :-(

hello

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Attempting to parse free-form ANSI text.

2006-10-21 Thread Michael B. Trausch
Alright... I am attempting to find a way to parse ANSI text from a
telnet application.  However, I am experiencing a bit of trouble.

What I want to do is have all ANSI sequences _removed_ from the output,
save for those that manage color codes or text presentation (in short,
the ones that are ESC[#m (with additional #s separated by ; characters).
 The ones that are left, the ones that are the color codes, I want to
act on, and remove from the text stream, and display the text.

I am using wxPython's TextCtrl as output, so when I "get" an ANSI color
control sequence, I want to basically turn it into a call to wxWidgets'
TextCtrl.SetDefaultStyle method for the control, adding the appropriate
color/brightness/italic/bold/etc. settings to the TextCtrl until the
next ANSI code comes in to alter it.

It would *seem* easy, but I cannot seem to wrap my mind around the idea.
 :-/

I have a source tarball up at http://fd0man.theunixplace.com/Tmud.tar
which contains the code in question.  In short, the information is
coming in over a TCP/IP socket that is traditionally connected to with a
telnet client, so things can be broken mid-line (or even mid-control
sequence).  If anyone has any ideas as to what I am doing, expecting, or
assuming that is wrong, I would be delighted to hear it.  The code that
is not behaving as I would expect it to is in src/AnsiTextCtrl.py, but I
have included the entire project as it stands for completeness.

Any help would be appreciated!  Thanks!

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


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread casevh

Kenneth Long wrote:
> > Okay if one builds such from sources... but us poor
> > Windows flunkies
> > without a build environment have to wait for some
> > kindly soul to build
> > the installer compatible with the new Python
> > version.
> >
> especially since I havent got MS visual studio...
> and mingw is not supported... :-(

mingw32 is supported and can compile many extensions. See the following
post:

http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9

If you meant something else with your comment, please explain.

casevh

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


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Anthony Baxter
On 21 Oct 2006 21:39:51 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> mingw32 is supported and can compile many extensions. See the following
> post:
>
> http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9
>
> If you meant something else with your comment, please explain.

That's for Python 2.4. I'm not sure it works the same way with Python
2.5. If someone has information to the contrary, it would be excellent
to get confirmation and the steps that are necessary...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Martin v. Löwis
Kenneth Long schrieb:
>>  Okay if one builds such from sources... but us poor
>> Windows flunkies
>> without a build environment have to wait for some
>> kindly soul to build
>> the installer compatible with the new Python
>> version.
>>
> especially since I havent got MS visual studio...
> and mingw is not supported... :-(

Why do you say that? mingw might just work fine
(depending on particular details of the extension
module in question).

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


Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development

2006-10-21 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb:
> I wonder if the committee has really decided on a PROBLEM or BUG
> tracker, not an "issue" tracker. For some silly reason, "issue" has
> become a euphemism for "problem" nowadays. It is worth keeping in mind
> the difference. Questions about the future direction of Python, such as
> (for example) whether there should be optional static typing, are
> "issues". Python crashing for some reason would be a "problem".

Traditionally (i.e. on SF), we have been tracking three different kinds
of things: bugs, patches, and "requests for enhancements". While bug
reports clearly indicate problems, patches do not so necessarily. The
patch, in itself, is not a "problem", instead, it is fortunate that
somebody contributes to Python. Some patches are, of course, meant to
solve some problem. One may argue that all patches are contributed
because they solve a problem of the submitter.

However, from a technical point of view, these distinctions are minor,
and, indeed, it has been counter-productive to have different trackers
for different kinds of "issues". So the roundup installation will
likely have only a single tracker, with filters to find out whether
the submissions include patches, and perhaps also whether the issue
discussed is an enhancement or not.

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


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread casevh

Anthony Baxter wrote:
> On 21 Oct 2006 21:39:51 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > mingw32 is supported and can compile many extensions. See the following
> > post:
> >
> > http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9
> >
> > If you meant something else with your comment, please explain.
>
> That's for Python 2.4. I'm not sure it works the same way with Python
> 2.5. If someone has information to the contrary, it would be excellent
> to get confirmation and the steps that are necessary...

I've used mingw32 to build gmpy for Python 2.5 without any problems. It
looks like mingw32 works just fine with Python 2.5 (assuming the
extension will compile with mingw32).

casevh

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


Re: Attempting to parse free-form ANSI text.

2006-10-21 Thread Jean-Paul Calderone
On Sun, 22 Oct 2006 00:34:14 -0400, "Michael B. Trausch"  wrote:
>Alright... I am attempting to find a way to parse ANSI text from a
>telnet application.  However, I am experiencing a bit of trouble.
>
>What I want to do is have all ANSI sequences _removed_ from the output,
>save for those that manage color codes or text presentation (in short,
>the ones that are ESC[#m (with additional #s separated by ; characters).
> The ones that are left, the ones that are the color codes, I want to
>act on, and remove from the text stream, and display the text.

http://originalgamer.cvs.sourceforge.net/originalgamer/originalgamer/originalgamer/ansi.py?revision=1.12&view=markup
 may be of some interest.

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


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Kenneth Long

> 
> mingw32 is supported and can compile many
> extensions. See the following
> post:
> 
>
http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9
> 
> If you meant something else with your comment,
> please explain.
> 

thanks for the reference.. I just got the latest
source for python and reading contents in PC, PCbuild,
PCbuild8 directories. It would be nice if the windows
build was as simple as running ./configure and make...

The link for pexports-0.42h.zip is broken so I cant
test it on an extension.




hello

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >