ANN: pyobjc-1.2

2004-12-30 Thread Ronald Oussoren
PyObjC 1.2 is now available for download at 
http://pyobjc.sourceforge.net/

PyObjC is a bridge between Python and Objective-C.  It allows full
featured Cocoa applications to be written in pure Python.  It is also
easy to use other frameworks containing Objective-C class libraries
from Python and to mix in Objective-C, C and C++ source.
Python is a highly dynamic programming language with a shallow learning
curve.  It combines remarkable power with very clear syntax.
The installer package includes a number of Xcode templates
for easily creating new Cocoa-Python projects.
PyObjC also supports full introspection of Objective-C classes and
direct invocation of Objective-C APIs from the interactive interpreter.
PyObjC requires Mac OS X 10.2 or later and Python 2.3 or later.  PyObjC 
works
both with the Apple provided Python installation in Mac OS X 10.3 (and 
later)
and with MacPython 2.3.

This release features several bugfixes, improved documentation as well 
as
support for categories, easier customization and basic support for 
creating
Interface Builder palettes. See the news file at
http://pyobjc.sourceforge.net/NEWS-1.2.txt for more information.

PyObjC is released with an open source license (MIT style).
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANN: PyEnchant 0.9.1

2004-12-30 Thread Ryan Kelly
PyEnchant version 0.9.1 has been released.  Updates include:
 * Windows installer with self-contained copy of enchant library and 
ispell dictionaries
 * Confirmed to work with latest Enchant release

Most importantly, it now provides a click-to-install spellchecking 
solution for python on the windows platform.
It should work using the system enchant library anywhere that enchant 
itself can run.

About:
---
Enchant (http://www.abisource.com/enchant/) is the spellchecking
package behind the AbiWord word processor, is being considered for
inclusion in the KDE office suite, and is proposed as a
FreeDesktop.org standard. It's completely cross-platform because
it wraps the native spellchecking engine to provide a uniform
interface.
PyEnchant brings this simple, powerful and flexible spellchecking
engine to Python:
 http://www.rfk.id.au/software/projects/pyenchant/
Current Version: 0.9.1
Licence: LGPL with exemptions, as per Enchant itself
Cheers,
   Ryan
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


ANNOUNCE: ReSTedit v0.50

2004-12-30 Thread bbum
ReSTedit v0.50 is now available for download.
ReSTedit is a GUI tool for editing and interactivly exploring texts in 
the ReStructuredText format (or ReST) as introduced by the Docutils 
project. Despite being quite simple, ReSTedit is very useful for 
quickly checking if Docutils renders some text as you would expect it. 
You only paste it into a ReSTedit window to see if it's ok or not, 
without writing any test code around it.

It adds three features of note:
- the underlying document is monitored via a kqueue.  Any change to the 
on-disk file will cause ReSTedit to re-render the document.

- it now uses RBSplitView such that the document can be switched 
between text only, rendered content only, or split display via a 
Toolbar control.

- the app is packaged via py2app such that the binary distribution is 
completely self-contained and significantly smaller than previous 
distributions.

More information can be found here:
http://www.pycs.net/bbum/2004/12/29/#200412292
General information on ReStructured Text and the underlying docutils 
rendering engine can be found here:

http://docutils.sourceforge.net/
A self-contained binary of ReSTedit.app can be found on my .mac 
downloads page.   It does not require any additional components to be 
installed as pyobjc and docutils are both embedded in the .app wrapper.

http://homepage.mac.com/bbum/BumFiles/FileSharing27.html
b.bum
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


Re: Why would I use inspect.isclass()?

2004-12-30 Thread it's me
Okay, Nick, I didn't know you can pass a Class rather then an instance.  I
have to chew on what your example does.

But no, I want to pass an instance of a Class.  But how do I know that the
calling routine *did* pass me a class - pardon me: an instance of a Class?

--
It's me



Nicolas Fleury [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 It's me wrote:
 I guess another example would be an assert on the type of argument:
 def foo(someClass):
  assert inspect.isclass(someClass)
  # rest of code
 
  But that would always fail!  (I just tried it).

 Are you sure you haven't pass an instance instead of a class?  Remember,
 classes are also objects in Python:

   import inspect
   class A: pass
 ...
   def foo(a): assert inspect.isclass(a)
 ...
   foo(A)
  

 Works fine and makes sense, no?  Of course, if I pass an instance
 instead of a class it would fail:

   myA = A()
   foo(myA)
 Traceback (most recent call last):
File stdin, line 1, in ?
File stdin, line 1, in foo
 AssertionError

 Maybe your question is in what situations passing a class can be useful?
 There's many examples and once you're used to that capability it can
 be powerful.  One simple example could be the generation of
 documentation; since you usually want to doc your classes, not
 instances.  So it would make sense to do something like:

 def writeHtmlDoc(file, someClass): ...

 Regards,
 Nicolas


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


Re: justifying text...and also...correct use of classes...

2004-12-30 Thread Craig Ringer
On Thu, 2004-12-30 at 10:39, Ross La Haye wrote:

[snip code listing]

 Is the way I've used the Combin class considered correct/appropriate in
 the binprob method?  If not, what is the standard usage?  

I'm afraid I have no idea what that's about, so I'll have to pass on
that.

 Also, I'm trying to get my results to print close to this(.i.e., I would
 like the first column to be right justified and the second column to be
 exactly as it is):

[snip]

 I feel like I'm missing something obvious here and apologize in advance if I
 am, but I just can't figure it out.

%20s: %s % (leftstring, rightstring)
or
%20s: %-40s % (leftstring, rightstring)

That's Python's 'printf' style string formatting.

--
Craig Ringer

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


Re: portable text user interface

2004-12-30 Thread Miki Tebeka
Hello Fuzzyman,

   Are there widely used and recommended Python libraries that will
   let me makes a portable text user interface?
  If you just need a text-like interface you can use Tkinter.
  See (shameless plug) http://developer.berlios.de/projects/bcd/ and
  http://developer.berlios.de/dbimage.php?id=1112 for example.

 Your project looks very interesting. It would be better if it displayed
 an error message if it can't find the '_bcdrc' file. If you run it from
 windoze it just appears and disapears.
 
 How about allowing the '_bcdrc' file to be in the same directory as the
 script as well.
Cool. A user!
Thanks for the comments. I'll add searching next to the application on
win32 platforms.

 Any chance of you releasing the Tkinter text interface as a separate
 library, with a less restrictive license ? It looks very good - but I
 can't use it in my projects if it is GPL.
It's just standard Tkinter Listbox with key bindings and it's under 160
lines of code. Nothing special here.

Bye.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: where's import in the C sources?

2004-12-30 Thread Torsten Mohr
Hi David,

thanks for the explanation.  That is very helpful to me.


Best regards,
Torsten.


David Bolen wrote:

 Torsten Mohr [EMAIL PROTECTED] writes:
 
 i tried to find the file and line in the C sources of python
 where the command import is implemented.  Can anybody give
 me some hint on this?
 
 Well, there are several levels, depending on what you are looking for.
 The literal import syntax in a source module is translated by the
 Python compiler to various IMPORT_* bytecodes, which are processed in
 the main interpreter loop (see ceval.c).
 
 They all basically bubble down to making use of the builtin __import__
 method, which is obtained from the builtin module defined in
 bltinmodule.c.
 
 That in turn makes use of the import processing module whose code can
 be found in import.c - which is the same source that also implements
 the imp module to provide lower layer access to to the import
 internals.
 
 Now, when it comes to physically loading in a module, Python source
 and compiled modules are handled by import (well, not the compiling
 part), but dynamically loaded extension modules are OS specific.  You
 can find the handling of such extension modules in OS-specific source
 files dynload_*.c (e.g., dynload_win.c for Windows).
 
 All of these files can be found in the dist/src/Python directory in
 the Python source tree.
 
 -- David

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


GUI with sophisticated Table support

2004-12-30 Thread Torsten Mohr
Hi,

i want to write an application where i need a Table to
display some values.

The table should display a list of objects, so to say,
a column for each attribute of the object.
I'd also like the user to be able to change the width
of each column, like in Excel.

I'd prefer to use Tkinter, but i think it can't do all
that.

Is there a way for Tkinter to handle this?

If not, what other GUI can do that? (wxPython?)


Thanks for hints,
Torsten.

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


Re: Updating file objects automatically

2004-12-30 Thread Craig Ringer
On Thu, 2004-12-30 at 11:15, Jorge Luiz Godoy Filho wrote:

 Is there something I can do to change all instances of the Search class? 
 Are there different alternatives for such a thing?

I couldn't really catch your explanation, but mention of changing all
instances of a class suggests that you may be in a situation where you
need to modify the class, not its instances. There are two methods I use
when I have to change things across all instances:

def A(object):
A class that provides a variable shared by all instances,
and a method of changing it using a normal method and, for
example's sake, a class method.

class_level_variable = True

def __init__(self):
pass

def getvalue(self):
return self.class_level_variable

def setvalue(self, newval):
self.__class__.class_level_variable = newval

def setvaluecls(cls, newval):
cls.class_level_variable = newval
setvaluecls = classmethod(setvaluecls)

sevaluecls and setvalue look the same to callers calling them on an
instance of the class.

I have no idea if that's actually appropriate for your needs, it's just
a stab in the dark, but perhaps it might be.

--
Craig Ringer

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


ANN: pyobjc-1.2

2004-12-30 Thread Ronald Oussoren
PyObjC 1.2 is now available for download at 
http://pyobjc.sourceforge.net/

PyObjC is a bridge between Python and Objective-C.  It allows full
featured Cocoa applications to be written in pure Python.  It is also
easy to use other frameworks containing Objective-C class libraries
from Python and to mix in Objective-C, C and C++ source.
Python is a highly dynamic programming language with a shallow learning
curve.  It combines remarkable power with very clear syntax.
The installer package includes a number of Xcode templates
for easily creating new Cocoa-Python projects.
PyObjC also supports full introspection of Objective-C classes and
direct invocation of Objective-C APIs from the interactive interpreter.
PyObjC requires Mac OS X 10.2 or later and Python 2.3 or later.  PyObjC 
works
both with the Apple provided Python installation in Mac OS X 10.3 (and 
later)
and with MacPython 2.3.

This release features several bugfixes, improved documentation as well 
as
support for categories, easier customization and basic support for 
creating
Interface Builder palettes. See the news file at
http://pyobjc.sourceforge.net/NEWS-1.2.txt for more information.

PyObjC is released with an open source license (MIT style).
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why would I use inspect.isclass()?

2004-12-30 Thread Nicolas Fleury
it's me wrote:
Okay, Nick, I didn't know you can pass a Class rather then an instance.  I
have to chew on what your example does.
But no, I want to pass an instance of a Class.  But how do I know that the
calling routine *did* pass me a class - pardon me: an instance of a Class?
You have the builtin function isinstance:
class A: pass
a = A()
print isinstance(a, A)  # True
Regards,
Nicolas
--
http://mail.python.org/mailman/listinfo/python-list


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread Dave Cook
On 2004-12-29, Alex Martelli [EMAIL PROTECTED] wrote:

 the coverage of Twisted and adding just a few things (numarray --

I'd rather have a whole book on Twisted :p.  But I'll take a more extensive
section in PiaN if I can't have it.

Dave Cook

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


Re: Using python to deploy software

2004-12-30 Thread it's me
pyro is most intriguing!  Thanks for the information.

Anand [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I haven't but one of my friends have used Pyro (Python Remote Objects)
 to do so.

 You basically need to write a custom Pyro server and run it on a
 central machine. Your pyro clients can be installed on the machines
 where the software need to be installed.

 For more details and similar ideas refer the project page of pyro at
 http://pyro.sourceforge.net/projects.html .

 -Anand



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


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Brendan Kohler
mike kreiner [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Are there any plans for developing a standard IDE for python that's
 included with the python installation? I found information about other
 IDE's elsewhere online, but couldn't even find any mention of this
 possibility.

 I'm still relatively new to Python--I switched over from VB--and I
 found it difficult to learn python without an IDE. Most experienced
 programmers I know started out using Emacs or another text editor, and
 are very happy with that; however, I found it difficult to put all the
 pieces (like GUI, etc.) together myself. i tried many of the free IDEs,
 but was dissatisfied (VS is tough to beat in my opinion, much better
 than the average m$ application *plz don't flame*). although it'd be a
 difficult undertaking, i think an IDE would be a tremendous boost for
 python in terms of gaining support in education and the business
 community. has anyone else discussed this? does anyone know the BDFL's
 stance? thanks.

 ~mike


That would be something called IDLE, which is included with python already.


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


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread Alex Martelli
Dave Cook [EMAIL PROTECTED] wrote:

 On 2004-12-29, Alex Martelli [EMAIL PROTECTED] wrote:
 
  the coverage of Twisted and adding just a few things (numarray --
 
 I'd rather have a whole book on Twisted :p.  But I'll take a more extensive
 section in PiaN if I can't have it.

I believe one or more books on Twisted are in the works, but I have no
insider info about them, their timing, and so on.


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


Re: GUI with sophisticated Table support

2004-12-30 Thread F. GEIGER
Torsten Mohr [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 Hi,

 i want to write an application where i need a Table to
 display some values.

 The table should display a list of objects, so to say,
 a column for each attribute of the object.
 I'd also like the user to be able to change the width
 of each column, like in Excel.

 I'd prefer to use Tkinter, but i think it can't do all
 that.

Do a group-google search for *tkinter table*. That shows up quite a few
hits.


 Is there a way for Tkinter to handle this?

 If not, what other GUI can do that? (wxPython?)

What you are looking for is contained in the wxPython demo app.



 Thanks for hints,
 Torsten.


HTH
Franz GEIGER


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


Re: PyQT installation

2004-12-30 Thread Phil Thompson
On Thursday 30 December 2004 1:27 am, Nanoscalesoft wrote:
 hello all,
 I am planning to start coding a nanoscale design software in
 python with QT interface.I have to do this in windows or linux.Intially
 windows would be fine.
 I have struggled almost full day today trying to make
 from import qt *
 execute...I have the basic python core. I went
 through the sites like riverbankcomputing and trolltech and few online
 pages and books which talk about PyQT but never say about their
 installation step properly.
 I need to know step by step what shud i do.I have also installed
 the windows binary of PyQT from riverbank and have ordered a QTdesigner
 CD.But i can't wait.I need to do this fast.(Is there any other thing i
 have to do)
 Any clean and clear cut info in linux or windows( as I hope this
 as the groups standard to be) would help me start my nanoscale project
 or otherwise i have to rethink the GUI..Common QT is my favourite i
 need my project work to be done on my favourite thing.

Exactly what versions of Python, Qt and PyQt have you installed?

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


Re: GUI with sophisticated Table support

2004-12-30 Thread Torsten Mohr
Hi,

 Do a group-google search for *tkinter table*. That shows up quite a few
 hits.

thanks for that hint, but nearly every hit shows the Table of contents
for Tkinter, which is not what i search for.

My question here is rather in detail about Tkinters Table and if it can
show resizable columns tho easily display a list of objects.

I did not find any help searching for this with google, but i'd really
rather like to use Tkinter over wxPython, that's the background of the
question.

Thanks for your help anyway, sorry if my question was unclear.


Best regards,
Torsten.

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


Re: Why would I use inspect.isclass()?

2004-12-30 Thread Martin v. Löwis
it's me wrote:
Okay, Nick, I didn't know you can pass a Class rather then an instance.  I
have to chew on what your example does.
But no, I want to pass an instance of a Class.  But how do I know that the
calling routine *did* pass me a class - pardon me: an instance of a Class?
You really need to fully digest the difference between classes and
instances. In Python, both classes and instances (of classes) are
objects/values (just like functions and modules). You can bind (store)
*classes* in variables, like so
 import httplib
 x=httplib.HTTP
 inspect.isclass(x)
True
 x=3
 inspect.isclass(x)
False
For many things, it is not obvious that they are classes. For example,
consider str and repr:
 inspect.isclass(repr)
False
 inspect.isclass(str)
True
Actually, in older Python versions, str was not always a class (a type).
It used to be a function, but now is a class.
The real purpose of why you have *inspect*.isclass is for inspecting.
For example, assume I wanted to display the contents of module httplib.
I would need to find out what the things in httplib are, and I do this
with
 for x in dir(httplib):
...   print x,
...   x = getattr(httplib, x)
...   if inspect.isclass(x):print class
...   elif inspect.isfunction(x):print function
...   elif inspect.ismodule(x):print module
...   else: print something else
...
BadStatusLine class
CannotSendHeader class
CannotSendRequest class
FakeSocket class
HTTP class
HTTPConnection class
HTTPException class
HTTPMessage class
HTTPResponse class
HTTPS class
HTTPSConnection class
HTTPS_PORT something else
HTTP_PORT something else
ImproperConnectionState class
IncompleteRead class
InvalidURL class
LineAndFileWrapper class
NotConnected class
ResponseNotReady class
SSLFile class
SharedSocket class
SharedSocketClient class
StringIO something else
UnimplementedFileMode class
UnknownProtocol class
UnknownTransferEncoding class
_CS_IDLE something else
_CS_REQ_SENT something else
_CS_REQ_STARTED something else
_UNKNOWN something else
__all__ something else
__builtins__ something else
__doc__ something else
__file__ something else
__name__ something else
errno module
error class
mimetools module
socket module
test function
urlsplit function
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


Re: Mutable objects which define __hash__ (was Re: Why are tuples immutable?)

2004-12-30 Thread Bengt Richter
On Thu, 30 Dec 2004 17:36:57 +1000, Nick Coghlan [EMAIL PROTECTED] wrote:

Bengt Richter wrote:
 Essentially syntactic sugar to avoid writing id(obj) ? (and to get a little 
 performance
 improvement if they're written in C). I can't believe this thread came from 
 the
 lack of such sugar ;-)

The downside of doing it that way is you have no means of getting from the 
id() 
stored as a key back to the associated object. Meaningful iteration (including 
listing of contents) becomes impossible. Doing the id() call at the Python 
level 
instead of internally to the interpreter is also relatively expensive.
ISTM

d[id(obj)] = obj, classifier_func(obj)

gets around the iteration problem (IIRC a very similar suggestion was somewhere 
in thread).
But if the id call is a significant portion of the cycle budget, yeah, might 
want to
pursue a collections solution ;-)


 Or, for that matter, (if you are the designer) giving the objects an
 obj.my_classification attribute (or indeed, property, if dynamic) as part
 of their initialization/design?

The main mutable objects we're talking about here are Python lists. Selecting 
an 
and really non-mutated Python lists?
alternate classification schemes using a subclass is the current recommended 
approach - this thread is about alternatives to that.
I'm getting the impression your meaning of classification is less about 
classifying
objects according their interesting features than how to associate the resulting
kind-of-thing info with the objects for more efficient access that 
recalculating.
In which case ISTM to be an optimization problem that depends intimately on the
particular features of interest in the data, etc.

I generally work with small enough data sets that I just use lists for 
classification (sorting test input data into inputs which worked properly, and 
those which failed for various reasons). However, I can understand wanting to 
use a better data structure when doing frequent membership testing, *without* 
having to make fundamental changes to an application's object model.

The DYFR thing ever lurks ;-)

 Or subclass your graph node so you can do something readable like
 if node.is_leaf: ...
 instead of
 if my_obj_classification[id(node)] == 'leaf': ...
I'd prefer:
   if node in leaf_nodes:
 ...
Which is trivial to code, except for optimization issues, right? ;-)


Separation of concerns suggests that a class shouldn't need to know about all 
the different ways it may be classified. And mutability shouldn't be a barrier 
to classification of an object according to its current state.
Agreed. I didn't mean to imply otherwise. I did mention possibly
memoizing classification functions as an optimization approach ;-)


Hence why I suggested Antoon should consider pursuing 
collections.identity_dict 
and collections.identity_set if identity-based lookup would actually address 
his 
requirements. Providing these two data types seemed like a nice way to do an 
end 
run around the bulk of the 'potentially variable hash' key problem.
 
 I googled for those ;-) I guess pursuing meant implementing ;-)

