Re: multiple versions of python

2013-05-07 Thread Colin J. Williams

On 07/05/2013 6:26 PM, sokovic.anamar...@gmail.com wrote:

Hi,

what is the generally recommended structure when we have into play this type of 
problem:
multiple versions of python (both in the sense of main versions and sub 
versions, e.g.,
2.7 :
2.7.1
2.7.3
3:
  3.3
3.3.1
Different versions of gcc
different compilation strategies (-vanilla and non-vanilla)
different modules (numpy,scipy) together with the different versions of all the 
rest.

any help is appreciated

Ana


Do you really need more than 2.7.3  and 3.3.1.

Typically, these go to C:\Python27 and C:\Python33 with windows.

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


Re: Style question -- plural of class name?

2013-05-08 Thread Colin J. Williams

On 08/05/2013 4:20 PM, Roy Smith wrote:

FooEntry is a class.  How would you describe a list of these in a
docstring?

"A list of FooEntries"  0

"A list of FooEntrys"   -1

"A list of FooEntry's"  +1

"A list of FooEntry instances"  No FooEntry is specified as a class.

The first one certainly sounds the best, but it seems wierd to change
the spelling of the class name to make it plural.



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


Re: Determine actually given command line arguments

2013-05-15 Thread Colin J. Williams

On 15/05/2013 2:34 AM, Henry Leyh wrote:

Hello,
I am writing a program that gets its parameters from a combination of
config file (using configparser) and command line arguments (using
argparse).  Now I would also like the program to be able to _write_ a
configparser config file that contains only the parameters actually
given on the commandline.  Is there a simple way to determine which
command line arguments were actually given on the commandline, i.e. does
argparse.ArgumentParser() know which of its namespace members were
actually hit during parse_args().

I have tried giving the arguments default values and then looking for
those having a non-default value but this is really awkward, especially
if it comes to non-string arguments.  Also, parsing sys.argv looks
clumsy because you have to keep track of short and long options with and
without argument etc. i.e. all things that I got argparse for in the
first place.

Thanks && Greetings,
Henry

Try sys.argv

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


Re: Fractal

2013-05-15 Thread Colin J. Williams

On 13/05/2013 11:41 AM, Sharon COUKA wrote:

Hello, I'm new to python and i have to make a Mandelbrot fractal image for 
school but I don't know how to zoom in my image.
Thank you for helping me.

Envoyé de mon iPad



Google is your friend.  Try "Mandelbrot Python"

Colin W.




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


Re: Unicode humor

2013-05-15 Thread Colin J. Williams

On 15/05/2013 1:21 PM, MRAB wrote:

On 15/05/2013 18:04, Jean-Michel Pichavant wrote:

- Original Message -

On 15/05/2013 14:19, Jean-Michel Pichavant wrote:

This reflects a lack of understanding of Unicode.



jmf



And this reflects a lack of a sense of humor.  :)


Isn't that a crime in the UK?

ChrisA


The problem with English humour (as against standard humor)
is that its not unicode compliant


British humour includes "double entendre", which is not
French-compliant.


I didn't get that one. Which possibly confirm MRAB's statement.


It's called "double entendre" in English (using French words, from
"à double entente"), but that isn't correct French ("double
sens").


Thanks for clarifying, I didn't know "double entendre" had actually a
meaning in english, it's obviously 2 french words but this is the
first time I see them used together.


Occasionally speakers of one language will borrow a word or phrase from
another language and use it in a way a native speaker wouldn't (or even
understand).


double-entendre - Chambers Fails, but see Wiktionary: 
http://en.wiktionary.org/wiki/double_entendre


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


Re: Which way is best to execute a Python script in Excel?

2012-07-06 Thread Colin J. Williams

On 06/07/2012 1:09 AM, Terry Reedy wrote:


On 7/5/2012 10:30 PM, Karim wrote:


An excellent link to derived all code example to python:
http://www.pitonyak.org/AndrewMacro.sxw.


Even though he only writes in OOBasic, you are right that he explains
the basic concepts needed for accessing the api from any language. He is
also honest. Writing non-api code is relatively easy; accessing the
OO/LO api is harder. I made a start. When I get further, I will look at
the examples that are close to some things I want to do. I will also
study your Python examples. Thanks for the help.

Terry



You might be interested in pyspread
(http://manns.github.com/pyspread/).

It is no longer maintained for Windows.

Colin W.

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


Re: lambda in list comprehension acting funny

2012-07-11 Thread Colin J. Williams

On 11/07/2012 2:41 AM, Daniel Fetchinson wrote:

funcs = [ lambda x: x**i for i in range( 5 ) ]
print funcs[0]( 2 )
print funcs[1]( 2 )
print funcs[2]( 2 )

This gives me

16
16
16

When I was excepting

1
2
4

Does anyone know why?

Cheers,
Daniel



I don't understand why you would expect 1, 2, 4.

Perhaps parentheses will help the order of evaluation:

funcs = [(lambda x: x**i) for i in range( 5 )]

This gives:
1
16
81

Colin W.

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Colin J. Williams

On 21/07/2012 6:48 AM, Dave Angel wrote:

Has anybody else noticed the sudden double-posting of nearly all
messages in the python mailing list?



No.

Colin W.

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


Re: Setting up a class

2012-09-06 Thread Colin J. Williams

On 06/09/2012 8:20 AM, MRAB wrote:

On 06/09/2012 13:00, shaun wrote:

Hi all,

So I'm trying to to OO a script which is currently in place on work.
It connects to the database and makes multiple strings and sends them
to a server.

But I'm having major problems since I am new to python I keep trying
to do it as I would do it in Java but classes seem to be very
different. I was wondering could someone answer a few questions?

1) Is there anything I should know about passing in variables from
another script to the class?

2) When I'm passing variables back to the script they seem to come
back blank as if I haven't done it correctly (I declare the empty
variable at the top of the class, I use the information I get from the
database to fill it and I send it back) Is there anything I'm not
doing right with this.

3)When I want to use a method from a class in another class method it
never seems to work for me, I have a feeling this is to do with "self"
but im not too sure??

Any help would be appreciated.
Thanks,
Shaun


You should have a look as a Python tutorial to help you get used to the
language. It shouldn't take you long, provided that you remember that
Python isn't Java and don't try to write Java in Python. :-)

Here's one you could look at:

Python for Java programmers
http://python4java.necaiseweb.org/Main/TableOfContents


The link given seems dated and incomplete - see "operator overloading".

Sorry I can't assist the OP.

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


Re: which a is used?

2012-09-25 Thread Colin J. Williams

On 24/09/2012 10:14 PM, alex23 wrote:

On Sep 25, 11:13 am, Dwight Hutto  wrote:

bitch


I honestly could not care less what you think about me, but don't use
that term. This isn't a boys' club and we don't need your hurt ego
driving people away from here.


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


Re: How to get progress in python script.

2012-09-29 Thread Colin J. Williams

On 28/09/2012 12:26 PM, Rolando Cañer Roblejo wrote:

Hi all,

Please, I need you suggest me a way to get statistics about a progress
of my python script. My python script could take a lot of time
processing a file, so I need a way that an external program check the
progress of the script. My first idea was that the python script write a
temp file showing the progress and the external program can check that
file, but I think might happen file read/write locking issues.

Thanks.

Would the Python profiler meet your need?

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


Re: Numpy module

2012-11-08 Thread Colin J. Williams

On 08/11/2012 8:09 AM, Anssi Saari wrote:

farrellpolym...@gmail.com writes:


[snip]

Does Numpy 1.6.2 not run with Python 3.2.3?


It does on the Raspberry Pi, which uses a variant of Debian.

Colin W.

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


Error messages from format()

2012-11-13 Thread Colin J. Williams
Is there some way to get more informative error messages from the 
builtin format?


Most messages are such as:
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid conversion specification

This example doesn't point to the first invalid case.

[Dbg]>>> format((25, 31),'{0^9o} a(1:9x}')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid conversion specification

Basically, I'm trying to make use of the format function with Python 
3.2, but find little in the way of examples in the docs.


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


Re: Error messages from format()

2012-11-13 Thread Colin J. Williams

On 13/11/2012 1:38 PM, Steven D'Aprano wrote:

On Tue, 13 Nov 2012 10:08:59 -0500, Colin J. Williams wrote:


Is there some way to get more informative error messages from the
builtin format?


Yes -- post a feature request on the Python bug tracker, then wait until
Python 3.4 comes out in about 16 months.

:(


Many thanks :)

I am working on the assumption that the first argument of the format 
builtin function and be a sequence of values, which can be selected

with {1:}, {2:}, {0:} etc.

The docs don't make this clear.  I would appreciate advice.

Colin W.

[snip]

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


Re: Error messages from format()

2012-11-13 Thread Colin J. Williams

  
  

On 13/11/2012 4:18 PM, Dave Angel
  wrote:


  On 11/13/2012 03:24 PM, Colin J. Williams wrote:

  


I am working on the assumption that the first argument of the format
builtin function and be a sequence of values, which can be selected
with {1:}, {2:}, {0:} etc.

The docs don't make this clear.  I would appreciate advice.


  
  
The built-in function format():

http://docs.python.org/3.3/library/functions.html?highlight=format%20builtin#format

The first parameter is a single object, NOT a sequence.  One object, one
format.  If you want more generality, use the str.format() method:

http://docs.python.org/3.3/library/stdtypes.html?highlight=format#str.format

where you can supply a list or a dictionary of multiple items to be
formatted into a single string.  That's the one where you supply the
curly braces.




The docs for the first case leave open the possibility of using a
sequence when they say:
"Convert a value to a “formatted” representation, as
  controlled by
  format_spec. The
  interpretation of format_spec
  will depend on the type
  of the value argument, however there is a standard formatting syntax that
  is used by most built-in types: Format
  Specification Mini-Language."

I hope that, as time goes by, consideration will be given to
permitting a sequence.  It would appear to be a relatively simple
change.  This would extend the generality of the format function.

Thanks for clarifying this.  It confirmed my trial and error
results.

Colin W.





  

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


Re: Yet another Python textbook

2012-11-21 Thread Colin J. Williams

On 20/11/2012 4:00 PM, Chris Angelico wrote:

On Wed, Nov 21, 2012 at 1:57 AM,   wrote:

Le mardi 20 novembre 2012 09:09:50 UTC+1, Chris Angelico a écrit :

On Tue, Nov 20, 2012 at 7:02 PM, Pavel Solin  wrote:


Perhaps you are right. Is there any statistics of how many Python



programmers are using 2.7 vs. 3? Most of people I know use 2.7.




If you're teaching Python, the stats are probably about zero for zero.

Start them off on Py3 and help move the world forward.



ChrisA




Do not count with me.

The absurd flexible string representation has practically
borrowed the idea to propose once Python has a teaching tool.


To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393
strings. Take no notice; the rest of the world sees this as a huge
advantage. Python is now in a VERY small group of languages (I'm aware
of just one other) that have absolutely proper Unicode handling *and*
efficient string handling.

ChrisA

It's interesting to see that someone else finds the format function to 
be a pain.  Perhaps the problem lies with the documentation.


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


Re: Yet another Python textbook

2012-11-22 Thread Colin J. Williams

From Yet another Python textbook
On 21/11/2012 5:17 PM, Chris Angelico wrote:

On Thu, Nov 22, 2012 at 4:03 AM, Colin J. Williams  wrote:

On 20/11/2012 4:00 PM, Chris Angelico wrote:

To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393
strings. Take no notice; the rest of the world sees this as a huge
advantage. Python is now in a VERY small group of languages (I'm aware
of just one other) that have absolutely proper Unicode handling *and*
efficient string handling.

ChrisA


It's interesting to see that someone else finds the format function to be a
pain.  Perhaps the problem lies with the documentation.


Hang on, what? I'm not sure where the format function comes in. I was
referring to the underlying representation.

The OP wrote:
  "The absurd flexible string representation has practically
borrowed the idea to propose once Python has a teaching tool."

I perhaps stretched this to refer specifically on one aspect, formatting 
in my comment.


