enable-framework Vs. Naught

2017-01-09 Thread André Lemos
Hi,


I have a C++ module that I am compiling to use inside of my Python
installation under Mac OS.

If I compile & link it against a Framework enabled Python installation, it
works fine, but if I compile & link it against a *non* enabled Framework
installation that we use for distribution, I simply get a non inspiring:

Fatal Python error: PyThreadState_Get: no current thread


I am using python-config to get my flags on both the examples, but I simply
cannot get it to run (although it compiles fine) on a *non* enabled
Framework installation.


Thoughts/Help?



--
André Lemos
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: empty clause of for loops

2016-03-19 Thread André Roberge
On Wednesday, 16 March 2016 07:23:48 UTC-3, Sven R. Kunze  wrote:
> Hi,
> 
> a colleague of mine (I write this mail because I am on the list) has the 
> following issue:
> 
> 
> for x in my_iterable:
>  # do
> empty:
>  # do something else
> 
> 
> What's the most Pythonic way of doing this?
> 
> Best,
> Sven

for x in my_iterable:
   # do something

if not my_iterable:
   # do something else

André
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Still off-top] Physics [was Requests author discusses MentalHealthError exception]

2016-03-04 Thread André Roberge
This discussion about energy and masses of particles has nothing to do with 
Python, and I am hoping that it will be dropped.  That being said, I feel 
compelled to correct what are completely wrong statements.

On Friday, 4 March 2016 13:36:11 UTC-4, Oscar Benjamin  wrote:
> On 4 March 2016 at 10:38, Marko Rauhamaa  wrote:
> > Oscar Benjamin :
> >
...
> 
> That's just a casual use of terminology. If we want to be precise then
> it's pointless to even refer to the "rest mass" of something that is
> never at rest. The masslessness of photons comes from an extrapolation
> that leads to a divide by infinity: strictly speaking it's just
> undefined.

This is simply wrong.  In Quantum Field Theory, particles can have "bare" mass 
term included in the Lagrangian and the measured mass either includes the bare 
mass + quantum corrections OR is a purely dynamically generated term.

In the Standard Model, there is no bare mass term for the photon, nor is there 
any dynamically generated mass.  In fact, to preserve gauge invariance 
symmetry, the mass of the photon MUST be identically equal to zero.

(Of course, the Standard Model could be incorrect but all meausurements done so 
far are completely consistent with a massless photon; see 
http://pdg.lbl.gov/2015/listings/rpp2015-list-photon.pdf for current 
experimental limits.)


> 
> > As for the existence of a negative mass, it is interesting to note that
> > the (rest) mass of an alpha particle is less than the sum of the (rest)
> > masses of its constituents. About 1% of the mass is "missing."
> 
> Since the binding is associated with negative energy it has a negative
> contribution to the energy/mass of the particle as a whole. This is
> true of any bound state.
> 
> Something I don't know is if there's some theoretical reason why the
> binding energy could never exceed the sum of the energies of the
> constituent particles (resulting in an overall negative mass).

The (magnitude of the) binding energy is DEFINED as the difference between the 
(energy equivalent) sums of the individual masses of the consistuents and that 
of the bound state.

===
Now, could we forget about Physics and go back to discussions related to Python?

André Roberge


> 
> --
> Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable vs. object

2015-11-29 Thread André Roberge
On Sunday, 29 November 2015 22:06:58 UTC-4, fl  wrote:
> Hi,
> 
> I read several parts on line about Python that everything in Python is an 
> object. Yes, it is a key difference with other languages. Then, I read a page
> it says variables: global and local variable at:
> 
> http://www.tutorialspoint.com/python/python_functions.htm
> 
> 
> I have a question that whether variables are objects?
> 
> For example,
> 
> a=10
> 
> 'a' is an integer. Is it an object too?
> 
> Thanks,

In Python, a "variable" is a name given to an object.  In Python, the "=" sign 
is used to assign a name to an object: the name is on the left-hand side, and 
the object is on the right hand side.   Multiple names can be assigned to the 
same object.  In the example you gave, "a" is a name given to the object "10" 
which is an integer.

If you do:

a = 10
b = a
a = "hello"

b will be 10.  b was just another name given to object 10 to which the name "a" 
was referring to at that point, even though we decided later that a should 
refer to the string "hello" (which is an object).

André
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python PEP suggestion

2015-11-08 Thread André Roberge
On Sunday, 8 November 2015 11:35:32 UTC-4, Dan Strohl  wrote:
> All,
> 
> I wanted to run the following thought past the list as a possible PEP 
> enhancement suggestion to see if it feels like something that is worth 
> proposing.   I know it is not in the PEP format at this point, I can, and 
> will, clean it up if needed, I am just trying to throw it against the wall at 
> this point to see if it resonates... (or if it falls flat and goes "splat" 
> ).
> 
> Thoughts?
> 
> Dan Strohl
>
Snip

You might want to post this to the python-ideas list.

André
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anybody explain the '-' in a 2-D creation code?

2015-06-25 Thread André Roberge
On Thursday, 25 June 2015 22:07:42 UTC-3, fl  wrote:
> Hi,
> 
> I read Ned's tutorial on Python. It is very interesting. On its last
> example, I cannot understand the '_' in:
> 
> 
> 
> board=[[0]*8 for _ in range(8)]
> 
> 
> I know  '_' is the precious answer, but it is still unclear what it is
> in the above line. Can you explain it to me?

'_' is the previous answer ONLY when using the read-eval-print-loop interpreter.

Here, it is the "name" of a variable; since we don't care about the particular 
name (it is used just for looping a fixed number of times), the common practice 
of using '_' has been used.  As you will have noted (since it confused you), 
'_' doesn't seem to designate anything of interest - unlike a variable name 
like 'string_index' or 'character', etc.

Sometimes, people will use the name "dummy" instead of '_', with the same idea 
in mind.
> 
> 
> Thanks,

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


Re: An object is an instance (or not)?

2015-01-27 Thread André Roberge
On Tuesday, 27 January 2015 17:43:38 UTC-4, Mario Figueiredo  wrote:
> In article , 
> andre.robe...@gmail.com says...
> > 
> > It is appropriate to refer to an instance as an object.  It might not 
> > be appropriate to refer to an object as an instance ... but Python
> > does not do so as your explicit examples demonstrate, and contrary to 
> > your claim.
> 
> I'll try one more time: It - Is - Not - My - Claim.
> 
> It is the claim of a few users in here that replied to that thread.

At the very beginning of the first message I replied to, you wrote:

**This is a follow up from a previous discussion in which it is argued 
that the following code produces the correct error message terminology **

I pointed out to you that the word object WAS used correctly: hence, the 
correct terminology was used in that error message.

You are just wasting people's time.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: An object is an instance (or not)?

2015-01-27 Thread André Roberge
On Tuesday, 27 January 2015 17:06:50 UTC-4, Mario Figueiredo  wrote:
> In article <80a9f882-6b13-45a7-b514-8c47b3a4c...@googlegroups.com>, 
> andre.robe...@gmail.com says...
> > 
> > You keep writing "an object is not an instance", making statements
> > such as "the terminology keeps indicating that in Python an object is 
> > an instance" and yet, none of the examples you show from Python
> > (tracebacks or repr outputs) include the word "instance".   
> 
> I think you misread my argument. Look at the first example on my post, 
> or follow the discussion on "__bases__ misleading error message" here on 
> the newsgroups.


> 
> That error message has me start that thread arguing that the error is 
> misleading because the Sub object does have the __bases__ attribute. 
> It's the Sub instance object that does not have it.
> 

To use the word object to describe an instance is perfectly appropriate. Your 
claims imply the the opposite is happening.

> Some of the answers that were given argued that in Python object = 
> instance.
> 
> > Yet
> > **you** claim that "Python" states that objects are instances 
> 
> That is no my claim. I said that much. You should probably read my post 
> more carefully.

I read your post carefully: not once did I see an output from Python using the 
word "instance".


>From your post:

 Python's output ==
AttributeError: 'Sub' object has no attribute '__bases__' 
=
Python uses the word "object, not "instance".



++ your words +++

Here's another example where the terminology keeps indicating that in 
Python an object is an instance: 
++

==Python's output ===
<__main__.Sub object at 0x02631690> 
===
Python uses the word "object, not "instance", contrary to what you wrote.



+++ your words ++

The problem is that an object isn't always an instance. 
+


 your words 

What I'm arguing thought is that 
error messages in Python cannot become the source of new terminology. 


Not a single output from Python uses the word instance.

It is appropriate to refer to an instance as an object.  It might not be 
appropriate to refer to an object as an instance ... but Python does not do so 
as your explicit examples demonstrate, and contrary to your claim.

A.R.


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


Re: An object is an instance (or not)?

2015-01-27 Thread André Roberge
On Tuesday, 27 January 2015 16:12:47 UTC-4, Mario Figueiredo  wrote:
> This is a follow up from a previous discussion in which it is argued 
> that the following code produces the correct error message terminology, 
> considering that in Python an object is also an instance.
> 
> >>> class Sub:
> >>> pass
> 
> >>> foo = Sub()
> >>> foo.__bases__
> [...]
> AttributeError: 'Sub' object has no attribute '__bases__'
> 
> I'm making this into a new thread, because the particular discussion of 
> whether an object is an instance in Python seems more interesting than 
> discussing whether that error message should be changed or not.
> 
> Here's another example where the terminology keeps indicating that in 
> Python an object is an instance:
> 
> >>> class Sub:
>   pass
> 
> >>> x = Sub()
> >>> x
> <__main__.Sub object at 0x02631690>
> 
> The problem is that I personally cannot agree with this terminology and 
> I would like to hear arguments that could convince me to adopt the 
> Python way. But before your replies, here's my argumentation:
> 
> An instance IS an object. On that we can agree. After all, everything in 
> Python is an object. Even classes are. We can even pass them as function 
> arguments:
> 
> >>> class Sub:
>   pass
> 
> >>> def show(aClass):
>   print(type(aClass))
>   
> >>> show(Sub)
> 
> 
> The problem is that an object isn't always an instance. The word 
> instance in OOP has a very formal meaning. In programming languages in 
> which the classes aren't fully realized objects, it is ok to speak of 
> 'instance' and 'object' interchangeably. But even then, sometimes the 
> term 'object instance' is preferred, as a way to separate these 
> 'instances' from other variable instances that may not be created from 
> class definitions (e.g. C++ built-in types).
> 
> The fact that in Python classes are objects, should not just eliminate 
> this distinction. The OOP terminology should exist beyond the language 
> implementing it. It facilitates discourse and helps transmiting concepts 
> when describing your ideas to another programmer. And because in python, 
> classes are of the type 'type' and they exist as fully realized objects, 
> is no excuse to make a distinction between them and their own fully 
> realized instances. The language implementation details should not exist 
> as a way for us to freely reformulate long standing terms.
> 
> Because, from my own study of Python, I've came to realize that the 
> distinction between objects and instances of objects actually exists. In 
> Python, class objects cannot participate in OOP, only their instances. 
> This is why I say that even in Python, where a class is an object, an 
> object is not always an instance. The language itself forces that 
> distinction.
> 
> ...
> 
> I don't think that any of this is reason enough to rewrite error 
> messages in Python. Seems unnecessary. What I'm arguing thought is that 
> error messages in Python cannot become the source of new terminology. 
> The language itself implements a very clear distinction between class 
> objects and their instances. And it is thus wrong of us to say that 
> Object = Instance. At least from an OOP perspective.

You keep writing "an object is not an instance", making statements such as "the 
terminology keeps indicating that in Python an object is an instance" and yet, 
none of the examples you show from Python (tracebacks or repr outputs) include 
the word "instance".   

To phrase it differently: all the examples of output from Python that you show 
use the word "object" and not the word "instance".  Yet **you** claim that 
"Python" states that objects are instances Can you point out at least 
one example where "Python" wrongly use the word instance instead of object?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to "wow" someone new to Python

2015-01-21 Thread André Roberge
On Wednesday, 21 January 2015 15:06:33 UTC-4, Chris Angelico  wrote:
> On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong  wrote:
> > On 21-1-2015 18:59, Steve Hayes wrote:
> >
> >> 3. When I started to look at it, I found that strings could be any length 
> >> and
> >> were not limited to swomething arbitrary, like 256 characters.
> >
> > Even more fun is that Python's primitive integer type (longs for older 
> > Python versions)
> > has no arbitrary limitation either.
> >
> > That amazed me at the time I discovered python :)
> 
> I hadn't worked with length-limited strings in basically forever
> (technically BASIC has a length limit, but I never ran into it; and I
> never did much with Pascal), but you're right, arbitrary-precision
> integers would have impressed me a lot more if I hadn't first known
> REXX. So... is there a way to show that off efficiently? 

How about:

 >>> def fac(n):
 ... ans = 1
 ... while n > 1:
 ... ans *= n
 ... n -= 1
 ... return ans
 ...
 >>> a = fac(100)
 >>> a
 
9332621544394415268169923885626670049071596826438162146859296389521753229915608941463976156518286253697920827223758251185210916864
 >>> b = fac(102)
 >>> b
 
961446671503512660926865558697259548455355905059659464369444714048531715130254590603314961882364451384985595980362059157503710042865532928
 >>> b//a
 10302
 >>> b//a == 102 * 101
 True

André


Normally, any
> calculation that goes beyond 2**32 has already gone way beyond most
> humans' ability to hold the numbers in their heads.
> 
> ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to "wow" someone new to Python

2015-01-21 Thread André Roberge
On Friday, 16 January 2015 11:04:20 UTC-4, Chris Angelico  wrote:
> Scenario: You're introducing someone to Python for the first time.
> S/he may have some previous programming experience, or may be new to
> the whole idea of giving a computer instructions. You have a couple of
> minutes to show off how awesome Python is. What do you do?
> 
> I was thinking along the lines of a simple demo in the REPL, showing
> off some of Python's coolest features. But then I got stuck on the
> specifics. What are Python's best coolnesses? What makes for a good
> demo?
> 
> Ideally, this should be something that can be demo'd quickly and
> easily, and it should be impressive without going into great details
> of "and see, this is how it works on the inside". So, how would you
> brag about this language?
> 
> ChrisA
If you are willing to install an older version of Python (because the program I 
am going to mention has not been updated in years ... but it *should* work with 
2.6), I'm going to suggest an odd one:  Crunchy!  (ok, I'm biased :-).

The home page is at https://code.google.com/p/crunchy/ where you can find a 
link to some screencasts (based on an even older version ...)   So, before you 
install anything, just have a quick look at the screencast to see if it's 
worthwhile.