Yup. After all, the collections module is about high-performance datatypes for 
more specific purposes than the standard builtins. identity_dict and 
identity_set seem like natural fits for dealing with annotation and 
classification problems where you don't want to modify the class definitions 
for 
the objects being annotated or classified.
Well, at least they ought to be comparatively easy to do.

I don't want the capability enough to pursue it, but Antoon seems reasonably 
motivated :)
Let's see what happens ;-)

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


Odd error by mod_python

2004-12-30 Thread charliek
I have mod_python 2.7.10 running with python 2.3.4 and am getting an odd
error.  The error is happening on the production machine, and not on my
development machine.

I am using the publisher handler and am calling the index function with this
code:
--
from mod_python import apache
import random

def index(req):
return hello world
--
I am getting the following error:

  File
/usr/local/python/lib/python2.3/site-packages/mod_python/publisher.py,
line 130, in handler
module = apache.import_module(module_name, _req, [path])

  File /usr/local/python/lib/python2.3/site-packages/mod_python/apache.py,
line 335, in import_module
module = imp.load_module(mname, f, p, d)

  File /var/www/html/test.py, line 2, in ?
import random

  File /usr/local/python/lib/python2.3/random.py, line 54, in ?
LOG4 = _log(4.0)

ValueError: (84, 'Invalid or incomplete multibyte or wide character')


Does anybody know what may cause this?  I have searched the error in google
and have little success.  I am thinking it is some sort of encoding error
or something, but I don't know why this is only happening in production.

Note that this error is only occuring when I import the random module, and
if I comment that out everything works fine.  However I need the random
module for some of my other code.

Also if I run the following from the command line it works fine:
-
import random
print hello world
-

I don't know if it matters but I am running:
apache 1.3.27
redhat 7.2

Thanks,

Charliek

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


Is there a better way of listing Windows shares other than using os.listdir

2004-12-30 Thread Doran_Dermot
Hi All,

I'm currently using os.listdir to obtain the contents of some slow Windows
shares.  I think I've seen another way of doing this using the win32 library
but I can't find the example anymore.

My main problem with using os.listdir is that it hangs my gui application.
The tread running the os.listdir appears to block all other threads when
it calls this function.

Any ideas, comments or suggestions?

Thanks in advance,

Dermot.

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


Re: GUI with sophisticated Table support

2004-12-30 Thread Alex Martelli
Torsten Mohr [EMAIL PROTECTED] wrote:

 My question here is rather in detail about Tkinters Table and if it can
 show resizable columns tho easily display a list of objects.
 
 I did not find any help searching for this with google, but i'd really
 rather like to use Tkinter over wxPython, that's the background of the
 question.

Hmmm -- there's a tktable (on sourceforge) which claims to have
resizable columns and a Python/Tkinter wrapper, but I haven't tried it,
myself.  tktable.sourceforge.net for more info...


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


Re: need some help with threading module...

2004-12-30 Thread chahnaz.ourzikene
Hi,

I fixed the code, it runs under Linux but not under windows 0_o ??! i guess
windows and Linux do not handle threads the same way.

However, i don't have the result i excpect.

Please have a look here :

## In this little program, i'm trying to find a way to yield data from a
thread within another
## thread, where both threads are NON-COOPERATIVE.
## To do so, i imagined an application launching two threads : a subject (to
yield data from)
## and a controller that will try to yield data from the subject. The
controller has a link
## with the subject, so he can call his methods and ask him to return the
desired data.
##
## The problem is that it appears that on windows systems, this program
idles and crashes after
## some seconds. On linux systems, this program runs but not the way i
figured : the two threads
## seem not to run in parallel...
##
## Look at the controller code : his job is to call the subject's methode
count() and compare
## the returned data to a threshold he's exepcting to reach. If the count
method of the subject
## returns a number less than threshold, than the controller loop again (in
a recursive function)
## until the subject's count method returns a number greater or equal to
threshold or the recursive funtion
## runs limit times ( to avoid unlimited recursive calls ).
##
## Now look at the subject code : his only job is to increment a counter in
a recursive methode.
## This counter is retrieved within the controller code via the count()
methode of the subject.
## When that counter reaches threshold (defined in the controller), the
controller returns.
##
## Execute the following code to see the result. You'll find someting like
this under linux :
##
## controller waiting...  0 loops
## controller waiting...  1 loops
## controller waiting...  2 loops
## controller waiting...  3 loops
## controller waiting...  4 loops
## controller waiting...  5 loops
## controller waiting...  6 loops
## controller waiting...  7 loops
## controller waiting...  8 loops
## controller waiting...  9 loops
## controller waiting...  10 loops
## controller waiting...  11 loops
## controller waiting...  12 loops
## controller waiting...  13 loops
## controller waiting...  14 loops
## controller waiting...  15 loops
## controller waiting...  16 loops
## controller waiting...  17 loops
## controller waiting...  18 loops
## controller waiting...  19 loops
## controller waiting...  20 loops
## controller waiting...  21 loops
## controller waiting...  22 loops
## controller waiting...  23 loops
## controller waiting...  24 loops
## controller waiting...  25 loops
## controller waiting...  26 loops
## controller waiting...  27 loops
## controller waiting...  28 loops
## controller waiting...  29 loops
## controller waiting...  30 loops
## controller waiting...  31 loops
## controller waiting...  32 loops
## controller waiting...  33 loops
## controller waiting...  34 loops
## controller waiting...  35 loops
## controller waiting...  36 loops
## controller waiting...  37 loops
## controller waiting...  38 loops
## controller waiting...  39 loops
## controller waiting...  40 loops
## controller waiting...  41 loops
## controller waiting...  42 loops
## controller waiting...  43 loops
## controller waiting...  44 loops
## controller waiting...  45 loops
## controller waiting...  46 loops
## controller waiting...  47 loops
## controller waiting...  48 loops
## controller waiting...  49 loops
## controller : limit of recursive loops reached :
## threshold 20 never reached
## Subject : the counter is now 0
## Subject : the counter is now 1
## Subject : the counter is now 2
## Subject : the counter is now 3
## Subject : the counter is now 4
## Subject : the counter is now 5
## Subject : the counter is now 6
## Subject : the counter is now 7
## Subject : the counter is now 8
## Subject : the counter is now 9
## Subject : the counter is now 10
## Subject : the counter is now 11
## Subject : the counter is now 12
## Subject : the counter is now 13
## Subject : the counter is now 14
## Subject : the counter is now 15
## Subject : the counter is now 16
## Subject : the counter is now 17
## Subject : the counter is now 18
## Subject : the counter is now 19
## Subject : the counter is now 20
## Subject : the counter is now 21
## Subject : the counter is now 22
## Subject : the counter is now 23
## Subject : the counter is now 24
## Subject : the counter is now 25
## Subject : the counter is now 26
## Subject : the counter is now 27
## Subject : the counter is now 28
## Subject : the counter is now 29
## Subject : the counter is now 30
## Subject : the counter is now 31
## Subject : the counter is now 32
## Subject : the counter is now 33
## Subject : the counter is now 34
## Subject : the counter is now 35
## Subject : the 