That said, though, I'm just glad that %-formatting is staying. It's an
extremely expressive string formatting method, and exists in many
languages (thanks to C's heritage). Pike's version is insanely
powerful, Python's is more like C's, but all three are compact and
convenient.

str.format(), on the other hand, is flexible. It strikes me as rather
more complicated than a string formatting function needs to be, but
that may be a cost of its flexibility.

ChrisA


Yes is is complicated.

From my reading of the docs, it seems to me that the three following 
should be equivalent:


  (a) formattingStr.format(values)
with
  (b) format(values, formattingStr)
or
  (c) tupleOfValues.__format__(formattingStr

Example:
print('{:-^14f}{:^14d}'.format(-25.61, 95 ))
print(format((-25.61, 95), '{:-^14f}{:^14d}'))
(-25.61, 95 ).__format__('{:-^14f}{:^14d}')

The second fails, perhaps because values can only be a single value.
The third fails, the reason is unclear.

Steven D'Aprano earlier said that a better diagnostic tool is planned 
for Python 3.4.


Should we retreat to %-formatting for now?

Colin W.







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


Re: Yet another Python textbook

2012-11-22 Thread Colin J. Williams

On 22/11/2012 1:27 PM, Ian Kelly wrote:

On Thu, Nov 22, 2012 at 5:24 AM, Colin J. Williams  wrote:

 From my reading of the docs, it seems to me that the three following should
be equivalent:

   (a) formattingStr.format(values)
with
   (b) format(values, formattingStr)
or
   (c) tupleOfValues.__format__(formattingStr

Example:
print('{:-^14f}{:^14d}'.format(-25.61, 95 ))
print(format((-25.61, 95), '{:-^14f}{:^14d}'))
(-25.61, 95 ).__format__('{:-^14f}{:^14d}')

The second fails, perhaps because values can only be a single value.
The third fails, the reason is unclear.


The latter two (which are more or less equivalent) fail because they are
intended for invoking the formatting rules of a single value.  The
string argument to each of them is not a format string, but a "format
specification", which in a format string is only the part that goes
inside the curly braces and after the optional colon.  For example, in
this format string:


Thanks, this is clear.  I wish the docs made this clearer.

You and I used __format__.  I understand that the use of double 
underscore functions is deprecated.  Is there some regular function 
which can achieve the same result?





'Hello world {0!s:_>4s}'.format(42)

'Hello world __42'

The format specifier here is "_>4s":


format('42', '_>4s')

'__42'

The valid format specifiers depend upon the type of the object being formatted:


format(42, '04x')

'002a'


format(datetime(2012, 11, 22, 11, 17, 0), 'The time is %Y %d %m %H:%M:%S')

'The time is 2012 22 11 11:17:00'

Custom types can implement custom format specifications by overriding
the __format__ method:


class Foo:

... def __init__(self, value):
... self.value = value
... def __format__(self, spec):
... if spec == 'a':
... return str(self.value)
... if spec == 'b':
... return ''.join(reversed(str(self.value)))
... raise ValueError("Unknown format code {!r}".format(spec))
...

format(Foo(42), 'a')

'42'

format(Foo(42), 'b')

'24'

The same format specifications can then also be passed to str.format:


'{0:a} reversed is {0:b}'.format(Foo(42))

'42 reversed is 24'

Unfortunately, there does not seem to be a good reference to the
format specifications available for built-in types beyond basic
strings and numbers.  I only knew about the datetime example because
it is used in an example in the str.format docs.  The
datetime.__format__ implementation (which seems to be just a thin
wrapper of datetime.strftime) does not seem to be documented anywhere
in the datetime module docs.



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


Re: py2exe is on Sourceforge list of top growth projects

2012-12-18 Thread Colin J. Williams

On 18/12/2012 1:52 AM, Frank Millman wrote:

This is from Sourceforge's monthly update -



Top Growth Projects

We're always on the lookout for projects that might be doing interesting
things, and a surge in downloads is one of many metrics that we look at
to identify them. Here's the projects that had the greatest growth in
the last month.

[...]

py2exe: A distutils extension to create standalone Windows programs from
python scripts.



It is 19th on a list of 19, but still, it is nice to see. I wonder if
there was any particular reason for that?

Frank Millman


Yes, but py2exe appears limited to Python 2.6.

PyInstaller is another option with similar functionality.

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


Re: Pigeon Computer 0.1 Initial (BETA) release

2012-12-22 Thread Colin J. Williams

On 21/12/2012 7:07 PM, Amirouche Boubekki wrote:

Héllo,


2012/12/22 Simon Forman mailto:forman.si...@gmail.com>>

Pigeon Computer 0.1 Initial (BETA) release

Summary


The Pigeon Computer is a simple but sophisticated system for learning
and exploring the fundamentals of computers and programming.

It is written to support a course or class (as yet pending) to learn
programming from the bit to the compiler.

There is a DRAFT manual and a Pigeon User Interface that includes:

   * An assembler for the ATmega328P micro-controller.
   * A polymorphic meta-compiler.
   * Forth-like firmware in assembly.
   * Simple high-level language for assembly control structures.
   * A virtual computer that illustrates Functional Programming.

Source code is released under the GPL (v3) and is hosted on Github:
https://github.com/PhoenixBureau/PigeonComputer

The manual is online in HTML form here:
http://phoenixbureau.github.com/PigeonComputer/

Mailing list:
https://groups.google.com/d/forum/pigeoncomputer

It has been tested on Linux with Python 2.7, YMMV.

I'm releasing it now because it's basically done even though it needs
polish and I'm just too excited about it.  Happy End of the World Day!


This sound fun!

Could you elaborate a bit in simple words what it is and what's the
common way to interact with the system ? What do you mean by «
Forth-like firmware in assembly » ? Is there a GUI ? Does it feels like
being a hipster like in the '50s or before and breaking the 1 billion
dollar thing ?

Of course the little tutorial I stripped and read a bit gives some of
the responses.

Thanks

Amirouche


  - - -

Whew!  If you are still reading, thank you.  There is a lot more to be
done and I am hoping to form classes in early January 2013.  If you
are interested please email me at forman.si...@gmail.com


You can also participate on Github and join the mailing list.
   * https://github.com/PhoenixBureau/PigeonComputer
   * https://groups.google.com/d/forum/pigeoncomputer

Warm regards,
~Simon P. Forman
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


The Pigeon would appear to have objectives similar to those of the 
Raspberry Pi Project, which uses an ARM processor and has operational 
both Python 2.7 and Python 3.2.  The Raspberry Pi Foundation can be 
reached at: http://www.cl.cam.ac.uk/projects/raspberrypi/


Colin W.


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


Re: Good Python IDE

2013-01-06 Thread Colin J. Williams

On 06/01/2013 7:48 AM, Tetsuya wrote:

On 01/06/2013 05:45 AM, Sourabh Mhaisekar wrote:

Hello All,
I am recently started couple of projects in Python, one in Python GTK

 > and one in Python Qt. I want a good IDE (For Windows ) for Python which
 > gives support for Python as well as PyGtk and PyQt.


Features I am looking for
* Support for Core Python Auto-completion.
* Support for PyGtk and PyQt
* Support for either Bazaar (preferred) or CVS

Thanks !

- Sourabh



I develop only under GNU/Linux (using Vim, with some plugins like
python-jedi and supertab for autocompletion, Gundo for undo management
in a *very* smart way, etc..), but in the recent past I tried various
IDEs. They're all ugly and/or cumbersome, but it seemed to me that the
less ugly maybe is PyCharm, you could try that.
I would suggest that you look at PyScripter for Windows or Linuz when 
Wine is available.


See: http://www.decalage.info/en/python/tutorial

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


Re: newb __init__ inheritance

2012-03-10 Thread Colin J. Williams

On 08/03/2012 10:25 AM, hyperboogie wrote:

Hello everyone.

This is my first post in this group.
I started learning python a week ago from the "dive into python" e-
book and thus far all was clear.
However today while reading chapter 5 about objects and object
orientation I ran into something that confused me.
it says here:
http://www.diveintopython.net/object_oriented_framework/defining_classes.html#fileinfo.class.example

"__init__ methods are optional, but when you define one, you must
remember to explicitly call the ancestor's __init__ method (if it
defines one). This is more generally true: whenever a descendant wants
to extend the behavior of the ancestor, the descendant method must
explicitly call the ancestor method at the proper time, with the
proper arguments. "

However later on in the chapter:
http://www.diveintopython.net/object_oriented_framework/userdict.html

it says:
"Methods are defined solely by their name, and there can be only one
method per class with a given name. So if a descendant class has an
__init__ method, it always overrides the ancestor __init__ method,
even if the descendant defines it with a different argument list. And
the same rule applies to any other method. "

My question is if __init__ in the descendant class overrides __init__
in the parent class how can I call the parent's __init__ from the
descendant class - I just overrode it didn't I?

Am I missing something more fundamental here?
Thanks


The mro function [Method Resolution Order]is not too well advertised in 
the docs.  This should illustrate its usage:


#!/usr/bin/env python

class A():
  def __init__(self):
z= 1

  def ringA(self):
print ('aaa')

  def ringB(self):
print('bbb')

class B(A):
  def __init__(self):
z= 2

  def ringB(self):
print('BBB')

a= A()
b= B()
b.ringB()
b.ringA()
b.__class__.mro()[1].ringB(b)

z= 1
def main():
pass

if __name__ == '__main__':
main()
I'm not sure that the class initialization is required.

Good luck,

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


Re: newb __init__ inheritance

2012-03-10 Thread Colin J. Williams

On 10/03/2012 12:58 PM, Colin J. Williams wrote:

On 08/03/2012 10:25 AM, hyperboogie wrote:

Hello everyone.


[snip]

main()
I'm not sure that the class initialization is required.

Good luck,

Colin W.

When I wrote earlier, I wondered about the need for initialization.

With Version 2, both __new__ and __init__ were required, not in the 
example below, using version 3.2:

#!/usr/bin/env python

class A():

  def ringA(self):
print ('aaa')

  def ringB(self):
print('bbb')

class B(A):
  def __init__(self:)
  def ringB(self):
print('BBB')

a= A()
b= B()
b.ringB()
b.ringA()
b.__class__.mro()[0].ringB(22)   #  22 is used for the ringB attribute
 #  Trial and error shows that any
 #  non-Null,including None for the
 #  argument gives the same result
z= 1
def main():
pass

if __name__ == '__main__':
main()

Colin W.


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


Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Colin J. Williams

On 16/03/2012 8:45 AM, Ray Song wrote:

I confess i've indulged in Haskell and found
 f a
more readable than
 f(a)

And why aren't functions curried (partially applied function is another 
function which takes the rest arguments) by default?


Thanks in advance for any suggestions.

--
Ray

+1

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


Re: Fabric Engine v1.0 released under AGPL

2012-03-20 Thread Colin J. Williams

On 20/03/2012 12:51 PM, Fabric Paul wrote:

Hi everyone - just letting you know that we released v1.0 of Fabric
Engine today. We've open-sourced the core under AGPL, so I hope that
gives you an incentive to get started with high-performance for
Python :)

http://fabricengine.com/technology/benchmarks/ - to give you an idea
of the kind of performance possible. Most of these are with node, but
the core engine is the same - we just bound it to Python.

For those of you using Python on the desktop (particularly if you're
working with 3D), we've started a closed beta on a PyQt framework -
you can see more here: 
http://fabricengine.com/2012/03/pyqt-framework-for-fabric-engine/
- email b...@fabricengine.com if you'd like to take part in the
testing program.

Thanks for your time,

Paul



It seems that sing;e dimension arrays are used in KL.  How does this 
compare with Numpy?


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


Re: Python-URL! - weekly Python news and links (Mar 31)

2012-04-03 Thread Colin J. Williams

On 31/03/2012 11:38 AM, Cameron Laird wrote:

I pine for the fjords.

And it's time to bring "Python-URL!" to a close.  "Python-URL!", which
Jean-Claude Wippler and I appear to have launched in 1998, has reached
the end of its utility.  We still have many loyal and enthusiastic
readers--one subscription request arrived within the last day, in
fact--and certainly much writing turns up every week that *deserves*
the spotlight "Python-URL!" has shone in the past.

However, the Python world has changed a great deal over the last
fourteen years.  There are many, MANY other ways for those with an
interest in Python to nourish themselves, and Python itself has grown
and "normalized" so much that it no longer fits particularly well in
the "Python-URL!" format.  Enjoy "Mouse vs. Python"http://www.blog.pythonlibrary.org/>, the Python areas of DZone,
Reddit, developerWorks, stackoverflow, and so on.

For your reference, I append below the most-recent-but-not-
particularly-
current version of "Python-URL!"'s coda of related readings.

That is all.



Everything Python-related you want is probably one or two clicks away
in
these pages:

 Python.org's Python Language Website is the traditional
 center of Pythonia
 http://www.python.org
 Notice especially the master FAQ
 http://www.python.org/doc/FAQ.html

 Just beginning with Python?  This page is a great place to start:
http://wiki.python.org/moin/BeginnersGuide/Programmers

 Planet Python:  you want to visit there:
http://planet.python.org
 But don't confuse it with Planet SciPy:
http://planet.scipy.org
 And don't confuse *that* with SciPyTip, a high-quality daily (!)
tip
 for the numerically-inclined:
http://twitter.com/SciPyTip

 Python Insider is the official blog of the Python core development
 team:
http://pyfound.blogspot.com/2011/03/python-dev-launches-python-insider
-blog.html

 The Python Software Foundation (PSF) has replaced the Python
 Consortium as an independent nexus of activity.  It has official
 responsibility for Python's development and maintenance.
 http://www.python.org/psf/
 Among the ways you can support PSF is with a donation.
 http://www.python.org/psf/donations/
 Keep up with the PSF at "Python Software Foundation News":
http://pyfound.blogspot.com

 The Python Papers aims to publish "the efforts of Python
enthusiasts":
http://pythonpapers.org/

 Doug Hellman's "Module of the week" is essential reading:
http://www.doughellmann.com/PyMOTW/

 comp.lang.python.announce announces new Python software.  Be
 sure to scan this newsgroup weekly.
 http://groups.google.com/group/comp.lang.python.announce/topics

 Python411 indexes "podcasts ... to help people learn Python ..."
 Updates appear more-than-weekly:
 http://www.awaretek.com/python/index.html

 The Python Package Index catalogues packages.
 http://www.python.org/pypi/

 Much of Python's real work takes place on Special-Interest Group
 mailing lists
 http://www.python.org/sigs/

 Python Success Stories--from air-traffic control to on-line
 match-making--can inspire you or decision-makers to whom you're
 subject with a vision of what the language makes practical.
 http://www.pythonology.com/success

 The Summary of Python Tracker Issues is an automatically generated
 report summarizing new bugs, closed ones, and patch submissions.
 http://search.gmane.org/?author=status%40bugs.python.org&group=gmane.c