A demo using Crunchy seems to  be even more impressive if the person knows some 
programming.

(Here is what was said about an even older version of Crunchy by people at the 
Omaha Python group: " Jeff gave a presentation on Crunchy ([WWW]
http://crunchy.sourceforge.net/) Talk about a gee whiz app."  
[https://mail.python.org/pipermail/omaha/2007-July/65.html])

In a nutshell, I would open the official Python tutorial in my browser, showing 
the official Python tutorial.   (boring)

Then, I would open the exact same page using a browser tab served by Crunchy: 
"magically" some text-input boxes would have been inserted allowing you to try 
out the code in the REPL provided by Crunchy.  Then I'd use Crunchy to launch 
an external app (perhaps a tkinter program), etc.

As I said at the beginning, Crunchy has not been updated in *years* ... more or 
less since the IPython and Sage notebooks came along...

André
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to run a python script with functions

2015-01-20 Thread André Roberge
On Tuesday, 20 January 2015 17:11:58 UTC-4, faiz@gmail.com  wrote:
> Hi
> 
> I have a file with a python scripts that has many functions in it. To run the 
> script I did the following:
> 1. $ python (to initiate python, using the python command)
> 2. >>> import file_name (without .py)
> 3. >>> file_name.function_name(argument) (to run the function_name with 
> argument (argument)
> 
> My question is: Is there any other way that I can just use the function name 
> (function_name) without having to use the file_name. part? That is, use only:
> >>> function_name(argument)
> 

from file_name import function1, function2

> ~faizlo

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


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-13 Thread André Roberge
On Tuesday, 13 January 2015 08:23:30 UTC-4, stephen...@gmail.com  wrote:
> I found a solution that I'm happy with.
> 
> from datetime import datetime
> from easygui_qt import *
> 
> datestring = get_date()
> mydate = datetime.strptime(datestring, '%b %d %Y')

I'm thinking of having the new version return a datetime object automatically.

André

> 
> On Saturday, January 10, 2015 at 1:02:30 AM UTC, André Roberge wrote:
> > On Friday, 9 January 2015 19:09:15 UTC-4, stephen...@gmail.com  wrote:
> > > On Wednesday, December 31, 2014 at 4:24:50 PM UTC-6, André Roberge wrote:
> > > > EasyGUI_Qt version 0.9 has been released.  This is the first 
> > > > announcement about EasyGUI_Qt on this list.
> > > > 
> > > > Like the original EasyGUI (which used Tkinter), 
> > > > EasyGUI_Qt seeks to provide simple GUI widgets
> > > > that can be called in a procedural program. 
> > > > 
> > > > EasyGUI_Qt is NOT event-driven: all GUI interactions are invoked by 
> > > > simple function calls.
> > > > 
> > > > The archetype is get_string(message)
> > > > which pops a box whose purpose is exactly the same as Python's 
> > > > input(prompt),
> > > > that is, present the user with a question/prompt, have the user enter an
> > > > answer, and return the provided answer as a string.  Thus
> > > > easygui_qt.get_string() can be used as a drop-in replacement for
> > > > input().
> > > > 
> > > > Similarly, instead of using a print() function to display a message,
> > > > show_message() is used which pops a message window.
> > > > 
> > > > EasyGUI_Qt requires PyQt4 and is really targeted for Python 3.3+ - 
> > > > although it can work (possibly with some unicode problems ...) using 
> > > > Python 2.7.
> > > > 
> > > > More information can be found at 
> > > > http://easygui-qt.readthedocs.org/en/latest/index.html
> > > > 
> > > > Feedback is most welcome, including reporting bugs to 
> > > > https://github.com/aroberge/easygui_qt/issues
> > > > 
> > > > Happy 2015 everyone,
> > > > 
> > > > André Roberge
> > > 
> > > Very nice, thanks.
> > > 
> > > One issue is the format returned for the calendar selection. For today, 
> > > the string returned is "Fri Jan 9 2015". My script needs to convert the 
> > > date to a datetime.date, and having the month returned as a string 
> > > instead of an integer makes this harder.
> > 
> > Would today's date be represented as the string "09.01.2015" useful to you? 
> > (I found out how to do this.)  If so, I could perhaps add an argument like 
> > numeric_format = True.
> > 
> > André

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


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-09 Thread André Roberge
On Friday, 9 January 2015 19:09:15 UTC-4, stephen...@gmail.com  wrote:
> On Wednesday, December 31, 2014 at 4:24:50 PM UTC-6, André Roberge wrote:
> > EasyGUI_Qt version 0.9 has been released.  This is the first announcement 
> > about EasyGUI_Qt on this list.
> > 
> > Like the original EasyGUI (which used Tkinter), 
> > EasyGUI_Qt seeks to provide simple GUI widgets
> > that can be called in a procedural program. 
> > 
> > EasyGUI_Qt is NOT event-driven: all GUI interactions are invoked by simple 
> > function calls.
> > 
> > The archetype is get_string(message)
> > which pops a box whose purpose is exactly the same as Python's 
> > input(prompt),
> > that is, present the user with a question/prompt, have the user enter an
> > answer, and return the provided answer as a string.  Thus
> > easygui_qt.get_string() can be used as a drop-in replacement for
> > input().
> > 
> > Similarly, instead of using a print() function to display a message,
> > show_message() is used which pops a message window.
> > 
> > EasyGUI_Qt requires PyQt4 and is really targeted for Python 3.3+ - although 
> > it can work (possibly with some unicode problems ...) using Python 2.7.
> > 
> > More information can be found at 
> > http://easygui-qt.readthedocs.org/en/latest/index.html
> > 
> > Feedback is most welcome, including reporting bugs to 
> > https://github.com/aroberge/easygui_qt/issues
> > 
> > Happy 2015 everyone,
> > 
> > André Roberge
> 
> Very nice, thanks.
> 
> One issue is the format returned for the calendar selection. For today, the 
> string returned is "Fri Jan 9 2015". My script needs to convert the date to a 
> datetime.date, and having the month returned as a string instead of an 
> integer makes this harder.

Would today's date be represented as the string "09.01.2015" useful to you? (I 
found out how to do this.)  If so, I could perhaps add an argument like 
numeric_format = True.

André
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-09 Thread André Roberge
On Friday, 9 January 2015 19:09:15 UTC-4, stephen...@gmail.com  wrote:

> Very nice, thanks.
> 
> One issue is the format returned for the calendar selection. For today, the 
> string returned is "Fri Jan 9 2015". My script needs to convert the date to a 
> datetime.date, and having the month returned as a string instead of an 
> integer makes this harder.

Unfortunately, this is the default calendar widget from Qt - I just use the 
default:
 ... def confirm(self):
self.date = self.cal.selectedDate()

Perhaps I can find something in the docs to see if I could have the format 
configurable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-03 Thread André Roberge
On Saturday, 3 January 2015 04:52:21 UTC-4, wxjm...@gmail.com  wrote:
> Le vendredi 2 janvier 2015 20:11:25 UTC+1, André Roberge a écrit :
> > On Friday, 2 January 2015 06:29:37 UTC-4, wxjm...@gmail.com  wrote:
> > > Le mercredi 31 décembre 2014 23:24:50 UTC+1, André Roberge a écrit :
> > > > EasyGUI_Qt version 0.9 has been released.  This is the first 
> > > > announcement about EasyGUI_Qt on this list.
> > snip
> > > I toyed and I spent a couple of hours with it.
> > > I do not know to much what to say.
> > Well, this is more positive than your previous comment expressing doubt 
> > that it would work. ;-)   So, thank you!
> 
> Do not get me wrong, I do not wish to be rude.
> You are building a tool upon a toolkit which
> simply does not work properly.
> 
> If for some reason you are not aware of this,
> you are not aware of this, it is unfortunately
> a simple as this.
> 
> (Not only I know why, I'm able to explain the
> cause).

Would you care to elaborate?  All the code I have written works correctly on 
all the tests I have done.  I do have reports from a user using a Mac with 
Python 2.7 for which some widgets did not quite work properly ... but that's 
all I have heard about problems with it. 

I would like to hear about the problems you know about either here, on by 
filing an issue at https://github.com/aroberge/easygui_qt/issues
> 
> jmf
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-02 Thread André Roberge
On Friday, 2 January 2015 16:22:21 UTC-4, Emil Oppeln-Bronikowski  wrote:
> On Fri, Jan 02, 2015 at 11:53:26AM -0800, André Roberge wrote:
> > How could it then be used?
> 
> Maybe I failed to explain myself fully. What I meant to say is building a 
> distribution-ready program that utilizes your library; not your library being 
> turn into a executable.

Ah, this makes sense.  But I have not had the need to do so mysefl.
> 
> Or maybe something is going over my head? Tell you what, once I get to some 
> decent network I'll try it on my own. :)
Please, let me know what you think - direct email is probably better.
> -- 
> People are like potatos. They die when you eat them.

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


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-02 Thread André Roberge
On Friday, 2 January 2015 15:22:22 UTC-4, Emil Oppeln-Bronikowski  wrote:
> On Fri, Jan 02, 2015 at 11:11:05AM -0800, André Roberge wrote:
> 
> Sorry if this was asked before: have you tried building a portable version 
> using py2exe/Nuitka/etc? I always hit a wall when it comes to building 
> against huge libraries like Python-Qt.
> 
No, this would seem really silly since the widgets created by EasyGUI_Qt need 
to be used within a Python program, like Python's own "input()" function.  What 
would happen if you took a simple module containing the following:

def get_string(prompt):
return input(prompt)

and tried to package it into an exe?  How could it then be used?

> -- 
> People are like potatos. They die when you eat them.

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


Re: [ANN] EasyGUI_Qt version 0.9

2015-01-02 Thread André Roberge
On Friday, 2 January 2015 06:29:37 UTC-4, wxjm...@gmail.com  wrote:
> Le mercredi 31 décembre 2014 23:24:50 UTC+1, André Roberge a écrit :
> > EasyGUI_Qt version 0.9 has been released.  This is the first announcement 
> > about EasyGUI_Qt on this list.
snip
> I toyed and I spent a couple of hours with it.
> I do not know to much what to say.
Well, this is more positive than your previous comment expressing doubt that it 
would work. ;-)   So, thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] EasyGUI_Qt version 0.9

2014-12-31 Thread André Roberge
EasyGUI_Qt version 0.9 has been released.  This is the first announcement about 
EasyGUI_Qt on this list.

Like the original EasyGUI (which used Tkinter), 
EasyGUI_Qt seeks to provide simple GUI widgets
that can be called in a procedural program. 

EasyGUI_Qt is NOT event-driven: all GUI interactions are invoked by simple 
function calls.

The archetype is get_string(message)
which pops a box whose purpose is exactly the same as Python's input(prompt),
that is, present the user with a question/prompt, have the user enter an
answer, and return the provided answer as a string.  Thus
easygui_qt.get_string() can be used as a drop-in replacement for
input().

Similarly, instead of using a print() function to display a message,
show_message() is used which pops a message window.

EasyGUI_Qt requires PyQt4 and is really targeted for Python 3.3+ - although it 
can work (possibly with some unicode problems ...) using Python 2.7.

More information can be found at 
http://easygui-qt.readthedocs.org/en/latest/index.html

Feedback is most welcome, including reporting bugs to 
https://github.com/aroberge/easygui_qt/issues

Happy 2015 everyone,

André Roberge
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: problems with Methods in Python 3.4.2

2014-12-18 Thread André Roberge
On Thursday, 18 December 2014 13:28:33 UTC-4, Marcus Lütolf  wrote:
> Hello Dears,
> 1)I am trying to do this:
>  
> >>> dir(_builtins_)
You need two underscore characters on each sides:

dir(__builtins__)

>  
> I am getting this:
> Traceback (most recent call last):
>   File "", line 1, in 
> dir(_builtins_)
> NameError: name '_builtins_' is not defined
>  
> 2)I am trying to do this:
>  
> >>> 'TTA',_add_('GGA')
Same; magic methods have two underscore characters on each side.
>  
> I'am getting this :
> Traceback (most recent call last):
>   File "", line 1, in 
> 'TTA',_add_('GGA')
> NameError: name '_add_' is not defined
>  
> 3)I am trying to do this:
>  
> >>> -3  .abs()
abs(-3)  abs is a function in Python.

See http://lucumr.pocoo.org/2011/7/9/python-and-pola/ for a good explanation...

>  
> I'am getting this
> Traceback (most recent call last):
>   File "", line 1, in 
> -3 .abs()
> AttributeError: 'int' object has no attribute 'abs'
>  
> 4) finally, after printing
>  
> >>>abs._doc_()
>  

Guess why!  ;-)

> I am getting this (and so on) :
> Traceback (most recent call last):
>   File "", line 1, in 
> abs._doc_()
> AttributeError: 'builtin_function_or_method' object has no attribute '_doc_'
> 
> What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, 
> CH-7000 Chur, Switzerland.
>  
> 
> 
> 
> 
> 
>   
>   
>   
>   
>   
>   
>   
>   
> 
>   Diese E-Mail wurde von Avast Antivirus-Software 
> auf Viren geprüft.
>   
> www.avast.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: About some problem

2014-01-03 Thread André Malo
* Steven D'Aprano wrote:

> Mark Lawrence wrote:
> 
>> raise "Not Valid DB Type"
>> 
>> is perfectly valid in Python 2.
> 
> Actually, no it isn't. It's only valid up to Python 2.4. In Python 2.5,
> string exceptions display a warning but continue to work, and in Python
> 2.6 they generate a compile-time SyntaxError.

Oh? Doesn't look like it.

$ cat x.py
try:
raise "foo"
except:
print "bar"

$ python2.7 x.py
bar
$ python2.6 x.py
bar

A lone '''raise "foo"''' raises a TypeError, though.

nd
-- 
sub the($){+shift} sub answer (){ord q
[* It is always 42! *]   }
   print the answer
# André Malo # http://pub.perlig.de/ #
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why is regex so slow?

2013-06-18 Thread André Malo
* André Malo wrote:

> * Johannes Bauer wrote:
> 
>> The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3
>> sec). Curious. This is Python 3.2.3 on Linux x86_64.
> 
> A lot of time is spent with dict lookups (timings at my box, Python 3.2.3)
> in your inner loop (150 times...)

[...]

Missed one basic timing BTW:

#!/usr/bin/python3
def main():
for line in open('error.log'):
pass
main()

runs ~ 0.53 s

nd
-- 
Already I've seen people (really!) write web URLs in the form:
http:\\some.site.somewhere
[...] How soon until greengrocers start writing "apples $1\pound"
or something?   -- Joona I Palaste in clc
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is regex so slow?