Re: Unicode entries on sys.path

2004-12-30 Thread vincent wehren
Thomas Heller wrote:
Martin v. Löwis [EMAIL PROTECTED] writes:

Thomas Heller wrote:
How should these patches be approached?
Please have a look as to how posixmodule.c and fileobject.c deal with
this issue.

On windows, it would probably
be easiest to use the MS generic text routines: _tcslen instead of
strlen, for example, and to rely on the _UNICODE preprocessor symbol to
map this function to strlen or wcslen.
No. This fails for two reasons:
1. We don't compile Python with _UNICODE, and never will do so. This
   macro is only a mechanism to simplify porting code from ANSI APIs
   to Unicode APIs, so you don't have to reformulate all the API calls.
   For new code, it is better to use the Unicode APIs directly if you
   plan to use them.
2. On Win9x, the Unicode APIs don't work (*). So you need to chose at
   run-time whether you want to use wide or narrow API. Unless
   a) we ship two binaries in the future, one for W9x, one for NT+
  (I hope this won't happen), or
   b) we drop support for W9x. I'm in favour of doing so sooner or
  later, but perhaps not for Python 2.5.

I wasn't asking about the *W functions, I'm asking about string/unicode
handling in Python source files. Looking into Python/import.c, wouldn't
it be required to change the signature of a lot of functions to receive
PyObject* arguments, instead of char* ?
For example, find_module should change from
  static struct filedescr *find_module(char *, char *, PyObject *,
   char *, size_t, FILE **, PyObject **);
to 

  static struct filedescr *find_module(char *, char *, PyObject *,
   PyObject **, FILE **, PyObject **);
where the fourth argument would now be either a PyString or PyUnicode
object pointer?

(*) Can somebody please report whether the *W file APIs fail on W9x
because the entry points are not there (so you can't even run the
binary), or because they fail with an error when called?

I always thought that the *W apis would not be there in win98, but it
seems that is wrong.  Fortunately, how could Python, which links to the
FindFirstFileW exported function for example, run on win98 otherwise...
Normally I would have thought this would require using the Microsoft 
Layer for Unicode (unicows.dll).

According to MSDN 9x already does have a handful of unicode APIs.
FindFirstFile does not seem to be one of them - unless the list on
htpp://msdn.microsoft.com/library/default.asp?url=/library/en-us/mslu/winprog/other_existing_unicode_support.asp)
is bogus (?).
--
Vincent Wehren

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


RE: Is there a better way of listing Windows shares other than us ing os.listdir

2004-12-30 Thread Tim Golden
[EMAIL PROTECTED]

| I'm currently using os.listdir to obtain the contents of 
| some slow Windows shares.  I think I've seen another way of 
| doing this using the win32 library but I can't find the 
| example anymore.

It may be FindFilesIterator, recently added to the win32file
module in pywin32. I don't know if it's any more efficient
than an os.listdir (which may use it under the covers, for
all I know) but it certainly works:

code
import win32file