omp.python.devel&sort=date

 nullege is an interesting search Web application, with the
intelligence
 to distinguish between Python code and comments.  It provides what
 appear to be relevant results, and demands neither Java nor CSS be
 enabled:
http://www.nullege.com

 Although unmaintained since 2002, the Cetus collection of Python
 hyperlinks retains a few gems.
 http://www.cetus-links.org/oo_python.html

 The Cookbook is a collaborative effort to capture useful and
 interesting recipes:
http://code.activestate.com/recipes/langs/python/

 Many Python conferences around the world are in preparation.
 Watch this space for links to them.

 Among several Python-oriented RSS/RDF feeds available, see:
 http://www.python.org/channews.rdf
 For more, see:
 http://www.syndic8.com/feedlist.php?ShowMatch=python&ShowStatus=all
 The old Python "To-Do List" now lives principally in a
 SourceForge reincarnation.
 http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse
http://www.python.org/dev/peps/pep-0042/

 del.icio.us presents an intriguing approach to reference
commentary.
 It already aggregates quite a bit of Python intelligence.
 http://

Re: Some posts do not show up in Google Groups

2012-04-30 Thread Colin J. Williams

On 30/04/2012 2:20 AM, Frank Millman wrote:

Hi all

For a while now I have been using Google Groups to read this group, but on the 
odd occasion when I want to post a message, I use Outlook Express, as I know 
that some people reject all messages from Google Groups due to the high spam 
ratio (which seems to have improved recently, BTW).

 From time to time I see a thread where the original post is missing, but the 
follow-ups do appear. My own posts have shown up with no problem.

Now, in the last month, I have posted two messages using Outlook Express, and 
neither of them have shown up in Google Groups. I can see replies in OE, so 
they are being accepted. I send to the group gmane.comp.python.general.

Does anyone know a reason for this, or have a solution?

Frank Millman


I lose about two messages a day from the Usenet Group.  At the end of 
the day, the Group reports one or two messges as being available, but 
they are not.


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


Re: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Colin J. Williams

On 01/05/2012 2:43 PM, someone wrote:
[snip]

a = [1 2 3]; b = [11 12 13]; c = [21 22 23].

Then notice that c = 2*b - a. So c is linearly dependent on a and b.
Geometrically this means the three vectors are in the same plane,
so the matrix doesn't have an inverse.




Does it not mean that there are three parallel planes?

Consider the example in two dimensional space.

Colin W.
[snip]
--
http://mail.python.org/mailman/listinfo/python-list


.py to .pyc

2012-05-13 Thread Colin J. Williams
Is there some way to ensure that a .pyc file is produced when executing 
a .py file?


It seems that for small files the .pyc file is not produced.

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


.py to .pyc

2012-05-13 Thread Colin J. Williams
Is there some way to ensure that a .pyc file is produced when executing 
a .py file?


It seems that for small files the .pyc file is not produced.

Colin W.
PLEASE IGNORE - I was in the wrong directory.

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


Re: .py to .pyc

2012-05-19 Thread Colin J. Williams

On 18/05/2012 7:20 PM, Tony the Tiger wrote:

On Sun, 13 May 2012 23:36:02 +0200, Irmen de Jong wrote:


Why do you care anyway?


Wanna hide his code...?

  /Grrr
Curiosity.  Perhaps there are stack-based processors out there which 
could use the .pyc code more directly.


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


Re: Dynamic comparison operators

2012-05-24 Thread Colin J. Williams

On 24/05/2012 10:14 AM, mlangenho...@gmail.com wrote:

I would like to pass something like this into a function
test(val1,val2,'>=')

and it should come back with True or False.

Is there a way to dynamically compare 2 values like this or will I have to code 
each operator individually?


Would something like the following meet your need?

Yes, it would be nice if there were a b.__name__ constant.

Colin W.
'''
I would like to pass something like this into a function
test(val1,val2,'>=')

and it should come back with True or False.

Is there a way to dynamically compare 2 values like this or will I have 
to code each operator individually?

'''
def test(text):
return eval(text)

a= 25
b= 50

print test('a == b')
print test('a != b')
print test('a <= b')



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


Re: Smallest/cheapest possible Python platform?

2012-05-27 Thread Colin J. Williams

On 26/05/2012 12:25 PM, Paul Rubin wrote:

Roy Smith  writes:

The Rasberry Pi certainly looks attractive, but isn't quite available
today.  Can you run Python on an Arduino?


No.  YOu want a 32-bit platform with an OS and perhaps 1 meg of memory.
And by the time you port Python to it unless it's there already, you may
as well have just written your application in C.


Python is available and included with the Debian distribution for the 
RPi.  32 bit and smaller operations are provided.  Floating point is by 
software.  A FPU is available for the AIM processor, but not provided 
with the BRCM 2835 board.


Colin W.

[snip]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Nexus Programming Language

2012-06-10 Thread Colin J. Williams

On 10/06/2012 1:45 AM, rusi wrote:

On Jun 10, 7:46 am, Adam Campbell  wrote:

The Nexus programming language version 0.5.0 has been released. It is
an "object-oriented, dynamically-typed, reflective programming
language", drawing from Lua and Ruby.www.nexuslang.org


What does nexus have that python doesn't?
Yeah I know this kind of question leads to flames but a brief glance
at the about page does not tell me anything in this direction.


It has a more complex block structure, with lots of braces {}.

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


Re: reg: playing with the list

2011-06-24 Thread Colin J. Williams

On 24-Jun-11 03:01 AM, kaustubh joshi wrote:

Hey all,
I am new here and new to python too. In general new to programming .
I was working on aproblem.
and need some help.
I have a list of numbers say [2,3,5,6,10,15]
which all divide number 30.
Now i have to reduce this list to the numbers which are prime in number.
i.e.
[2,3,5]
can somebody suggest?
K



You might try  writing the boolean function is_prime(n) for almost any n.

There was a recent discussion on this topic.

Colin W.

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


Re: Function docstring as a local variable

2011-07-10 Thread Colin J. Williams

On 10-Jul-11 13:44 PM, rantingrick wrote:

On Jul 10, 12:41 pm, Tim Johnson  wrote:

It possible for a function to print it's own docstring?


def f():
"""docstring"""
print "docstring"

any questions?


Try:

def f():
 ds= """docstring"""
 print ds
>

Colin W.

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


Re: python.org is down?

2011-07-24 Thread Colin J. Williams

On 24-Jul-11 03:43 AM, Laszlo Nagy wrote:

Can it be a problem on my side? I have tried from several different
computers. I cannot even ping it.


The same for me at Noon EST

Holland where are you?

Colin W.

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


Re: Announcing a new podcast: Radio Free Python

2011-08-24 Thread Colin J. Williams

On 24-Aug-11 00:15 AM, Larry Hastings wrote:



Radio Free Python is a new monthly podcast focused on Python and its
community.

Episode 1 has just been released! It features a panel discussion with
the PythonLabs team:

  * Barry Warsaw,
  * Fred Drake,
  * Guido van Rossum,
  * Roger Masse,
  * and Tim Peters.


You can find it at http://www.radiofreepython.com/ as of this very minute.

Enjoy!


/larry/



+1

Colin W.

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


Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams

On 27-Aug-11 03:50 AM, Hans Mulder wrote:

On 27/08/11 09:08:20, Arnaud Delobelle wrote:

I'm wondering what advice you have about formatting if statements with
long conditions (I always format my code to<80 colums)

Here's an example taken from something I'm writing at the moment and
how I've formatted it:


if (isinstance(left, PyCompare) and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]):
py_and = PyCompare(left.complist + right.complist[1:])
else:
py_and = PyBooleanAnd(left, right)

What would you do?


I would break after the '(' and indent the condition once and
put the '):' bit on a separate line, aligned with the 'if':


if (
isinstance(left, PyCompare)
and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]
):
py_and = PyCompare(left.complist + right.complist[1:])
else:
py_and = PyBooleanAnd(left, right)

It may look ugly, but it's very clear where the condition part ends
and the 'then' part begins.

-- HansM


What about:
  cond=  isinstance(left, PyCompare)
 and isinstance(right, PyCompare)
 and left.complist[-1] is right.complist[0]
  py_and= PyCompare(left.complist + right.complist[1:])if cond
  else: py_and = PyBooleanAnd(left, right)
Colin W.

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


Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams

On 27-Aug-11 11:53 AM, Hans Mulder wrote:

On 27/08/11 17:16:51, Colin J. Williams wrote:


What about:
cond= isinstance(left, PyCompare)
and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]
py_and= PyCompare(left.complist + right.complist[1:])if cond
else: py_and = PyBooleanAnd(left, right)
Colin W.


That's a syntax error. You need to add parenthesis.

How about:

cond = (
isinstance(left, PyCompare)
and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]
}
py_and = (
PyCompare(left.complist + right.complist[1:])
if cond
else PyBooleanAnd(left, right)
)

-- HansM


I like your 11:53 message but suggest indenting the if cond as below to 
make it clearer that it, with the preceding line, is all one statement.


Colin W.

#!/usr/bin/env python
z= 1
class PyCompare:
complist = [True, False]
def __init__(self):
pass
left= PyCompare
right= PyCompare
def isinstance(a, b):
return True
def PyBooleanAnd(a, b):
return True
def PyCompare(a):
return False
z=2

def try1():

  '''Hans Mulder suggestion  03:50  '''
  if (
  isinstance(left, PyCompare)
  and isinstance(right, PyCompare)
  and left.complist[-1] is right.complist[0]
  ):
  py_and = PyCompare(left.complist + right.complist[1:])
  else:
  py_and = PyBooleanAnd(left, right)

def try2():
  '''cjw response - corrected  11:56  '''
  cond=  (isinstance(left, PyCompare)
 and isinstance(right, PyCompare)
 and left.complist[-1] is right.complist[0])
  py_and= (PyCompare(left.complist + right.complist[1:]) if cond
  else PyBooleanAnd(left, right))

def try3():
'''   Hans Mulder 11:53   '''
cond = (
isinstance(left, PyCompare)
and isinstance(right, PyCompare)
and left.complist[-1] is right.complist[0]
)  # not }
py_and = (
 PyCompare(left.complist + right.complist[1:])
 if   cond
 else PyBooleanAnd(left, right)
)
def main():
try1()
try2()
try3()
if __name__ == '__main__':
main()
pass
--
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Anyone here familiar with installing Open Watcom F77?

2011-09-05 Thread Colin J. Williams

On 05-Sep-11 12:22 PM, Dan Nagle wrote:

Hello,

On 2011-09-05 16:15:20 +, W. eWatson said:


On 9/5/2011 8:24 AM, Chris Angelico wrote:

On Tue, Sep 6, 2011 at 1:15 AM, W. eWatson
wrote:

See Subject.





To what extent "familiar"? I have it installed on several computers,

but only because it comes with Open Wat C/C++.

With something off-topic like this,





sierra_mtnview @ sbcglobal.net

Here's the story.

As far as I can tell F77 1.8 is not available. I've Googled quite a
bit for it. My source for 1.9 is
. It gives me:
open-watcom-f77-win32-1.9.exe.


On Usenet, comp.lang.fortran might be the best source of help for this.
There's a good chance one of the regulars there can answer you
within one or two posts. (I'll not cross-post, you can choose for
yourself.)

HTH



You might get in touch with someone at Waterloo University, which is 
located in Kitchener/Waterloo.


This could have come from the 60's or 70's.

Good luck.

Colin W.

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


Re: Running Python Demo on the Web?

2011-09-06 Thread Colin J. Williams

On 05-Sep-11 18:00 PM, Python Fiddle Admin wrote:

Python has been ported to the web browser at pythonfiddle.com. Python
Fiddle can import snippets of code that you are reading on a web page
and run them in the browser. It supports a few popular libraries.

Another common usage is to post code on the site to allow other people
to play around with it. Also, it can be used to demonstrate a working
program.

A neat idea.

import brian
dir(brian)

Responds "scipy not available"

Colin W.

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


Re: lxml

2011-02-24 Thread Colin J. Williams

On 24-Feb-11 03:20 AM, Stefan Behnel wrote:

MRAB, 24.02.2011 01:25:

On 24/02/2011 00:10, Colin J. Williams wrote:

Could someone please let me know whether lxml is available for Windows
XP?. If so, is it available for Python 2.7?


The latest stable release is here:

http://pypi.python.org/pypi/lxml/2.2.8


Not quite the latest "stable release" (that would be 2.3), but at least
one that's pre-built for Windows.

Stefan


Thanks to both respondents.  I had tried easy_install before.

It now looks clean and importable.

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


Re: lxml

2011-02-25 Thread Colin J. Williams

On 24-Feb-11 19:39 PM, alex23 wrote:

On Feb 24, 6:20 pm, Stefan Behnel  wrote:

MRAB, 24.02.2011 01:25:

The latest stable release is here:



http://pypi.python.org/pypi/lxml/2.2.8


Not quite the latest "stable release" (that would be 2.3), but at least one
that's pre-built for Windows.


Christoph Gohlke has an 'unofficial' Window's binaries site that
includes lxml 2.3 for Python 2.6, 2.7, 3.1 and 3.1:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

Very handy site.


Thanks,

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


Re: Python getting stuck

2011-02-27 Thread Colin J. Williams