2013-06-18 Thread André Malo
* Johannes Bauer wrote:

> The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3
> sec). Curious. This is Python 3.2.3 on Linux x86_64.

A lot of time is spent with dict lookups (timings at my box, Python 3.2.3)
in your inner loop (150 times...)

#!/usr/bin/python3
import re
pattern = re.compile(r'ENQUEUEING: /listen/(.*)')
count = 0
for line in open('error.log'):
#if 'ENQ' not in line:
#continue
m = pattern.search(line)
if m:
count += 1
print(count)

runs ~ 1.39 s

replacing some dict lookups with index lookups:

#!/usr/bin/python3
def main():
import re
pattern = re.compile(r'ENQUEUEING: /listen/(.*)')
count = 0
for line in open('error.log'):
#if 'ENQ' not in line:
#continue
m = pattern.search(line)
if m:
count += 1
print(count)
main()

runs ~ 1.15s

and further:

#!/usr/bin/python3
def main():
import re
pattern = re.compile(r'ENQUEUEING: /listen/(.*)')
search = pattern.search
count = 0
for line in open('error.log'):
#if 'ENQ' not in line:
#continue
m = search(line)
if m:
count += 1
print(count)
main()

runs ~ 1.08 s

and for reference:

#!/usr/bin/python3
def main():
import re
pattern = re.compile(r'ENQUEUEING: /listen/(.*)')
search = pattern.search
count = 0
for line in open('error.log'):
if 'ENQ' not in line:
continue
m = search(line)
if m:
count += 1
print(count)
main()

runs ~ 0.71 s

The final difference is probably just the difference between a hardcoded
string search and a generic NFA.

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


Re: object.enable() anti-pattern

2013-05-11 Thread André Malo
* Serhiy Storchaka wrote:

> Another example is running a subprocess in Unix-like systems.
> 
>  fork()
>  open/close file descriptors, set limits, etc
>  exec*()

For running a subprocess, only fork() is needed. For starting another
executable, only exec() is needed. For running the new executable in a
subprocess fork() and exec() are needed. I think, that's a bad example.
These APIs are actually well-designed.

nd
-- 
Gefunden auf einer "Webdesigner"-Seite:
> Programmierung in HTML, XML, WML, CGI, FLASH <

# André Malo # http://pub.perlig.de/ #
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread André Malo
* Roy Smith wrote:

> The third is that I never use methods I can't figure out how to
> pronounce.

here: strip'time

nd
-- 
Flhacs wird im Usenet grundsätzlich alsfhc geschrieben. Schreibt man
lafhsc nicht slfach, so ist das schlichtweg hclafs. Hingegen darf man
rihctig ruhig rhitcgi schreiben, weil eine shcalfe Schreibweise bei
irhictg nicht als shflac angesehen wird.   -- Hajo Pflüger in dnq
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread André Malo
* Tom P wrote:

> consider a nested loop algorithm -
> 
> for i in range(100):
>  for j in range(100):
>  do_something(i,j)

> 
> Now, suppose I don't want to use i = 0 and j = 0 as initial values, but
> some other values i = N and j = M, and I want to iterate through all
> 10,000 values in sequence - is there a neat python-like way to this? I
> realize I can do things like use a variable for k in range(1): and
> then derive values for i and j from k, but I'm wondering if there's
> something less clunky.

you mean:
do_something((i + N) % 100, (j + M) % 100)

?

I'd define my own range function doing exactly that.

def rrange(count, start=0):
for j in xrange(count):
yield (j + start) % count

(untested)

Or use some itertools magic for that. It might be faster.

nd
-- 
"Umfassendes Werk (auch fuer Umsteiger vom Apache 1.3)"
  -- aus einer Rezension


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


Re: multiprocessing: apply_async with different callbacks

2012-07-17 Thread André Panisson

On 07/17/2012 11:44 PM, André Panisson wrote:

Hi all,

I'm having a strange behavior when executing the following script:
---
import multiprocessing

def f(i):
return i

p = multiprocessing.Pool()
for i in range(20):
def c(r):
print r, i
p.apply_async(f, (i,) , callback=c)
p.close()
p.join()
---

Result:
0 6
1 11
2 13
3 15
4 15
5 19
etc

It seems that the callbacks of all submitted tasks are being 
overridden with the last callback submitted by apply_async.
Is this the right behaviour or I am stumbling in some issue? I'm using 
Python 2.7.3 @ Ubuntu 12.04


Regards,



Sorry for taking the time, I just found the solution:
---
import multiprocessing

def f(i):
return i

def cfactory(i):
def c(r):
print r, i
return c

p = multiprocessing.Pool()
for i in range(20):
p.apply_async(f, (i,) , callback=cfactory(i))
p.close()
p.join()
--

Regards,
André



smime.p7s
Description: S/MIME Cryptographic Signature
-- 
http://mail.python.org/mailman/listinfo/python-list


multiprocessing: apply_async with different callbacks

2012-07-17 Thread André Panisson

Hi all,

I'm having a strange behavior when executing the following script:
---
import multiprocessing

def f(i):
return i

p = multiprocessing.Pool()
for i in range(20):
def c(r):
print r, i
p.apply_async(f, (i,) , callback=c)
p.close()
p.join()
---

Result:
0 6
1 11
2 13
3 15
4 15
5 19
etc

It seems that the callbacks of all submitted tasks are being overridden 
with the last callback submitted by apply_async.
Is this the right behaviour or I am stumbling in some issue? I'm using 
Python 2.7.3 @ Ubuntu 12.04


Regards,
André



smime.p7s
Description: S/MIME Cryptographic Signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Gotcha's?

2012-04-08 Thread André Malo
* Grzegorz Staniak wrote:

> On 06.04.2012, rusi  wroted:
>
>> There should be one-- and preferably only one --obvious way to do it.
> 
> Then again, practicality beats purity.

Yes.

If you ever grepped for, say, the usage of dictionary keys in a bigger
application, you might agree, that having multiple equivalent quote
characters is not as practical as it might seem in the first place.

Code is written once and read often.

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


Re: Python Gotcha's?

2012-04-06 Thread André Malo
* Steven D'Aprano wrote:

> On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote:
> 
>> * Steven D'Aprano wrote:
>> 
>>> For a 21st century programming language or data format to accept only
>>> one type of quotation mark as string delimiter is rather like having a
>>> 21st century automobile with a hand crank to start the engine instead
>>> of an ignition. Even if there's a good reason for it (which I doubt),
>>> it's still surprising.
>> 
>> Here's a reason: KISS.
> 
> KISS is a reason *for* allowing multiple string delimiters, not against
> it. The simplicity which matters here are:
> 
> * the user doesn't need to memorise which delimiter is allowed, and
>   which is forbidden, which will be different from probably 50% of
>   the other languages he knows;
> 
> * the user can avoid the plague of escaping quotes inside strings
>   whenever he needs to embed the delimiter inside a string literal.
> 
> This is the 21st century, not 1960, and if the language designer is
> worried about the trivially small extra effort of parsing ' as well as "
> then he's almost certainly putting his efforts in the wrong place.

Yes, that's what you said already. My reasoning was in the part you stripped
from my quote. *shrug*

nd
-- 
Treat your password like your toothbrush. Don't let anybody else
use it, and get a new one every six months.  -- Clifford Stoll

(found in ssl_engine_pphrase.c)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Gotcha's?

2012-04-05 Thread André Malo
* Steven D'Aprano wrote:

> For a 21st century programming language or data format to accept only one
> type of quotation mark as string delimiter is rather like having a 21st
> century automobile with a hand crank to start the engine instead of an
> ignition. Even if there's a good reason for it (which I doubt), it's
> still surprising.

Here's a reason: KISS. Actually I've never understood the reason for
multiple equivalent quote characters. There are languages where these are
not equivalent, like perl, C or shell script. There it makes way more
sense.

(If a parser doesn't accept foreign syntax, that's reasonable enough for me,
too.)

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


Re: Puzzled by FiPy's use of "=="

2012-03-26 Thread André Roberge
On Monday, 26 March 2012 09:16:07 UTC-3, Robert Kern  wrote:
> On 3/26/12 12:47 PM, André Roberge wrote:
> > In FiPy (a finite volume PDE solver), equations are "magically" set up as
> >
> > eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)
> >
> > and solved via
> >
> > eqX.solve(...)
> >
> > How can eqX be anything than True or False?...  This must be via a 
> > redefinition of "==" but I can't see how that is done.  I did look at many 
> > of the source files, thinking that it must be via a redefinition of 
> > "__eq__" somewhere but with no luck.   Any pointers would be appreciated.
> 
> It's in the root base class Term:
> 
>http://matforge.org/fipy/browser/trunk/fipy/terms/term.py#L374
> 

I thought I looked at terms.py ... but I must have missed that.  Thanks!

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

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


Puzzled by FiPy's use of "=="

2012-03-26 Thread André Roberge
In FiPy (a finite volume PDE solver), equations are "magically" set up as 

eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)

and solved via

eqX.solve(...)

How can eqX be anything than True or False?...  This must be via a redefinition 
of "==" but I can't see how that is done.  I did look at many of the source 
files, thinking that it must be via a redefinition of "__eq__" somewhere but 
with no luck.   Any pointers would be appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyPI - how do you pronounce it?

2012-01-30 Thread André Malo
* Chris Angelico wrote:

> Hopefully this will be a step up from Rick's threads in usefulness,
> but I'm aware it's not of particularly great value!
> 
> How do you pronounce PyPI? Is it:
> * Pie-Pie?
> * Pie-Pip, but without the last p? (same as above but short i)
> * Pie-Pea-Eye?
> * Something else?