for file_data in win32file.FindFilesIterator (c:/temp/*):
  ( attr, ctime, atime, wtime, 
size_hi, size_lo, r0, r1, 
longname, shortname
  ) = file_data
  print longname
/code

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

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


Re: help - problem installing pywin32

2004-12-30 Thread Simon Brunning
On 27 Dec 2004 10:18:18 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hello,
 
 I was trying to install pywin32 on one computer which has Python 2.4
 installed and it failed.
 The error message I got was
 
 Can't load Python for pre-install script.

I'm not sure what the problem actually is, but as a workaround, I
found that adding Python's root directory to my path fixed it.

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Is there a better way of listing Windows shares other than us ing os.listdir

2004-12-30 Thread Doran_Dermot
Hi Tim,

That does the trick!  Now my gui remains responsive during the long search
time. 

Thanks!

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Tim Golden
Sent: 30 December 2004 10:54
To: python-list@python.org
Subject: RE: Is there a better way of listing Windows shares other than us
ing os.listdir

[EMAIL PROTECTED]

| I'm currently using os.listdir to obtain the contents of 
| some slow Windows shares.  I think I've seen another way of 
| doing this using the win32 library but I can't find the 
| example anymore.

It may be FindFilesIterator, recently added to the win32file
module in pywin32. I don't know if it's any more efficient
than an os.listdir (which may use it under the covers, for
all I know) but it certainly works:

code
import win32file

for file_data in win32file.FindFilesIterator (c:/temp/*):
  ( attr, ctime, atime, wtime, 
size_hi, size_lo, r0, r1, 
longname, shortname
  ) = file_data
  print longname
/code

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

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


Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Miki Tebeka wrote:
Hello Fuzzyman,

Are there widely used and recommended Python libraries that will
let me makes a portable text user interface?
If you just need a text-like interface you can use Tkinter.
See (shameless plug) http://developer.berlios.de/projects/bcd/ and
http://developer.berlios.de/dbimage.php?id=1112 for example.

Your project looks very interesting. It would be better if it displayed
an error message if it can't find the '_bcdrc' file. If you run it from
windoze it just appears and disapears.
How about allowing the '_bcdrc' file to be in the same directory as the
script as well.
Cool. A user!
Thanks for the comments. I'll add searching next to the application on
win32 platforms.

Any chance of you releasing the Tkinter text interface as a separate
library, with a less restrictive license ? It looks very good - but I
can't use it in my projects if it is GPL.
It's just standard Tkinter Listbox with key bindings and it's under 160
lines of code. Nothing special here.
Bye.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
i have not used Tcl/Tk before, and don't know how to solve the problem -
after i've made config file (.bcdrc) and run the script on FreeBSD 4, i've got 
the message:
Traceback (most recent call last):
  File ./bcd.py, line 177, in ?
root = Tk() # Main window
  File /usr/local/lib/python2.2/lib-tk/Tkinter.py, line 1511, in __init__
self.tk = _tkinter.create(screenName, baseName, className)
TclError: no display name and no $DISPLAY environment variable
--
Best regards,
Maxim
--
http://mail.python.org/mailman/listinfo/python-list


Re: Updating file objects automatically

2004-12-30 Thread Jorge Luiz Godoy Filho
Craig Ringer, Quinta 30 Dezembro 2004 06:27, wrote:

 I couldn't really catch your explanation, but mention of changing all
 instances of a class suggests that you may be in a situation where you
 need to modify the class, not its instances. There are two methods I use
 when I have to change things across all instances:

I'm sorry.  It was late here and I've been coding this and other things for
near 14h in a row...  I think that even I wouldn't understand that if I
weren't working with it :-)

 I have no idea if that's actually appropriate for your needs, it's just
 a stab in the dark, but perhaps it might be.

It helps, yes.  Putting the object on the class instead of on an instance of
it might (I'm 99.9% sure) solve the problem.  (I have already done that for
other object that is shared, but I didn't remember doing that for this)


Thank you.  You helped a lot to make me see it :-)

-- 
Godoy. [EMAIL PROTECTED]

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


Re: GUI with sophisticated Table support

2004-12-30 Thread F. GEIGER

Torsten Mohr [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 Hi,

  Do a group-google search for *tkinter table*. That shows up quite a few
  hits.

 thanks for that hint, but nearly every hit shows the Table of contents
 for Tkinter, which is not what i search for.

Do a *group* google serach (i.e. a search w/i groups indexed by Google,
formerly known as DejaNews).

Then you'll get for example
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266
http://tkinter.unpythonic.net/wiki/SortableTable
http://groups.google.at/groups?hl=delr=selm=tkjjrtr89f687e%40news.supernew
s.com
to name a few.

But even if I do a normal (i.e.. web) google search I get
http://pmwcontribd.sourceforge.net/PmwContribD-r2_0_1/Table.py.html
for example.

HTH
Franz GEIGER


 My question here is rather in detail about Tkinters Table and if it can
 show resizable columns tho easily display a list of objects.

 I did not find any help searching for this with google, but i'd really
 rather like to use Tkinter over wxPython, that's the background of the
 question.

 Thanks for your help anyway, sorry if my question was unclear.


 Best regards,
 Torsten.



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


Re: Unicode entries on sys.path

2004-12-30 Thread Martin v. Löwis
vincent wehren wrote:
FindFirstFile does not seem to be one of them - unless the list on
htpp://msdn.microsoft.com/library/default.asp?url=/library/en-us/mslu/winprog/other_existing_unicode_support.asp) 

is bogus (?).
It might perhaps be misleading: I think the entry points are there, but 
calling the functions will always fail.

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


Re: build a static executable program with python

2004-12-30 Thread David Fraser
Torsten Mohr wrote:
Hi,
i'd like to build an executable file that is linked with
a python library and executes a script via PyRun_SimpleString
or similar functions.
Is there a static library of python available, so the users
don't need to install python?
What about DLL modules, do i just need to compile them
as a static lib, link them together with my program and
call their init function?
What about python modules, can i just use a tool like
freeze or py2exe to break up the import hierarchy
and call them before my script?
Is there some more information about building a static
executable available?
Thanks for any hints,
Torsten.
Just have a look at py2exe, it does basically what you're asking for - 
see the link to the wiki from the py2exe home page for more information...

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


Re: Updating file objects automatically

2004-12-30 Thread Jorge Luiz Godoy Filho
Jorge Luiz Godoy Filho, Quinta 30 Dezembro 2004 09:20, wrote:

 It helps, yes.  Putting the object on the class instead of on an instance
 of
 it might (I'm 99.9% sure) solve the problem.  (I have already done that
 for other object that is shared, but I didn't remember doing that for
 this)

And, as expected, it worked.  Thanks for the help, Craig.

-- 
Godoy. [EMAIL PROTECTED]

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


Re: Python + Lisp integration?

2004-12-30 Thread Simo Melenius
Erno Kuusela [EMAIL PROTECTED] writes:

 you might want to look at http://logix.livelogix.com/ .

Thanks, this was a good link! Logix looks like an interesting project,
really, and I think I'll at least study its internals myself to shed
light to how it uses the Python compiler. Looks like something to hack
on.


br,
S
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread alecwy
Discussion of GIL and (in)ability to control thread priority.
Thanks for asking!

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


Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2004-12-30 Thread Cameron Laird
QOTW:  I found the discussion of unicode, in any python book I have,
insufficient. -- Thomas Heller

If you develop on a Mac, ... Objective-C could come in handy.  . . .
PyObjC makes mixing the two languages dead easy and more convenient than
indoor plumbing. -- Robert Kern


Among other activities, the PSF aggregates donors with dollars
destined to do good Python works, and developers expert in
obscure corners of Pythonia.

http://groups-beta.google.com/group/comp.lang.python.announce/browse_thread/thread/705bfe05419aa0b3

http://groups-beta.google.com/group/comp.lang.python.announce/browse_thread/thread/1122f3e14752ce5/

Yippee!  The martellibot promises to explain Unicode for Pythoneers.

http://groups-beta.google.com/group/comp.lang.python/msg/6015a5a05c206712

The glorious SciPy project supports *multiple* worthwhile Wikis.
http://www.scipy.org/wikis

Good style in Python does not generally include in-place
operations on lists.  Several cleaner idioms are possible.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/c94559f53d25474e

Assume you're comfortable with tuples' semantics, immutability,
and so on.  Do you correctly understand the basics of their
syntax, though?  This is another opportunity to think about
Unicode, by the way.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/990049d7adb1bcce

Robert Kern, Paul Rubin, Mike Meyer, Alex Martelli, and others
provide disproportionately high-quality advice (and tangents!)
on the subject of languages which complement Python.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bbc1c6d9d87049b6



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

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Brett Cannon continues the marvelous tradition established by 
Andrew Kuchling and Michael Hudson of intelligently summarizing
action on the python-dev mailing list once every other week.
http://www.python.org/dev/summary/

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

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

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

The Python Business Forum further[s] the interests of companies
that base their business on ... Python.
http://www.python-in-business.org

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 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/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://aspn.activestate.com/ASPN/Cookbook/Python

Among several Python-oriented RSS/RDF feeds available are
http://www.python.org/channews.rdf
http://bootleg-rss.g-blog.net/pythonware_com_daily.pcgi
http://python.de/backend.php
For more, see
http://www.syndic8.com/feedlist.php?ShowMatch=pythonShowStatus=all
The old Python To-Do List now lives principally in a
SourceForge reincarnation.

Re: Other notes

2004-12-30 Thread Steve Holden
Bengt Richter wrote:
On Wed, 29 Dec 2004 13:11:43 -0500, Steve Holden [EMAIL PROTECTED] wrote:
[...]
Well, perhaps you can explain how a change that's made at run time 
(calling the decorator) can affect the parser's compile time behavior, 
then. At the moment, IIRC, the only way Python code can affect the 
parser's behavior is in the __future__ module, which must be imported at 
the very head of a module.
Good point, which I didn't address in my reply. (in fact I said I liked
@infix('..') for punctuation-char-named ops, but I was too busy with my
idea to think about that implementation ;-)
Well, that explains the lack of detail. I realize that you are more 
likely than most to be able to come up with an implementation.

Potentially, you could do it dynamically with a frame flag (to limit the damage)
which said, check all ops against a dict of overloads and infix definitions 
while
executing byte code for this frame. Of course, the compiler would have to defer
some kinds of syntax error 'til run time. I.e., '..' would have to be translated
to OP_POSSIBLE_CUSTOM_INFIX or such. I doubt if it would be worth doing.
Right. I can't say I think deferring syntax errors until runtime is a 
good idea.

OTOH, I think my suggestion might be ;-) I.e., just do a macro-like (not a 
general
macro capability for this!!) translation of expressions with dots at both ends 
and
no embedded spaces (intial thought, to make things easier) thus:
x .expr. y =  expr(x, y)
when expr is a simple name, you can use that expression format to call a 
two-arg function
of that name, e.g.,
def interval(x, y): return xrange(x, y+1)
for i in x .interval. y: print i,  # same as for i in interval(x, y): print 
i,
but you could also write stuff like
def GE(x,y): return x is MY_INFINITY or x = y
if x .GE. y: print 'x is greater than y'
The .expr. as expression would allow module references or tapping into general
expression and attribute magic etc. I.e., (untested)
   from itertools import chain as CHAIN
   for k,v in d1.items() .CHAIN. d2.items(): print k, v
or if you had itertools imported and liked verbose infix spelling:
   for k,v in d1.items() .itertools.chain. d2.items(): print k, v
or define a hidden-attribute access operation using an object's dict
   def HATTR(obj, i):
   try: return vars(obj)[i]
   except KeyError: raise AttributeError('No such attribute: %r', i)
   if thing .HATTR. 2 == 'two': print 'well spelled'
or
   from rational import rat as RAT
   if x .RAT. y  1 .RAT. 3: do_it()
or
   your turn ;-)
Well, I can see that Fortran programmers might appreciate it :-). And I 
suppose that the syntax is at least regular enough to be lexed with the 
current framework, give or take. It would lead to potential breakage due 
to the syntactic ambiguity between

module .function. attribute
and
module.function.attribute
though I don't honestly think that most people currently insert 
gratuitous spaces into attribute references.


[precedence and associativity]
My suggestion if implemented with left-right priority would be easy to
implement (I think ;-) And you could always override order with parens.
Now you're just trying to make it easy :-)
regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in threading

2004-12-30 Thread Steve Holden
Gurpreet Sachdeva wrote:
So That means blindly using threads on any process won't help!
It depends on what help means to you.

Help means to improve processing speed in achieving a particular
task... *Help* here also means that I have a processor farm, how do I
best use them to get maximum processing speed out of them...
And that's the crux of your problem.
Firstly, you've discovered that attempts to partition a task using 
threads won't work well with a compute-intensive algorithm, since 
multiple threads will simply contend against each other for CPU in a 
single process.

This is not assisted by Python's use of a global interpreter lock (GIL) 
to ensure thread-safety.

A thread can release the GIL, but typically it will do this only when 
it's involved in some blocking operation. This means that threading can 
be useful to speed up network operations, for example, but even then you 
might get a better speedup using explicitly asynchronous techniques 
based on non-blocking sockets.

The example you listed isn't a good use of thread for performance

The example was a dummy one to become friendly with Threads and to
understand the working/power of them... The example which will be
finally used with threads take 5 Days to complete... I want to convert
that in few hours!
In that case you definitely need to be looking at multiprocess 
algorithms if you are sticking with Python. Since each process has its 
own copy of the interpreter, they each also have their own GIL, and so 
the operating system will be able to schedule the processes in parallel 
on separate CPUs.

Long Journey ahead...
Indeed, but an interesting one, no doubt. Good luck.
regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why tuples use parentheses ()'s instead of something else like 's?

2004-12-30 Thread Ed Leafe
On Dec 29, 2004, at 3:38 PM, Rocco Moretti wrote:
So to summarize:
Commas define tuples, except when they don't, and parentheses are only 
required when they are necessary.
Exactly! Now can we clear anything else up for you? ;-)
 ___/
/
   __/
  /
 /
 Ed Leafe
 http://leafe.com/
 http://dabodev.com/
--
http://mail.python.org/mailman/listinfo/python-list


Securing a future for anonymous functions in Python

2004-12-30 Thread Nick Coghlan
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. 
Getting rid of lambda seems like a worthy goal, but I'd prefer to see it dropped 
in favour of a different syntax, rather than completely losing the ability to 
have anonymous functions.

Anyway, I'm looking for feedback on a def-based syntax that came up in a recent 
c.l.p discussion:
http://boredomandlaziness.skystorm.net/2004/12/anonymous-functions-in-python.html

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Computer text recognition (was. Re: Why tuples use parentheses ()'s instead of something else like 's?)

2004-12-30 Thread Nick Coghlan
Ed Leafe wrote:
Exactly! Now can we clear anything else up for you? ;-)
How about a computer program than can correctly count the number of letter E's 
in your signature? :)

Cheers,
Nick.
I like the sig, if you hadn't guessed. . .
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: Confusion About Classes

2004-12-30 Thread Steve Holden
Steven Bethard wrote:
M.E.Farmer wrote:
there are no variables in python
[...]
As M.E.Farmer mentioned, you can't remove underscores on special method 
names like __init__.  However, when you're declaring an instance 
variable, e.g.:

self.__xyz = True
then you're choosing the name here, so you can name it whatever you 
want.  The only reason to use leading double-underscores is if you want 
Python to name-mangle the variable so it's not (easily) accessible from 
subclasses.  In most cases, this is unnecessary.

While it's unnecessary in most cases, I'd like to point out that the 
mechanism is mostly to avoid inadvertent clashes in the object namespace.

So, if you are designing a class explicitly to be subclassed, that's 
when the use of mangled names can pay off.

Of course, if the subclass implementor actually *does* need access to 
your instance variables they will curse you if you've mangled them.

unwrapping-that-mangling-isn't-pretti-ly y'rs  - steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter vs wxPython

2004-12-30 Thread Steve Holden
Bernd Schmidt wrote:
Thomas Bartkus schrieb:
When run under Linux, my wxPython programs follow the look and feel of my
Gnome desktop.  When the same program is run on Windows, it follows that
desktop theme. Both Gnome and Windows XP alter the the controls design
according to user preferences.  wxPython GUIs reflect this 
automatically and
the controls always look and work like the underlying system.

Sure, but on my Linux, I use KDE, never Gnome, other people use 
Windowmaker or something else. wxPython with KDE-Look? What is the 
native look with wxPython and KDE? I don't think there is something like 
this, and the problem is that there isn't a free QT on Windows.

Bernd
Well, of course, the problem with X Window has always been when you ran 
an application built using one toolkit under a window manager built 
using another. *Then* the ugliness is due to the fact that different 
parts of the window are decorated by different toolkits. That's always 
going to be ugly.

remembering-motif-under-open-windows-ly y'rs  - steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Steve Holden
Brendan Kohler wrote:
mike kreiner [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Are there any plans for developing a standard IDE for python that's
included with the python installation? I found information about other
IDE's elsewhere online, but couldn't even find any mention of this
possibility.
I'm still relatively new to Python--I switched over from VB--and I
found it difficult to learn python without an IDE. Most experienced
programmers I know started out using Emacs or another text editor, and
are very happy with that; however, I found it difficult to put all the
pieces (like GUI, etc.) together myself. i tried many of the free IDEs,
but was dissatisfied (VS is tough to beat in my opinion, much better
than the average m$ application *plz don't flame*). although it'd be a
difficult undertaking, i think an IDE would be a tremendous boost for
python in terms of gaining support in education and the business
community. has anyone else discussed this? does anyone know the BDFL's
stance? thanks.
~mike

That would be something called IDLE, which is included with python already.

With respect it wouldn't, since IDLE doesn;t include a GUI builder. I 
think Mike's cri-de-couer is for a tool that makes it as easy as Visual 
Studio to put a GUI-based application together.

To which I can only respond that it's obvious Microsoft haven't wasted 
ALL the money they've spent on developemnt. VS *is* a tough act to beat, 
though certainly not impossible.

 I wish there *were* something equivalent. If Jim Hugunin can persuade 
Microsoft to fully support Python in Visula Studio .NET they'd have at 
least one more customer.

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why would I use inspect.isclass()?

2004-12-30 Thread Steve Holden
it's me wrote:
Okay, Nick, I didn't know you can pass a Class rather then an instance.  I
have to chew on what your example does.
But no, I want to pass an instance of a Class.  But how do I know that the
calling routine *did* pass me a class - pardon me: an instance of a Class?
You should Google for duck typing and stop worrying so much about what 
your functions//methods have been passed.

At least, that's the traditional Python approach. I suspect you are 
still trying to program in C in Python :-)

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why would I use inspect.isclass()?

2004-12-30 Thread Steve Holden
Martin v. Löwis wrote:
it's me wrote:
Okay, Nick, I didn't know you can pass a Class rather then an 
instance.  I
have to chew on what your example does.

But no, I want to pass an instance of a Class.  But how do I know that 
the
calling routine *did* pass me a class - pardon me: an instance of a 
Class?

[...]
The real purpose of why you have *inspect*.isclass is for inspecting.
For example, assume I wanted to display the contents of module httplib.
I would need to find out what the things in httplib are, and I do this
with
  for x in dir(httplib):
   print x,
   x = getattr(httplib, x)
   if inspect.isclass(x):print class
   elif inspect.isfunction(x):print function
   elif inspect.ismodule(x):print module
   else: print something else

This technique is often called introspection, and involves having 
programs indulge in the time-honored practice of contemplating their own 
navels. The ability to introspect is one side of a major dichotomy in 
programming languages. A C program has no real ability to introspect, 
but Python and SmallTalk (and Java) programs do.

But it isn't really a novice topic, and many programmers spend entire 
careers quite happily without using introspection.

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: portable text user interface

2004-12-30 Thread Steve Holden
Maxim Kasimov wrote:
Miki Tebeka wrote:
Hello Fuzzyman,

Are there widely used and recommended Python libraries that will
let me makes a portable text user interface?

If you just need a text-like interface you can use Tkinter.
See (shameless plug) http://developer.berlios.de/projects/bcd/ and
http://developer.berlios.de/dbimage.php?id=1112 for example.


Your project looks very interesting. It would be better if it displayed
an error message if it can't find the '_bcdrc' file. If you run it from
windoze it just appears and disapears.
How about allowing the '_bcdrc' file to be in the same directory as the
script as well.

Cool. A user!
Thanks for the comments. I'll add searching next to the application on
win32 platforms.

Any chance of you releasing the Tkinter text interface as a separate
library, with a less restrictive license ? It looks very good - but I
can't use it in my projects if it is GPL.

It's just standard Tkinter Listbox with key bindings and it's under 160
lines of code. Nothing special here.
Bye.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

i have not used Tcl/Tk before, and don't know how to solve the problem -
after i've made config file (.bcdrc) and run the script on FreeBSD 4, 
i've got the message:

Traceback (most recent call last):
  File ./bcd.py, line 177, in ?
root = Tk() # Main window
  File /usr/local/lib/python2.2/lib-tk/Tkinter.py, line 1511, in __init__
self.tk = _tkinter.create(screenName, baseName, className)
TclError: no display name and no $DISPLAY environment variable

This is a problem with window creation. I presume it's occurring because 
you aren't running the program in a windowed environment - if you've 
logged in through a graphical screen such as xdm and you are running the 
program in a window on a desktop the DISPLAY environment variable is 
normally set up for you.

Perhaps you are just telnetting in from a remote system?
regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Nick Coghlan
Paul Rubin wrote:
Nick Coghlan [EMAIL PROTECTED] writes:
Anyway, I'm looking for feedback on a def-based syntax that came up in
a recent c.l.p discussion:

Looks like just an even more contorted version of lambda.  It doesn't
fix lambda's main deficiency which is inability to have several
statements in the anonymous function.
Do you consider generator expressions or list comprehensions deficient because 
they don't allow several statements in the body of the for loop?

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Steve Holden wrote:
Maxim Kasimov wrote:
Miki Tebeka wrote:
Hello Fuzzyman,

Are there widely used and recommended Python libraries that will
let me makes a portable text user interface?

If you just need a text-like interface you can use Tkinter.
See (shameless plug) http://developer.berlios.de/projects/bcd/ and
http://developer.berlios.de/dbimage.php?id=1112 for example.


Your project looks very interesting. It would be better if it displayed
an error message if it can't find the '_bcdrc' file. If you run it from
windoze it just appears and disapears.
How about allowing the '_bcdrc' file to be in the same directory as the
script as well.

Cool. A user!
Thanks for the comments. I'll add searching next to the application on
win32 platforms.

Any chance of you releasing the Tkinter text interface as a separate
library, with a less restrictive license ? It looks very good - but I
can't use it in my projects if it is GPL.

It's just standard Tkinter Listbox with key bindings and it's under 160
lines of code. Nothing special here.
Bye.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

i have not used Tcl/Tk before, and don't know how to solve the problem -
after i've made config file (.bcdrc) and run the script on FreeBSD 4, 
i've got the message:

Traceback (most recent call last):
  File ./bcd.py, line 177, in ?
root = Tk() # Main window
  File /usr/local/lib/python2.2/lib-tk/Tkinter.py, line 1511, in 
__init__
self.tk = _tkinter.create(screenName, baseName, className)
TclError: no display name and no $DISPLAY environment variable


This is a problem with window creation. I presume it's occurring because 
you aren't running the program in a windowed environment - if you've 
logged in through a graphical screen such as xdm and you are running the 
program in a window on a desktop the DISPLAY environment variable is 
normally set up for you.

Perhaps you are just telnetting in from a remote system?
regards
 Steve
yes i'm telneting (sshing), that is the reason why i'm looking for
libs for making text interfaces.
i know there is a project named anakonda - red hat linux installer,
but it is uses specific C libs. i can use only python libs.
--
Best regards,
Maxim
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Jp Calderone
On Fri, 31 Dec 2004 00:00:31 +1000, Nick Coghlan [EMAIL PROTECTED] wrote:
Paul Rubin wrote:
  Nick Coghlan [EMAIL PROTECTED] writes:
  
 Anyway, I'm looking for feedback on a def-based syntax that came up in
 a recent c.l.p discussion:
  
  
  Looks like just an even more contorted version of lambda.  It doesn't
  fix lambda's main deficiency which is inability to have several
  statements in the anonymous function.
 
 Do you consider generator expressions or list comprehensions deficient 
 because 
 they don't allow several statements in the body of the for loop?
 

 (foo + bar
... for foo in range(13) if foo % 3 == 2
... for bar in range(16, 23) if 2 = bar % 5  4)
generator object at 0xb7dec10c
 

  Hmm.  Two for loops and two if clauses.  That's four altogether.  
Does that qualify as several? :) Sure, they're not statements 
according to the grammar, but that's entirely beside the point.

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


Re: build a static executable program with python

2004-12-30 Thread Adal Chiriliuc
My app uses Python 2.4 and the Pythonwin GUI (Python MFC wrapper).
I build it as a single exe file with everything linked in it. It's
a lot smaller than all the DLL's put together.

The Python modules are also put into the file as a Win32 resource
which contains all the modules bz2 compressed. I gather the required
modules the same way as py2exe does (using modulefinder), then I
compile them to .pyc files, bundle them all together in one file with
some information (like size and name) and than bzip compress the whole
file. When the app starts it uncompresses them and init's the
PyImport_FrozenModules variable (just like in freeze).

So I only have one exe file to ship, which contains everything needed.
Right now it's size is 2 MB, but bear in mind that it contains STLport
and Crypto++ which are big libraries. It compresses down to under 1 MB.

It's not very difficult to do if you have some experience. But you do
have to tweak some Python header files (to disable for example the
normal link against python24.lib).

You are right about the DLL modules. You just compile tham as a static
lib and manually call their's their's init function, AND ALSO THE
DllMain ONE. The exe file will still export the DLL functions, but you
can disable this with some tweaks.

Hope that helps. I can guide you through the process if you wish.

On Thursday, December 30, 2004 Torsten Mohr wrote:
 Hi,

 i'd like to build an executable file that is linked with
 a python library and executes a script via PyRun_SimpleString
 or similar functions.

 Is there a static library of python available, so the users
 don't need to install python?

 What about DLL modules, do i just need to compile them
 as a static lib, link them together with my program and
 call their init function?


 What about python modules, can i just use a tool like
 freeze or py2exe to break up the import hierarchy
 and call them before my script?


 Is there some more information about building a static
 executable available?


 Thanks for any hints,
 Torsten.



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


Re: Mixing metaclasses and exceptions

2004-12-30 Thread Jp Calderone
On Mon, 27 Dec 2004 21:44:23 -0500, Steve Menard [EMAIL PROTECTED] wrote:
In writing the next version of Jpype (Python to Java bridge), I have hot 
 a rather unpleasant wall ... Hopefully it is I who is doing something 
 wrong and i can be fixed ...
 
 Since I am bridging Java classes and presenting them as Python classes, 
 I decided to try to create a corresponding python class for every Jva 
 classes accessed inside the python program. So far, everything is great 
 .. until we get to exception handling.
 
 Since I am creating classes, on the fly, I thought the easiest and most 
 pythonic way to do it would be to create a metaclass. This is true also 
 for the Java exception classes.
 
 The problem arises when I try to raise one of those exception classes 
 ... it sems Python will not allow classes that have a custom metaclass 
 to be raised as exceptions! Even though those classes derive from 
 Exception! To illustrate, try the following snippet :

  Only instances of classic classes can be raised.  This is an arbitrary 
restriction imposed by CPython.  There's no particular reason it need be 
the case, aside from the fact that no one has bothered to do the necessary 
work to make new-style classes usable as exceptions.

  One way you could get around this problem is by making your metaclass 
return an instance of a classic class.

  I'd skip that, though.  Your problem doesn't sound Metaclass! at me.
I wonder if you could elaborate on your usage?  Perhaps there's a better 
solution which doesn't involve metaclasses at all.

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


Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Nick Coghlan
Jp Calderone wrote:
On Fri, 31 Dec 2004 00:00:31 +1000, Nick Coghlan [EMAIL PROTECTED] wrote:
Paul Rubin wrote:
Nick Coghlan [EMAIL PROTECTED] writes:

Anyway, I'm looking for feedback on a def-based syntax that came up in
a recent c.l.p discussion:

Looks like just an even more contorted version of lambda.  It doesn't
fix lambda's main deficiency which is inability to have several
statements in the anonymous function.
Do you consider generator expressions or list comprehensions deficient because 
they don't allow several statements in the body of the for loop?


 (foo + bar
... for foo in range(13) if foo % 3 == 2
... for bar in range(16, 23) if 2 = bar % 5  4)
generator object at 0xb7dec10c
 

  Hmm.  Two for loops and two if clauses.  That's four altogether.  
Does that qualify as several? :) Sure, they're not statements 
according to the grammar, but that's entirely beside the point.

  Jp
And that's an expression, and hence perfectly legal as the body of an anonymous 
function.

So if we feel like abusing our anonymous functions, we use generator expressions 
to get if statements and for loops, sys.stdout.write() for print statements, 
sys.stdin.read() for input statements, anonymous functions for def statements, 
and throw in our own functions with lazily evaluated arguments for anything that 
isn't already covered by the interpreter core (which isn't much).

I just don't understand why people complain so much about the restriction to a 
single expression in lambdas, yet there is nary a peep about the same 
restriction for generator expressions and list comprehensions.

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Jp Calderone
On Fri, 31 Dec 2004 00:19:29 +1000, Nick Coghlan [EMAIL PROTECTED] wrote:
Jp Calderone wrote:
  On Fri, 31 Dec 2004 00:00:31 +1000, Nick Coghlan [EMAIL PROTECTED] wrote:
  
 Paul Rubin wrote:
 
 Nick Coghlan [EMAIL PROTECTED] writes:
 
 
 Anyway, I'm looking for feedback on a def-based syntax that came up in
 a recent c.l.p discussion:
 
 
 Looks like just an even more contorted version of lambda.  It doesn't
 fix lambda's main deficiency which is inability to have several
 statements in the anonymous function.
 
 Do you consider generator expressions or list comprehensions deficient 
 because 
 they don't allow several statements in the body of the for loop?
 
  
  
   (foo + bar
  ... for foo in range(13) if foo % 3 == 2
  ... for bar in range(16, 23) if 2 = bar % 5  4)
  generator object at 0xb7dec10c
   
  
Hmm.  Two for loops and two if clauses.  That's four altogether.  
  Does that qualify as several? :) Sure, they're not statements 
  according to the grammar, but that's entirely beside the point.
  
Jp
 
 And that's an expression, and hence perfectly legal as the body of an 
 anonymous 
 function.

  Quoting my response again:

 Jp Calderone wrote:
  Sure, they're not statements according to the grammar, but 
  that's entirely beside the point.

  I thought this was obvious to anyone, oh well.

  List and generator comprehensions have special syntax so that behavior 
normally acheivable only with statements can be used to control their 
execution.  Lambdas don't have any similar special syntax.

  I'm not saying boo hoo lambdas are crippled fix them waah.  I'm saying 
Lambdas and generator comprehensions are not comparable in this sense and 
arguments based on one should not be used to support positions about the 
other.

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


RE: Securing a future for anonymous functions in Python

2004-12-30 Thread Batista, Facundo
Title: RE: Securing a future for anonymous functions in Python





[Nick Coghlan]


#- I just don't understand why people complain so much about 
#- the restriction to a 
#- single _expression_ in lambdas, yet there is nary a peep about 
#- the same 
#- restriction for generator expressions and list comprehensions.


What *I* don't understand (and it could perfectly be plain ignorance, as never studied languages or computer sciences) is why anonymous functions are so important.

While I'm one of those who spend 30% of the time writing the function and 70% choosing a name for it, I never really use lambdas (except for minor cases in Tkinter buttons).

hoping-to-learn-something-new-in-the-next-mail--ly yours,


. Facundo


Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/



  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ADVERTENCIA.


La información contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener información confidencial o propietaria, cuya divulgación es sancionada por la ley.

Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no está autorizado a divulgar, copiar, distribuir o retener información (o parte de ella) contenida en este mensaje. Por favor notifíquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnético) que pueda haber realizado del mismo.

Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones Personales S.A. o alguna empresa asociada.

Los mensajes electrónicos pueden ser alterados, motivo por el cual Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje.

Muchas Gracias.



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

Re: PyQT installation

2004-12-30 Thread Nanoscalesoft
hi phil...
py--2.4
pyqt--3.3
qt--2.3.0

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


Re: portable text user interface

2004-12-30 Thread Grant Edwards
On 2004-12-30, Maxim Kasimov [EMAIL PROTECTED] wrote:

 yes i'm telneting (sshing), that is the reason why i'm looking
 for libs for making text interfaces. i know there is a project
 named anakonda - red hat linux installer, but it is uses
 specific C libs. i can use only python libs.

By only python libs do you mean only the stuff that's
included in the vanilla CPython distro?  If that's the case,
then curses is pretty much the only choice.  Last time I
looked, it didn't work on Windows.

I've used the snack module (which is what anaconda uses), and
it's very handy for simple text-based UIs.

-- 
Grant Edwards   grante Yow!  I'm having a
  at   RELIGIOUS EXPERIENCE... and
   visi.comI don't take any DRUGS
-- 
http://mail.python.org/mailman/listinfo/python-list


Want some extra cash, try this

2004-12-30 Thread adamhum
want some extra cash, try this



THIS REALLY CAN MAKE YOU EASY MONEY!!
A little while back, I was on my computer having a grand old

time, just like you are now and came across an article similar

to this that said you could make thousands dollars within weeks

with only an initial investment of $6.00! So I thought, Yeah,

right, this must be a scam, but like most of us, I was

curious, so I kept reading. Anyway, it said that you send $1.00

to each of the 6 names and address stated in the article. You

then place your own name and address in the bottom of the list

at #6, and post the article in at least 200 newsgroups. No

catch, that was it. So after thinking it over, and talking to

few people first, I thought about trying it. I figured what

have I got to lose
except 6 stamps and $6.00, right? Like most of us I was a

little skeptical and a little worried about the legal aspects

of it all, So I checked it out with the U.S. Post Office (1-

800-725-2161) and they confirmed that it is indeed legal! Then

I invested the measly $6.00. Well GUESS WHAT!!?. Within 7 days,

I started getting money in the mail! I was shocked! I figured

it would end soon, but the money just kept coming in. In my

first week, I made about $25.00. By the end second week I had

made a total over $1,000.00! In the third week I had over $10,

000.00 and it's still growing. Its Certainly worth $6.00, and 6

stamps, I have spent more than that on the lottery!! Let me

tell you how this works and most importantly, why it works?.

STEP 1: Get 6 separate pieces of paper and write the following

on each piece of paper PLEASE PUT ME ON YOUR MAILING LIST.

Now get 6 US $1.00 bills and place ONE inside EACH of the 6

pieces of paper so the bill will not be seen through the

envelope to prevent thievery. Next, place one paper in each

stating the above phrase, your name and address, and a $1.00

bill. What you are doing is creating a service by this. THIS IS

ABSOLUTELY LEGAL! Mail the 6 envelopes to the following

addresses:

#1) Jason Barone P.O. Box 1015 Glen Burnie, MD 21060-1015
#2) Jonathon Markwood 3308 Birdsong Way Birmingham, AL 35242
#3) Eben Mcgee 1876 #C Locust, Las Cruces, NM 88001
#4) Ricky DeMaio 471 McCutcheon rd, Hudson WI 54016
#5) P. Ortner 29 Briarlee Dr. Tonawanda, NY 14150
#6) O. Humphrey 8452 E. Louise Dr, Tucson, AZ 85730

STEP 2: Now take the #1 name off the list that you see above,

move the other names up
and add YOUR Name as number 6 on the list. STEP 3: Change

anything you need to, but try to keep this article as close to

original as possible. Now, post your amended article to at

least 200 newsgroups, message board. All you need is 200, but

remember, the more you post, the more money you make!
Just copy this message, paste it in Word or Notepad, find

message boards like this and paste away.

Congratulations? THAT'S IT! All you have to do is jump to

different newsgroups and post away, after you get the hang of

it, and it will take about 30 seconds for each newsgroup! *

REMEMBER, THE MORE NEWSGROUPS OR MESSAGE BOARD YOU POST IN, THE

MORE MONEY YOU EILL MAKE!! BUT YOU HAVE TO POST A MINIMUM OF

200* That's it! You will begin receiving money from around the
world within days!

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


Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread xunling
Hallo,

ich hätte da mal eine Frage zum Azureus bttrn client.

Ich habe über die homepage eine jar datei runtergeldan, in der steht
aber nicht viel drin, vielleicht nimmt sich jemand die Zeit und schaut
sie sich mal an / und oder klärt mich auf?... Kann ich die Jardatei
nicht verwenden (was ich will ist Einblick, in dem meines Wissend nach
OpenSource Code vo´n Bittorrent), Azureus deswegen, da ich glaube dass
mir JAVA ehr liegt.

hier ist der Link: http://www.geocities.com/bradbrandom/helpYO.html

mfg - xunling

Dankeschön [PS es Eilt]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQT installation

2004-12-30 Thread Phil Thompson
On Thursday 30 December 2004 2:34 pm, Nanoscalesoft wrote:
 hi phil...
 py--2.4
 pyqt--3.3

I assume you mean PyQt-win-nc-msvc-3.13.exe

 qt--2.3.0

I assume you mean the non-commercial edition.

The binaries are built against Python 2.3.3 - Python 2.4 won't work. Python 
2.4 (and later) will never be supported by the non-commercial edition because 
of the MSVC 6 vs 7 issue.

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


Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread JZ
Dnia 30 Dec 2004 07:24:45 -0800, xunling napisa(a):

 ich htte da mal eine Frage zum Azureus bttrn client.

This is not German newsgroup! Write English or none.

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


Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2004-12-30 Thread Cameron Laird
QOTW:  I found the discussion of unicode, in any python book I have,
insufficient. -- Thomas Heller

If you develop on a Mac, ... Objective-C could come in handy.  . . .
PyObjC makes mixing the two languages dead easy and more convenient than
indoor plumbing. -- Robert Kern


Among other activities, the PSF aggregates donors with dollars
destined to do good Python works, and developers expert in
obscure corners of Pythonia.

http://groups-beta.google.com/group/comp.lang.python.announce/browse_thread/thread/705bfe05419aa0b3

http://groups-beta.google.com/group/comp.lang.python.announce/browse_thread/thread/1122f3e14752ce5/

Yippee!  The martellibot promises to explain Unicode for Pythoneers.

http://groups-beta.google.com/group/comp.lang.python/msg/6015a5a05c206712

The glorious SciPy project supports *multiple* worthwhile Wikis.
http://www.scipy.org/wikis

Good style in Python does not generally include in-place
operations on lists.  Several cleaner idioms are possible.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/c94559f53d25474e

Assume you're comfortable with tuples' semantics, immutability,
and so on.  Do you correctly understand the basics of their
syntax, though?  This is another opportunity to think about
Unicode, by the way.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/990049d7adb1bcce

Robert Kern, Paul Rubin, Mike Meyer, Alex Martelli, and others
provide disproportionately high-quality advice (and tangents!)
on the subject of languages which complement Python.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bbc1c6d9d87049b6



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

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Brett Cannon continues the marvelous tradition established by 
Andrew Kuchling and Michael Hudson of intelligently summarizing
action on the python-dev mailing list once every other week.
http://www.python.org/dev/summary/

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

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

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

The Python Business Forum further[s] the interests of companies
that base their business on ... Python.
http://www.python-in-business.org

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 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/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://aspn.activestate.com/ASPN/Cookbook/Python

Among several Python-oriented RSS/RDF feeds available are
http://www.python.org/channews.rdf
http://bootleg-rss.g-blog.net/pythonware_com_daily.pcgi
http://python.de/backend.php
For more, see
http://www.syndic8.com/feedlist.php?ShowMatch=pythonShowStatus=all
The old Python To-Do List now lives principally in a
SourceForge reincarnation.

import with python -O

2004-12-30 Thread Sylvain Thenault
Hi there !

I'm usually relying on the fact that pyc file are autogenerated when
necessary (ie usually when the py file has been modified since the pyc
creation). However, it doesn't seems to work correctly when the -O option
is given to the interpreter :

[EMAIL PROTECTED]:test$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type help, copyright, credits or license for more information.
. from logilab import pylint
. pylint.__file__
'/home/syt/cvs_work/logilab/pylint/__init__.pyc'
.
[EMAIL PROTECTED]:test$ python -O
Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type help, copyright, credits or license for more information.
. from logilab import pylint
. pylint.__file__
'/usr/lib/python2.3/site-packages/logilab/pylint/__init__.pyo'

The PYTHONPATH has not changed but the interpreter seems to take the first
pyo it finds, even if there is a more recent .py file before in the python
path. Should this behaviour be considered as normal ?

-- 
Sylvain Thénault   LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org


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


Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Craig Ringer
On Thu, 2004-12-30 at 23:31, JZ wrote:
 Dnia 30 Dec 2004 07:24:45 -0800, xunling napisał(a):
 
  ich hätte da mal eine Frage zum Azureus bttrn client.
 
 This is not German newsgroup! Write English or none.

While that may be true, there are nicer ways to express the sentiment. I
don't know about you, but I frequently feel rather poorly about
demanding that others speak my language when I have no (or in this case
very, very minimal) ability to speak theirs.

The original poster's question appears to be more about the BitTorrent
client Azureus (azureus.sf.net) than Python in this case anyway. This is
probably not the right place.

--
Craig Ringer

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


[OT] Azureus Java BitTorrent client - was: Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Gerhard Haering
On Thu, Dec 30, 2004 at 07:24:45AM -0800, xunling wrote:
 Hallo,
 
 ich hätte da mal eine Frage zum Azureus bttrn client. [...]

[I'd have a question about the Azureus BitTorrent client.]

While the original BitTorrent is implemented in Python, this is not
the right mailing list/newsgruop for Java BitTorrent clients.

The Azureus homepage has a guide on how to get it running on various
operating systems. Perhaps these instructions will help you:
http://azureus.sourceforge.net/howto_win.php

-- Gerhard


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Aahz
In article [EMAIL PROTECTED],
Steve Holden  [EMAIL PROTECTED] wrote:

With respect it wouldn't, since IDLE doesn;t include a GUI builder. I 
think Mike's cri-de-couer is for a tool that makes it as easy as Visual 
Studio to put a GUI-based application together.

Should the Python community really care about this, I suspect Eclipse
might be the best way.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

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


Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Gerhard Haering
On Fri, Dec 31, 2004 at 12:02:24AM +0800, Craig Ringer wrote:
 On Thu, 2004-12-30 at 23:31, JZ wrote:
  Dnia 30 Dec 2004 07:24:45 -0800, xunling napisa??(a):
  
   ich hätte da mal eine Frage zum Azureus bttrn client.
  
  This is not German newsgroup! Write English or none.
 
 While that may be true, there are nicer ways to express the
 sentiment. I don't know about you, but I frequently feel rather
 poorly about demanding that others speak my language when I have no
 (or in this case very, very minimal) ability to speak theirs. [...]

I can understand your emotions here. OTOH it's typical for Germans
(and even more so French) to assume that everybody speaks their
language. And if they don't, to make an effort to figure out what the
heck they want. I'm sure it's not only not knowing the medium and
environment [*], but also plain arrogance.

-- Gerhard

[*] The very minimum of netiquette would require to read a few
messages in the newsgroup/mailing list and check what it is about and
in what language it is.


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Steve Holden
Aahz wrote:
In article [EMAIL PROTECTED],
Steve Holden  [EMAIL PROTECTED] wrote:
With respect it wouldn't, since IDLE doesn;t include a GUI builder. I 
think Mike's cri-de-couer is for a tool that makes it as easy as Visual 
Studio to put a GUI-based application together.

Should the Python community really care about this, I suspect Eclipse
might be the best way.
If Eclipse really is the answer I'll have to learn more about it, but 
from the little I know so far it seems like a very heavyweight solution. 
Not that Visual Studio is becomingly trim, of course - it's a fine 
example of bloatware, but it does do a useful job as a GUI builder. 
Perhaps there's a lesson somewhere in there ...

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: PyQT installation

2004-12-30 Thread Steve Holden
Phil Thompson wrote:
On Thursday 30 December 2004 2:34 pm, Nanoscalesoft wrote:
hi phil...
py--2.4
pyqt--3.3

I assume you mean PyQt-win-nc-msvc-3.13.exe

qt--2.3.0

I assume you mean the non-commercial edition.
The binaries are built against Python 2.3.3 - Python 2.4 won't work. Python 
2.4 (and later) will never be supported by the non-commercial edition because 
of the MSVC 6 vs 7 issue.

Phil
If that is a real *never* then Qt just fell behind in the what's the 
best GUI platform stakes. It'd be a shame to lose PyQT, but if there's 
no way to migrate it forwards it will atrophy and die. Have TrollTech 
said they will never issue MSVC 7 binaries?

Is there no way to use the free Microsoft toolchain to compile, or do 
the language differences just make the whole deal too difficult (or is 
there some other show-stopper that my ignorance prevents me from seeing?).

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


UK Python Conference - 20-23 April 2005 - Last Call for talks

2004-12-30 Thread pyuk2005
The UK Python Conference for 2005 will take place at
the Randolph Hotel, Oxford on 20-23 April 2005.

This is the FINAL CALL for talks.  The original deadline
of 26th December has been extended to 6 January, to help
all those folks who were concentrating on the PyCon deadline
of 30th December.  Recycled PyCon talks are acceptable.


About the event
===
This will once again be held as a track within the ACCU
conference.  The conference site is here:
   http://www.accu.org/conference/

Python track information will be reachable from here once
talk selection is complete:
 http://www.accu.org/conference/highlights.html#python


The ACCU event is one of the foremost conferences for programmers,
attracting the inventors and/or leading proponents of C, C++,
Java, .NET and Python over the last few years.  Past Python speakers
have included Guido van Rossum, David Ascher, Alex Martelli, Armin Rigo,
Paul Everitt, Marc-Andre Lemburg and many others, and the
ACCU now treats Python as being fully on par with Java and C++.
The event is priced midway between commercial and community
events, at approx. £100 per day, and is professionally managed.

It is located in a historic hotel in the centre of Oxford and is
ideal for anyone wanting to combine a holiday with a conference.

We aim to hold a Python 'masterclass' the day before, and are working
to arrange a PyPy sprint the week after.


Conference Format
=
The Python conference will span THREE days, with ONE track.
The first slot each morning is taken by the cross-conference
keynote. This was the overwhelming preference of those we polled
last year. (There will NOT be a separate Open Source track this
year; the rotating special subject is Security. As a result,
Python-related security talks would be of interest)

You may propose 90 minute or 45 minute talks. The
ACCU's general preference is for a small number of high
quality, well prepared talks on subjects of broad interest
to programmers, and the Python track will follow this.
There will also be space for less formal lunchtime talks,
evening BOFs and other events.

Speakers' compensation is yet to be confirmed, but in the
past those doing 90 minutes (or 2x45 minute talks) will be
eligible for 4 days paid accomodation and admission to
the 4 day event; 45 minute speakers will gain 1 day's admission.
Where possible, we will attempt to allocate resources to ensure
that the best speakers are able to attend irrespective of
circumstances.


Submission Procedure
===
Please send an email to pyuk2005_talks at reportlab.com
not later than 6th January (this is the FINAL deadline!),
with the following information:
  Your Name
  Short Biography
  Talk Title
  Talk Synopsis

This is a simple mailbox; the committee will review and
acknowledge submissions next week.
If the talk is selected, you will be given a chance to refine
the details through a web based system in January.


Committee
=
A small committee has been formed to scrutinize talk proposals
including those whol volunteered last year. This includes
myself, Dr. Tim Couper and Dr. John Lee.  General discussion about
the event should be directed to the python-uk list
(python-uk at python.org)

ReportLab Europe Ltd. is managing parts of the event infrastructure
and will be providing some staff time to provide a guaranteed
point of contact.


---

Best Regards


Andy Robinson
CEO/Chief Architect
ReportLab Europe Ltd
tel +44-20-8544-8049

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


Re: import with python -O

2004-12-30 Thread Sylvain Thenault
On Thu, 30 Dec 2004 16:56:17 +0100, Sylvain Thenault wrote:

 Hi there !
 
 I'm usually relying on the fact that pyc file are autogenerated when
 necessary (ie usually when the py file has been modified since the pyc
 creation). However, it doesn't seems to work correctly when the -O option
 is given to the interpreter :
 
 [EMAIL PROTECTED]:test$ python
 Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
 [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
 Type help, copyright, credits or license for more information.
 . from logilab import pylint
 . pylint.__file__
 '/home/syt/cvs_work/logilab/pylint/__init__.pyc'
 .
 [EMAIL PROTECTED]:test$ python -O
 Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
 [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
 Type help, copyright, credits or license for more information.
 . from logilab import pylint
 . pylint.__file__
 '/usr/lib/python2.3/site-packages/logilab/pylint/__init__.pyo'
 
 The PYTHONPATH has not changed but the interpreter seems to take the first
 pyo it finds, even if there is a more recent .py file before in the python
 path. Should this behaviour be considered as normal ?

ok, my fault... The problem was that the logilab subdirectory didn't have
anymore the __init__.py file, but only the __init__.pyc file. Adding it
fix the problem.
Thank you four your attention.

-- 
Sylvain Thénault   LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org


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


Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Steve Holden
JZ wrote:
Dnia 30 Dec 2004 07:24:45 -0800, xunling napisa(a):

ich htte da mal eine Frage zum Azureus bttrn client.

This is not German newsgroup! Write English or none.
Perhaps not, but can we say International? There is no rule requiring 
the use of any particular language on c.l.py, and I can certainly 
remember both French and Esperanto threads in the past. Ease up, it's 
hard enough if you're German ;-)

be-polite-or-don't-write-ly y'rs  - steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread JoeG
I use your book a lot so another version would be helpful.  I know I'll
buy a copy.  Heck, I'd pay you money just to have access to the draft
while you write it.

One suggestion I have is to include chapters that expand on test based
development and lazy functions.  Maybe you could go into some of the
concepts and methods used in the Zope3 project.  That would be useful
to me because I've been reading a lot about  it but still can't seem to
grok any of it.  It's really hard to learn new concepts from books - no
matter how well written.  I usually need to read several different
sources from different authors to get a decent picture.

That gives me an idea for a perfect book.  Take a single short subject
- say doctest.  Get three or four experts to independently write
chapter.  Then combine the chapters into a section.  That way I could
buy one book and get the different perspectives I need to really
understand the subject.

You could keep the books small and inexpensive.  Twenty bucks and 100
to 200 pages.  It would keep the book projects small and specific and
with four people working separately, they could be cranked out quickly.
Combine them all together and you've got a library.

Well anyway, it's probably beyond the scope of your update but I'd like
to see someone do it. Unlike a lot of authors, I can understand most of
what you write.

I've been working with Python for about a year and I still feel like a
beginner.  That probably gives me a different perspective than most of
the people you'll hear from.  I disagree with your Tkinter vs. wxPython
decision.  I tried a number of programs written with Tkinter and really
didn't like the interface.  The program I helped develop is Windows
based and I knew that a program with the Tkinter interface would never
work as a cross platform environment.  Out existing customers just
wouldn't accept it.   I can't see anyone using Tkinter for new mass
market development.  If you've already got an application written with
it you might want to continue using it but for new projects, wxPython
seems to have some BIG advantages.

wxPython takes on more of the native platform's interface.  I say seems
to because I haven't actually written any code with it.

These are just my opinions.  I've been programming for  over twenty
years now so I do have some perspective on the market even if I don't
have much expertise with Linux or Python development.

Good luck with your update.  Let me know when it's published and I'll
buy a copy.

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


Re: Why would I use inspect.isclass()?

2004-12-30 Thread It's me
Steve,

You are correct that I worry too much about types.   It's *really* hard not
to - having so many years of C in my head (and I am not exactly a
programmer).

I realize that if you don't understand duck typing, you don't really
understand Python - and that's why I am struggling to learn about this.

It's hard to writing a routine and not thinking what kind of parameters will
be passed down from above.  In the old days, we go out of the way to do that
so programs don't fail in mysterous ways.


Steve Holden [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 it's me wrote:

  Okay, Nick, I didn't know you can pass a Class rather then an
instance.  I
  have to chew on what your example does.
 
  But no, I want to pass an instance of a Class.  But how do I know that
the
  calling routine *did* pass me a class - pardon me: an instance of a
Class?
 
 You should Google for duck typing and stop worrying so much about what
 your functions//methods have been passed.

 At least, that's the traditional Python approach. I suspect you are
 still trying to program in C in Python :-)

 regards
   Steve
 -- 
 Steve Holden   http://www.holdenweb.com/
 Python Web Programming  http://pydish.holdenweb.com/
 Holden Web LLC  +1 703 861 4237  +1 800 494 3119


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


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread mrkurt
Steve Holden wrote:
Aahz wrote:
In article [EMAIL PROTECTED],
Steve Holden  [EMAIL PROTECTED] wrote:
With respect it wouldn't, since IDLE doesn;t include a GUI builder. I 
think Mike's cri-de-couer is for a tool that makes it as easy as 
Visual Studio to put a GUI-based application together.

Should the Python community really care about this, I suspect Eclipse
might be the best way.

If Eclipse really is the answer I'll have to learn more about it, but 
from the little I know so far it seems like a very heavyweight solution. 
Not that Visual Studio is becomingly trim, of course - it's a fine 
example of bloatware, but it does do a useful job as a GUI builder. 
Perhaps there's a lesson somewhere in there ...

regards
 Steve
About the closest thing to what Mike might want is Boa Constructor, 
which does have a GUI building tool.  It is not as polished as the 
Visual Studio GUI builder, but there are a lot of controls there that 
can be used.  It requires the wxWindows toolkit.

BTW, has anyone used or tried WingIDE?  It does look like a really 
polished product.

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


Re: PyQT installation

2004-12-30 Thread Phil Thompson
On Thursday 30 December 2004 4:13 pm, Steve Holden wrote:
 Phil Thompson wrote:
  On Thursday 30 December 2004 2:34 pm, Nanoscalesoft wrote:
 hi phil...
 py--2.4
 pyqt--3.3
 
  I assume you mean PyQt-win-nc-msvc-3.13.exe
 
 qt--2.3.0
 
  I assume you mean the non-commercial edition.
 
  The binaries are built against Python 2.3.3 - Python 2.4 won't work.
  Python 2.4 (and later) will never be supported by the non-commercial
  edition because of the MSVC 6 vs 7 issue.
 
  Phil

 If that is a real *never* then Qt just fell behind in the what's the
 best GUI platform stakes. It'd be a shame to lose PyQT, but if there's
 no way to migrate it forwards it will atrophy and die. Have TrollTech
 said they will never issue MSVC 7 binaries?

 Is there no way to use the free Microsoft toolchain to compile, or do
 the language differences just make the whole deal too difficult (or is
 there some other show-stopper that my ignorance prevents me from seeing?).

You've completely misunderstood what I said.

I specifically said the non-commercial edition. This is a binary only version 
based on Qt v2.3 and released in March 2001 - the first beta of Qt v4.0 has 
just been released. The commercial and GPL versions of Qt is supplied in 
source form and supports MSVC 6, 7, Borland, Cygwin and the Intel compiler. 
PyQt supports all versions of Python since v1.5.2.

I think Qt is doing very well in the best GUI platform stakes if people 
still want to use a 4 year old version in preference to up to date versions 
of the alternatives.

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


Re: PyQT installation

2004-12-30 Thread Jorge Luiz Godoy Filho
Steve Holden, Quinta 30 Dezembro 2004 14:13, wrote:

 If that is a real *never* then Qt just fell behind in the what's the
 best GUI platform stakes. It'd be a shame to lose PyQT, but if there's
 no way to migrate it forwards it will atrophy and die. Have TrollTech
 said they will never issue MSVC 7 binaries?

non-commercial binaries he said...  I hope it is just the non-commercial
really, 'cause the look  feel of Qt is very nice.
 
 Is there no way to use the free Microsoft toolchain to compile, or do
 the language differences just make the whole deal too difficult (or is
 there some other show-stopper that my ignorance prevents me from seeing?).

Isn't it possible to compile everything with a free compiler?  I'm not a
Windows user, but... :-)


-- 
Godoy. [EMAIL PROTECTED]

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


Re: portable text user interface

2004-12-30 Thread Maxim Kasimov
Grant Edwards wrote:
On 2004-12-30, Maxim Kasimov [EMAIL PROTECTED] wrote:

yes i'm telneting (sshing), that is the reason why i'm looking
for libs for making text interfaces. i know there is a project
named anakonda - red hat linux installer, but it is uses
specific C libs. i can use only python libs.

By only python libs do you mean only the stuff that's
included in the vanilla CPython distro?  If that's the case,
then curses is pretty much the only choice.  Last time I
looked, it didn't work on Windows.
I've used the snack module (which is what anaconda uses), and
it's very handy for simple text-based UIs.
at ports (FreeBSD) i've found this:
  Port:   snack-2.2.7
  Path:   /usr/ports/audio/snack
  Info:   A sound toolkit for scripting languages
and at http://rpmfind.net i've found: sound extension for Tcl/Tk and Python
so if it's about http://www.speech.kth.se/snack/
not sure is it what i need but will try and thanks for help.
--
Best regards,
Maxim
--
http://mail.python.org/mailman/listinfo/python-list


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread mrkurt
mrkurt wrote:
Steve Holden wrote:
Aahz wrote:
In article [EMAIL PROTECTED],
Steve Holden  [EMAIL PROTECTED] wrote:
With respect it wouldn't, since IDLE doesn;t include a GUI builder. 
I think Mike's cri-de-couer is for a tool that makes it as easy as 
Visual Studio to put a GUI-based application together.


Should the Python community really care about this, I suspect Eclipse
might be the best way.

If Eclipse really is the answer I'll have to learn more about it, but 
from the little I know so far it seems like a very heavyweight 
solution. Not that Visual Studio is becomingly trim, of course - it's 
a fine example of bloatware, but it does do a useful job as a GUI 
builder. Perhaps there's a lesson somewhere in there ...

regards
 Steve
About the closest thing to what Mike might want is Boa Constructor, 
which does have a GUI building tool.  It is not as polished as the 
Visual Studio GUI builder, but there are a lot of controls there that 
can be used.  It requires the wxWindows toolkit.
Some self-correction:
Sorry, I meant to call them widgets, not controls.  And Boa 
Constructor needs wxPython, which comes with wxWindows.
BTW, has anyone used or tried WingIDE?  It does look like a really 
polished product.

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


The Industry choice

2004-12-30 Thread Sridhar R
From technical point of view, I could not understand the the reasoning
behind using Java in major companies.  Sure that Python, is used in
some, but still Java is considered as a sure-job language.

After being a python programmer for long time, I consider it painful to
learn/use Java now (well, like many I will be forced to do that in my
job).

What makes such companies to choose Java over dynamic, productive
languages like Python?  Are there any viable, technical reasons for
that?

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


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Jorge Luiz Godoy Filho
mrkurt, Quinta 30 Dezembro 2004 14:39, wrote:

 About the closest thing to what Mike might want is Boa Constructor,
 which does have a GUI building tool.  It is not as polished as the
 Visual Studio GUI builder, but there are a lot of controls there that
 can be used.  It requires the wxWindows toolkit.

It has another advantage as well: it can be improved by *us*, the community.  

I am looking at Eclipse for a while and it is interesting, but too heavy,
indeed.  
 

-- 
Godoy. [EMAIL PROTECTED]

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


Re: Why tuples use parentheses ()'s instead of something else like 's?

2004-12-30 Thread Alex Martelli
John Roth [EMAIL PROTECTED] wrote:
   ...
 and division. We've allowed ourselves to be limited by the
 ASCII character set for so long that improving that seems to be
 outside of most people's boxes.

APL didn't allow itself to be limited that way.  Anybody who's used it
can hardly be accused to keep non-ASCII characters outside their box.

And, you know what?  Despite being an old APL user, I think would be a
_disaster_ for Python to go that route.  Yes, ASCII imposes design
constraints.  But constraints can be a good and helpful thing.  Look for
example at what classical architects and sculptors DID, within horrible
technical constraints on materials and methods, and compare it with
artsy modern architecture, which can use an enormously wider palette of
technical approaches and materials... I think a tiny minority of today's
architecture and sculpture can rightfully be compared with the
masterpieces of millennia past.  Similarly, highly constrained forms
such as sonnet or haiku can unchain a poet's creativity in part BECAUSE
of the strict constraints they impose wrt free verse or prose...

Back to feet-on-ground issues, mandating a wider-than-ASCII character
set would horribly limit the set of devices, as well as of software
tools, usable with/for Python -- I love the fact that Python runs on
cellphones, for example.  Input methods for characters outside the ASCII
set are always a bother, particularly to the touch-typist: even to enter
Italian accented vowels, on this US keyboard, I have to go through
definitely eccessive gyrations, which horribly slow down my usually very
fast typing.  Seeing what you're doing can sometimes be a bother too:
you need to ensure the glyphs for all the characters you need are
readable _and distinguishable_ in whatever font you're using.


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


Re: PyQT installation

2004-12-30 Thread Nanoscalesoft
does that mean PyQT is not forward What a bad thing is this...

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


Re: build a static executable program with python

2004-12-30 Thread Torsten Mohr
Hi,

thank you very much for that detailled description.
I will try to get as far as i can with this information and
get back to you if i have any questions.


Thanks a lot,
Torsten.

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


Re: build a static executable program with python

2004-12-30 Thread Torsten Mohr
Hi Adal,

can you send me your mail address?  I think the one in your
posting is a spam stopper.


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


Re: Why tuples use parentheses ()'s instead of something else like 's?

2004-12-30 Thread Alex Martelli
Dan Sommers [EMAIL PROTECTED] wrote:
   ...
  I was pretty sure that « and » were guillmots, but google sure
  preferred the sea bird when I asked it.
 
 They're guillemets (with an e); this is a [relatively] well-known
 Adobe SNAFU.  (A quick google search or two failed to find an
 authoritative reference, but I know that such references are out there
 somewhere.)

Ameritan Heritage dictionary:


SYLLABICATION:
guil·le·met

PRONUNCIATION:
  gl-mt, g--m

NOUN:
 Either of a pair of punctuation marks («) or (») used in some
languages, such as French and Russian, to mark the beginning and end of
a quotation.


SYLLABICATION:
guil·le·mot

PRONUNCIATION:
  gl-mt

NOUN:
 Any of several auks of the genus Cepphus, having black plumage with
white markings.


Both come from the French name Guillaume (William), but they happened
to pass into English with slightly different spellings.  (I find
American Heritage to be a very authoritative reference -- I just love
it!-).


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


Re: Why tuples use parentheses ()'s instead of something else like 's?

2004-12-30 Thread Alex Martelli
Jeff Shannon [EMAIL PROTECTED] wrote:
   ...
 to remember and type some arcane alt-keycode formula to be able to do
 basic scripting would be obnoxious, to say the least.  Most keyboards
 worldwide provide decent support for the ASCII character set (though 
 some add a few extra national characters).  Perhaps things will change

Italian-layout support for braces is the pits (alt-keycodes ahoy): one
way I managed to get a local friend interested in Python was to point
out that he'd neved NEED to type braces (calling `dict' is just as good
a way to make dictionaries, as braces-laden `dict display' forms;-).


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


OT: novice regular expression question

2004-12-30 Thread It's me
I am never very good with regular expressions.  My head always hurts
whenever I need to use it.

I need to read a data file and parse each data record.  Each item on the
data record begins with either a string, or a list of strings.  I searched
around and didn't see any existing Python packages that does that.
scanf.py, for instance, can do standard items but doesn't know about list.
So, I figure I might have to write a lex engine for it and of course I have
to deal wit RE again.

But I run into problem right from the start.   To recognize a list, I need a
RE for the string:

1) begin with [  (left bracket followed by a double quote with zero or more
spaces in between)
2) followed by any characters until ] but only if that left bracket is not
preceeded by the escape character \.

So, I tried:

^\[[ ]*[a-z,A-Z\,, ]*(\\\])*[a-z,A-Z\,, \]*]

and tested with:

[This line\] works]

but it fails with:

[This line fails]

I would have thought that:

   (\\\])*

should work because it's zero or more incidence of the pattern \]

Any help is greatly appreciated.

Sorry for beign OT.  I posted this question at the lex group and didn't get
any response.  I figure may be somebody would know around here.


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


Re: Problem in threading

2004-12-30 Thread David Bolen
It's me [EMAIL PROTECTED] writes:

 It depends on what help means to you.   Both Windows and Unix (and it's
 variances) are considered thread-weak OSes.  So, using thread will come
 with some cost.   The long gone IBM OS/2 is a classic example of a
 thread-strong OS.
(...)

Interesting - can you clarify what you perceive as the differences
between a thread-weak and thread-strong OS?  If given the choice, I
would probably refer to Windows (at least NT based systems, let's
ignore 9x) as thread-strong, and yes, often think of Windows as
preferring thread based solutions, while Unix would often prefer
process based.

Windows is far more efficient at handling large numbers of threads
than it is processes, with much less overhead and there is lots of
flexibility in terms of managing threads and their resources.  Threads
are first class OS objects at the kernel and scheduler level (waitable
and manageable).

I can't think of anything offhand specific that OS/2 did with respect
to threads that isn't as well supported by current Win32 systems.

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


Re: Problem in threading

2004-12-30 Thread It's me
That's an OT topic.   :=)

There were lots of discussions about this topic in the old days.   No need
to dive into it again.

Windows context switching overhead is very high.   You would be lucky to get
it down to the mid-30ms.   OS/2 can get it down to less then 10.   And for
OS/2, thread swithing time is only a few machine instructionsOT.OT.


David Bolen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 It's me [EMAIL PROTECTED] writes:

  It depends on what help means to you.   Both Windows and Unix (and
it's
  variances) are considered thread-weak OSes.  So, using thread will
come
  with some cost.   The long gone IBM OS/2 is a classic example of a
  thread-strong OS.
 (...)

 Interesting - can you clarify what you perceive as the differences
 between a thread-weak and thread-strong OS?  If given the choice, I
 would probably refer to Windows (at least NT based systems, let's
 ignore 9x) as thread-strong, and yes, often think of Windows as
 preferring thread based solutions, while Unix would often prefer
 process based.

 Windows is far more efficient at handling large numbers of threads
 than it is processes, with much less overhead and there is lots of
 flexibility in terms of managing threads and their resources.  Threads
 are first class OS objects at the kernel and scheduler level (waitable
 and manageable).

 I can't think of anything offhand specific that OS/2 did with respect
 to threads that isn't as well supported by current Win32 systems.

 -- David


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


Using pyclbr

2004-12-30 Thread Ed Leafe
	I've been playing around with pyclbr today, and it does what I need it 
to do. The only problem is that it seems r-e-e-e-a-a-a-a-l-l-l-l-y-y-y 
slow! I called pyclbr.readmodule() with a file that was about 2K in 
size, and which contained only two classes. That call took over 12 
seconds to complete! I tried also passing the optional path to the 
module, but it had no effect on the speed. Is this normal? Is there 
anything I can do to improve performance?

I'm running Python 2.3.4 on Mac OS X 10.3.
 ___/
/
   __/
  /
 /
 Ed Leafe
 http://leafe.com/
 http://dabodev.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2004-12-30 Thread Premshree Pillai
On 30 Dec 2004 08:58:36 -0800, Sridhar  R [EMAIL PROTECTED] wrote:
 From technical point of view, I could not understand the the reasoning
 behind using Java in major companies.  Sure that Python, is used in
 some, but still Java is considered as a sure-job language.

It certainly is not because Python is bad or something. Organizations
typically take lot of time to change -- be it technology or office
furniture.

We either need time for folks to accept dynamic, scripting
languages, or a lot of modern language programmers need to gang up
against managers and stuff. :)

 
 After being a python programmer for long time, I consider it painful to
 learn/use Java now (well, like many I will be forced to do that in my
 job).
 
 What makes such companies to choose Java over dynamic, productive
 languages like Python?  Are there any viable, technical reasons for
 that?
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 


-- 
Premshree Pillai
http://www.livejournal.com/~premshree
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a better way of listing Windows shares other than using os.listdir

2004-12-30 Thread David Bolen
[EMAIL PROTECTED] writes:

 I'm currently using os.listdir to obtain the contents of some slow Windows
 shares.  I think I've seen another way of doing this using the win32 library
 but I can't find the example anymore.

Do you want the list of files on the shares or the list of shares
itself?  If the files, you can use something like FindFiles, but I
don't expect it to be that much faster just to obtain directory names
(likely the overhead is on the network).

If you just want a list of shares, you could use NetUseEnum, which
should be pretty speedy.

(FindFiles is wrapped by win32api, and NetUseEnum by win32net, both parts
 of the pywin32 package)

Here's a short example of displaying equivalent output to the net
use command:

  - - - - - - - - - - - - - - - - - - - - - - - - -
import win32net

status = {0 : 'Ok',
  1 : 'Paused',
  2 : 'Disconnected',
  3 : 'Network Error',
  4 : 'Connected',
  5 : 'Reconnected'}

resume = 0
while 1:
(results, total, resume) = win32net.NetUseEnum(None, 1, resume)
for use in results:
print '%-15s %-5s %s' % (status.get(use['status'], 'Unknown'),
 use['local'],
 use['remote'])
if not resume:
break
  - - - - - - - - - - - - - - - - - - - - - - - - -

Details on the the arguments to NetUseEnum can be found in MSDN (with
any pywin32 specifics in the pywin32 documentation).

 My main problem with using os.listdir is that it hangs my gui application.
 The tread running the os.listdir appears to block all other threads when
 it calls this function.

Yes, for a GUI you need to keep your main GUI thread always responsive
(e.g., don't do any blocking operations).

There are a number of alternatives to handling a long processing task
in a GUI application, dependent on both the operation and toolkit in
use.  For wxPython, http://wiki.wxpython.org/index.cgi/LongRunningTasks
covers several of the options (and the theory behind them is generally
portable to other toolkits although implementation will change).

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


Re: portable text user interface

2004-12-30 Thread Grant Edwards
On 2004-12-30, Maxim Kasimov [EMAIL PROTECTED] wrote:

yes i'm telneting (sshing), that is the reason why i'm looking
for libs for making text interfaces. i know there is a project
named anakonda - red hat linux installer, but it is uses
specific C libs. i can use only python libs.
 
 By only python libs do you mean only the stuff that's
 included in the vanilla CPython distro?  If that's the case,
 then curses is pretty much the only choice.  Last time I
 looked, it didn't work on Windows.
 
 I've used the snack module (which is what anaconda uses), and
 it's very handy for simple text-based UIs.
 
 at ports (FreeBSD) i've found this:
Port:   snack-2.2.7
Path:   /usr/ports/audio/snack
Info:   A sound toolkit for scripting languages

Unfortunately there are two modules with the same name. The one
you found is a sound library.  

The other one is the Python wrapped version of the newt
library.  I've no idea why the Python newt module is called
snack.  The new source code comes with the Python snack
module wrapper.

The most recent version I have handy is available at

  ftp://ftp.visi.com/users/grante/stuff/newt-0.50.tar.gz

There appear to be more recent versions available:

  http://rpmfind.net/linux/RPM/fedora/3/i386/newt-0.51.6-5.i386.html
  http://linux.maruhn.com/sec/newt.html
  http://www.freshports.org/devel/newt
  
There's a rather outdated tutorial on using Newt v0.30 from C:

  http://www.oksid.ch/gnewt/tutorial.html

Newt requires the s-lang library:

  http://www.s-lang.org/

-- 
Grant Edwards   grante Yow!  Imagine--a WORLD
  at   without POODLES...
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why would I use inspect.isclass()?

2004-12-30 Thread Steve Holden
It's me wrote (top posting as usual, but we won't make a big song and 
dance about that[1] :-):

Steve,
You are correct that I worry too much about types.   It's *really* hard not
to - having so many years of C in my head (and I am not exactly a
programmer).
I realize that if you don't understand duck typing, you don't really
understand Python - and that's why I am struggling to learn about this.
Well the basic idea is treat what you've been passed as though it is 
the type you wanted. When it's only you writing the code that's likely 
going to be the case. When it's others, you have to be a little more 
careful to catch the exceptions (except when you don;t bother, in which 
case the users will have to understand the tracebacks).

It's hard to writing a routine and not thinking what kind of parameters will
be passed down from above.  In the old days, we go out of the way to do that
so programs don't fail in mysterous ways.
Don't worry. Soon you will understand the Way of Python, and all will 
become clear :-)

probably-won't-stop-you-top-posting-though-ly y'rs  - steve
[1] OK, so I lied.
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


More baby squeaking - iterators in a class

2004-12-30 Thread Bulba!
Hello Mr Everyone,

From:
http://docs.python.org/tut/node11.html#SECTION001190

Define a __iter__() method which returns an object with a next()
method. If the class defines next(), then __iter__() can just return
self:

The thing is, I tried to define __iter__() directly without explicit 
defining next (after all, the conclusion from this passage should
be that it's possible).


class R:
def __init__(self, d):
self.d=d
self.i=len(d)
def __iter__(self):
if self.i == 0:
raise StopIteration
self.i -= 1
return self.d[self.i]


 s=R('spam')

 dir(s)
['__doc__', '__init__', '__iter__', '__module__', 'd', 'i']

Apparently no, there is no next() method. Let's see
if iterator works:

 s.__iter__()
'm'
 s.__iter__()
'a'
 s.__iter__()
'p'
 s.__iter__()
's'
 s.__iter__()
Traceback (most recent call last):
  File interactive input, line 1, in ?
  File interactive input, line 7, in __iter__
StopIteration

OK, this part works. But this:

 s=R('spam')
 for i in s:
print i

Traceback (most recent call last):
  File interactive input, line 1, in ?
TypeError: __iter__ returned non-iterator of type 'str'

So which is it? Does next() method HAS to be defined
explicitly? That's what Wikipedia says:

http://en.wikipedia.org/wiki/Iterator#Python

Any user defined class can support standard iteration (either
implicit or explicit) by defining an __iter__() method which creates
an iterator object. The iterator object then needs to define both an
__iter__() method as well as a next() method.




--
It's a man's life in a Python Programming Association.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what would you like to see in a 2nd edition Nutshell?

2004-12-30 Thread Michael Bernstein
Aside from negative indices, I'd also suggest a small (and rather
obvious) example for replacing a substring:
 s='spam'
 s=s[:1]+'xx'+s[3:]
 s
'sxxm'


- Michael

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


Re: standard IDE in python 3000 (or beyond)? *semi-newbie*

2004-12-30 Thread Steve Holden
mrkurt wrote:
[...]
BTW, has anyone used or tried WingIDE?  It does look like a really 
polished product.

Yes, I'm a very happy WingIDE user. It has no GUI builder, but it's very 
impressive in letting you debug windowed programs. Only yesterday I was 
setting breakpoints in a PythonCard interface. Well worth the dosh, IMHO.

regards
 Steve
--
Steve Holden   http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC  +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2004-12-30 Thread Michael Spencer
Nick Coghlan wrote:
GvR has commented that he want to get rid of the lambda keyword for 
Python 3.0. Getting rid of lambda seems like a worthy goal, but I'd 
prefer to see it dropped in favour of a different syntax, rather than 
completely losing the ability to have anonymous functions.

Anyway, I'm looking for feedback on a def-based syntax that came up in a 
recent c.l.p discussion:
http://boredomandlaziness.skystorm.net/2004/12/anonymous-functions-in-python.html 
...
The proposed syntax is:
accepts_func((def (a, b, c) to f(a) + g(b) - h(c)))
...
Cheers,
Nick.
From the blog Comments:
Nick said...
A potentially easier to parse version moves the argument list to the 
end of the anonymous function and uses the existing keyword 'from'. That is:
(def f(a) + g(b) - h(c) from (a, b, c))
11:46 PM   

Post a Comment

This alternative syntax seems more elegant to me because of the similarity with 
 generator expressions.  But the 'def' still seems awkward.

Idle speculation
Isn't the important point that the arguments have delayed evaluation?  If so, 
the syntax could highlight this instead: i.e.,

(f(a) + g(b) - h(c) from args(a, b, c))
and, in general:
(expression from args(a, *args, **kw))
while we're at it, perhaps 'for' would be more appropriate:
(expression for args(a, *args, **kw))

I also wonder if a callable, args, that stored its argument list for delayed 
evaluation would have other applications besides anonymous functions, but that 
is another topic

/Idle speculation
Michael Spencer




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


  1   2   >