On 26-Feb-11 18:55 PM, Shanush Premathasarathan wrote:

Hi All,

When I use cut, copy, paste, and any keyboard shortcuts, Python freezes and I 
am unable to use Python. Please Help as quick as possible!!!

Thanks a lot.

Kind Regards
Big Python fan!
Shanush


What operating system are you using?

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


Re: Could I joined in this Happy family

2011-03-20 Thread Colin J. Williams
On 18-Mar-11 15:47 PM, Nick Stinemates wrote:
> Welcome aboard !
> 
> On Mar 18, 2011 11:34 AM, "duxiu xiang"  > wrote:
>  > Dear friends:
>  > I am in China.For some rearon,I cannot visit your Google Group.May
>  > I joint this mail list for help in learning Python?
>  >
>  > --
>  > 笑看嫣红染半山,逐风万里白云间。
> 
You might try: http://gmane.org/

Colin W.

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


Re: "in house" pypi?

2011-03-25 Thread Colin J. Williams

On 24-Mar-11 03:13 AM, John Nagle wrote:

On 3/23/2011 8:19 PM, Miki Tebeka wrote:

Greetings,

My company want to distribute Python packages internally. We would
like something like an internal PyPi where people can upload and
easy_install from packages.

Is there such a ready made solution? I'd like something as simple as
possible, without my install headache.

Thanks, -- Miki


PyPi isn't a code repository, like CPAN or SourceForge.
It's mostly a collection of links.

Take a look at CPAN, Perl's package repository. That's
well organized and useful. Modules are stored in a common archive
after an approval process, and can be downloaded and installed
in a standard way.

"easy_install" generally isn't easy. It has some built-in
assumptions about where things are stored, assumptions which
often don't hold true.

John Nagle


I've not found problems with "easy_install" using Windows.

Colin W.

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


Python Tutorial

2011-03-27 Thread Colin J. Williams

I have come across: http://www.java2s.com/Tutorial/Python/CatalogPython.htm

On a quick skim, the above seems to cover more ground
than the standard: http://docs.python.org/tutorial/

I spotted one bug in the former, but one of the Network
examples was helpful.

Colin W.

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


Re: Python benefits over Cobra

2011-04-05 Thread Colin J. Williams

On 05-Apr-11 06:22 AM, Brendan Simon (eTRIX) wrote:

I just came across the Cobra language, which appears to be heavily
influenced by Python (and other languages). The pitch sounds great. It's
supposed to have:

   1. Quick, expressive coding
   2. Fast execution
   3. Static and dynamic binding
   4. Language level support for quality


http://cobra-language.com/docs/why/

http://cobra-language.com/docs/python/

I was wondering what advantages Python has over Cobra. I know it's
probably a difficult question to answer and depends on specific
requirements. All I can think of is:

* Maturity of language
  o Robust and tested.
  o availability of modules (standard and built-in).
  o large community support (commercial and non-commercial).
* No dependence of .NET/Mono
  o I don't know if this is an pro or con as I don't know .NET.


Presumably the maturity argument would be less significant over time.

I'm not sure about the .NET/Mono framework, whether that is good or bad.
Sounds good in some situations at least.

Any other arguments where Python has benefits over Cobra ??

Cheers, Brendan.


Two questions:
   1. Is Cobra Open Source?
   2. The blog ended on October, did he run out of steam?

I liked the '.', in place of '.self', but that's been rejected for Python.

Colin W.


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


Re: Argument of the bool function

2011-04-10 Thread Colin J. Williams

On 10-Apr-11 12:21 PM, Mel wrote:

Chris Angelico wrote:


Who would use keyword arguments with a function that takes only one arg
anyway?


It's hard to imagine.  Maybe somebody trying to generalize function calls
(trying to interpret some other language using a python program?)

# e.g. input winds up having the effect of ..
function = bool
name = 'x'
value = 'the well at the end of the world'
## ...
actions.append ((function, {name:value}))
## ...
for function, args in actions:
 results.append (function (**args))

Not something I, for one, do every day.  But regularity in a language is
good when you can get it, especially for abstract things like that.

I can sort of guess that `dir` was perhaps coded in C for speed and doesn't
spend time looking for complicated argument lists.

Python is a pragmatic language, so all the rules come pre-broken.


Mel.

This thread has lasted 3 days so far.

I presume that it is agreed they the following is a satisfactory outcome:

*** Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit 
(Intel)] on win32. ***

>>> bool(x=0)
False
>>> bool(x=1)
True
>>>

Colin W.

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


Re: Feature suggestion -- return if true

2011-04-12 Thread Colin J. Williams

On 12-Apr-11 06:55 AM, scattered wrote:

On Apr 12, 2:21 am, James Mills  wrote:

On Tue, Apr 12, 2011 at 4:08 PM, Nobody  wrote:

It should be abundantly clear that this only returns if the expression is
considered true, otherwise it continues on to the following statements.


Uggh come on guys. We've been over this.
You cannot make that assumption.

cheers
James

--
-- James Mills
--
-- "Problems are solved by method"


I'm puzzled as to why you seem to be parsing the OP's statements
different from everybody else. The only assumption that people other
than you seem to be making is that they are assuming that the OP meant
what he said. He *gave* a definition of what he meant by return? and
the definition he actually gave has the property that it terminates
the function only when the condition is true, whereas your suggested
translation *always* terminates the function call. I agree with
"Nobody" that the OP's intention was "abundantly clear". Your "return
expr or None" suggestion was not an unreasonable try - but it doesn't
provide something which is equivalent to what the OP gave. On the
other hand, your persistence in defending your original statement as a
plausible translation of return? after the difference has been pointed
out by various posters *is* starting to become unreasonable.


In my view, the suggestion would add complexity to the language without 
sufficient benefit.


Colin W.



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


Re: Python IDE/text-editor

2011-04-16 Thread Colin J. Williams

On 15-Apr-11 23:20 PM, Alec Taylor wrote:

Good Afternoon,

I'm looking for an IDE which offers syntax-highlighting,
code-completion, tabs, an embedded interpreter and which is portable
(for running from USB on Windows).

Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png

Which would you recommend?

Thanks in advance for any suggestions,

Alec Taylor


Here is an extract from the PyScripter Help:

PyScripter - a Python IDE



PyScripter originally started as a lightweight IDE designed to to serve 
the purpose of providing a strong scripting solution for Delphi 
applications, complementing the excellent Python for Delphi (P4D) 
components.  However, and with the encouragement of the P4D creator 
Morgan Martinez and a few early users, it has now evolved into a 
full-featured stand-alone Python IDE.  It is built in Delphi using P4D 
and the SynEdit component but is extensible using Python scripts. 
Currently, it is only available for Microsoft Windows operating systems 
and  features a modern user-interface. Being built in a compiled 
language is rather snappier than some of the other IDEs   and provides 
an extensive blend of features that make it a productive Python 
development environment.


Why yet another Python IDE?


There are many Python Integrated Development Environments around.  And 
quite a few good ones, for example PythonWin, Boa (a Delphi clone built 
for and with wxPython), SPE and Eric3, not to mention IDLE which is 
included in the standard Python distribution.  So it is reasonable to 
ask why bother to develop yet another Python IDE.  The short answer is 
for the fun of it!  The long answer relates to the ambition to create a 
Python IDE that is competitive with commercial Windows-based IDEs 
available for other languages.


It has the functionality that you seek.

Colin W.




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


Python IDE/text-editor

2011-04-16 Thread Colin J. Williams

On 15-Apr-11 23:20 PM, Alec Taylor wrote:
> Good Afternoon,
>
> I'm looking for an IDE which offers syntax-highlighting,
> code-completion, tabs, an embedded interpreter and which is portable
> (for running from USB on Windows).
>
> Here's a mockup of the app I'm looking for: http://i52.tinypic.com
>
> Which would you recommend?
>
> Thanks in advance for any suggestions,
>
> Alec Taylor

Here is an extract from the PyScripter Help:

PyScripter - a Python IDE



PyScripter originally started as a lightweight IDE designed to to serve 
the purpose of providing a strong scripting solution for Delphi 
applications, complementing the excellent Python for Delphi (P4D) 
components.  However, and with the encouragement of the P4D creator 
Morgan Martinez and a few early users, it has now evolved into a 
full-featured stand-alone Python IDE.  It is built in Delphi using P4D 
and the SynEdit component but is extensible using Python scripts. 
Currently, it is only available for Microsoft Windows operating systems 
and  features a modern user-interface. Being built in a compiled 
language is rather snappier than some of the other IDEs   and provides 
an extensive blend of features that make it a productive Python 
development environment.


Why yet another Python IDE?


There are many Python Integrated Development Environments around.  And 
quite a few good ones, for example PythonWin, Boa (a Delphi clone built 
for and with wxPython), SPE and Eric3, not to mention IDLE which is 
included in the standard Python distribution.  So it is reasonable to 
ask why bother to develop yet another Python IDE.  The short answer is 
for the fun of it!  The long answer relates to the ambition to create a 
Python IDE that is competitive with commercial Windows-based IDEs 
available for other languages.


It has the functionality that you seek.

Colin W.




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


Re: Function __defaults__

2011-04-25 Thread Colin J. Williams

On 24-Apr-11 13:07 PM, Ken Seehart wrote:

On 4/24/2011 2:58 AM, Steven D'Aprano wrote:

Consider this in Python 3.1:



def f(a=42):

... return a
...

f()

42

f.__defaults__ = (23,)
f()

23


Is this an accident of implementation, or can I trust that changing
function defaults in this fashion is guaranteed to work?


This is documented in python 3, so I would expect it to be stable (until
python 4, that is)
http://docs.python.org/py3k/whatsnew/3.0.html#operators-and-special-methods
http://docs.python.org/py3k/library/inspect.html#types-and-members

The f.__defaults__ attribute was previously known as f.func_defaults (in
python 2.x), which has been around, documented and stable for quite a
while.

So it's probably just as safe as any other monkey patching technique. :)

Best of luck,
Ken



Wouldn't it make more sense to return a dictionary instead of a tuple?

Colin W.

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


Re: Function __defaults__

2011-04-25 Thread Colin J. Williams

On 25-Apr-11 08:30 AM, Ken Seehart wrote:

On 4/25/2011 4:59 AM, Colin J. Williams wrote:

On 24-Apr-11 13:07 PM, Ken Seehart wrote:

On 4/24/2011 2:58 AM, Steven D'Aprano wrote:

Consider this in Python 3.1:



def f(a=42):

... return a
...

f()

42

f.__defaults__ = (23,)
f()

23


Is this an accident of implementation, or can I trust that changing
function defaults in this fashion is guaranteed to work?


This is documented in python 3, so I would expect it to be stable (until
python 4, that is)
http://docs.python.org/py3k/whatsnew/3.0.html#operators-and-special-methods

http://docs.python.org/py3k/library/inspect.html#types-and-members

The f.__defaults__ attribute was previously known as f.func_defaults (in
python 2.x), which has been around, documented and stable for quite a
while.

So it's probably just as safe as any other monkey patching technique. :)

Best of luck,
Ken



Wouldn't it make more sense to return a dictionary instead of a tuple?

Colin W.



I assume you mean making the value of f.__defaults__ a dictionary
instead of a tuple.

A dictionary would be slower to process since it would have to iterate
the dictionary keys and assign arguments by name.
Since argument defaults can only be applied to the rightmost contiguous
sequence of zero or more parameters (excluding *args,**kwargs), a tuple
is sufficient to cover all cases, so a dictionary would provide no
advantage.
Also, a dictionary would produce an unnecessary error case (if a key in
the dictionary is not the name of an argument).

Good question though.

Cheers,
Ken

I doubt that this functionality would be used in time critical work and 
so I suggest that efficiency is not a key consideration.


Loss of information is perhaps more important.  With the tuple being 
returned, the user is not informed that the value is associated with the 
name "a"


Colin W.

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


Re: and becomes or and or becomes and

2011-05-23 Thread Colin J. Williams

On 22-May-11 15:23 PM, Stef Mientki wrote:

hello,

must of us will not use single bits these days,
but at first sight, this looks funny :


a=2
b=6
a and b

6

a&  b

2

a or b

2

a | b

6

cheers,
Stef

5.2. Boolean Operations — and, or, not

These are the Boolean operations, ordered by ascending priority:
  Operation Result  Notes
x or y   if x is false, then y, else x  (1)
   x and y   if x is false, then x, else y  (2)
not xif x is false, then True, else False   (3)

The second line is puzzling at first look, but consistent.

It is analogous to the Conditional Expression.
See: 
http://docs.python.org/reference/expressions.html#conditional-expressions


Colin W.

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


Re: Beginner needs advice

2011-05-25 Thread Colin J. Williams

On 25-May-11 02:22 AM, Lew Schwartz wrote:

So, if I read between the lines correctly, you recommend Python 3? Does
the windows version install with a development environment?



It would be safer to stick with Python 2.7 initially and then consider 
the transition to 3.2 later.


No, there is not more than Idle.

PyScripter provides an excellent development environment.  See: 
http://en.wikipedia.org/wiki/PyScripter


Colin W.

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


Re: Question about isodate

2011-05-28 Thread Colin J. Williams

On 26-May-11 07:48 AM, truongxuan quang wrote:

Hello list,

I am installing and testing istSOS wrote base on Python with its
extension like gdal, isodate, easy istall, setuptool, psycopg. I have
already installed all these stuff when I was using method POST the error
appear is "_No module named mx.DateTime.ISO_" , could you please give me
your command and advice.