I actually always pronounce it "Python Package Index". That's unambiguous
(and can't be confused with things like peepee and stuff.)

nd
-- 
"Das Verhalten von Gates hatte mir bewiesen, dass ich auf ihn und seine
beiden Gefährten nicht zu zählen brauchte" -- Karl May, "Winnetou III"

Im Westen was neues: 
-- 
http://mail.python.org/mailman/listinfo/python-list


Execute python within Oracle

2011-12-09 Thread André Lopes
Hi all,



   I wrote a simple Java program to be called within an Oracle database.
The goal is to execute a Python program within the DB itself, by the means
of a Java program. The problem is that when I execute the procedure inside
the DB, nothing happens…



   If I create the same Java class outside the DB and execute it, the
python program works perfectly, only inside the DB nothing happens. The
program is the following.



CREATE OR REPLACE AND COMPILE java source named "OSCommand" as

import java.io.*;

public class OSCommand{

public static void Run(){

try

{

Runtime r = Runtime.getRuntime();

Process p = r.exec("cmd /c C:\\Python32\\python.exe
C:\\Ficheiros\\SAP\\Novos\\xls2csv.py
C:\\Ficheiros\\SAP\\Novos\\20111020_ListagemSAP.xlsx");



}

catch (Exception e)

{

e.printStackTrace();

}

}

}

/



   Can anyone help?



Thanks,

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


Re: replace random matches of regexp

2011-09-08 Thread André Malo
* gry wrote:

> I might want to replace '(max|min|cos|sqrt|ceil' with "public.\1", but
> only with probability 0.7.  I looked and looked for some computed
> thing in re's that I could stick and expression, but could not find
> such(for good reasons, I know).
> Any ideas how to do this?  I would go for simple, even if it's wildly
> inefficient, though elegance is always admired...

You can run a re.sub() with a function as replacement value. This function
then either returns the replacement or the original match based on a
weighted random value.

nd
-- 
"Umfassendes Werk (auch fuer Umsteiger vom Apache 1.3)"
  -- aus einer Rezension


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


Re: IDLE won't wrap lines of text

2011-02-20 Thread André Roberge
On Sunday, February 20, 2011 10:51:38 PM UTC-4, Dick Moores wrote:
> On Sun, Feb 20, 2011 at 18:32, Rhodri James  
> wrote:
> > On Mon, 21 Feb 2011 01:41:12 -, Richard D. Moores 
> > wrote:
> >
> >> On Sun, Feb 20, 2011 at 16:31, Rhodri James 
> >> wrote:
> >>>
> >>> On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores
> >>> 
> >>> wrote:
> >>>
> >>>> Vista
> >>>> Python 3.1.3
> >>>>
> >>>> I can't figure out how to get IDLE to wrap text pasted in from, say, a
> >>>> newspaper article. Usually, a each paragraph will appear as one long
> >>>> unwrapped line, with no way to read the whole line, because no
> >>>> horizontal bar is created. I haven't found anything about this in
> >>>> either the options or the help.
> >>>
> >>> I hate to ask, but why are you doing this?  IDLE isn't a general-purpose
> >>> editor, it's a programming editor specifically for Python, and as such
> >>> it's
> >>> entirely appropriate for it to discourage overly long lines.
> >>
> >> Take a look at <http://tutoree7.pastebin.com/EmyQTaYt>
> >
> > I see.  I'd recommend the approach of sticking your source data in a
> > separate text file (using a text editor rather than IDLE) in any case;
> > it's much less of a pain to change what you are working on that way.
> 
> Problem is I know of no text editor that can handle Japanese.
> 
> Thanks,
> 
> Dick


The editor in Crunchy (http://code.google.com/p/crunchy) appears to be working 
just fine with the sample code you posted (at least when using Python 3 - I got 
an error when using it to run the code with Python 2). That being said, I would 
not recommend it for heavy work 

An editor that seems to work just fine (although it took a long time to load 
the sample code) is SublimeText (http://www.sublimetext.com/) - version 2 
alpha; it is becoming my editor of choice.

André

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


Re: floating point woes

2011-02-15 Thread André Roberge
On Tuesday, February 15, 2011 7:49:34 PM UTC-4, Hans-Peter Jansen wrote:
> Hi,
> 
> while I usually cope with the woes of floating point issues, this is 
> one, that I didn't expect:
> 
> >>> round(2.385, 2)
> 2.3799
> 
> Doesn't the docs say, it's rounded up for this case?

The problem is probably that 2.385 can not be represented as 2.3850

>>> a = 2.385
>>> a
2.3848

André
> 
> 
> Values are rounded to the closest multiple of 10 to the power minus n; 
> if two multiples are equally close, rounding is done away from 0
> 
> 
> Well, that one is clearly rounding down.
> 
> What's up, eh, down here?
> 
> Pete
> 
> Python 2.6 (r26:66714, Feb  8 2011, 08:50:11) 
> [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2

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


Re: Arrays/List, filters, Pytho, Ruby

2011-02-11 Thread André Roberge
On Friday, February 11, 2011 5:24:15 PM UTC-4, LL.Snark wrote:
> Hi,
> 
> I'm looking for a pythonic way to translate this short Ruby code :
> t=[6,7,8,6,7,9,8,4,3,6,7]
> i=t.index {|x| x 
> If you don't know Ruby, the second line means :
> What is the index, in array t, of the first element x such that x 
> If can write it in python several ways :
> t=[6,7,8,6,7,9,8,4,3,6,7]
> i=0
> while t[i]>=t[0] : i+=1
> 
> ... not pythonic I think...
> 
> Or :
> t=[6,7,8,6,7,9,8,4,3,6,7]
> i=[j for j in range(len(t)) if t[j] 
> ...too cryptic...
> 
You could go with something like (untested)
t = [6,7,8,6,7,9,8,4,3,6,7]
for i, j in enumerate(t):
if j < t[0]:
break
else:
i = 0

;-)



> I'm using Python 3.
> 
> Thx

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


Re: Print docstrings to shell

2011-02-01 Thread André Roberge
On Tuesday, February 1, 2011 9:21:48 PM UTC-4, André Roberge wrote:
SNIP
> 
> ===
> import pydoc
> import os
> import sys
> 
> '''this is a test'''
> 
> class A(object):
>   '''docstring'''
>   pass
> 
> _path, _file_name = os.path.split(__file__)
> _module_name = _file_name[:-3]
> sys.path.append(_path)
> pydoc.help(_module_name)
> =
> 

Actually, one does not need to import pydoc; using help() without importing 
seems to work just as well (or as badly, as it displays it twice...)
André


> Note: I've included an underscore in variables names so that they would not 
> appear.
> Note 2: for some reason, which I do not understand, it shows the help twice 
> (i.e. I have to hit "q" twice to make it go away).  Sorry that I can not help 
> with this.
> 
> André

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


Re: Print docstrings to shell

2011-02-01 Thread André Roberge
On Tuesday, February 1, 2011 9:05:28 PM UTC-4, Gnarlodious wrote:
> On Feb 1, 5:30 pm, André Roberge  wrote:
> 
> > test.py==
> > import pydoc
> >
> > '''this is a test'''
> >
> > class A(object):
> >         '''docstring'''
> >         pass
> >
> > print(pydoc.help(__file__[:-3]))
> > =
> >
> > python test.py
> 
> 
> OK that works, but only if I cd into the folder of the script. If I
> run it from ~ I get the same error. How to get around that prob?
> 
> -- Gnarlie

===
import pydoc
import os
import sys

'''this is a test'''

class A(object):
'''docstring'''
pass

_path, _file_name = os.path.split(__file__)
_module_name = _file_name[:-3]
sys.path.append(_path)
pydoc.help(_module_name)
=

Note: I've included an underscore in variables names so that they would not 
appear.
Note 2: for some reason, which I do not understand, it shows the help twice 
(i.e. I have to hit "q" twice to make it go away).  Sorry that I can not help 
with this.

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


Re: Print docstrings to shell

2011-02-01 Thread André Roberge
On Tuesday, February 1, 2011 8:11:51 PM UTC-4, Gnarlodious wrote:
> Can I run a script in bash and print out its docstrings to the bash
> shell? I tried this at the end:
> 
> print(help(__file__))
> 
> Runnig the script:
> python ~/Sites/Sectrum/Harmonics.py
> 
> but all it spit out was:
> 
> no Python documentation found for '~/Sites/Sectrum/Harmonics.py'
> 
> However in the interactive shell it prints out the class structure
> nicely. What I really want to see is this output in the bash window.
> 
> -- Gnarlie

Try the following:

test.py==
import pydoc

'''this is a test'''

class A(object):
'''docstring'''
pass

print(pydoc.help(__file__[:-3]))
=

python test.py

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


Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-01 Thread André
On Tuesday, February 1, 2011 9:38:26 AM UTC-4, Richard "rantingrick" 
Johnson wrote:
> On Feb 1, 6:53 am, Adam Tauno Williams  wrote:
> 
> > If you despise IDLE so much - use one of the many other IDE's that
> > support Python;  move on.
> 
> Not exactly. Can we continue to ignore such lackluster and shabby code
> in OUR stdlib. Remember the code reflects on all of us!

Could you enlighten us and tell us what code YOU contributed to the stdlib?  

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


Re: WxPython versus Tkinter.

2011-01-25 Thread André
On Tuesday, January 25, 2011 10:12:23 PM UTC-4, Tim Chase wrote:
> On 01/25/2011 07:07 PM, rantingrick wrote:
> > What is it going to take for you (and others) to take me seriously?
> 
> Easy: Stop ranting, start writing quality code.
> 
+1
André

> -tkc

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


Re: New instance of a class : not reset?

2011-01-20 Thread André
On Thursday, January 20, 2011 10:35:46 PM UTC-4, Jean-Francois wrote:
> Hi,
> 
> In the following example, I don't understand why attribute 'data' is
> not reset when I get the new instance of Bag
> It works if I make a copy (data[:]) but I want to understand why
> 
> Thanks
> 
> 
> class Bag(object):
>   def __init__(self, data = []):


See http://docs.python.org/tutorial/controlflow.html#default-argument-values
Read the text following "Important warning: The default value is evaluated only 
once.".

André

>   self.data = data
>   #self.data = data[:]
>   def add(self, x):
>   self.data.append(x)
> 
> bag = Bag()
> print bag.data
> bag.add('toto')
> print bag.data
> bag = Bag()  # new instance of Bag, all attributes clear?
> print bag.data   # 'toto' is still there !!!

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


Re: move to end, in Python 3.2 Really?

2011-01-19 Thread André
On Wednesday, January 19, 2011 7:21:53 PM UTC-4, rantingrick wrote:
> On Jan 19, 9:18 am, Grant Edwards  wrote:
> 
> > And an unmoderated Usenet newsgroup (which has even less of a chain of
> > command than a mailing list).
> 
> Moderated status has nothing to do with it. The fact is that the
> "elite" no longer feel it necessary to care about the troubles of the
> Python peasants. This is evident by no posting from GvR for many
> years, and no posting from his subordinate (and the PSF chair!) Steve
> Holden. The last time Steve and i "rubbed shoulders" was when i
> chastised him for engaging in trollish behavior. So now i get it... He
> has time for trolling and flaming but no time for real discussion on
> topics that concern the very future evolution of this language? hmm.

Perhaps it is because they are either busy programming and/or busy organizing 
Pycon 2011.

Some people do a lot, some people talk/write a lot.  It is hard to find the 
time to do both ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regular expression for "key = value" pairs

2010-12-22 Thread André
On Wednesday, December 22, 2010 12:22:22 PM UTC-4, Francesco Napolitano wrote:
> Hi all,
> suppose I have:
> 
> s='a=b, c=d'
> 
> and I want to extract sub-strings a,b,c and d from s (and in general 
> from any longer list of such comma separated pairs).
> Some failed attempts:
> 
> In [12]: re.findall(r'(.+)=(.+)', s)
> Out[12]: [('a=b, c', 'd')]
> 
> In [13]: re.findall(r'(.+?)=(.+)', s)
> Out[13]: [('a', 'b, c=d')]
> 
> In [14]: re.findall(r'(.+)=(.+)*', s)
> Out[14]: [('a=b, c', 'd')]
> 
> In [15]: re.findall(r'(.+)=(.+),', s)
> Out[15]: [('a', 'b')]
> 
> In [16]: re.findall(r'(.+)=(.+),?', s)
> Out[16]: [('a=b, c', 'd')]
> 

How about the following:

>>> s = 'a=b,c=d'
>>> t = []
>>> for u in s.split(','):
... t.extend(u.split('='))
... 
>>> t
['a', 'b', 'c', 'd']

HTH,

André
> Thanks for your help,
> francesco.

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


Re: string identity and comparison

2010-12-16 Thread André
On Thursday, December 16, 2010 7:55:20 AM UTC-4, jeanmichel wrote:
> Fellows,
> 
> I'd like to illutrate the fact that comparing strings using identity is, 
> most of the time, a bad idea. However I'm searching a short example of 
> code that yields 2 differents object for the same string content.
> 
> id('foo')
> 3082385472L
> id('foo')
> 3082385472L
> 
> Anyone has that kind of code ?
> 
> JM

How about this:

Python 2.6 (trunk:66714:66715M, Oct  1 2008, 18:36:04) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'spam'
>>> b = 'spa'
>>> c = a[:-1]
>>> c
'spa'
>>> id(c)
548256
>>> id(b)
548224

Or, even more simply, this:

Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26) 
[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'foo'
>>> b = 'foo'
>>> id(a)
1
>>> id(b)
2

Reusing immutable objects, for the sake of efficiency, is an implementation 
details which should not be relied upon (as you know since you ask for 
examples).

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


Re: TDD in python

2010-11-29 Thread André
On Nov 29, 7:31 am, rustom  wrote:
> On Nov 28, 7:52 pm, Stefan Behnel  wrote:
>
> > Rustom Mody, 28.11.2010 11:58:
>
> > > Does anyone know of something like this for python?
>
> > >http://www.vimeo.com/13240481
>
> > The page seems to require a recent version of the Flash player. Could you
> > describe what exactly you are looking for?
>
> > Stefan
>
> Well most modern languages have TDD frameworks.
> However TDD is learnt by doing and not from books (like swimming/
> cycling).
> This screencast gives a detailed demo of *doing it* in eclipse/C++
> I was hoping for something similar for python


Go to showmedo.com and do a search for "python tdd"; you'll find many
such screencasts.

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


Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-28 Thread André Malo
* Steve Holden wrote:

> Even inheritance itself isn't as useful as it at first
> appears, and composition turns out in practice to be much more useful.
> That goes double for multiple inheritance.

Amen.

nd
-- 
my @japh = (sub{q~Just~},sub{q~Another~},sub{q~Perl~},sub{q~Hacker~});
my $japh = q[sub japh { }]; print join   #
 [ $japh =~ /{(.)}/] -> [0] => map $_ -> ()  #André Malo #
=> @japh;# http://www.perlig.de/ #
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some syntactic sugar proposals

2010-11-16 Thread André
On Nov 15, 2:39 am, Dmitry Groshev  wrote:
> Here are some proposals. They are quite useful at my opinion and I'm
> interested for suggestions. It's all about some common patterns.
> First of all: how many times do you write something like
>     t = foo()
>     t = t if pred(t) else default_value

Never!

[snip]

> And the third. The more I use python the more I see how "natural" it
> can be. By "natural" I mean the statements like this:
>     [x.strip() for x in reversed(foo)]
> which looks almost like a natural language. But there is some
> pitfalls:
>     if x in range(a, b): #wrong!

This is true only if x is an integer such that  a <= x < b

> it feels so natural to check it that way, but we have to write
>     if a <= x <= b

This is true if x is an integer OR a float.   Two very different
cases, deserving of different notation.

André


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


Re: How to write pbm file in Python 3?

2010-10-30 Thread André
On Oct 31, 1:11 am, Chris Rebert  wrote:
> On Sat, Oct 30, 2010 at 8:32 PM, André  wrote:
> > I'm trying to create pbm (portable bitmap) files using Python 3 and
> > have run into a problem.   The example I am using is the Python 2
> > Mandelbrot program found at
> >http://shootout.alioth.debian.org/u32/program.php?test=mandelbrot&lan...
>
> > When I run it using Python 2 with size=100, I get a file of size 1311
> > bytes.  This file contains the correct image.
>
> > When I run it using Python 3 with the same parameter (and replacing
> > xrange by range - the only change suggested by 2to3), I get a file of
> > size 1812 bytes; this file does not contain the right image.
>
> > Any help would be much appreciated.
>
> Have you tried changing all instances of chr() to
> bytes([]) ?
Yes, I had.  And I got the following traceback:

Traceback (most recent call last):
  File "mandel_orig.py", line 39, in 
main()
  File "mandel_orig.py", line 30, in main
cout(bytes([byte_acc]))
TypeError: must be str, not bytes

André

> In Python 3, chr() always returns Unicode rather than a bytestring; I
> suspect this might be the cause of your problem.
>
> If my suggestion fixes things, then arguably 2to3 ought to have warned
> about chr() and thus you should report this as a bug.
>
> Cheers,
> Chris
> --http://blog.rebertia.com

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


How to write pbm file in Python 3?

2010-10-30 Thread André
I'm trying to create pbm (portable bitmap) files using Python 3 and
have run into a problem.   The example I am using is the Python 2
Mandelbrot program found at
http://shootout.alioth.debian.org/u32/program.php?test=mandelbrot&lang=python&id=1

When I run it using Python 2 with size=100, I get a file of size 1311
bytes.  This file contains the correct image.

When I run it using Python 3 with the same parameter (and replacing
xrange by range - the only change suggested by 2to3), I get a file of
size 1812 bytes; this file does not contain the right image.

Any help would be much appreciated.

André

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


Re: OT Komodo Edit, line selection gutter is one pixel wide?

2010-07-01 Thread André
On Jul 1, 1:39 pm, John Doe  wrote:
> Is there a way to increase the line selection gutter width? It
> seems to be only one pixel wide. In other words... When I single
> click on the left side of the line, in order to automatically
> select the line, the pointer must be in a precise single pixel
> location immediately to the left of the line. Or am I doing
> something wrong?
>
Assuming it is the same behavior as for Komodo IDE, if you set it up
so that linenumbers are shown, then you get a much larger target to
click and select the line.

André


> Thanks.
>
> By the way... I can see that clicking and dragging to select
> multiple lines can be done somewhere in the space of the first
> character on the lines, but I am talking about single clicking to
> select the single line.

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


Re: Python is cool!!

2010-05-09 Thread André
On Mar 23, 1:55 pm, Jose Manuel  wrote:
> I have been learning Python, and it is amazing  I am using the
> tutorial that comes with the official distribution.
>
> At the end my goal is to develop applied mathematic in engineering
> applications to be published on the Web, specially on app. oriented to
> simulations and control systems, I was about to start learning Java
> but I found Python which seems easier to learn that Java.
>
> Would it be easy to integrate Python in Web pages with HTML? I have
> read many info on Internet saying it is, and I hope so 
>

An alternative approach to those already mentioned is to use Crunchy
(http://code.google.com/p/crunchy) as a local app in combination with
a browser.

André


> Any opinion

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


Re: Teaching Programming

2010-05-03 Thread André
To Samuel Williams:(and other interested ;-)

If you want to consider Python in education, I would encourage you
have a look at http://www.python.org/community/sigs/current/edu-sig/

I think you will find that there are quite a few resources available -
perhaps more than you are aware of.

And, I don't think that because "some people do not like the
indentation strategy" is a valid reason not to consider that Python's
syntax is concise and simple.   Actually, I would almost argue for the
contrary.  Indentation indicate programming structure/logic very
clearly, without the need for arbitrary keywords and other punctuation
symbols.   There are very few keywords in the language.

You indicate that Python programs are readable.  They are also known
to be short  (much shorter than some other languages).
André
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: remote evaluation of Python code typed in html webpage frame

2010-01-16 Thread André
On Jan 15, 11:47 am, dmitrey  wrote:
> Thank you for the link, but I meant what is appropriate soft to be
> installed on my server to do things like that.
> Also, for my purposes it's better to have some text with possibility
> of reexecuting after some minor code changes than python interpreter
> command prompt.
> Regards, D.
>

You could install crunchy (http://code.google.com/p/crunchy) on your
server and embed an editor in a page that is displayed.

If you have Python code executed on your server ... it is a huge
security risk, but it's your choice.  For your purpose, you likely
would have to disable the authentication feature of Crunchy.

André

> On 15 янв, 16:41, "Diez B. Roggisch"  wrote:
>
> > Am 15.01.10 15:16, schrieb dmitrey:
>
> > > hi all,
> > > what's the simplest way to create a webpage with a frame for Python
> > > code to be typed in (as a plain text, or, better, as a highlighted
> > > text or something like scite or any other easy python IDE, capable of
> > > automatic indentations), and then pressing a button to evaluate it
> > > using a remote server?
>
> > > Thank you in advance, D.
>
> >http://try-python.mired.org/
>
> > Diez
>
>

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


Re: Those two controversial 2nd & 3rd paragraphs of my ch 1

2010-01-13 Thread André
On Jan 13, 12:30 pm, Daniel Fetchinson 
wrote:

>
> One code base of cheetah works under python 2 and 3? I doubt it, but I
> could be wrong. What I can easily imagine is that somebody ported
> cheetah to python 3. In this case there are two code bases, one for
> python 2 and another for python 3. So it's not the same program that
> runs under python 2 and 3.
>

I don't know about Cheetah, but I have read about other programs with
one code base that run under both Python 2 and Python 3.  And I can
guarantee that it is the case for Crunchy.

It *is* possible to have one program working correctly under both
Python 2 *and* 3 with a single code base.  It might not be the
officially recommended way... but that does not make it impossible.

André

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


Re: Bugs in CPython 3.1.1 [wave.py]

2010-01-12 Thread André
On Jan 12, 9:33 am, "Alf P. Steinbach"  wrote:

>
> Well, this is for my Python (actually, beginning programmer) writings, at
>
>    http://tinyurl.com/programmingbookP3
>

Thanks for writing this book.  I just had a quick look at the
beginning of it where you write:
===
As of this writing two main variants of the Python language are in
use, namely
Python 2.x and Python 3.x (versions 3.0 and greater). Mostly they’re
the same but the
effect of e.g. the / division operator changed in 3.0, so in practice
it’s hopeless to try
to create programs that work the same – or even just work – with both
variants.
===
Notwithstanding your experience (finding a bug in wave.py), this
statement is false.  There are plenty of non-trivial applications that
have been ported so that they work "as is" with both Python 2.x and
Python 3.x.   If you do a google search, I am sure that you can find
many examples proving this point.  For example, you may want to read:
http://mail.mems-exchange.org/durusmail/qp/441/  or try out
Crunchy  (http://code.google.com/p/crunchy).   It may be required to
isolate some small parts and do conditional imports ... but this is
fairly straightforward to do if one writes a new application.

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


Re: unittest inconsistent

2010-01-05 Thread André
On Jan 5, 8:14 pm, Matt Haggard  wrote:
> Can anyone tell me why this test fails?
>
> http://pastebin.com/f20039b17
>
> This is a minimal example of a much more complex thing I'm trying to
> do.  I'm trying to hijack a function and inspect the args passed to it
> by another function.
>
> The reason the 'Tester' object has no attribute 'arg1' is because
> "self" still refers to the object made for testA.

Quick answer: change faketest.py as follows:

#--
# faketest.py
#--

#from importme import render
import importme

def run(somearg):
return importme.render(somearg)

=
A long answer, with explanation, will cost you twice as much ;-)
(but will have to wait)

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


Re: Python 3.1 cx_Oracle 5.0.2 "ImportError: DLL load failed: The specified module could not be found."

2009-11-25 Thread André
On Nov 19, 6:57 pm, Neil Hodgson 
wrote:
> André:
>
> > Apparently the error is caused by cx_Oracle not being able to find the
> > Oracle client DLLs (oci.dll and others). The client home path and the
> > client home path bin directory are in the PATH System Variable and
> > oci.dll is there.
>
>    Open the cx_Oracle extension with Dependency Walker
> (http://www.dependencywalker.com/) to get a better idea about what the
> problem is in more detail.
>
>    Neil

Thanks Neil. I used Dependency Walker and discovered cx_Oracle was
looking for python30.dll. I seems to be a known issue with Python 3.1
http://bugs.python.org/issue4091. I'm now used Python 2.6.4 and the
corresponding cx_Oracle version with no problems.

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


Python 3.1 cx_Oracle 5.0.2 "ImportError: DLL load failed: The specified module could not be found."

2009-11-19 Thread André
Hello,

I'm trying to get Python 3.1 and cx_Oracle 5.02
(cx_Oracle-5.0.2-10g.win32-py3.0.msi) to connect to an Oracle
11.1.0.7.0 database via OraClient10g 10.2.0.3.0 with Pydev
1.5.1.1258496115 in Eclipse 20090920-1017 on Windows XP SP 3 v2002.
The import cx_Oracle line appears as an unresolved import and when I
run the application I get the following error to console:
Traceback (most recent call last):
  File "FILEPATHHERE", line 1, in 
import cx_Oracle
ImportError: DLL load failed: The specified module could not be found.

Apparently the error is caused by cx_Oracle not being able to find the
Oracle client DLLs (oci.dll and others). The client home path and the
client home path bin directory are in the PATH System Variable and
oci.dll is there.

I tried getting the Oracle Instant Client (instantclient-basic-
win32-11.1.0.7.0.zip from 
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html)
and installing it as directed. I added the instant client path to the
PATH System Variable but that didn't work either.

I have scoured the internet and have not found a solution.

Please help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to improve this code?

2009-09-14 Thread André
On Sep 14, 10:16 pm, "Diez B. Roggisch"  wrote:
> Oltmans schrieb:
>
>
>
> > Hello,
>
> > Is there someway I can improve the following code(pythonically)?
> > (Copying from IDLE)
> > match=[1,2,3,4,5]
>
> > def elementsPresent(aList):
> >    result=False
> >    if not aList:
> >            return False
> >    for e in aList:
> >            if e in match:
> >                    result=True
> >            else:
> >                    result = False
> >    return result
> >  elementsPresent([6,7,8,9,5]) # should return True because 5 is
> > present in list named match.
>
> > Is there somehow I can improve code in elementsPresent()? I'm not a
> > very good programmer but I sense that idea of using a variable named
> > 'result' inside elementsPresent() doesn't sound very good. Any ideas
> > will be highly appreciated.
>
> 1) don't use a global variable for your function. Pass both parameters
> 2) make the lookup O(1) instead O(n) for you match by using a set
> 3) stop when something is found
> 4) Unless you want the code to be working with things that are not a
> list, but False, the first "if" is superflous
>
> def elementsPresent(aList, match):
>      match = set(match)
>      for item in aList:
>          if item in match:
>              return True
>      return False
>
> It might actually be that turning both lists to sets & checking if these
> overlap is faster because it's in pure C.
>
> Diez

Here's an example using sets:

>>> def is_present(list_1, list_2):
...if set(list_1).intersection(set(list_2)):
...   return True
...return False
...
>>> is_present([1,2,3], [4,5,6])
False
>>> is_present([1,2,3], [0,2,4])
True


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


Re: NameError: name '__main__' is not defined

2009-09-13 Thread André
On Sep 13, 10:43 pm, Peng Yu  wrote:
> Hi,
>
> I try the following code. I don't quite understand why __main__ is not
> defined. Could somebody let me know what I am wrong about it?
>
> Regards,
> Peng
>
> $ cat test.py
> #!/usr/bin/env python
>
> if __main__ == '__main__' :
>   print "Hello World!\n"
> $ ./test.py
> Traceback (most recent call last):
>   File "./test.py", line 3, in 
>     if __main__ == '__main__' :
> NameError: name '__main__' is not defined

You wrote __main__ instead of __name__.  It should have been:

if __name__ == '__main__':
 ...

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


Re: list as an instance attribute

2009-09-12 Thread André
On Sep 12, 11:48 pm, Daniel Luis dos Santos 
wrote:
> Hello,
>
> I have an object definition :
>
> class primitive:
>
>         def __init__(self)
>                 self.name = ""
>                 self.transforms = []
>
>         def copy(self, copyName)
>
>                 copy = self.copyInternalState(copyName)  # method defined 
> elsewhere
> in derived class
>
>                 if self.transforms != []
>                         for transf in self.transforms
>                                 copy.transforms.append(transf.copy())
>
> In short, what I want to is to have the transforms list as an instance
> attribute of the class. I will add objects to it. When I call the copy
> method on the object the list is to be copied to the new object.
>
> Problem is that the python interpreter is complaining that it doesn't
> know any self.transforms in the if statement.
>
> Help

1. Always post the actual code - the code you posted is not valid
Python as many colons (:) are missing.
2. You appear to be attempting to use the same name (copy) both as a
method name AND as a local variable of that method.  This definitely
look wrong.

Perhaps if you could post the actual offending code (the smallest
example showing the problem you observe) others might be able to help
you.

Cheers,

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


Re: pyjamas in action?

2009-08-31 Thread André
On Aug 31, 4:46 pm, kj  wrote:
> At work we want to implement a webapp using Google's GWT, and we're
> debating whether to use the standard GWT approach with Java, or to
> try Pyjamas.  There's no great love here for Java, but there's the
> concern that Pyjamas will not be able to deliver the full power
> and/or convenience of standard Java-based GWT.  (Why-oh-why did
> Google pick Java for this?  Couldn't Guido twist some arms?  Just
> kidding.)
>
> Are there any examples of real production websites implemented with
> Pyjamas?
>
> TIA!
>
> kynn

Perhaps you might get answers faster if you posted to the pyjamas
group: http://groups.google.com/group/pyjamas-dev

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


WEB PROGRAMMER ANALYST (with Python knowledge) for Laval, Quebec needed.

2009-08-30 Thread Marc-André Ouellette
To whom it may concern,

 

ABP Personnel Consultants is a recruiting firm established in Montreal.  We
presently have a need for a web programmer with knowledge of Python.  Below
is the job description :

 

Our client offers much more than simple Internet advertising and website
design. They are a full-service automotive industry consulting company that
develops integrated sales and CRM solutions, focussing on showing clients
how to make the most of online communications.  Their digital marketing
services are geared towards measurable results attained with the help of
rigorous online methodology.

 

Du to the expansion of the company nationally, they are seeking talented
individuals to fill full-time software development positions at their
offices in Laval.
The candidate will be responsible for analyzing client requests and/or
specifications. Determine the functionality demanded by the system and
resources/requirements, using the most
appropriate development technology to produce the required application,
and/or modification.


Additionally, the candidate will work with Quality Assurance department to
validate newly developed applications, and/or modifications. Software
Developers will also be required to troubleshoot applications when problems
arise.

The working environment is flexible, easy going and encourages teamwork.   

 

EXPERIENCE (not required to know all):


Candidates should have commercial programming experience (Python, SQL and
Javascript).
Knowledge in one or more of the following technologies is desirable:
Languages: Python, SQL, JavaScript, C/C++, Delphi
Servers: Apache, Sybase, PostgreSQL
Markups: HTML, XML, CSS, XUL
Frameworks/Toolkits: Django, Twisted Matrix, wxWidgets
Protocols: TCP/UDP IP, XMLRPC/SOAP, AJAX, FTP, HTTP, POP/SMTP
OSes: Linux, Windows, MacOSX
Other: Client/server architectures, version control systems Mercurial

 

SALARY:

 

Based on level of experience, from 5$ to 75000$ + benefits.

 

 

If your interested to know more, please contact me. 

 

Regards,

 

Marc-André Ouellette

marcan...@abppers.com

 

 

Marc-André Ouellette

Consultant en recrutement

Recruitment consultant

T. 514-939-3399 poste 105

F. 514-939-0241

Courriel : marcan...@abppers.com



Consultez nos offres d'emplois au www.abppers.com 

Visit us online at  <http://www.abppers.com/> www.abppers.com 

 Ce message, ainsi que tout fichier qui y est joint, est destiné
exclusivement aux personnes à qui il est adressé. Il peut contenir des
renseignements ou des informations de nature confidentielle qui ne doivent
être divulgués en vertu des lois applicables. Si vous n'êtes pas le
destinataire de ce message ou un mandataire autorisé de celui-ci, par la
présente vous êtes avisé que toute impression, diffusion, distribution ou
reproduction de ce message et de tout fichier qui y est joint est
strictement interdite. L'intégrité de ce message n'étant pas assurée sur
Internet, ABP Consultants en Personnel inc. ne peut être tenue responsable
de son contenu s'il a été altéré, déformé ou falsifié. Si ce message vous a
été transmis par erreur, veuillez en aviser sans délai l'expéditeur et
l'effacer ainsi que tout fichier joint sans en conserver de copie.

This message, and any attachments, is intended only for the use of the
addressee or his authorized representative. It may contain information that
is privileged, confidential and exempt from disclosure under applicable law.
If the reader of this message is not the intended recipient,or his
authorized representative, you are hereby notified that any dissemination,
distribution or copying of this message and any attachments isstrictly
prohibited. The integrity of this message cannot be guaranteed on the
Internet, ABP Personnel Consultants inc. shall not be liable for its content
if altered, changed or falsified. If you have received this message in
error, please contact right away with the sender and delete this message
andany attachments from your system.

 

 

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


Re: P3 weird sys.stdout.write()

2009-08-24 Thread André
On Aug 24, 10:13 am, Jerzy Jalocha N  wrote:
> I've stumbled upon the following in Python 3:
>
> Python 3.0.1+ (r301:69556, Apr 15 2009, 15:59:22)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import sys
> >>> sys.stdout.write("")
> 0
> >>> sys.stdout.write("something")
> something9
>
> write() is appending the length of the string to it's output.


Not quite right, see below.

> That's
> not how it worked in 2.6.
>
> What's the reason for this? Is this intended? I couldn't find a bug
> report for this.

I don't know what the reason for the change, but try the following:

>>> out = sys.stdout.write("test\n")
test
>>> out
5


What you are seeing is the concatenation of the return value of the
write() method with its output.

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


Re: IDLE is not as interactive as Maple

2009-08-20 Thread André
On Aug 20, 12:22 am, laser  wrote:
> In the future, will Python provide programe enviroment like Maple
> does?

A quick, flip answer: perhaps if you design one?  Tools for Python are
designed by people scratching an itch.

That being said, have a look at reinteract:
http://www.reinteract.org/trac/wiki/Tutorial/Introduction


> In Maple, you can remove anything unneeded in the editor. And
> the code execution order are not necessary in one direction. You can
> run any command line on the screen by
> push Enter key. These functions gave a lot of flaxibility for users to
> start with programming something.

André

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


Re: Identifying a class type - bad practice?

2009-08-18 Thread André
On Aug 18, 2:09 pm, James Harris 
wrote:
> I am writing some code to form a tree of nodes of different types. The
> idea is to define one class per node type such as
>
> class node_type_1(node):
>   
> class node_type_2(node):
>   
> etc
>
> (Class "node" would hold any common properties).
>
> When walking the tree I need to know what type of node I'm dealing
> with so polymorphism isn't generally useful. The action to be taken
> depends on the node type. Two options appear to be useful: __class__
> and isinstance. I know the latter will match the instance against any
> superclass and the former will match one class only.
>
> My question is: is this the Pythonic way to deal with such a tree? Is
> there a better way? In C I would use structs where one field was a tag
> indicating the kind of struct.
>
> James

I would probably go with hasattr(instance, 'what_I_want')

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


Re: Obtaining Python version

2009-08-03 Thread André
On Aug 3, 7:19 pm, John Nagle  wrote:
> This works, but it seems too cute:
>
>  >>> pyver = map(int,sys.version.split()[0].split('.'))
>  >>> print(pyver)
> [2, 6, 1]
>

You can also do:

>>> import sys
>>> sys.version_info
(2, 5, 2, 'final', 0)

or
>>> sys.version_info[:3]
(2, 5, 2)

> Is it guaranteed that the Python version string will be in a form
> suitable for that?  In other words, does "sys.version" begin
>
> N.N.N other stuff
>
> in all versions, and will it stay that way?  Are there ever
> non-numeric versions, like "3.2.rc1"?
>
>                                 John Nagle

I strongly suspect that sys.version_info would never change...

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


Re: Announcing PythonTurtle

2009-08-03 Thread André
On Aug 3, 10:18 am, cool-RR  wrote:
> Hello,
>
> I wanted to announce that I have just released my little side project,
> PythonTurtle.
> Here is its website:http://pythonturtle.com
>
> Its goal is to be the lowest-threshold way to learn (or teach) Python.
> You can read more about it and download it on the website.
>
> Ram.

Why not make the source available?  At the very least, people that do
not run windows could try it too.

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


Re: how to embed the python interpreter into web App (Mehndi, Sibtey)

2009-07-29 Thread André
On Jul 29, 1:11 pm, Ryniek90  wrote:
> > Hi All
>
> > I am trying to embed the python interpreter in to a web app but could
> > not get the way, any one can suggest me how to do this.
>
> > Thanks,
>
> > Sibtey Mehdi
>
> > This e-mail (and any attachments), is confidential and may be privileged. 
> > It may be read, copied and used only
> > by intended recipients. Unauthorized access to this e-mail (or attachments) 
> > and disclosure or copying of its
> > contents or any action taken in reliance on it is unlawful. Unintended 
> > recipients must notify the sender immediately
> > by e-mail/phone & delete it from their system without making any copies or 
> > disclosing it to a third person.
>
> Here's example:http://try-python.mired.org/
>
> Contact with author of that website/webapp.
>
> Good luck.

Or you can look at the code for Crunchy: http://code.google.com/p/crunchy

Note however that this will result in something that is not secure...
To quote the try-python site:

"My ISP (idiom.com) provides a sandbox inside a FreeBSD Jail..."

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


Re: ElementTree's Element substitution in Python 3

2009-07-24 Thread André
On Jul 24, 4:17 pm, Piet van Oostrum  wrote:
> >>>>> André  (A) a écrit:
> >A> I have a function to replace the content of an ElementTree Element by
> >A> that of another one which works using Python 2 but not with Python 3.
> >A> I get an assertion error.

[SNIP]

> >A> Traceback (most recent call last):
> >A>   File "test.py", line 7, in 
> >A>     a[:] = c[:]
> >A>   File "/usr/local/py3.1/lib/python3.1/xml/etree/ElementTree.py", line
> >A> 210, in __setitem__
> >A>     assert iselement(element)
> >A> AssertionError
>
> This is a Python bug. Please report it.

Done.

> The problem is that in Python 3
> slice assignments are done with __setitem__ rather than __setslice__ but
> ElementTree has not been adapted to that.
> --
> Piet van Oostrum 
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p...@vanoostrum.org

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


Re: ElementTree's Element substitution in Python 3

2009-07-24 Thread André
Sorry for replying to myself ...  the following seems to be a working
solution to my original problem.
On Jul 24, 2:54 pm, André  wrote:
> I have a function to replace the content of an ElementTree Element by
> that of another one which works using Python 2 but not with Python 3.
> I get an assertion error.  The function is as follows:
>
> def replace_element(elem, replacement):
>     '''replace the content of an ElementTree Element by that of
> another
>        one.
>     '''
>     elem.clear()
>     elem.text = replacement.text
>     elem.tail = replacement.tail
>     elem.tag = replacement.tag
>     elem.attrib = replacement.attrib
>     elem[:] = replacement[:]
>

Use instead:

def replace_element(elem, replacement):
'''replace the content of an ElementTree Element by that of
another
   one.
'''
elem.clear()
elem.text = replacement.text
elem.tail = replacement.tail
elem.tag = replacement.tag
elem.attrib = replacement.attrib
try:
elem[:] = replacement[:]  # works with Python 2.x (fast) but
not 3.x
except AssertionError:
del elem[:]
for child in replacement:
elem.append(child)


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


ElementTree's Element substitution in Python 3

2009-07-24 Thread André
I have a function to replace the content of an ElementTree Element by
that of another one which works using Python 2 but not with Python 3.
I get an assertion error.  The function is as follows:

def replace_element(elem, replacement):
'''replace the content of an ElementTree Element by that of
another
   one.
'''
elem.clear()
elem.text = replacement.text
elem.tail = replacement.tail
elem.tag = replacement.tag
elem.attrib = replacement.attrib
elem[:] = replacement[:]

The last line is problematic.  For example, if I do the following
program with Python2.5
###
from xml.etree import ElementTree as et

a = et.Element('a')
b = et.SubElement(a, 'b')
c = et.Element('c')

a[:] = c[:]
###
nothing of note happens - however, doing the same with Python 3.1, I
get the following traceback:

Traceback (most recent call last):
  File "test.py", line 7, in 
a[:] = c[:]
  File "/usr/local/py3.1/lib/python3.1/xml/etree/ElementTree.py", line
210, in __setitem__
assert iselement(element)
AssertionError

==
I would gladly welcome any suggestion for writing a replace_element()
function that works with Python 3.1

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


Re: Presentation software for Python code

2009-04-23 Thread André
On Apr 23, 4:16 pm, Scott David Daniels  wrote:
> Michael Hoffman wrote:
> >... Does anyone here have software they would suggest for making a
> > presentation that includes Python code? Other than that it would
> > probably be mainly bullet points. I'm willing to consider TeX- and
> > HTML-based approaches.
>
> You might take a look at Crunchy, and just do up your talk there.
> Crunchy is a Python program that combines an otherwise static html
> document with an interactive Python session within a browser
>      http://code.google.com/p/crunchy/
>
> A demo from an earlier version of Crunchy  (when thedemo was made,
> Firfox only). The basic features of that early version of Crunchy
> are demonstrated in this screencast.
>
>      http://showmedo.com/videos/video?name=143&fromSeriesID=143
>

And if you do use Crunchy for a presentation, you might be interested
in the html style used for Crunchy's own talk at the latest Pycon:
http://us.pycon.org/media/2009/talkdata/PyCon2009/012/crunchy_.html


André Roberge



> --Scott David Daniels
> scott.dani...@acm.org

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


Re: Problem understanding some unit tests in Python distribution

2009-04-04 Thread André
On Apr 4, 4:38 am, Peter Otten <__pete...@web.de> wrote:
> André wrote:
> > Hi everyone,
>
> > In the hope of perhaps contributing some additional unit tests for
> > Python (thus contributing back to the community), I dove in the code
> > and found something that should be simple but that I can not wrap my
> > head around.
>
> > In list_tests.py, one finds
> > ===
> > from test import test_support, seq_tests
>
> > class CommonTest(seq_tests.CommonTest):
>
> >     def test_init(self):
> >         # Iterable arg is optional
> >         self.assertEqual(self.type2test([]), self.type2test())
> > # etc.
> > ===
>
> > Wanting to figure out what the type2test() method does, I looked in
> > seq_tests.py and found the following:
>
> > ===
> > class CommonTest(unittest.TestCase):
> >     # The type to be tested
> >     type2test = None
>
> >     def test_constructors(self):
> >         l0 = []
> >         l1 = [0]
> >         l2 = [0, 1]
>
> >         u = self.type2test()
> >         u0 = self.type2test(l0)
> >         u1 = self.type2test(l1)
> >         u2 = self.type2test(l2)
>
> > # etc.
> > ===
> > No where do I find a definition for the type2test() method - other
> > than seeing it as a class variable defined to be None by default.  I
> > looked in unittest.TestCase and did not see it anywhere.
>
> > Am I missing something obvious?  I would appreciate if someone could
> > point me in the right direction.
>
> Use grep ;)
>

I sort of did (use a "find all" from within my editor...)

> CommonTest is not run standalone, it is used as a(n abstract) base class for
> several other tests that override type2test.
>
> E. g. in Lib/test/list_tests.py:
>
> from test import test_support, seq_tests
>
> class CommonTest(seq_tests.CommonTest):
> ...
>
> And then in Lib/test/test_list.py:
>
> from test import test_support, list_tests
>
> class ListTest(list_tests.CommonTest):
>     type2test = list

I can't believe I missed that one.

Thank you very much!

André

> ...
>
> Peter

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


Problem understanding some unit tests in Python distribution

2009-04-03 Thread André
Hi everyone,

In the hope of perhaps contributing some additional unit tests for
Python (thus contributing back to the community), I dove in the code
and found something that should be simple but that I can not wrap my
head around.

In list_tests.py, one finds
===
from test import test_support, seq_tests

class CommonTest(seq_tests.CommonTest):

def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), self.type2test())
# etc.
===

Wanting to figure out what the type2test() method does, I looked in
seq_tests.py and found the following:

===
class CommonTest(unittest.TestCase):
# The type to be tested
type2test = None

def test_constructors(self):
l0 = []
l1 = [0]
l2 = [0, 1]

u = self.type2test()
u0 = self.type2test(l0)
u1 = self.type2test(l1)
u2 = self.type2test(l2)

# etc.
===
No where do I find a definition for the type2test() method - other
than seeing it as a class variable defined to be None by default.  I
looked in unittest.TestCase and did not see it anywhere.

Am I missing something obvious?  I would appreciate if someone could
point me in the right direction.

Cheers,

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


Re: Introducing Python to others

2009-03-26 Thread André
On Mar 26, 6:35 am, "Paddy O'Loughlin" 
wrote:
> Hi,
> As our resident python advocate, I've been asked by my team leader to
> give a bit of a presentation as an introduction to python to the rest
> of our department.
> It'll be less than an hour, with time for taking questions at the end.
>
> There's not going to be a whole lot of structure to it. First, I'm
> going to open up a python terminal and show them how the interpreter
> works and a few basic syntax things and then a file .py files (got to
> show them that python's indenting structure is not something to be
> afraid of :P). I think I'll mostly show things in the order that they
> appear in the python tutorial (http://docs.python.org/tutorial/).
>

Shameless plug:

Show them the Python tutorial in a regular browser window ... and then
switch tab to one in which you have the same tutorial loaded from
Crunchy (http://code.google.code/p/crunchy) and go through it
(interpreter and all) right from the browser's window.  I've had some
really positive reactions from long-term Pythonistas when I did that
one-on-one two years ago.

Then perhaps use IPython as a terminal window and show them other cool
stuff that people have mentioned.

André

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


Re: Preparing teaching materials

2009-03-20 Thread André
On Mar 20, 8:58 am, grkunt...@gmail.com wrote:
> I am considering teaching a beginning programming course using Python.
> I would like to prepare my class handouts in such a way that I can
> import the Python code from real ".py" files directly into the
> documents. This way I can run real unit tests on the code to confirm
> that they work as expected.
>
> I am considering using LaTeX to write the handouts and then converting
> them to PDF files. I will probably use a Makefile to convert the LaTeX
> with embedded Python code into the PDF files using pdflatex.
>
> I will probably organize my directory structure into sub-directories
> py-src, py-test, doc-src, and doc-dist.
>
> I will be starting out using Windows Vista/cygwin and hopefully switch
> to a Macbook this summer.
>
> Any thoughts?

If I may suggest a very different alternative than the ones already
suggested: use Crunchy.  (http://code.google.com/p/crunchy)

You can have you handouts (html or reStructuredText documents) live on
the web with all your code samples executable from within Firefox.

If you don't want to install Crunchy, but want to see it in action,
you can check these older videos:
http://showmedo.com/videos/video?name=143;fromSeriesID=143
http://showmedo.com/videos/video?name=1430020;fromSeriesID=143

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


Re: New to python, open source Mac OS X IDE?

2009-01-27 Thread André
On Jan 27, 7:06 pm, "joseph.a.mar...@gmail.com"
 wrote:
> Greetings! I've heard enough raving about Python, I'm going to see for
> myself what all the praise is for!
>
> I'm on a Mac. I use Netbeans for Java, PHP, and C if needed. Do you
> even use an IDE for Python?
>

If you already use netbeans, what about http://www.netbeans.org/features/python/
?

> Any recommendations on open source Python environments?

I like Komodo Edit (which has many IDE like features).  In fact, I
like it so much that I decided to buy the Komodo IDE - the only non-
free software I use.

André
>
> Thanks!

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


Re: reading file to list

2009-01-18 Thread André Thieme

William James schrieb:

André Thieme wrote:

You make a very strong case that Lisp is very feeble at
processing data.  I'm almost convinced.


I somehow don’t believe you :-)



Ruby isn't feeble, so data like this is fine:


shall we begin?
or lotus135? 1984 times!
The 3 stooges: COBOL,LISP,FORTRAN.
3.14, si11y L00KING


Extracting the unsigned integers:

IO.readlines('data').map{|s| s.scan(/\d+/).map{|s| s.to_i}}
==>[[], [135, 1984], [3], [3, 14, 11, 0]]


Just take the program I posted before and replace
(.split % "\\s")
with
(re-seq #"\d+" %)


Now that I was so kind to give you what you asked for, you will
probably do the same for me and show me your Ruby code, in which you
define a variable that contains the Fibonacci sequence.

(def fibs (lazy-cat [0 1] (map + fibs (drop 1 fibs


(nth fibs 70) ==> 190392490709135

One requirement is that when you look at the n'th fib the results up
to n must be memoized, so that nothing needs to be calculated again
when you ask for a fib between 0 and n. And when you ask for the n+1'th
it will start the calculation right from point n.

Example:
user> (time (nth fibs 900))
"Elapsed time: 16.898726 msecs"

user> (time (nth fibs 901))
"Elapsed time: 0.268603 msecs"


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


Re: reading file to list

2009-01-17 Thread André Thieme

Xah Lee schrieb:

Xah Lee wrote:

• A Ruby Illustration of Lisp Problems
 http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html



On Jan 17, 12:30 pm, André Thieme  wrote:



In the Lisp style Clojure for example one does exactly the same as
Jillian James (JJ) did in Ruby:



(map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (line-seq
(reader "blob.txt")))


Note that you have nested map. This is a problem of function chaning
as i detailed.


Yes, Jillian also has nested maps:
IO.readlines("blob.txt").map{|line| line.split.map{|s| s.to_i }}



The other problem of cons, is commonly seen. Just about every week, we
see some perhaps beginning lisper asking how to do various trivial
list
manipulation problem, which you don't see such question or frequency
in any of modern high level lang forms.


You see questions about trivial problems every week in all forums about
programming languages.
It has nothing to do with conses. Wrong road.



The frequently asked list manipulation question we see include how to
append, prepend, or anything involving nested list such as
partitioning, reordering sublists, getting leaves, interpretation of
leaves, etc. This is caused by the cons.


Yes, same with all containers in all programming languages.



The clojure example you gave above, apparently inherited the irregular
syntax problem. (you see the #, [], % things, which is breaks the
lisp's sexp idea)


My code used 8 “mysterious symbols”:
(  )  #  [  ]  .  "  %

The Ruby version had these 7:
(  )  |  {  }  .  "

And of course, neither in Ruby nor Clojure they break any idea.




Also, all modern lisp basically all get fucked up by
inheriting the cons (e.g. clojure, NewLisp, Arc lisp, Liskell). Often,
they change the semantic a bit apparently as a mesaure towards solving
the cons problem. (and Qi Lisp creates a huge bag of ad hoc, extremely
ugly, syntax soup)


Funny.
What you write is an english text with words that most people can 
understand.

You trick them into thinking that it actually makes sense what you say.
It is so technical, that a random would believe it.
But what you really say is about as meaningful as saying that it is
impossible to write good programs in Python, because it adds whitespace
to its syntax.



• Fundamental Problems of Lisp
  http://xahlee.org/UnixResource_dir/writ/lisp_problems.html


You wasted lots of your time. Or was this maybe generated by a bot?
Maybe http://pdos.csail.mit.edu/scigen/ or something like that?
I also found this paper that you wrote:
http://apps.pdos.lcs.mit.edu/scicache/184/scimakelatex.7076.Xah+Lee.html
Another crap posting of you. But a random person might be impressed.


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


Re: reading file to list

2009-01-17 Thread André Thieme

Xah Lee schrieb:

comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby

Here's a interesting toy problem posted by Drew Krause to
comp.lang.lisp:


On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]:

OK, I want to create a nested list in Lisp (always of only integers)
from a text file, such that each line in the text file would be
represented as a sublist in the 'imported' list.

example of a file's content

3 10 2
4 1
11 18

example of programing behavior
(make-list-from-text "blob.txt") => ((3 10 2) (4 1) (11 18))

w_a_x_...@yahoo.com gave a ruby solution:

  IO.readlines("blob.txt").map{|line| line.split }

augumented by Jilliam James for result to be numbers:

  IO.readlines("blob.txt").map{|line| line.split.map{|s| s.to_i }}

Very beautiful.

---

That's really the beauty of Ruby.

This problem and ruby code illustrates 2 fundamental problems of lisp,
namely, the cons problem, and the nested syntax pain. Both of which
are practically unfixable.


*Of course* Xah is wrong, as always.
Who would expect anything else?
In the Lisp style Clojure for example one does exactly the same as
Jillian James (JJ) did in Ruby:
(map #(map (fn [s] (Integer/parseInt s)) (.split % "\\s")) (line-seq 
(reader "blob.txt")))


This is slightly longer, simply because the functions have longer names.
Integer/parseInt  vs  to_i

Also the function split takes a regexp, so I have to add the "\\s" here.
I don’t know though if Jillians version also handles any kind of
whitespac per line.
And the last thing is, that the function reader returns a BufferedReader.
So in general this is more valuable in real programs as opposed to one-
line scripts. If we combine line-seq and reader into readline and apply
the two other changes we would say:
(map #(map (fn [s] (to_i s)) (.split %)) (readlines "blob.txt"))
vs
IO.readlines("blob.txt").map{|line| line.split.map{|s| s.to_i }}

So, obviously Xah is far away from any reality.
It took him hours of his life to write up all his ideas about Lisp.
Sad to see that all that time was wasted. All of it was wrong.
Poor Xah :(


And btw, Drew Krause is just a Lisp newbie. No Lisper would ever store
data for his programs in the format
3 10 2
4 1
11 18

but instead as
(3 10 2)
(4 1)
(11 18)

And then read it back into the program with:
(map read-string (line-seq (reader "blob.txt")))


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


Solved. was: Memory leak problem (while using tkinter)

2008-12-31 Thread André
On Dec 31, 12:21 am, André  wrote:
> I have written a small program (my first Tkinter-based app) to play
> around the idea mentioned on
> http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mo...
> and, in doing so, have encountered a memory leak problem.   I have
> seen mentions on the web of using the delete() method of canvas to
> prevent such problems - which I have tried to do with limited
> success.  Below is the code I wrote; to run it, you will need a small
> image file
> (I used the one found onhttp://alteredqualia.com/visualization/evolve/)
> that is saved under "mona_lisa.png".
>


It appears that the problem occurred due to creating drawing
"contexts" with aggdraw which became orphaned in some ways.  Below is
some changes that appear to solve the problem.  Perhaps this will be
useful to others at some point...

André


[SNIP]
>
> class AggDrawCanvas(Canvas):
>     def __init__(self, width, height, win):
>         Canvas.__init__(self, win)
>         self.image_id = None
>         self.win = win
>         self._width = width
>         self._height = height
>         self._size = width, height
>         self.config(width=width, height=height+20)
>         self.info = self.create_text(width/2, height+20)
>         self.pack()
>         self.dna = DNA(self._width, self._height)
>         self.mutations = 0

 self.img = None

>
>     def draw_dna(self):
>         img = Image.new("RGBA", self._size, "black")
>         self.context = aggdraw.Draw(img)

replace by:

if self.img is None:
self.img = Image.new("RGBA", self._size, "black")
self.context = aggdraw.Draw(self.img)
else:
brush = aggdraw.Brush((0, 0, 0), opacity=255)
self.context.rectangle((0, 0, self._width, self._height),
brush)




>         for gene in self.dna.dna:
>             brush = aggdraw.Brush(tuple(gene[1][0:3]), opacity=gene[1]
> [3])
>             self.context.polygon(gene[0], brush)
>         self.delete(img)
>         self.redraw()
>
[SNIP]
--
http://mail.python.org/mailman/listinfo/python-list


Memory leak problem (while using tkinter)

2008-12-30 Thread André
I have written a small program (my first Tkinter-based app) to play
around the idea mentioned on
http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/
and, in doing so, have encountered a memory leak problem.   I have
seen mentions on the web of using the delete() method of canvas to
prevent such problems - which I have tried to do with limited
success.  Below is the code I wrote; to run it, you will need a small
image file
(I used the one found on http://alteredqualia.com/visualization/evolve/)
that is saved under "mona_lisa.png".

Any help would be greatly appreciated.

André
==

from Tkinter import Canvas, Tk, Label
import Image, ImageTk, ImageChops, ImageStat # PIL
import aggdraw
from random import randint
import time
import copy

FITNESS_OFFSET = 0
saved = [None, None]
def fitness(im1, im2):
"""Calculate a value derived from the root mean squared of the
difference
between two images.  It is normalized so that when a black image
is
compared with the original one (img1), the fitness given is 0, and
when the
image is identical, the fitness value is 100."""
global FITNESS_OFFSET
stat = ImageStat.Stat(ImageChops.difference(im1, im2))
fit = 1. - sum(stat.rms[:3])/(255*3)
if FITNESS_OFFSET == 0:
black_image = aggdraw.Draw("RGBA", im1.size, "black")
s = black_image.tostring()
raw = Image.fromstring('RGBA', im1.size, s)
stat = ImageStat.Stat(ImageChops.difference(im1, raw))
FITNESS_OFFSET = 1. - sum(stat.rms[:3])/(255*3)
return 100*(fit-FITNESS_OFFSET)/(1.-FITNESS_OFFSET)

class DNA(object):
def __init__(self, width, height, polygons=50, edges=6):
self.polygons = polygons
self.edges = edges
self.width = width
self.height = height
self.dna = []

def init_dna(self):
for i in range(self.polygons):
self.dna.append(self.random_polygon())

def random_polygon(self):
edges = []
for i in range(self.edges):
edges.append(randint(0, self.width))
edges.append(randint(0, self.height))
col = [randint(0, 255), randint(0, 255), randint(0, 255),
randint(0, 255)]
return edges, col

def mutate(self):
selected = randint(0, self.polygons-1)
_type = randint(0, 2)
if _type == 0: # colour
col_index = randint(0, 3)
self.dna[selected][1][col_index] = randint(0, 255)
elif _type == 1: # x coordinate
coord = randint(0, self.edges-1)
self.dna[selected][0][2*coord] = randint(0, self.width)
elif _type == 2: # y coordinate
coord = randint(0, self.edges-1)
self.dna[selected][0][2*coord+1] = randint(0, self.height)

class AggDrawCanvas(Canvas):
def __init__(self, width, height, win):
Canvas.__init__(self, win)
self.image_id = None
self.win = win
self._width = width
self._height = height
self._size = width, height
self.config(width=width, height=height+20)
self.info = self.create_text(width/2, height+20)
self.pack()
self.dna = DNA(self._width, self._height)
self.mutations = 0

def draw_dna(self):
img = Image.new("RGBA", self._size, "black")
self.context = aggdraw.Draw(img)
for gene in self.dna.dna:
brush = aggdraw.Brush(tuple(gene[1][0:3]), opacity=gene[1]
[3])
self.context.polygon(gene[0], brush)
self.delete(img)
self.redraw()

def redraw(self):
self.mutations += 1
s = self.context.tostring()
self.delete(self.context)
raw = Image.fromstring('RGBA', self._size, s)
self.fitness = fitness(mona_lisa, raw)
self.itemconfig(self.info,
text="%2.2f  %d"%(self.fitness,
self.mutations),
fill="black")
self.image = ImageTk.PhotoImage(raw)
self.delete(self.image_id)
self.image_id = self.create_image(self._width/2, self._height/
2, image=self.image)
self.update()

win = Tk()

mona_lisa = Image.open("mona_lisa.png")
img = ImageTk.PhotoImage(mona_lisa)

original_image = Canvas(win)
original_image.pack()
fitness_label = Label(win)

_w, _h = img.width(), img.height()
original_image.config(width=_w, height=_h)
original_image.create_image(_w/2, _h/2, image=img)

best_fit = AggDrawCanvas(_w, _h, win)
best_fit.dna.dna = []
best_fit.draw_dna()

current_fit = AggDrawCanvas(_w, _h, win)
current_fit.dna.init_dna()
current_fit.draw_dna()

while True:
current_fit.dna.mutate()
current_fit.draw_dna()
if current_fit.fitness > best_fit.fitness:
best_fit.dna.dna = copy.deepcopy(current_fit.dna.dna)
best_fit.draw_dna()
else:
current_fit.dna.dna = copy.deepcopy(best_fit.dna.dna)

if __name__ == '__main__':
win.mainloop()
--
http://mail.python.org/mailman/listinfo/python-list


Re: getting object instead of string from dir()

2008-12-17 Thread André
On Dec 17, 3:52 pm, Rominsky  wrote:

>
> I do have some understanding of the pythonic methodology of
> programming, though by far I still don't consider myself an expert.
> The problem at hand is that I am coming from a matlab world and trying
> to drag my coworkers with me.  I have gotten a lot of them excited
> about using python for this work, but the biggest gripe everytime is
> they want their matlab ide.  I am trying to experiment with making
> similar pieces of the ide, in particular I am working on the workspace
> window which lists all the current variables in the namespace, along
> with their type, size, value, etc  I am trying to create a python
> equivalent.  


You might want to have a look at
http://www.physics.ox.ac.uk/users/santoso/Software.WebLab.html

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


Re: Google Summer of Code 2009

2008-12-09 Thread André
On Dec 8, 10:34 pm, Eric <[EMAIL PROTECTED]> wrote:
> Hello,
> I am interested in participating in Google Summer of Code 2009,
> hopefully for something in Python.  I realize that this is way before
> it begins, but I would like to start to get to know the community
> better and find something that I could work on during the summer of
> code.  I know a decent amount of Python, and I am a Sophomore Computer
> Science major.  My school teaches Java, but on the side I taught
> myself Python.  If anyone knows of any projects that could use another
> hand, I would appreciate it.
>
> Thanks,
> Eric

You should have a look at
http://wiki.python.org/moin/SummerOfCode

It's still early, so there's nothing yet for 2009, but I am sure that
some ongoing projects mentioned in previous years [like Crunchy ;-)]
will be looking for volunteers.

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


Re: Python for kids?

2008-12-07 Thread André
On Dec 7, 4:13 pm, "Russ P." <[EMAIL PROTECTED]> wrote:
> I have a 12-year-old son who spends too much time playing Xbox live
> and watching silly YouTube videos. I would like to try to get him
> interested in programming. Is anyone aware of a good book or website
> that addresses this concern, preferably (but not necessarily) using
> Python? I could try to teach him Python myself, but I'm afraid I would
> just frustrate him and kill his interest in programming. I did a
> Google search and found a few things, but not a lot. Thanks.

http://rur-ple.sourceforge.net

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


Re: python book for non technical absolute beginner

2008-12-07 Thread André
On Dec 6, 9:21 am, News123 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> One of my 'non technical' friends complained about knowing nothing at
> all about programming (though using computers regularly for mails / web
> browsing / googling and downloading / cropping photos )
>
> He wants to play a little with programming to stimulate parts of his
> otehrwise idle brain cells. ;-) Normally it's more the social science /
> linguistic parts being exercised,
>
> I thought python might be a nice language for this
>
> No my question does anybody know a nice beginners book (or a learning CD
> or on line tutorial)? Ideally it shouldn't be too serious and have a lot
> of small nice mini-examples
>
> thanks in advance for any suggestions hints
>
> bye
>
> N
For something completely different, try http://rur-ple.sourceforge.net/
It's Karel the robot, using only Python, and comes with a whole bunch
of lessons and exercises.

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


Re: Using dictionary to hold regex patterns?

2008-11-23 Thread André
On Nov 23, 1:40 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote:
> Hello
>
> After downloading a web page, I need to search for several patterns,
> and if found, extract information and put them into a database.
>
> To avoid a bunch of "if m", I figured maybe I could use a dictionary
> to hold the patterns, and loop through it:
>
> ==
> pattern = {}
> pattern["pattern1"] = ">.+?.+?>(.+?)"
> for key,value in pattern.items():
>         response = ">whatever.+?>Blababla"
>
>         #AttributeError: 'str' object has no attribute 'search'
>         m = key.search(response)
>         if m:
>                 print key + "#" + value
> ==
>
> Is there a way to use a dictionary this way, or am I stuck with
> copy/pasting blocks of "if m:"?
>
> Thank you.

Yes it is possible and you don't need to use pattern.items()...

Here is something I use (straight cut-and-paste):

def parse_single_line(self, line):
'''Parses a given line to see if it match a known pattern'''
for name in self.patterns:
result = self.patterns[name].match(line)
if result is not None:
return name, result.groups()
return None, line


where self.patterns is something like
self.patterns={
'pattern1': re.compile(...),
'pattern2': re.compile(...)
}

The one potential problem with the method as I wrote it is that
sometimes a more generic pattern gets matched first whereas a more
specific pattern may be desired.

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


Parsing: request for pointers

2008-11-11 Thread André
Hi everyone,

I would like to implement a parser for a mini-language
and would appreciate some pointers.  The type of
text I would like to parse is an extension of:

http://www.websequencediagrams.com/examples.html

For those that don't want to go to the link, consider
the following, *very* simplified, example:
===

programmer Guido
programmer "Fredrik Lundh" as effbot
programmer "Alex Martelli" as martellibot
programmer "Tim Peters" as timbot
note left of effbot: cutting sense of humor
note over martellibot:
Offers detailed note, explaining a problem,
accompanied by culinary diversion
to the delight of the reader
note over timbot: programmer "clever" as fox
timbot -> Guido: I give you doctest
Guido --> timbot: Have you checked my time machine?

===
>From this, I would like to be able to extract
("programmer", "Guido")
("programmer as", "Fredrik Lundh", "effbot")
...
("note left of", "effbot", "cutting sense of humor")
("note over", "martellibot", "Offers...")
("note over", "timbot", 'programmer "clever" as fox')

Some observations:
1. I want to use indentation to identify blocks.
  (the site I referred to uses "end note" which I don't want)
2. "keywords"  (such as "programmer", "note over")
   can appear in text, and should not then be misidentified
3. I was thinking of using http://effbot.org/zone/simple-top-down-parsing.htm
   as a guide; however, it is not clear to me how it could be
   adapted to handle observations 1 and 2. (If it "easily" could,
   just a few pointers would be enough, and I'll start from there...)
4. I want to do this only using modules in the standard Python
   library, as I want to use this to learn about the basics
   of parsing.  So, please don't *simply* suggest to use a
   third-party module, such as
   [1] plex, [2] yapps, [3] pyparsing
   The learning journey is more important for me than just
   having a canned solution to my (current) parsing problem.

Cheers,

André

[1] http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/
[2] http://theory.stanford.edu/~amitp/yapps/
[3] http://pyparsing.wikispaces.com/

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


ANN: Docpicture 0.2

2008-10-31 Thread André
Docpicture 0.2 has been released.  You can download it from
http://code.google.com/p/docpicture/

Docpicture's goal is to enable embedding pictures inside Python
docstrings using some custom domain specific language (dsl).
docpicture includes a plugin architecture enabling users to extend it
by adding new dsl parsers.  Docpicture behaves as an enhanced help()
for Python.  It requires a default browser capable of displaying svg
images (e.g. Firefox 3)

===
This version of docpicture can display the following type of images:

1. turtles (!)
2. images downloaded from the web (in any format)
3. Mathematical equations  (requires matplotlib)
4. UML sequence diagrams (require a live internet connection)
5. Full matplotlib plots.

This is very much a proof-of-concept version.  Comments and
suggestions are most welcome.  Code contributions [for other types of
images] even more so. ;-)

André Roberge
--
http://mail.python.org/mailman/listinfo/python-list


Re: math equation, svg and matplotlib

2008-10-29 Thread André
On Oct 29, 6:34 pm, kib2 <[EMAIL PROTECTED]> wrote:
> André a écrit :
>
> > Would anyone have a "quick and dirty" code sample to create an svg
> > output of a sample math equation using matplotlib?
>
> > André
>
> Hi André,
>
> maybe that's not what you want be there's something like this here (a
> converter from DVI to SVG in pure Python), look at the samples at the bottom
> of the page:
>
> http://www.wmula.republika.pl/proj/pydvi2svg/index.html#samples

Your project looks very interesting; however, I figured out a way to
do it.  It required doing a bit of playing around with one
comprehensive examples on the matplotlib gallery.

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


math equation, svg and matplotlib

2008-10-29 Thread André
Would anyone have a "quick and dirty" code sample to create an svg
output of a sample math equation using matplotlib?

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


Re: docpicture

2008-10-14 Thread André
On Oct 14, 1:56 pm, [EMAIL PROTECTED] wrote:
> André:
>
> > Ok, the following is my first attempt at implementing this idea.
>
> I suggest you to change the program you use to encode your images,
> because it's 1000 bytes, while with my program the same 256 colors
> image needs just 278 bytes:
>
> iVBORw0KGgoNSUhEUgAAABYeCAMfOR5kBGdBTUEAAL
> GPC/xhBQd0SU1FB9gKDhAtOfvfKucYUExURf///wAAADMzM1tb
> W4CAgKSkpMDAwP8AAEQE8ZoBdFJOUwBA5thmCXBIWXMAAA50AA
> AOdAFrJLPWdElEQVQoU63Q0QrAIAgFUO/U9f9/vIxqpRIMdqOXQ6lF
> RHBhsgAXs4zofXPzTZujlMayRjdmaMZDjXvtEy9FFp75zOXI/pX5n6D/lQ
> v1WHnUJarTjGuRxpIxkLHtyIinx4tcy2S694Kjfzn2HDNqYM54H/wB55QF
> O+Mp5mAASUVORK5CYII=
>
> (and it contains just 8 colors, so it can be saved as a 4 bit PNG,
> saving even more bytes). Generally I suggest to use as few bits/pixel
> as possible, just 1 if possible.

While I agree that embedded images should be as small as possible,
this,
I believe, should be left entirely to the user.  The code sample I
gave
was just a proof of concept - something people asked for on this list.

> For the encoding/decoding you can use str.encode("base64") and
> str.decode("base64"), you don't need to import modules.
>
Good suggestion.

> Bye,
> bearophile

A more complete example is now available at
http://code.activestate.com/recipes/576538/

André

(Of course, now I'll have to include this in Crunchy... ;-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: docpicture

2008-10-14 Thread André
On Oct 14, 10:58 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Tue, 14 Oct 2008 06:12:59 -0700, Scott David Daniels wrote:
> > Steven D'Aprano wrote:
> >> And if not, it's no big deal. Your help string has a clearly labeled
> >> few lines of hex:
>
> >> Help on function spam:
>
> >> spam(...)
> >>     spam spam spam spam spam spam
> >>     spam spam spam spam with a fried egg on top
>
> >>     === begin docpicture ===
> >>     1234567890ABCDEF...
> >>     === end docpicture ===
> >> Or similar. I'm sure people will cope, especially since it should be
> >> relatively rare.
>
> > or you could even use:
> >        '''
> >        1234567890ABCDEF...
> >        '''
> > A comment _not_ a docstring (only found by scanning the source). which
> > is easy enough to hunt for.
>
> +1 for docpictures
>
> -1 for them being comments instead of docstrings. The whole point of
> having them is to allow Python tools to operate on them. I should be able
> to do this:
>
> >>> import docpicture
> >>> docpicture.gui(myfunction)
>
> and get a nice Tk window showing the picture. There's all sorts of
> functionality that you lose by making them comments and therefore
> unavailable to Python tools. (Okay, technically this hypothetical
> docpicture module could scan the source file -- assuming the source code
> is even available, which isn't always true.)
>
> But anyway, we're getting well ahead of ourselves here. Unless bearophile
> is willing to share his code, or somebody reverse engineers it, this is
> nothing more than vapourware.
>
> --
> Steven

Ok, the following is my first attempt at implementing this idea.
Of course, it could be improved by using reStructuredText in
the docstring and docutils to format it...

'''Experimental function allowing to view docstrings with embedded
images.  The images are encoded in base 64.

(c) Andre Roberge
License: Adapt as you please, but preferably give credit to original
author (and any subsequent contributor).
'''

import base64
import os
import re
import sys
import webbrowser

html_template = "%s"
def docpicture_view(function):
"""
This is a test.

docpicture = reeborg_img.png

Some more explanation.
"""
source_module = sys.modules[function.__module__]

# extract image information from docstring, retrieve encoded data,
# decode, and write to file

image_name_pattern = re.compile("\s*docpicture\s*=\s*(.+?)\s")
image_filename =
image_name_pattern.search(function.__doc__).groups()[0]
base_name, ext = image_filename.split('.')
image = base64.b64decode(getattr(source_module, base_name))

image_file = open(image_filename, "wb")
image_file.write(image)
image_file.close()

# replace image information in docstring by link to image file,
# insert in an html template, create a new file that will be
displayed
# in a browser.

docpicture_pattern = re.compile("\s*(docpicture\s*=\s*.+?)\s")
text = docpicture_pattern.sub("" %
image_filename,
  function.__doc__)

html_file = open("test.html", 'w')
html_file.write(html_template % text)
html_file.close()

url = os.path.join(os.getcwd(), "test.html")
webbrowser.open(url)

reeborg_img = """\
iVBORw0KGgoNSUhEUgAAABYeCAMfOR5kCXBIWXMAAA7EAAAOxAGVKw4bAAAD
AFBMVEUzMzNbW1v/AACAgICkpKTAwMD///
8S8uhyd1MBD3UAADYAAFAAABkA
AAGFBJ4AAAkAADYAAFAAABkAABQAABcAAAkAAAQAAAQAAAQAAATxogDxoeQBD3UA
ADkAAAMAABMAABMBDusAACYFDpQAACaqAAD///
8V5iAV5hgS9XC1WqAS85wBDwG2L+RF
NyAAABMAABMBDutPyjgS9CC1WqC1VShP0RYAAABPyji1WqAS9CC1RBxP7jMAAAIBD3UAADkAAAMA
ABMAABMV5iAS9BhBx0G1DExCx4VCx43LD8i1DGxFM5sS9BhFM7JFM7oS9LRFM8QS9BgS9JjLD8jL
D8i1WqAS9DBCWLYABAEAAAC6Z1ES9FzUhzRTBRAABAEAAAC6Z1DLD8i6q80S9JgS9HTU
tqPUhPzUhaQDBRoAAAEWIagWIcgABAAWX8gAAADUtik94ZFTBRAS9SwWX8g94ZwA
BBMS9RAS9TjXBGfUiDDUiCrUuJsAAADLD8hTBRAABAEAAAC6Z1B
+cqwAAAEA
AACKACEABADV8+N+cph
+8XQAAaYAAAIABBMWIcgBCJ4A
AAAS8HSAFjwAAAUAAAVI2FSAGByAGKxI2GAAb1oS9fw97BsWX8gWIUgAAAQS
9mQ95ZgAAADXIloS9bzUtqPUhPzUhaQDBRoAAAEWX8gWIUgDBQES9dDUwr8S9gA90ZMD
BRo95ZgWX8jUiKYAAAIAAMgAABMWIVAS9ijUhzRTBR895Zi6q80S9mQ9
5ZgS9pDUi9n90AAS9pDUiFoS9lDUiCoAAA895ZgS
+WgAABQAAAEAABAAAFEA
AAAS9kTxbGQS+TjXBGfUiDDUiCoAAADKTwNHCHRSTlP/
AN6DvVkA
AAB6SURBVHjardCLCsAgCAXQO7P8/z
+eyVxWEgzmKNghfEEES5CoqV5E7FFbIzKOao5SjJknj0yo
Gbt2fnKfOCQJHEt+43Lkdcp8J8bbBmEb7Jemh35cq/07axJjzhjIuJ+dsb/
2iZaSc3fO3qO88T+P
mpF5TB+YMp4bvwEGcAqR53QgIgBJRU5ErkJggg==

"""

if __name__ == '__main__':
docpicture_view(docpicture_view)

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


Crunchy 1.0 alpha 1 released

2008-10-09 Thread André
Hi everyone,

Crunchy version 1.0 alpha 1 has been released.

Crunchy is an application that transforms normally static Python
tutorial (html files, or reStructuredText ones - if docutils is
installed on your computer) into interactive sessions within your
browser (Firefox).

It is available from http://code.google.com/p/crunchy/

This release includes:

* Completely revamped user interface
* Support for multiple simultaneous users, each being able to set
their own preferences
* Increased security on multi-users computer (as users now have to log
in)
* A number of interactive elements including Python interpreters,
editors, doctest, unittest (new), integration with code quality
analyzers such as pylint, pychecker and pyflakes (all new - you need
to have any one of these installed on your computer).
* Some experimental features such as an interface to pdb, the Python
debugger, and an early prototype (incomplete) for having time-limited
exams.
* etc.

Crunchy now makes use of Pygments to style the code.  As a result, it
is possible to embed (and style) code snippets in a large number of
programming language.  However, only Python code can be executed (for
now...).

Crunchy now also makes use of jQuery and various plugins.

As usual, suggestions for improvements, bug reports and other comments
are welcome.

Cheers,

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


  1   2   3   4   >