Many thanks

Quang

Does this help? 
http://www.google.com/url?sa=t&source=web&cd=1&ved=0CB0QFjAA&url=http%3A%2F%2Fwww.egenix.com%2Fproducts%2Fpython%2FmxBase%2FmxDateTime%2F&rct=j&q=mxdatetime&ei=eengTYf5MM6EtgfdzeSoBw&usg=AFQjCNEsnznUS1kZ_zAzbSxGlP2IF6BsTg&sig2=3GgXQ9caWtvHTwzZoJOBuQ&cad=rja


Colin W.

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


Re: Wrapping classes

2005-09-23 Thread Colin J. Williams
Jeremy Sanders wrote:
> Peter Hansen wrote:
>  
> 
>>Almost anything is possible in Python, though whether the underlying
>>design idea is sound is a completely different question.  (Translation:
>>try the following pseudo-code, but I have my suspicions about whether
>>what you're doing is a good idea. :-) )
> 
> 
> What I'd like to do precisely is to be able to evaluate an expression like
> "a+2*b" (using eval) where a and b are objects which behave like numarray
> arrays, but whose values aren't computed until their used.
Could you not have functions a and b each of which returns a NumArray 
instance?

Your expression would then be something like a(..)+2*b(..).

Colin W.
> 
> I need to compute the values when used because the arrays could depend on
> each other, and the easiest way to get the evaluation order correct is to
> only evaluate them when they're used.
> 
> An alternative way is to do some string processing to replace a with
> computearray("a") in the expression or something horrible like that.
> 
> Thanks
> 
> Jeremy
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to associate files with application

2005-10-28 Thread Colin J. Williams
Lasse Vågsæther Karlsen wrote:
> Ashok wrote:
> 
>> hi,
>> i want to know how to make a specific type of file open in an
>> application i developed in python when the user clicks on the file.(in
>> windows) for eg. a .txt file when clicked opens in notepad, a .doc file
>> when clicked opens in MS-word. In the same way i want to make a .xyz
>> file open in the application i developed when clicked.
>> thanks in advance for any advice.
>>
> 
> You need to add several registry keys to do this, here's a short version 
> of what you need to do:
> 
> Example assumes you want to:
> 
> 1. associate .ext with C:\Program Files\MyProgram\prog.exe
> 2. pass on any extra arguments to prog.exe (ie. test.ext 1 2 3 would 
> send 1 2 3 as well to prog.exe)
> 3. associate the icon of prog.exe to any file with a .ext extension
> 
> Ok, here's what you need to do:
> 
> 1. Under HKEY_CLASSES_ROOT, add a key (folder) with the name .ext
> 2. Open that key, and set the (Default) value to MyProgramExtendedFile 
> (this name is something you choose yourself and should be a "identifier" 
> that identifies the file type. If your program supports several types of 
> files, make up unique identifiers for each.)
> 3. Under HKEY_CLASSES_ROOT, add another key, this time with the same 
> name you made up in 2. above, ie MyProgramExtendedFile
> 4. Open that key, and set the (Default) value to a textual description 
> of the type of file. This is what will show up in explorer in the file 
> type column. If you leave this empty, the description will be .EXT File
> 5. Inside MyProgramExtendedFile, add another key with the name shell 
> (lower-case is typical, can probably be Shell or whatever)
> 6. Inside shell, create another key with the name open
> 7. Inside open, create another key with the name command
> 8. Inside command, Set the (Default) value to:
>"C:\Program Files\MyProgram\prog.exe" "%1" %*
> 
>Note that you need the quotes as specified above, exactly like written
> 
> 9. Go back to MyProgramExtendedFile and create another key with the name 
> DefaultIcon
> 10. Inside DefaultIcon, set (Default) value to:
> "C:\Program Files\MyProgram\prog.exe", 0
> 
> This will pick the first icon in prog.exe resource to show for the 
> files. Use 1 for second, etc.
> 
> There are also other commands you can add. If you want to be able to 
> right-click on the file and select a menu item to process the file in a 
> specific way, for instance by passing along specific parameters to 
> prog.exe, you can add more keys than "open" on the level open is 
> created. The (Default) value inside the key is then the text of the menu 
> item.
> 
> To find examples, just find a file extension in Windows that behaves the 
> way you want your own to behave and look through HKEY_CLASSES_ROOT\.ext 
> to find the details you want.
> 
I'm no Windows expert but I think that, using Windows Explorer, one can, 
with a right mouse click, select "Open With".

You can then choose the appropriate executable.  I believe that, if you 
had set the "Always open with this program" box, then the registry is 
automatically updated.

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


Re: 'super' to only be used for diamond inheritance problems?

2005-11-02 Thread Colin J. Williams
Giovanni Bajo wrote:
> Alex Hunsley wrote:
> 
> 
>>I've seen a few discussion about the use of 'super' in Python,
>>including the opinion that 'super' should only be used to solve
>>inheritance diamond problem. (And that a constructor that wants to
>>call the superclass methods should just call them by name and forget
>>about super.) What is people's opinion on this? Does it make any
>>sense?
> 
> 
> 
> I personally consider super a half-failure in Python. Some of my reasons are
> cited here:
> http://fuhm.org/super-harmful/
> 
It would help to have some clearer guidelines on class (type) usage.  I 
like James Knight's (fuhm) suggestion with respect to consistent signatures.

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


Re: Diff. between Class types and classic classes

2005-11-08 Thread Colin J. Williams
bruno at modulix wrote:
> venk wrote:
> 
>>Hi,
>>  can some one properly explain the differences between class types and
>>classic classes? ... Still face problems in identifying what is what.
> 
> 
> I'm not sure I understand your question. Are you talking about the diff
> between old-style and new-style classes, or the diff between classes and
> metaclasses ?
> 
"new" classes inherit from object.  Classic classes do not.
"new" classes have a __new__ method.  Classic classes generally do not.
The type of a "new" class is types.TypeType
The type of a classic class is a classobj
The type of an instance of a "new" class is the name of the class
The type of an instnce of a classic class is an instance

This is shown below:
 >>> class A(object):
...   def __init__(self):
... pass
...
 >>> a= A()
 >>> class B:
...   def __init__(self):
... pass
...
 >>> b= B()
 >>> type(A)

 >>> type(a)

 >>> type(B)

 >>> type(b)

 >>>

I hope that this helps.

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


Re: Diff. between Class types and classic classes

2005-11-09 Thread Colin J. Williams
Bruno Desthuilliers wrote:
> Colin J. Williams a écrit :
> 
>> bruno at modulix wrote:
>>
>>> venk wrote:
>>>
>>>> Hi,
>>>>  can some one properly explain the differences between class types and
>>>> classic classes? ... Still face problems in identifying what is what.
>>>
>>>
>>>
>>>
>>> I'm not sure I understand your question. Are you talking about the diff
>>> between old-style and new-style classes, or the diff between classes and
>>> metaclasses ?
>>>
>> "new" classes inherit from object.  Classic classes do not.
> 
> (snip)
> 
>>
>> I hope that this helps.
> 
> 
> Colin,
> 
> I don't personaly need much help with this !-) In fact, your answer is 
> almost the same as the one I was going to post - before I re-read the 
> OP's question. And I'm still not sure that what the OP is looking for.
> 
> 
Bruno,

Sorry, my reponse should have been addressed to venk.

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


Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Colin J. Williams
Alex Martelli wrote:
> George Sakkis <[EMAIL PROTECTED]> wrote:
>...
> 
FP functions like dropwhile/takewhile etc.
>>>
>>>No way -- the itertools module is and remains a PRECIOUS resource.
>>>If you want an iterator rather than a list, itertools.ifilter is quite
>>>appropriate here.
>>
>>What about the future of itertools in python 3K ? IIRC, several
>>functions and methods that currently return lists are going to return
>>iterators. Could this imply that itertools.(imap/ifilter/izip) will
>>take the place of map/filter/zip as builtins ?
> 
> 
> I think the builtin namespace shouldn't get too crowded.  But what I
> think matters little -- what __GvR__ thinks is more important...!-)
> 
> 
> Alex
Are there generally accepted guidelines on what is appropriate for the 
builtin namespace?

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


Re: Abstract Base Classes

2005-11-11 Thread Colin J. Williams
Ben Finney wrote:
> Howdy all,
> 
> Okay, so Guido doesn't like Abstract Base Classes[0], and interfaces
> are the way of the future[1]. But they're not here now, and I
> understand ABCs better.
This is a very interesting discussion - not all of it understandable to me.

Are interfaces really in our future?

I found the contributions of "steffen" particularly appealing. 
Interfaces seem to add another level of complexity without significant 
benefit.

Colin W.
> 
> I want my modules to (sometimes) define an abstract base exception
> class, that all other exceptions in that module inherit from.
> 
> class FooException(Exception):
> """ Base class for all FooModule exceptions """
> 
> class FooBadFilename(FooException):
> """ Raised when a bad filename is used in a foo """
> 
> class FooUnknownBar(FooException, KeyError):
> """ Raised when an unknown bar is used with a foo """
> 
> However, there should never be an exception raised of class
> FooException, and in fact I want that to cause an appropriate error to
> be raised from the module.
> 
> Normally, I'd pick some key part of the functionality of the class,
> and cause that to raise NotImplementedError. It's then the
> responsibility of subclasses to override that.
> 
> However, in the case of exceptions, I don't want to override *any*
> functionality; everything should be provided by the base classes. It'd
> be messy to have to override something in every subclass just to
> ensure the abstraction of the module base exception.
> 
> I've tried doing this in the __init__():
> 
> class FooException(Exception):
> """ Base class for all FooModule exceptions """
> def __init__(self):
> raise NotImplementedError, \
> "%s is an abstract class for exceptions" % self.__class__
> 
> When I use this, I discovered to my horror that the subclasses were
> calling FooException.__init__ -- which I though wasn't supposed to
> happen in Python!
> 
> It's also rather semantically weird, to my eye.
> 
> Can I do something tricky with checking base classes in the
> FooException.__init__() ?
> 
> 
> [0] Although he's apparently been quoted earlier as saying he did.
> He's changed his mind[1] since then.
> 
> [1] http://www.artima.com/weblogs/viewpost.jsp?thread=92662>
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tutorial example

2005-11-12 Thread Colin J. Williams
Ruben Charles wrote:
> That is the diference between a method and a function.
> A method do something and a function return something.
> 
This is not quite correct. The difference between a method and a 
function is that the method is associated with a type or class object, a 
function is not.

A method can be bound to a particular instance of an object or it can be 
unbound.  In the latter case the first argument of the method call 
should be an instance of the type or class object.  However, there is no 
builtin check to ensure that the first argument is in fact an instance.

Please see the little example below.

Colin W.
# areaToy.py

class Point(object):
   def __init__(self, x, y):
 self.x= x
 self.y= y

class Area(object):
   def __init__(self, *pts):
 ''' pts is a list of points describing the enclosing polygon,
 in clockwise order, instances of Point. '''
 self.pts= pts[0]

   def size(self):
 nPts= len(self.pts)
 if nPts < 3:
   return 0
 elif nPts == 3:
   return 0.5   # replace this with triangle area calc
 else:
   pts= self.pts
   return Area(pts[0:2] + [pts[-1]]).size() +\
  Area(pts[1:]).size()

pts= [Point(*pt) for pt in [(0, 1), (1, 1), (1, 0), (0, 0)]]
area= Area(pts)
size= area.size()
print 'points:', pts
print 'size:', size
print 'Area.size:', Area.size
print 'area.size:', area.size
> Example:
> 
> def psum(n, m):
> print (n + m)
> 
> def rsum(n, m):
> return (n +m)
> 
> Then try this...
> 
> 
> 
 psum(2, 3)
> 
> 
a = psum(2, 3)
> 
> 
a
> 
> 
a = rsum(2, 3)
> 
> 
a
> 
> 
> You see it?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tutorial example

2005-11-12 Thread Colin J. Williams
Max Erickson wrote:
> Not in python.
> 
> For example, what would you call the following?
> 
> def rsum(n, m):
> print n+m
> return n+m
> 
I would call it a python function with a side-effect.

Colin W.
> 
> In python a method is callable attached to an object. A function is a 
> callable object constructed with a def statement.
> 
> max
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to think like a computer scientist

2005-11-13 Thread Colin J. Williams
Brian van den Broek wrote:
> john boy said unto the world upon 2005-11-11 22:25:
> 
>> Question for the following program: sec 5.5
>>  
>> def factorial (n):
>>if n == 0:
>>   return 1
>>else:
>>   recurse = factorial (n-1)
>>   result = n * recurse
>>   return result
>>  
>> How come whenever I state the function with "n" given a value it 
>> prints no results in the interpreter for EX:
> 
> 
> 
> 
> 
>>  
>> So instead I have to give a "print" command to make the result appear 
>> in the interpreter for EX:
> 
> 
> 
> 
>> Is this correctshould I have to give a print command??
> 
> 
> 
> Hey,
> 
> I assume you mean when you run it as a script; when I run it as the 
> interactive prompt, I get output:
> 
> IDLE 1.1.2
>  >>> def factorial (n):
> if n == 0:
>   return 1
> else:
> recurse = factorial (n-1)
> result = n * recurse
> return result
> 
>  >>> factorial(3)
> 6
> 
> In general, it would be bad if the interpreter decided to print 
> everything you asked it to compute. The function returns the result of 
> the factorial(n) call, and it is up to your code to decide what to do 
> with it. If the only use is to print it, then
> 
> print factorial(3)
> 
> might be what you want. But it is also possible you'd want to store the 
> result for further computation, and would find the print an unwanted 
> 'feature'. So,
> 
> important_for_later = factorial(some_num)
> 
> Best,
> 
> Brian vdB
> 
Looks OK to me, prints 120.
Could be a little simpler:
def factorial (n):
if n == 0:
   return 1
else:
   return n * factorial (n-1)
print factorial(5)

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


Re: examining python objects

2005-11-20 Thread Colin J. Williams
[EMAIL PROTECTED] wrote:
> Bruno Desthuilliers wrote:
> 
>>[EMAIL PROTECTED] a écrit :
>>
>>>Is there a function/class/module/whatever I can use to
>>>look at objects?  I want something that will print the object's
>>>value (if any) in pretty-printed form, and list all it's attributes
>>>and their values.  And do all that recursively.
>>>I want to be able to find out everything about an object that
>>>Python can introspectively find out.
>>
>>Then check the inspect module
> 
> 
> I want a callable, ready-to-use class or function.
> Inspect provides soime funtions that would be useful for wrinting
> such a class or function, but does not provide one.
> 
> I seems that nobody who has written or used such a tool reads
> this group, or feels like responding.
> 
> FWIW, (for anyone looking for something similar in the future)
> I found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137951
> which will format and print an object's attributes.  By combining that
> and pprint in the Python distrib, I think can coble up what I am
> looking
> for.
> 
> Still, it is discouraging that such a basic thing is not provided with
> python, or at lleast easily available in some library.
> 
In the interactive mode, you might try >> help(object)

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


Re: best cumulative sum

2005-11-21 Thread Colin J. Williams
David Isaac wrote:
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
>>He seems to want scanl
> 
> 
> Yes.  But it's not in Python, right?
> (I know about Keller's version.)
> 
> Robert Kern wrote:
> 
>>Define better. More accurate? Less code?
> 
> 
> Good point.
> As Bonono (?) suggested: I'd most like a solution that
> relies on a built-in to give me both of those.
> (Pretty is good too.)  Like SciPy's cumsum.
> 
> Thanks,
> Alan Isaac
> 
> 
Doesn't numarray handle this?

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


Re: Understanding Python Documentation

2005-11-24 Thread Colin J. Williams
Shalabh Chaturvedi wrote:
> Josh Cronemeyer wrote:
> 
>> Hi,
>>
>> I have very little experience programming in python but considerable 
>> experience with java.  One thing that is frustrating me is the 
>> differences in the documentation style.  Javadocs, at the top level 
>> are just a list of packages.  Drilling down on a package reveals a 
>> list of classes in that package, and drilling down on a class reveals 
>> a list of methods for that class.  Is there something similar for 
>> python? 
>> The closest thing I have found to this for python is 
>> http://www.python.org/doc/2.4.2/modindex.html  which really isn't the 
>> same thing at all.
>>
>> wxpython has their documentation like this 
>> http://www.wxpython.org/docs/api/  is there something like this for 
>> the rest of python? 
> 
> 
> Here is the Python 2.3 standard lib docs generated using epydoc:
> 
> http://epydoc.sourceforge.net/stdlib/
> 
> In look and feel it's more like javadoc. However always check the 
> standard library documentation for usage and examples that might not be 
> in this.
> 
> Cheers,
> Shalabh
> 
One of the entries for the object type is:

__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature...

How do we find the __doc__ in the epy material?

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


Re: ANN: Dao Language v.0.9.6-beta is release!

2005-11-29 Thread Colin J. Williams
[EMAIL PROTECTED] wrote:
> Dear all,
> 
> This is just to let you know that the lastest version Dao language is
> released.
> This Dao was previously called Tao, and now is changed to Dao to avoid
> confusion
> with another Tao langauge. There are a number of new features
> implemented in
> this version, of which the most important one is the supporting for
> multi-threaded
> programming. A new concurrent garbage collector is also implemented to
> for the
> multi-threaded interpreter. Now unicode is also supported for string
> manipulation
> and regular expression (regex) matching etc. The algorithm for regex
> matching
> is enhanced with fixing of a few bugs which prevent finding the most
> reasonable
> matching in some case, and allowing reverse matching from the end of
> string.
> The interface for creating Dao plugin in C++ is further simplified and
> matured.
> Of course, many bugs are also fixed. For more information,
> please visite: http://www.xdao.org.
> 
> By the way, a console named DaoConsole with graphical user interface is
> also released.
> 
> With best regards,
> 
> Limin Fu
> 
> -
> ChangLog for this release:
> -
> 
> + : added
> ! : changed
> * : fixed
> - : removed
> 
> MULTITHREADING:
> + Multi-threaded programming is supported as a kernel feature of
>   Dao language. Posix thread library is used in the implementation.
>   And the thread API in Dao is similar to that in Posix thread.
>   Parts of the Dao interpreter is re-structured for multithreading.
> + A novel concurrent garbage collector based on reference counting
>   is implemented to support multithreading.
> + A upper bound for GC amount is applied to prevent memory "avalanche",
>   where mutators generate garbage faster than GC can collect them.
>   gcmin(), gcmax().
> 
> UNICODE:
> + UNICODE is supported. String quotated with double quotation symbol
>   is internally represented as Wide Character String(WCS), while string
>   quotated with single quotation symbol is internally represented
>   Multi Bytes String(MBS). Corresponding operations on WCS is also
>   supported.
> 
> REGEX:
> + Regex reverse matching is supported.
> + Now internal representation of Regex uses both MBS and WCS for both
>   efficiency and proper matching character class for unicode. When a
>   regex is applied to MBS or WCS, the corresponding representation is
>   used.
> + Regex datatype is added, a regex pattern can be compiled and stored
>   for later use, by using: define regex: rgx = /\d+\w/;
>   or, rgx = regex( "\\d+\\w" );
> + New character class abbreviations \u and \U are added for unicode.
> + Customized character class abbreviations are support. Users can
> define
>   their own character class abbreviations by:
>   define regex: \2 = [WhateverChars];
> ! Algorithm for regex matching is modified to extend matching when
>   possible, and is also modified to match regex group correctly.
> 
> NUMERIC ARRAY:
> + Specification of precision in numeric array enumeration is supported:
>   [EMAIL PROTECTED] array];
> ! Transpose operator(right operator) is changed from ' to ~.
> - Function convolute() for numeric arrays is removed.
> 
> EXTENDING AND EMBEDDING:
> + Some abstract classes are added for supporting easy embedding
>   of Dao interpreter ( the daoMain.cpp source file is an example
>   for embedding ).
> + Some wrapper classes for Dao data objects are provide in daoType.h
>   to faciliate the using of Dao data objects in plugins or other
>   programs in which Dao is embedded.
> ! A new technique is implemented to allow more tranparent passing
>   data between Dao interpreter and C++ modules. Creation of shadow
>   classes is also supported by the way.
> 
> IO:
> + Instead of using STL stream classes, new DaoStream classes are
>   added mainly for handling unicode in many places.
> + For file IO, more open modes such as "rwat" are supported, and
>   more methods such as eof(), seek(), tell() ... are implemented.
>   read() is enhanced such that it can read until meeting EOF.
> 
> OTHERS:
> + Multi inheritance is supported for OOP. And the passing parameters
>   and calling to parent constructor is simplified.
> + Negative subindex is supported for string.
> + Added a feature that allows using Alternate KeyWord (*.akw) to
>   write Dao scripts in non-english languages. The only requirement
>   is the character encoding for the .akw file must be the same as the
>   script files.
> ! Variable scope specification keyword "global" is added; keyword
>   "extern" is remove; keyword "share" is changed to "shared"
> ! Data states are added for constant and frozen data. Now a const
>   data is a really const, and can not be modified anymore. Function
>   freeze() is ad

Re: wxPython : getting started

2005-11-29 Thread Colin J. Williams
David Sulc wrote:
> Hi !
> 
> I've looked all over (internet, books, etc.) and I haven't found a very 
> good ressource to get started with wxPython (yes, I've been through 
> their tutorial).
> 
> What I would basically like to do for starters is to be able to define 
> the main panel being displayed. For example :
> 1. wxFrame contains a wxPanel  (call it mainPanel).
> 2. mainPanel contains another panel (childPanelA)
> 3. another panel has been defined (childPanelB) but is not displayed 
> (the user can only see childPanelA inside mainPanel)
> 4. by clicking on a menu entry (for example), the displayed panel is now 
> childPanelA (which is inside mainPanel)
> 
> So how do I do this ? I realize it's a very basic question, but it's 
> been driving me mad...
> 
> Also, is there any good open source wxPython program that I could study ?
> 
> Thanks for any help...
David,

I'm dodging your question but you might find this soon to be released 
book helpful:
http://www.manning.com/books/rappin

Also Boa Constructor is a helpful tool.

Colin W.

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


Re: How to list currently defined classes, methods etc

2005-12-02 Thread Colin J. Williams
Deep wrote:
> I have been looking a bit and am stuck at this point.
> 
> Given a string, how do i find what is the string bound to.
> Let me give an example.
> 
> def deep():
>  print "Hello"
> 
> now inspect.ismethod(deep) returns true. (As it should).
> But if I am trying to make a list of all bound methods), i use
> dir(), which is a list of strings. I get the string "deep" from this
> list.
> How do I obtain the reference to the method it is bound to.
> The same problem can be extended to attributes and classes.
> 
 >>> help('deep') in the interactive mode gives part of what you seek.

A prettier way is to use epydoc: 
http://www.answers.com/main/ntquery?s=epydoc&gwp=13

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


Re: Need help implementing an algorithm in python

2005-12-06 Thread Colin J. Williams
ech0 wrote:
> wow. nevermind. i figured it out.
> 
I hope that you will share it with those of us who haven't figured it 
out yet.

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


Re: Documentation suggestions

2005-12-06 Thread Colin J. Williams
Carl Friedrich Bolz wrote:
> [EMAIL PROTECTED] wrote:
> 
>> Ian> A test suite seems far more useful to implementors than any 
>> guide,
>>
>> Of course, test cases can be modified or ignored.  I'd agree with you 
>> if we
>> had a test suite that was more strongly cast in stone.
> 
> 
> hum. a test suite like that would have to be constructed very carefully. 
> The current CPython testsuite tests quite some things that are obviously 
> implementation details. For example test_itertools.py checks that izip 
> reuses tuples (which means changing them) when the refcount is 1. This 
> is something which does not quite work in an implementation using a 
> different GC :-)
> 
> Although on the other hand a short poll revealed that the reference 
> manual was not considered to be the most useful source among the PyPy 
> developpers :-)
True, but the choice is between abandoning it or updating it.

I would vote for the latter.

Colin W.
> 
> Cheers,
> 
> Carl Friedrich Bolz
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Documentation suggestions

2005-12-06 Thread Colin J. Williams
Michael Spencer wrote:
> A.M. Kuchling wrote:
> 
>> Here are some thoughts on reorganizing Python's documentation, with
>> one big suggestion.
>>
> 
> Thanks for raising this topic, and for your on-going efforts in this field.
> 
> I use the compiled html help file provided by PythonWin, which includes 
> all the core documentation.  I usually use the index interface, not the 
> table of contents (the main exception is the LibRef, see below).  In 
> this form, the structure of the documentation is less important than how 
> good the index is. Unfortunately, the "additional documentation', 
> including, in particular, your re HowTo is linked, but not indexed and 
> is therefore less accessible.
> 
>> The tutorial seems to be in pretty good shape because Raymond
> 
> 
> Agreed, but as you say below, there may be friendlier forms available 
> for the first-timer.
> 
> 
> 
>> There's another struggle within the LibRef: is it a reference or a
>> tutorial?
> 
> 
> I want it to help answer questions of the form "What's in the the 
> library that might help me do x?"  For this case, some of the current 
> section structure is not that helpful.  "Miscellaneous Services", in 
> particular, gives no clue to treasures it contains.  I would prefer, for 
> example, to see the data structure modules: collections, heapq, array 
> etc... given their own section. Documentation/testing, cmd/options might 
> be other candidates to draw together currently related material more 
> meaningfully.
> 
>   Does it list methods in alphabetical order so you can look
> 
>> them up, or does it list them in a pedagogically useful order?  I
>> think it has to be a reference;
> 
> 
> A reference, yes, but not necessarily alphabetical if another 
> organization is more communicative.  itertools is a good example where 
> alphabetic presentation makes perfect sense, since the functions are 
> more-or-less peers; the math functions are usefully classified by topic; 
> textwrap presents most commonly-used functions first; several modules 
> document classes before convenience functions.   Each of these has its 
> merits, and I don't see a lot of mileage in trying to standardize them, 
> given how varied modules are.  However, whatever the reference 
> structure, examples add significantly to the value to me.
> 
> 
> 
>> I suspect the Achilles' heel of the docs is the Language Reference.
>> Put aside the fact that it's not up to date with new-style classes and
>> other stuff; that would be fixable with some effort.
>>
> 
>> To some degree, the guide is trying to be very formal; it's written
>> like a specification for an implementor, not a document that people
>> would read through.  But there's no other way for people to learn
>> about all the special object methods like __add__; the tutorial can't
>> cover them all, and the LibRef doesn't describe them.  So the newbie
>> is stuck.
> 
> 
> I find very little of value to me in the Language Ref.  Special methods 
> are the crucial exception.  Perhaps they, together with a description of 
> class semantics (including metaclasses and descriptors) could be moved 
> to the Built-in types section of the LibRef, where some related material 
> is already.
> 
> I don't know whether the rest of the Language reference is of use to 
> implementers, but given the proliferation of implementations beyond 
> Cpython (Jython, IronPython, pypy) I would speculate that a formal 
> specification is now more important rather than less.  However, perhaps 
> it would be possible to express the specification more succinctly via 
> tests instead of a manual.
> 
> 
> 
>>
>> Perhaps we need a friendlier counterpart to the RefGuide, something
>> like the 20-page introduction to Python at the beginning of Beazley's 
>> Essential Reference:
> 
> 
> I did't know this source, but I just skimmed it at 
> http://www.amazon.com/gp/reader/0735709017/ref=sib_dp_pt/103-1276064-0751851#reader-page
>  
> 
> (not sure if this is a session link), and I agree it's a very clear 
> introduction.   Probably better first reading than the existing tutorial.
> 
> 
> 
> 
> Michael
> 
I like the approach but more would be helpful for a current Python, 
especially with respect to types/classes.  The book is based on Python 2.1.

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


Re: efficient 'tail' implementation

2005-12-09 Thread Colin J. Williams
[EMAIL PROTECTED] wrote:
> hi
> 
> I have a file which is very large eg over 200Mb , and i am going to use
> python to code  a "tail"
> command to get the last few lines of the file. What is a good algorithm
> for this type of task in python for very big files?
> Initially, i thought of reading everything into an array from the file
> and just get the last few elements (lines) but since it's a very big
> file, don't think is efficient. 
> thanks
> 
If your file is seekable you could consider using file's seek function.

This would appear to give you a way of just working with the last, say 1mb.

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


The First International Conference on Open Source Systems - OSS 2005 - Main

2005-01-15 Thread Colin J. Williams
I haven't spotted a posting on c.l.p but someone here may be interested.
Colin W.
http://oss2005.case.unibz.it/
--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonWin (build 203) for Python 2.3 causes Windows 2000 to grind to a halt?

2005-01-28 Thread Colin J. Williams
Chris P. wrote:
AWESOME - my life just got THAT much better.
The bug you suggested is exactly the problem that I was having... I
had looked through the bugs being tracked, but the title of that one
didn't jump out at me as something that would help.  Thanks!
- Chris
P.S. For anyone reading this group who wants to know exactly what I
did:
1) Uninstall Pywin32
2) Open the registry editor ('regedit' at the command prompt)
3) Go to HKEY_CURRENT_USER\Software\Python[version]\Python for Win32
You will likely find many many many keys that have the format
"ToolbarDefault-Bar#".  These keys filling up your registry cause
Windows 2000 to become extremely slow/unstable when Python is running
(especially if your debugger is running.)
4) Delete the keys... I just deleted it at the "Python[version]" root
5) Reinstall Pywin32
This is a great workaround but I've found that, with build 203, it needs 
to be repeated from time to time.

Colin W.

"Roger Upole" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
These look like symptoms of sf bug #1017504
http://sourceforge.net/tracker/index.php?func=detail&aid=1017504&group_id=78018&atid=551954
What version of Pywin32 are you running ?
There's a (semi) fix for this in the latest build.
  hth
 Roger
--
http://mail.python.org/mailman/listinfo/python-list


Re: type of simple object

2005-02-02 Thread Colin J. Williams
[EMAIL PROTECTED] wrote:
Thank you guys.
My function should multiply every element  of a list, for example
"something"
and "something" can be an integer or another list.
If it deals with integer than it is ok, but
If it deals with list than it become false for example list*2 =
listlist, and what I really want is to mutlitply its member.
That's why I need to know the type of my data in "something".
By the way I am new in python, I heard that it has a MatLab
capabilities, How good is that? Since It would be very nice when we can
do what MatLab do in python.
Sincerely Yours,
pujo
If you are looking for MatLab like facilities you might consider 
numarray, available from sourceforge.

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


Re: Debugger Confusion

2005-07-01 Thread Colin J. Williams
Adriaan Renting wrote:
> I use the debugger that comes with Eric3, but it is only free for Linux/
> OS X, as it needs PyQt.
> asside from setting  (conditional) breakpoints, one of it's features is
> that it can show you a browsable tree of all your variables. something
> like this:
> class MyClass
> |
> L-- string 'username' - 'myuser'
> |
> L-- list
>L-[0] - 1
>L-[1] - 'some value'
> 
> You should know by now that I like this IDE ;-)
> 
PythonWin has a similar capability for Windows and Boa-constructor for 
Linux or Windows.

Colin W.
> Adriaan Renting| Email: [EMAIL PROTECTED]
> ASTRON | Phone: +31 521 595 217
> P.O. Box 2 | GSM:   +31 6 24 25 17 28
> NL-7990 AA Dwingeloo   | FAX:   +31 521 597 332
> The Netherlands| Web: http://www.astron.nl/~renting/
> 
"Robert Brewer" <[EMAIL PROTECTED]> 06/28/05 11:02 PM >>>
> 
> Rex Eastbourne wrote:
> 
>>I'm a little confused about which debugging utilities do what, and
>>which I should use for my Python code. I'd like to be able to step
>>through my code, insert breakpoints, etc. I haven't been able to do
>>this yet (I'm using Emacs on Windows). I have seen references to GDB,
>>GUD, PDB, and others. Which ones do I need?
> 
> 
> 1. At the point you would like to start the debugger, insert the
> following 2 lines:
> 
> import pdb
> pdb.set_trace()
> 
> 2. Run your script from the command line.
> 3. When your script executes the above lines, the pdb debugger will
> start up, and give you a prompt. Type 'h' at the prompt (and hit
> 'enter'), and you'll be shown a list of pdb commands. 's' to step
> through your code, 'c' to continue processing (and stop the debugger,
> essentially). The prompt is interactive, so you can inspect program
> variables as you like.
> 
> Start with that, and come back if you have any more questions. :)
> 
> 
> Robert Brewer
> System Architect
> Amor Ministries
> [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which kid's beginners programming - Python or Forth?

2005-07-01 Thread Colin J. Williams
BORT wrote:
> Please forgive me if this is TOO newbie-ish.
> 
> I am toying with the idea of teaching my ten year old a little about
> programming.  I started my search with something like "best FREE
> programming language for kids."  After MUCH clicking and high-level
> scanning, I am looking at Python and Forth.  Both have advocates that
> say each is a great approach to learning computers.
> 
> My programming classes were a long, long time ago in a land far, far
> away.  My programming muscles, which were never truly developed, have
> atrophied even so.  That said, I want to learn this as we go.  The
> PROCESS of research and using net resources for a self-learning
> adventure is almost as much of the goal as learning a programming
> skill.
> 
> That said, a good learning goal for my kid would be to create a
> spelling tutor for his little brother.  My (simple) vision would be:
> 
> 1.  an input file of this week's word list
> 2.  use a free text-to-speech engine to call out one word at a time
> 3.  in turn, monitor each key press as a particular word is being
> typed, beeping on an incorrect keystroke and going to the next word if
> correct
> 
> I don't care if it takes a year or two to get to this level, I just
> want a vehicle that will take us there.
> 
> I told my son, who wants to learn how to compute probabilities, that we
> have to start with some boring stuff so we can learn how to do the cool
> stuff.  Adding and subtracting aren't really fun, but figuring odds on
> rolling dice IS fun.  Learning to program will be kind of like that.
> He accepted that explantion.
> 
> So, that said...   In ~simplest~ terms for the stated goal -- Forth or
> Python?
> the goal is NOT the spelling tutor... it is learning how to use a
> tool to solve a problem.  I am asking which tool is more suited to an
> otherwise arbitrary direction of "spelling tutor program."
> 
> [NOTE: This is not a troll.  I'm geting ready to bark up a tree and I
> prefer to avoid the wrong one. I am cross-posting.]
> 
> Thanks
> 
As a pre-learning-Python stage you might use the Firefox browser:
1. Set up a text file with correctly spelled words.
2. Open that file with Firefox.
3. Ctrl F to open the search window at the bottom of the screen.
4. Enter each word to test.

Fun? for the younger brother and a suggestion as to the functionality 
you might build into the second stage of your Python program.

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


Re: Modules for inclusion in standard library?

2005-07-02 Thread Colin J. Williams
Steven Bethard wrote:
> Fredrik Johansson wrote:
> 
>> On 6/27/05, Reinhold Birkenfeld 
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Do you have any other good and valued Python modules that you would 
>>> think are
>>> bug-free, mature (that includes a long release distance) and useful 
>>> enough to
>>> be granted a place in the stdlib?
>>
>>
>> First of all, numeric/numarray, obviously!
> 
> 
> There has been recent discussion about this.  Check the python-dev list 
> archives I think.  It's unlikely that all of numeric/numarray could go 
> into the Python stdlib because there still is disagreement between the 
> two camps as to the module architecture.  However, there does seem to be 
> some agreement at the level of the basic array object, so it may be 
> possible that at least the array object itself might join the stdlib in 
> the not too distant future.  I suspect there's more detailed discussion 
> of this in the numeric/numarray lists.

There was a flurry of exchanges about three months ago but it soon died.

One thing which needs to be sorted out is the silent truncation of 
complex values:
http://sourceforge.net/tracker/index.php?func=detail&aid=1216688&group_id=1369&atid=450446

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


Re: Modules for inclusion in standard library?

2005-07-02 Thread Colin J. Williams
Gregory Piñero wrote:
> While that policy does make sense, I think a database program falls
> somewhere in between an OS and an everyday third party program.  For
> web developers, the database might as well be the OS.  I use the
> database to store everything in my web app.  That way I can just worry
> about 1 place to access information and not have to fool with files
> and other OS issues.
> 
> So I humbly suggest the policy should be :
> 
> Python will not include interface code for third party programs which
> are not part of an operating system or database system.
> 
> ...
Isn't this where the discussion should start?  There should be some 
general policy guiding the types of modules which should be in the 
standard library.  Clearly, size is a factor as the msi version of 
Python 2.4 is now 10 MB.

if there were some sort of package manager which took account of 
dependencies would that reduce the need to expand the standard library?

Colin W.
> But I have no experience in designing world class programming
> langauges so forgive me if I am too bold.
> 
> -Greg
> 
> 
> On 6/29/05, Rocco Moretti <[EMAIL PROTECTED]> wrote:
> 
>>Paul Rubin wrote:
>>
>>>Gregory Piñero <[EMAIL PROTECTED] > writes:
>>>
>>>
I'd like to see some database API's to the most common databases
included.
>>>
>>>Yes, certainly, this is a serious deficiency with Python.
>>
>>Except that (please correct me if I'm wrong) there is somewhat of a
>>policy for not including interface code for third party programs which
>>are not part of the operating system. (I.e. the modules in the standard
>>libary should all be usable for anyone with a default OS + Python install..)
>>
>>A notable exception is the dbm modules, but I seem to recall hearing
>>that the official position is that it was a mistake. (Now only kept for
>>backward compatability.)
>>--
>>http://mail.python.org/mailman/listinfo/python-list 
>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modules for inclusion in standard library?

2005-07-02 Thread Colin J. Williams
Rocco Moretti wrote:
> Paul Rubin wrote:
> 
>> Rocco Moretti <[EMAIL PROTECTED]> writes:
>>
>>> Except that (please correct me if I'm wrong) there is somewhat of a
>>> policy for not including interface code for third party programs which
>>> are not part of the operating system. (I.e. the modules in the
>>> standard libary should all be usable for anyone with a default OS +
>>> Python install.)
>>
>>
>>
>> I've never heard of Python having such a policy and I don't understand
>> how such a stupid policy could be considered compatible with a
>> proclaimed "batteries included" philosophy.  Why would Python
>> advocates want to make Python deliberately uncompetitive with PHP,
>> Java, and other languages that do include database modules?
> 
> 
> Well, since there seems to be an outpouring of disgust at my statement, 
> and no official confirmation/rejection, it's probably a figment of my 
> prematurely failing mind.
> 
> However, if there was such a policy, it would not be unequivocally 
> "stupid." First off, there is a bit of flexibility in what is considered 
> part of the OS. E.g, Linux may properly refer to just the kernel, but 
> rarely is just the kernel installed. Various utilities and programs 
> might be considered part of the OS because they are ubiquitously 
> installed, or are included with the Python distribution itself (as Tk is 
> with windows Python).
> 
> For those programs which aren't ubiquitously installed, or even for ones 
> that are, but require significant configuration, it is reasonable to 
> expect that if someone has the ability and goes to the effort of 
> locating, obtaining, installing, and configuring a third party program, 
> they can just as easily obtain and install the python module, especially 
> as it's usually as easy as "python setup.py install".
> 
> At any rate, I'm not advocating such a policy, I'm just saying it can 
> make a bit of sense if you look at it from a certain angle.
I agree.  It makes sense to develop a policy first.

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


A Policy for Inclusion in the Standard Library: was Modules for inclusion in standard library?

2005-07-03 Thread Colin J. Williams
Terry Reedy wrote:
> "Colin J. Williams" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> 
>>Isn't this where the discussion should start?  There should be some
>>general policy guiding the types of modules which should be in the
>>standard library.
> 
> 
> A couple of times, Guido has given his general policy as generally useful; 
> best-of-breed, tested and accepted by the community; and backed by a 
> developer who will adapt it and its doc up to stdlib standards (if 
> necessary) and commit to maintainence for a few years.
> 
> Terry J. Reedy
> 
This is a good base.  Presumably "accepted by the community" means
with some minimum number of ongoing users.

Colin W.

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


Re: how to retrive highlighted text in a browser?

2005-07-03 Thread Colin J. Williams
wcc wrote:
> Hello group,
> 
> When browsing websites, quite often I have to look up words in
> dictionary.  I'm hoping that I can come up with a python program that
> does the following:
> 
> When I highlight some text in browser and right-click, besides the
> default options such as COPY, PASTE, etc, I want an option that says
> "Send to file", something like that.  The file is a text file, with
> fixed path. When I select this option, the highlighted text will be
> appended to the text file.  This way, I can collect those words &
> phrases that I don't know.
> 
> Is this going to be a difficult task?  I'm a newbie in python. TIA for
> your help.
> 
> - wcc
> 
Firefox doesn't provide the file capture function you seek but, using a 
readily available extension, does permit dictionary lookup using the 
American Heritage Dictionary - the response comes with copious 
advertising which is not overly intrusive.

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


Puzzled

2005-07-11 Thread Colin J. Williams
The snippet of code below gives the result which follows

for k in ut.keys():
   name= k.split('_')
   print '\n1', name
   if len(name) > 1:
 name[0]= name[0] + name[1].capitalize()
 print '2', name
   name[0]= name[0].capitalize()
   print '3', name

1 ['logical', 'or']
2 ['logicalOr', 'or']
3 ['Logicalor', 'or']

I was expecting that 3 would read ['LogicalOr', 'or']

If I replace the above code with:

for k in ut.keys():
   name= k.split('_')
   print '\n1', name
   if len(name) > 1:
 name[0]= name[0].capitalize() + name[1].capitalize()
 print '2', name
   else:
 name[0]= name[0].capitalize()
   print '3', name

I get the desired result.

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


Re: Puzzled

2005-07-12 Thread Colin J. Williams
Bengt Richter wrote:
> On Mon, 11 Jul 2005 22:10:33 -0400, "Colin J. Williams" <[EMAIL PROTECTED]> 
> wrote:
> 
> 
>>The snippet of code below gives the result which follows
>>
>>for k in ut.keys():
>>  name= k.split('_')
>>  print '\n1', name
>>  if len(name) > 1:
>>name[0]= name[0] + name[1].capitalize()
>>print '2', name
>>  name[0]= name[0].capitalize()
>>  print '3', name
>>
>>1 ['logical', 'or']
>>2 ['logicalOr', 'or']
>>3 ['Logicalor', 'or']
>>
>>I was expecting that 3 would read ['LogicalOr', 'or']
>>
>>If I replace the above code with:
>>
>>for k in ut.keys():
>>  name= k.split('_')
>>  print '\n1', name
>>  if len(name) > 1:
>>name[0]= name[0].capitalize() + name[1].capitalize()
>>print '2', name
>>  else:
>>name[0]= name[0].capitalize()
>>  print '3', name
>>
>>I get the desired result.
>>
> 
> If you walk through the results, you can see what happens to name[2] on 
> output line 2:
> 
>  >>> 'logicalOr'.capitalize()
>  'Logicalor'
> 
> I.e., 
>  >>> help(str.capitalize)
>  Help on method_descriptor:
> 
>  capitalize(...)
>  S.capitalize() -> string
> 
>  Return a copy of the string S with only its first character
>  capitalized.   -- meaning all the rest 
> lowercased,
>which changed your trailing 
> 'Or'
> 
> So, doing .capitalize on all the pieces from split('_') and then joining them:
> 
>  >>> def doit(w): return ''.join([s.capitalize() for s in w.split('_')])
>  ...
>  >>> doit('logical_or')
>  'LogicalOr'
>  >>> doit('logical')
>  'Logical'
>  >>> doit('logical_or_something')
>  'LogicalOrSomething'
>  >>> doit('UP_aNd_down')
>  'UpAndDown'
> 
> Regards,
> Bengt Richter
Many thanks. I missed the implication that any upper case characters 
after the first are changed to lower case.

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


Re: What is your favorite Python web framework?

2005-07-18 Thread Colin J. Williams
Luis M. Gonzalez wrote:
> Peter Hansen wrote:
> 
>>Gerhard Haering wrote:
>>
>>>On Mon, Jul 18, 2005 at 09:06:21AM -0400, Peter Hansen wrote:
>>>
I'm not familiar with this expression.  What do you mean by "black horse"?
>>>
>>>Maybe "the Ferrari of pythonic frameworks" (black horse on yellow
>>>background being the symbol of Ferrari).
>>
>>I know there are "black sheep" in some families, and "dark horse
>>candidates".  Also yellow-bellied sapsuckers.  There's a "black horse"
>>fish in the Mississippi valley (also, quite coincidentally, of the
>>sucker family).  Not entirely sure that was the intended connotation. :-)
>>
>>-Peter
> 
> 
> I'm used to make those mistakes too...
> This mailing list taught me more English than Python for sure.
> I read the expression "Dark horse contender" many times, and i guess it
> has some reminiscence from medieval times and the cavalry stories.
> It meaning is something like the "unknown that could be the new champ",
> someone intriguing and mysterious who doesn't unveil its skills untill
> showtime. Am I right?
> 
> Cheers,
> Luis
> 
You're right on!.

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


Re: how to get function signature

2005-07-28 Thread Colin J. Williams
Robert Kern wrote:
> [EMAIL PROTECTED] wrote:
> 
>> Hi,
>>
>> I was working on a dir like function that gives more information than
>> the usual dir, but I am not satisfied with the way I get function
>> arguments for callable members of an object. Take a look at it here:
>> http://nerdierthanthou.nfshost.com/2005/07/mdir-for-python.html. I have
>> seen PythonWin showing function arguments as tooltips, can anyone
>> please let me know how to get it.
> 
> 
> import inspect
> 
PythonWin provides this capability for machines using Windows.

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


Re: epyDoc Questions

2005-08-11 Thread Colin J. Williams
Neil Benn wrote:
> Hello,
> 
>  I can;t find a epyDoc specific mailing list, so I'll try here - 
> if you know of a epyDoc mailing list then please let me know (google is 
> not my friend, I can only find an announce, devel and commit list from 
> 'epydoc mailing list').
> 
epyDoc gives nice documentation with no mark-up.  I've not seen any
indication of maintenance for a year or so.
>I'm working on marking up a class in epyDoc and have a few things 
> that I strongly suspect I can do but can't find instructions for in the 
> docs - I was hoping that someone has cracked this already:
> 
>   1. I want to document the attributes (instance and also class) of a
>  class and or module, I know the tags are there - where does they
>  go (before/after theclass decleration, top of the module, if
>  someone puts in the class doc but misses out the module stuff, how
>  will epydoc know that this is meant to be class and not module
>  (although someone doing this will probably get shouted at in a
>  code review!)?
Why not post some code so that we can more clearly understand what you
aim to document?

Colin W.
>   2. In the argument to the tag for raises, how can I put a link
>  through to the exception?
>   3. How would I go about marking up the property docs so that it knows
>  what the setter and getter methods are - it links through to the
>  methods but the docs arn't in there, they are in the fifth
>  argument to the property method (I can manually do this using
>  sections but is there a tag I can use?)
> 
> Cheers for your help,
> 
> Neil
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Ordered" dicts

2005-08-11 Thread Colin J. Williams
Delaney, Timothy (Tim) wrote:
> Martin Miller wrote:
> 
> 
>>To avoid continued reinvention of this wheel, I'd also vote to have
>>this functionality be at least included in a standard module, if not
>>built-in.
> 
> 
> This has been discussed on python-dev (I proposed it actually). The
> final consensus was that no such implementation would be included at
> this time, as it's a pretty simple thing to implement, and there are
> already several implementations in the Cookbook.
> 
> My arguments included the fact that there were several implementations
> in the Cookbook as an indication it should be included in the standard
> library ...
> 
> Thread starts here:
> http://mail.python.org/pipermail/python-dev/2005-March/051915.html
> 
> Tim Delaney
I have a module "dictionaries.py" which might be of interest.

The __doc__ says:

'''
   To provide the classes rDict (restricted dictionary), oDict
   (ordered according to time of entry) and sDict (sorted dictionary).
   oDict delivers keys or items in the order in which they were
   inserted.

   rDict has keys restricted to either those identified initially,
   or those added with newEntry.

   sDict delivers keys and items in sorted order.

'''
It is available in the zip file 
(http://www3.sympatico.ca/cjw/PyMatrix/PyMatrix.zip) for the PyMatrix 
package.  The zip file (176 KB) contains lots of irrelevant stuff.

I would be glad to mail the dictionaries.py to anyone who is interested
with the usual lack of warranty.

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


Re: What are new-style classes?

2005-08-30 Thread Colin J. Williams
Reinhold Birkenfeld wrote:
> Terry Hancock wrote:
> 
>>On Sunday 28 August 2005 04:47 am, Vaibhav wrote:
>>
>>>I recently heard about 'new-style classes'. I am very sorry if this
>>>sounds like a newbie question, but what are they? I checked the Python
>>>Manual but did not find anything conclusive. Could someone please
>>>enlighten me? Thanks!
>>
>>"New style" classes are becoming the standard in Python, and must
>>always be declared as a subclass of a new style class, including built-in
>>classes.
> 
> 
> [Warning, advanced stuff ahead!]
> 
> That's not entirely true. New-style classes need not be derived from a new-
> style class, they need to use the metaclass "type" or a derived.
> 
> So you can also declare a new-style class as
> 
> class new_class:
> __metaclass__ = type
> 
> Or, if you want to switch a whole module with many classes to new-style, just 
> set a
> 
> __metaclass__ = type
> 
> globally.
> 
> 
> Reinhold
What are the pros and cons of the alternate approach?

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


Re: pydoc, best practices, and Data class

2005-08-30 Thread Colin J. Williams
[EMAIL PROTECTED] wrote:
> I have a python program that I am trying to generate documentation for.
> But in one of my files I have a class called "Data", when pydoc gets to
> this class it just barfs. Well more specifically it generates
> documentation for only that one class in the file, it ignores the rest
> of the classes, plus it doesn't create the standard header, Package
> Contents section, Classes section, or anything else. Just wondering if
> this is a known bug, I can get around it by naming the class something
> else and then just changing all other references to this class.
> 
> Second question I have is is there somewhere that gives a good overview
> of best practices for documenting code in python. I read something
> about ReST (reStructuredText), is this supported by pydoc? Is it
> commonly used? I found links to docutils and other things, is pydoc
> still the standard method of creating python documentation?
> 
> Thanks,
> Nathan Bullock
> 
epydoc is an alternative.

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


pyNMS

2005-09-03 Thread Colin J. Williams
The pyNMS package is available for network management using Linux.

Is there anything similar for Win32?

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


Re: Proposal: add sys to __builtins__

2005-09-04 Thread Colin J. Williams
Rick Wotnaz wrote:
> Michael Hoffman <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]: 
> 
> 
>>What would people think about adding sys to __builtins__ so that
>>"import sys" is no longer necessary? This is something I must
>>add to every script I write that's not a one-liner since they
>>have this idiom at the bottom:
>>
>>if __name__ == "__main__":
>> sys.exit(main(sys.argv[1:]))
>>
>>Additionally, the necessity of "import sys" makes some
>>one-liners a little more unwieldy than they should be--it is
>>surely the module I am missing the most in one-liners. For
>>example, with this proposal, this inelegant one-liner:
>>
>>$ python -c "import sys; print
>>''.join(sorted(sys.stdin.readlines()))" 
>>
>>could be replaced by:
>>
>>$ python -c "print ''.join(sorted(sys.stdin.readlines()))"
>>
>>Since sys is surely the most commonly used module (it is
>>imported in 108 of 188 Python 2.4 stdlib modules on my system,
>>and certainly more than any other module), I would hope few
>>people would be affected by a namespace collision.
>>
>>Other languages (e.g. C#) always make their system namespace
>>available without needing a special import.
>>
>>In short, given the wide use of sys, its unambiguous nature, and
>>the fact that it really is built-in already, although not
>>exposed as such, I think we would be better off if sys were
>>always allowed even without an import statement.
> 
> 
> +1 here. As far as I'm concerned, both os and sys could be special-
> cased that way. That said, I would guess the likelihood of that 
> happening is 0. 
> 
+1 for both.

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


Re: 'isa' keyword

2005-09-04 Thread Colin J. Williams
Rocco Moretti wrote:
> Terry Hancock wrote:
> 
>> On Thursday 01 September 2005 07:28 am, Fuzzyman wrote:
>>
>>> What's the difference between this and ``isinstance`` ?
>>
>>
>> I must confess that an "isa" operator sounds like it would
>> have been slightly nicer syntax than the isinstance() built-in
>> function. But not enough nicer to change, IMHO.
> 
> 
> Especially conidering that checking parameters with "isinstance" is 
> considered bad form with Python's duck typing.
Rocco,

Could you elaborate on that please?

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


Interactive use of Help with class/instance data

2005-09-09 Thread Colin J. Williams
help(instance.property) gives the same information as help(instance) but
help(cls.property) gives information specific to the property.

Is this a bug?

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


  1   2   3   4   5   >