saving a text file

2005-02-14 Thread Jan Rienyer Gadil
any idea how to automatically save to a text file?
here's what the program do:

first, data is read from the serial port every fixed lenght of time
the data will then be put to a table,
now, every serial read, a table will be created for the data that will
be gathered (one window for each table)
to avoid showing in too many windows, each table will be automatically
saved as a txt file after every 5 tables created.
the txt file will be named after the time it was taken (say from the
system clock)

thanks for your help and more power...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: custom classes in sets

2005-02-14 Thread vegetax
Steven Bethard wrote:

> vegetax wrote:
>> How can i make my custom class an element of a set?
>> 
>> class Cfile:
>>   def __init__(s,path): s.path = path
>> 
>>   def __eq__(s,other):
>>print 'inside equals'
>>return not os.popen('cmp %s %s' % (s.path,other.path)).read()
>> 
>>   def __hashcode__(s): return s.path.__hashcode__()
>> 
>> the idea is that it accepts file paths and construct a set of unique
>> files (the command "cmp" compares files byte by byte.),the files can
>> have different paths but the same content
>> 
>> but the method __eq__ is never called
> 
> Seems to be called fine for me:
> 
> py> class Cfile:
> ... def __eq__(self, other):
> ... print 'inside equals'
> ... return False
> ... def __hash__(self):
> ... return 0
> ...
> py> {Cfile():1, Cfile():2}
> inside equals
> {<__main__.Cfile instance at 0x01166490>: 1, <__main__.Cfile instance at
> 0x01166760>: 2}
> 
> Note that __eq__ won't be called if the hashes are different:

I just tried and it wont be called =(, so how can i generate a hash code for
the CFile class? note that the comparitions(__eq__) are done based on the
contents of a file using the command 'cmp', i guess thats not posible but 
thanks.

 


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


Re: ANN: pyMinGW support for Python 2.3.5 (final) is available

2005-02-14 Thread A.B., Khalid
Nick Craig-Wood wrote:
> A.B., Khalid <[EMAIL PROTECTED]> wrote:
> >  This is to inform those interested in compiling Python in MinGW
that
> >  an updated version of pyMinGW is now available.
>
> Ha anyone tried cross compiling python with mingw?  At work we
compile
> our software for lots of platforms (including windows) on a linux
> build host.  The windows builds are done with a mingw cross compiler.
> It would be interesting if we could do this with python + extensions
> also.
>
> --
> Nick Craig-Wood <[EMAIL PROTECTED]> --
http://www.craig-wood.com/nick


Hello Nick,


I haven't tried it; but could this be of any help?

http://tinyurl.com/58n5k

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


Re: Pythonic poker client

2005-02-14 Thread Efrat Regev
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> My PC finally went belly up last week and I'm looking forward to
> playing with my new Mac. However, I play a bit of online poker, and
> there is no Mac client for my poker room.
>
> Ideally, instead of running Virtual PC, I'd much rather build a custom
> poker client with Python. It's an idea I've been kicking around for a
> while, as it would let me create logs and better analyze my playing.
> I'm hoping it would also help me improve my Python coding skills.
>
> I've mostly done web development, so I'm a little out of my element
> here, but I would certainly appreciate any help someone could offer.
> How would one go about porting a client like this?
>

It's already built into Python :-)

import poker
import poker.holdem
import poker.omaha_eight
import poker.seven_stud
...

But, seriously, any Poker site (at least the commercial ones) go the
opposite direction from using an open protocol. Moreover, they somewhat
compete with themselves on using encryption techniques (Poker site reviews
take encryption into consideration). Finally, I think any Poker site
administrators would do anything possible to block your client, since once
you have a Python Poker client, the door is open to writing an automated
client - bringing on the doom of Poker websites.




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


RE: connecting to Sybase/MsSQL from python

2005-02-14 Thread Tim Golden
[Ed Leafe]
|   Has anyone ever used this product: 
| http://www.object-craft.com.au/projects/mssql/
| 
|   Any feedback, positive or negative?

I have, pretty much constantly, for the last three
years with no significant issues at all. I use it
on Win32 boxes, although I have had it running under
Linux -- don't remember how I got it to compile,
unfortunately.

Only slight issuettes are: it doesn't handle all the
datatypes (eg IMAGE and some others I don't remember);
as advertised, the callproc doesn't work on win32, but
it's easy enough for most purposes to do a

cursor.execute ("EXECUTE pr_...")

although you won't get a return code that way.

All in all, I'm a very happy customer. From time
to time I've dabbled with other ways of accessing
MSSQL - ADO, PyMSSQL, etc. but none has offered me
anything I couldn't get from the Object Craft module.

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: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Fuzzyman

Ilias Lazaridis wrote:
> I'm a newcomer to python:
>
> [EVALUATION] - E01: The Java Failure - May Python Helps?
>
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
>
> -
>
> I've download (as suggested) the python 2.4 installer for windows.
>
> Now I have problems to compile python extension that some packages
> depend on.
>
> I use the MinGW open-source compiler.
>
> -
>
> My questions:
>
> a) Why does the Python Foundation not provide additionally a binary
> version, compiled with MinGW or another open-source compiler?
>

It's not necessary.

> b) Why does the Python Foundation not ensure, that the python
> source-code is directly compilable with MinGW?
>

Are you sure it isn't ?

> c) Why are the following efforts not _directly_ included in the
python
> source code base?
>
> http://jove.prohosting.com/iwave/ipython/pyMinGW.html
>
> above link found in this thread:
>
>
http://groups-beta.google.com/group/comp.lang.python/msg/c9f0444c467de525
>
> d) Is it really neccessary that I dive into such adventures, to be
able
> to do the most natural thing like: "developing python extensions with

> MinGW"?
>
> http://starship.python.net/crew/kernr/mingw32/Notes.html
>

Not very difficult. The mingw compiler *is* supported through
distutils. distutils can straightforwardly be configured to build
extensions with mingw. The relevent lib files need converting, which is
also simple.

I did it for Python 2.3. For Python 2.4 I use the free MS optimimizing
compiler. That does need a bit of hacking into distutils, but gain -
not very difficult.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

> e) Is there any official statement available regarding the
msvcr71.dll
> and other MS licensing issues?
>
> [see several threads "[Python-Dev] Is msvcr71.dll
re-redistributable?"]
>
> http://mail.python.org/pipermail/python-dev/2005-February/thread.html
>
> f) Are there any official (Python Foundation) statements / rationales

> available, which explain why the MinGW compiler is unsupported,
although
> parts of the community obviously like to use it?
>
>
http://groups-beta.google.com/group/comp.lang.python/msg/dc3474e6c8053336
>
> -
>
> I just want to understand.
>
> Thankfull for any pointer to official documents / statements.
>
> [google is _not_ a fried here. I like to have a stable development
> environment, which is supported by the official projects, thus it can

> pass quality-assurance without beeing afraid about every next
release.]
> 
> .
> 
> -- 
> http://lazaridis.com

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


Re: AES crypto in pure Python?

2005-02-14 Thread Fuzzyman

[EMAIL PROTECTED] wrote:
> I'm looking for an implementation of AES (the Advanced Encryption
> Standard) in pure Python.  I'm aware of pycrypto, but that uses C
code.
>  I'm hoping to find something that only uses Python...I'm willing to
> trade speed for portability, since my application is designed for
> several different platforms.
>
> Anyone know if this has been done?
>

I'm afraid my internet is heavily restricted, so I can't check for you.
*But* there is a 'tlslite' module which implements several encryption
methods in pure python. I *think* AES is one of them.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml


> Thanks,
> 
> 
> -AF

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


Re: For American numbers

2005-02-14 Thread Peter Maas
Dave Brueck schrieb:
Multiple definitions aside, "kilo" and "mega" are far too entrenched - 
even if I could manage to say "kibibyte" with a straight face, I'd get 
nothing but blank stares in return.
This kibi-mebi thing will probably fail because very few can manage
to say "kibibyte" with a straight face :)
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Michael Hoffman wrote:
Ilias Lazaridis wrote:
a) Why does the Python Foundation not provide additionally a binary
 version, compiled with MinGW or another open-source compiler?
I use a binary version of Python compiled with an open-source
compiler on Windows that was provided by someone else.
Can you please point me (and the readers) to this resource?
b) Why does the Python Foundation not ensure, that the python 
source-code is directly compilable with MinGW?
Why should they? It already runs on Windows with a freely available 
compiler.
Obvious: Courtesy [against the userbase needs]
Obvious: Consistency [same code-base across different compiler]
f) Are there any official (Python Foundation) statements /
rationales available, which explain why the MinGW compiler is
unsupported, although parts of the community obviously like to use
it?
Not to my knowledge.
[...] - (guess & comments)
thank you.
Why don't you solve this problem and produce a patched version of 
Python that does what you want.
I'm not intrested in patching.
I'm intrested in a stable environment, supported by the original
implementors.
I need a solid fundament for my development.
[google is _not_ a fried here. I like to have a stable development
 environment, which is supported by the official projects, thus it
can pass quality-assurance without beeing afraid about every next
release.]
Then you have several options:
a) use a supported development environment
Requirement: "full open-source tool-chain".
b) do the work yourself to support MinGW
this would be not neccessary, as others do this work already.
My question (that you've ommited) was: why does the python foundation 
not include this efforts?

[REQUOTE]
c) Why are the following efforts not _directly_ included in the
python source code base?
http://jove.prohosting.com/iwave/ipython/pyMinGW.html
above link found in this thread:
http://groups-beta.google.com/group/comp.lang.python/msg/c9f0444c467de525
[/REQUOTE]
c) pay someone else to do the work
But don't act like the volunteers who develop Python owe you a
version of Python that runs out of the box on MinGW. They don't,
anymore than you owe *me* a version of Python that runs out of the
box on MinGW.
I think Python is a serious Open Source System, driven by the Python 
Foundation.

Serious Open Source Systems should serve the basic needs of their 
community, especially if there are many depending systems.

If it is a programming language, the requirement "using an open-source 
toolchain" is a rational and valid one.

The Python Foundation ingores this requirement, this way creating a
chain of neccessary manual uncontrolled actions.
This does not increase my trust in python [e.g. as an exchange for JAVA].
Now why haven't *you* produced a version of Python that is directly 
compileable with MinGW? Time's a-wasting.
I have stated already that I am a newcomer to python.
[you should really avoid this tenor. Python is not an open-source
project of a few teenies. It's a serious programming-language, which 
could be adopted by e.g. more phone-manufacturers (after Nokia)]

-
The Python Foundation could create an official sub-project to create an 
automated build target based on the MinGW toolchain. I am sure that many 
community members would be more than happy to contribute.

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


Re: custom classes in sets

2005-02-14 Thread Nick Coghlan
vegetax wrote:
How can i make my custom class an element of a set?
class Cfile:
  def __init__(s,path): s.path = path
  def __eq__(s,other):
   print 'inside equals'
   return not os.popen('cmp %s %s' % (s.path,other.path)).read()
  def __hashcode__(s): return s.path.__hashcode__()
the idea is that it accepts file paths and construct a set of unique 
files (the command "cmp" compares files byte by byte.),the files can
have different paths but the same content

but the method __eq__ is never called
Your problem is that your class defines an insane hash. For a sane hash, A == B 
implies hash(A) == hash(B), whereas you have based your hash on the path to the 
files, but the comparison on the contents of the files. If the paths are all 
different, then nothing is likely to hash the same, so the set will never get 
around to trying the direct comparison.

Change the hash method to use the size of the file or something else that has to 
be equal for the comparison to be equal (like the hash of the first line, or of 
the entire file), and you should see much better behaviour.

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


Re: AES crypto in pure Python?

2005-02-14 Thread Paul Rubin
[EMAIL PROTECTED] writes:
> I'm looking for an implementation of AES (the Advanced Encryption
> Standard) in pure Python.  I'm aware of pycrypto, but that uses C code.
>  I'm hoping to find something that only uses Python...I'm willing to
> trade speed for portability, since my application is designed for
> several different platforms.
> 
> Anyone know if this has been done?

Yes, it's been done a few times, you should be able to find some with
a web search.  The ones I've seen are WAY too slow for most
applications, like a few blocks per second.  If you don't require
using AES, there are some alternatives possible, like using the
built-in sha module as the round function for a Feistel cipher, or
using it in OFB mode as a keystream generator.  I have some examples
of how to do either of these, if you want to see them.
-- 
http://mail.python.org/mailman/listinfo/python-list


keep a local COM Server alive

2005-02-14 Thread [EMAIL PROTECTED]
I wrote a COM server in Python where all the clients use the same
global object(test_obj). So far it works, but when the last client is
closed the Python COM enviornment is closed and the global object is
lost. How can I prevent that?
I need that new clients use the same global object and not a new
created one. I figured out a workaround, but there must be another
solution.

The code looks like:

class test:
.

test_obj=test()

class test_f:
_reg_clsid_ = ...
_reg_progid_ = "test.cl"
_reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER
_public_methods_ = ...


def __init__(self):
 self.delegate=test_obj
 .
.
.

#Workaround to keep pythoncom alive
if not __name__=='__main__':
import win32com.client
dummy=win32com.client.Dispatch("test.cl")
#

if __name__=='__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(test_f, debug=0)

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
[please check your news-client. For some reason, the tag "[EVALUATION]" 
was removed]

-
You answer essentially something like "It's not necessary" cause "with a 
little hacking it works".

I've found lots of documents, which describe how to "hack around" to 
make it work.

I don't want to do "hacking".
I want to develope large scale applications, and for this I need an 
stable official version of the python language, either binary or 
produced directly out of official sources, completely with an 
open-source tool-chain.

That's the reason for my very specific questions, which you have mostly 
ignored.

-
copied from another answer:
"The Python Foundation could create an official sub-project to create an 
automated build target based on the MinGW toolchain. I am sure that many 
community members would be more than happy to contribute."

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


Re: multi threading in multi processor (computer)

2005-02-14 Thread Leif K-Brooks
Irmen de Jong wrote:
the GIL must die.
I couldn't resist:
http://www.razorvine.net/img/GIL.jpg
Neither could I:
http://ecritters.biz/diegil.png
(In case it's not entirely obvious, the stick figure just slices the GIL 
into two pieces with his sword, causing its blood to splatter on the wall.)
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Fuzzyman

Ilias Lazaridis wrote:
[snip..]
> >> b) Why does the Python Foundation not ensure, that the python
> >> source-code is directly compilable with MinGW?
> >
> > Why should they? It already runs on Windows with a freely available

> > compiler.
>
> Obvious: Courtesy [against the userbase needs]
>
> Obvious: Consistency [same code-base across different compiler]
>

Are you aware that the MSVC compiler they use produces tighter code
than gcc ? [1] *Most* users would rather have a faster python than a
python built with an open source compiler.

Particularly as distutils (read Python) can *easily* be configured to
use mingw to build extensions from source - which seems to be your real
requirement.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shmtl



[snip..]
> --
> http://lazaridis.com

[1] Not knocking gcc - it's just optimsied for portability rather than
speed. If you want to see *a* benchmark, there is a link to one in my
'upgrading python' article. (In the article section at
http://www.voidspace.org.uk/python/index.shmtl )

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Michael Hoffman
Ilias Lazaridis wrote:
Michael Hoffman wrote:
Can you please point me (and the readers) to this resource?
http://www.cygwin.com/
Why don't you solve this problem and produce a patched version of 
Python that does what you want.
I'm not intrested in patching.
I'm intrested in a stable environment, supported by the original
implementors.
And the core developers are not interested in doing more than what they
have already done without further help (e.g. from you). Surely you can
"not interested" as you have justified your own inaction through it.
This does not increase my trust in python [e.g. as an exchange for JAVA].
You cannot run all Java programs on an open source compiler, so I guess
it's an imperfect world for you. And to get GCJ to run on MinGW you have to
add a lot of patches.
Now why haven't *you* produced a version of Python that is directly 
compileable with MinGW? Time's a-wasting.
I have stated already that I am a newcomer to python.
[you should really avoid this tenor.
And you should avoid yours. Your sense of entitlement is palpable.
> Python is not an open-source project of a few teenies. It's a serious
> programming-language, which could be adopted by e.g. more
> phone-manufacturers (after Nokia)]
The idea that MinGW support would affect that is laughable.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: For American numbers

2005-02-14 Thread Michael Hoffman
Peter Maas wrote:
This kibi-mebi thing will probably fail because very few can manage
to say "kibibyte" with a straight face :)
I agree, I can't do it yet. I can write kiB and MiB though with a
straight face, and find that useful.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: mxCGIPython binaries for Python 2.3.5

2005-02-14 Thread Fuzzyman

Oleg Broytmann wrote:
> On Fri, Feb 11, 2005 at 10:13:21AM -0800, Titus Brown wrote:
> > what does mxCGIPython do?  I can't find anything at that Web site
that
>
>http://www.egenix.com/files/python/mxCGIPython.html
>
> > doesn't involve downloading & unpacking a file.
>
>It is unpackable, ready-to-run python binary.
>

It would be really noice if *someone* would maintain this for
windoze... maybe that's really difficult though *sigh*.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

> PS. I am neither author nor maintainer, I only provide binaries for
> some platforms...
>
> Oleg.
> --
>  Oleg Broytmannhttp://phd.pp.ru/
[EMAIL PROTECTED]
>Programmers don't die, they just GOSUB without RETURN.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Miki Tebeka wrote:
Hello Ilias,
d) Is it really neccessary that I dive into such adventures, to be able 
to do the most natural thing like: "developing python extensions with 
MinGW"?
Writing a setup.py and running 
python setup.py build_ext --compiler=mingw32
works for me *without* any more work. Things can't get much simpler.
looks really simple.
-
but:
the central problem still exists:
"** For a Python which was built with Cygwin, all should work without 
any of these following steps. **"
source:
http://www.python.org/doc/2.2.3/inst/non-ms-compilers.html#SECTION000312000

-
"the problem is that Python binary distributions for MS Windows do not 
include import libraries for popular gcc based tools: cygwin and mingw32"
source: http://www.zope.org/Members/als/tips/win32_mingw_modules

-
the solutions is possibly (copied from another answer):
"The Python Foundation could create an official sub-project to create an 
automated build target based on the MinGW toolchain. I am sure that many 
community members would be more than happy to contribute."

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Michael Hoffman
Ilias Lazaridis wrote:
"The Python Foundation could create an official sub-project to create an 
automated build target based on the MinGW toolchain. I am sure that many 
community members would be more than happy to contribute."
An "official sub-project" for something like this is not necessary. Identify
what needs to be done and create a patch, and it will be accepted if it is
a good patch.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: Commerical graphing packages?

2005-02-14 Thread David Fraser
Erik Johnson wrote:
I am wanting to generate dynamic graphs for our website and would rather
not invest the time in developing the code to draw these starting from
graphics primitives. I am looking for something that is... "fairly robust"
but our needs are relatively modest: X-Y scatter plots w/ data point
symbols, multiple data set X-Y line plots, bar charts, etc.
Preferably this would come from a company that can provide support &
decent documentation, and a package that can be installed without a bunch of
extra hassle (e.g., needs Numeric Python, needs to have the GD library
installed, needs separate JPEG encoders, font libraries, etc.)
I am aware of ChartDirector (http://www.advsofteng.com/ ) which
explicitly supports python and seems to be about the right level of
sophistication. I don't really know of any other packages in this space, do
you? I am seeking feedback and reccomendations from people who have used
this package or similar ones. I am particularly interested to hear about any
limitations or problems you ran into with whatever package you are using.
Thanks for taking the time to read my post! :)
It's worth checking out matplotlib as well although it may not meet all 
your criteria ... but have a look, its a great package
--
http://mail.python.org/mailman/listinfo/python-list


Re: saving a text file

2005-02-14 Thread Fuzzyman
Hmmm.. I can't guess what format you will create the 'tables' in,
or what format you want to save them in. You need the pyserial module
to read data from the serial port - I assume you have already
discovered that ?

Writing a text file to disc is *extremely* trivial   Turning a
table - (list ?) - into a single string for writing to file is also
*extremely* trivial

Are you familiar with the basic python data types, built-in functions,
and string methods ?

If not - please try the Python tutorial at www.python.org - it won't be
very long before you can do this. If your real problem is more
difficult (i.e. related to pyserial or choosing a data format) then
please provide more details.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread David Fraser
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps?
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
-
I've download (as suggested) the python 2.4 installer for windows.
Now I have problems to compile python extension that some packages 
depend on.

I use the MinGW open-source compiler.
-
My questions:
a) Why does the Python Foundation not provide additionally a binary 
version, compiled with MinGW or another open-source compiler?

b) Why does the Python Foundation not ensure, that the python 
source-code is directly compilable with MinGW?

c) Why are the following efforts not _directly_ included in the python 
source code base?

http://jove.prohosting.com/iwave/ipython/pyMinGW.html
above link found in this thread:
http://groups-beta.google.com/group/comp.lang.python/msg/c9f0444c467de525
d) Is it really neccessary that I dive into such adventures, to be able 
to do the most natural thing like: "developing python extensions with 
MinGW"?

http://starship.python.net/crew/kernr/mingw32/Notes.html
e) Is there any official statement available regarding the msvcr71.dll 
and other MS licensing issues?

[see several threads "[Python-Dev] Is msvcr71.dll re-redistributable?"]
http://mail.python.org/pipermail/python-dev/2005-February/thread.html
f) Are there any official (Python Foundation) statements / rationales 
available, which explain why the MinGW compiler is unsupported, although 
parts of the community obviously like to use it?

http://groups-beta.google.com/group/comp.lang.python/msg/dc3474e6c8053336
-
I just want to understand.
Thankfull for any pointer to official documents / statements.
[google is _not_ a fried here. I like to have a stable development 
environment, which is supported by the official projects, thus it can 
pass quality-assurance without beeing afraid about every next release.]

Just to add to all the other answers:
Don't just complain, submit patches and work at keeping them maintained. 
If this is done for a while it may be more of an argument for having 
them included

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


Re: Newbie help

2005-02-14 Thread bruno modulix
Chad Everett wrote:
Hey guys,
Hope you can help me again with another problem.  I am trying to learn 
Python on my own and need some help with the following.

I am writing a program that lets has the pc pick a number and the user 
has five guess to get the number.
1. BUG:  If the number is say 35 and I guess 41 the program tells me 
that I guessed the correct number and tells me I guessed 31.

2.When I do get the correct number I can not get the program to stop 
asking me for the number.

Your help is greatly appreciated.
Chad
# Five Tries to Guess My Number
#
# The computer picks a random number between 1 and 100
# The player gets Five tries to guess it and the computer lets
# the player know if the guess is too high, too low
# or right on the money
#
# Chad Everett 2/10/2005
import random
print "\tWelcome to 'Guess My Number'!"
print "\nI'm thinking of a number between 1 and 100."
print "You Only Have Five Guesses.\n"
# set the initial values
number = random.randrange(100) + 1
guess = int(raw_input("Go Ahead and Take a guess: "))
tries = 1
# guessing loop
while guess != number:
You actually need a second condition : tries >= 5
if (guess > number):
print "Guess Lower..."
else:
print "Guess Higher..."
The fact that guess is not strictly greater than number doesn't mean 
it's strictly lower... You should handle 3 cases :
1/ guess > number
2/ guess < number
3/ guess == number

Here the 2/ and /3 are handled by the same branch...
guess = int(raw_input("Take Another guess: "))
tries += 1

print "You guessed it!  The number was", number
print "And it only took you", tries, "tries!\n"
This will be executed whatever ! This code should be *outside* the loop. 
(remember that in Python, whitespace is significative...)

(snip)
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list


Re: saving a text file

2005-02-14 Thread bruno modulix
Jan Rienyer Gadil wrote:
any idea how to automatically save to a text file?
What does 'automatically' mean ?-)
AFAIK, the best way to write something to a file is to
* open the file in write mode
* write your data to the file
* close the file
Hopefully this is quite simple.
f = File('myfile.txt', 'w')
f.write(my_data)
f.close()
You'll of course need to add some code to handle IOErrors...
(snip)
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list


Re: custom classes in sets

2005-02-14 Thread Carl Banks
vegetax wrote:
> Steven Bethard wrote:
>
> > vegetax wrote:
> >> How can i make my custom class an element of a set?
> >>
> >> class Cfile:
> >>   def __init__(s,path): s.path = path
> >>
> >>   def __eq__(s,other):
> >>print 'inside equals'
> >>return not os.popen('cmp %s %s' % (s.path,other.path)).read()
> >>
> >>   def __hashcode__(s): return s.path.__hashcode__()
> >>
> >> the idea is that it accepts file paths and construct a set of
unique
> >> files (the command "cmp" compares files byte by byte.),the files
can
> >> have different paths but the same content
> >>
> >> but the method __eq__ is never called

[snip]

> I just tried and it wont be called =(, so how can i generate a hash
code for
> the CFile class? note that the comparitions(__eq__) are done based on
the
> contents of a file using the command 'cmp', i guess thats not posible
but
> thanks.


Let me suggest that, if your idea is to get a set of files all with
unique file contents, comparing a file byte-by-byte with each file
already in the set is going to be absurdly inefficient.

Instead, I recommend comparing md5 (or sha) digest.  The idea is, you
read in each file once, calculate an md5 digest, and compare the
digests instead of the file contents.

. import md5
.
. class Cfile:
. def __init__(self,path):
. self.path = path
. self.md5 = md5.new().update(open(path).read()).digest()
. def __eq__(self,other):
. return self.md5 == other.md5
. def __hash__(self):
. return hash(self.md5)

This is kind of hackish (not to mention untested).  You would probably
do better to mmap the file (see the mmap module) rather than read it.

And, in case you're wondering: yes it is theoretically possible for
different files to have the same md5.  However, the chances are
microscopic.  (Incidentally, the SCons build system uses MD5 to decide
if a file has been modified.)


-- 
CARL BANKS

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
Ilias Lazaridis wrote:

> [please check your news-client. For some reason, the tag "[EVALUATION]"
> was removed]
> 
> I want to develope large scale applications, and for this I need an
> stable official version of the python language, either binary or
> produced directly out of official sources, completely with an
> open-source tool-chain.

Where does that requirement come from? If you want to create large scale
apps, the price for a msvc++ compiler shouldn't matter. And: Windows is a
non-free platform at first. If you have to or want to develop on top of it,
be prepared to pay. Its as simple as that. If you want something cheaper -
you'll have to put some effort into it. Or use linux.

Additionally, your point is moot because there is no need for python _core_
developers or the foundation to support every imaginable platform/compiler
combination. Instead this can be done by companies - see activestate. So if
you want it, step up and do it yourself so your work _becomes_ the official
mingw port. Community gratitude would be guaranteed.

-- 
Regards,

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Fuzzyman wrote:
Ilias Lazaridis wrote:
[snip..]
b) Why does the Python Foundation not ensure, that the python
source-code is directly compilable with MinGW?
Why should they? It already runs on Windows with a freely available
compiler.
Obvious: Courtesy [against the userbase needs]
Obvious: Consistency [same code-base across different compiler]
Are you aware that the MSVC compiler they use produces tighter code
than gcc ? [1] *Most* users would rather have a faster python than a
python built with an open source compiler.
Particularly as distutils (read Python) can *easily* be configured to
use mingw to build extensions from source - which seems to be your real
requirement.
This is not relevant.
The Python Foundation should just ensure, that the source-code-base is 
compilable with MinGW on windows, too.

This is a very natural requirement.
There is really no need to 'fight' against this.
There is just a need to cooperate to achieve this.
[...]
[1] Not knocking gcc - it's just optimsied for portability rather than
speed. If you want to see *a* benchmark, there is a link to one in my
'upgrading python' article. (In the article section at
http://www.voidspace.org.uk/python/index.shmtl )
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Diez B. Roggisch wrote:
Ilias Lazaridis wrote:
I want to develope large scale applications, and for this I need an
 stable official version of the python language, either binary or 
produced directly out of official sources, completely with an 
open-source tool-chain.
Where does that requirement come from? If you want to create large
scale apps, the price for a msvc++ compiler shouldn't matter. And:
Windows is a non-free platform at first. If you have to or want to
develop on top of it, be prepared to pay. Its as simple as that. If
you want something cheaper - you'll have to put some effort into it.
Or use linux.
I will not go into this 'twisting' games.
the requirement "Use of an open-source tool-chain" is nothing special.
Additionally, your point is moot because there is no need for python
_core_ developers or the foundation to support every imaginable
platform/compiler combination.
MinGW is not "every imaginable platform/compliler".
Instead this can be done by companies - see activestate. So if you
want it, step up and do it yourself so your work _becomes_ the
official mingw port. Community gratitude would be guaranteed.
I'm not intrested in creating an distribution.
I provide an analysis of the situation, context: newcomer, disapointed 
from JAVA.

One of my questions is:
[REQUOTE]
c) Why are the following efforts not _directly_ included in the
python source code base?
http://jove.prohosting.com/iwave/ipython/pyMinGW.html
[/REQUOTE]
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
David Fraser wrote:
Ilias Lazaridis wrote:
[...]
Just to add to all the other answers:
Don't just complain, submit patches and work at keeping them maintained. 
If this is done for a while it may be more of an argument for having 
them included
I do not "just complain".
I've spend already hours with writing down the questionaire [which you 
have successfully ignored].

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


Re: For American numbers

2005-02-14 Thread Nick Coghlan
Michael Hoffman wrote:
Peter Maas wrote:
This kibi-mebi thing will probably fail because very few can manage
to say "kibibyte" with a straight face :)

I agree, I can't do it yet. I can write kiB and MiB though with a
straight face, and find that useful.
And written communication is where avoiding the ambiguity tends to matter more - 
in a conversation, if the difference actually matter, you can just ask. With a 
written document, requesting clarification often isn't so simple.

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Michael Hoffman wrote:
Ilias Lazaridis wrote:
"The Python Foundation could create an official sub-project to create 
an automated build target based on the MinGW toolchain. I am sure that 
many community members would be more than happy to contribute."
An "official sub-project" for something like this is not necessary. 
It is.
I hope the officials from the Python Foundation detect that:
 * source code should be _directly_ compilable under major compilers.
 * community efforts for such a important functionality should be
   channelized and organized
Identify
what needs to be done and create a patch, and it will be accepted if it is
a good patch.
[REQUOTE]
>> c) Why are the following efforts not _directly_ included in the
>> python source code base?
>>
>> http://jove.prohosting.com/iwave/ipython/pyMinGW.html
[/REQUOTE]
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Concurrent Python

2005-02-14 Thread Dominic Fox
> For an alternative approach (based on using generators forming a dataflow
> component system) you might find our project interesting - the core
> concurrency stuff is packaged up separately with API docs (and trivial
> example) here: http://kamaelia.sourceforge.net/Docs/Axon.html

Would it be correct to characterise this approach as co-operative
multithreading?

I have a feeling that in Python, at least, where threads and locks are
not so cheap, this approach will scale rather better - at the cost of
making some of the thread management explicit (I used to write WIMP
programs on the Acorn Archimedes that had the same basic structure:
message loop picks up messages, does some processing then explicitly
relinquishes control so that other applications can take their turn).
The syntax is also agreeably Pythonic.

I haven't investigated Stackless in much detail, but I believe it
makes a lot of these trade-offs moot - no need to simulate coroutines
when you have the real thing...

Anyway, thanks for this - I have linked it from the CTM in other
languages page of the CTM Wiki:

http://codepoetics.com/wiki/index.php?title=Topics:CTM_in_other_languages#Concurrency_in_Python

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


Re: changing __call__ on demand

2005-02-14 Thread Michael Hoffman
Stefan Behnel wrote:
Thanks for the quick answer. I didn't know they were class-level 
methods. Too bad. Guess I'll stick with indirection then.
Here is one way of doing that indirection I just thought of--have
the class __call__ attribute call on the instance __call__
attribute:
>>> class MyClass(object):
... def __init__(self, func):
... self.__call__ = func
... def __call__(self, *args, **keywds):
... return self.__call__(*args, **keywds)
...
>>> def f1(): return "foo"
...
>>> def f2(x, y): return x+y
...
>>> MyClass(f1)()
'foo'
>>> MyClass(f2)(30, 12)
42
I still can't figure out whether this is elegant, or opaque and
to be avoided. 
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Robert Kern
Ilias Lazaridis wrote:
David Fraser wrote:
Ilias Lazaridis wrote:
[...]
Just to add to all the other answers:
Don't just complain, submit patches and work at keeping them 
maintained. If this is done for a while it may be more of an argument 
for having them included

I do not "just complain".
I've spend already hours with writing down the questionaire [which you 
have successfully ignored].
Why don't you spend hours writing code and submitting working patches, 
instead? That's what I did years ago in the original effort to get mingw 
to compile Python extensions (one of the, woefully out-dated, web-pages 
you cite is mine. I have now edited it to clarify the situation so 
others do not come away from it as you did).

Just writing "questionnaires" *is* actually "just complaining."
The answer to most of your questions is, "Because no one has yet 
volunteered their time and effort to get the job done."

If this is important to you, you need to step up yourself and get it 
done and not expect other people to volunteer their unpaid time to 
satisfy your whims.

The open source Python community is driven by volunteerism, not a sense 
of entitlement. If this does not appeal to you, then perhaps the Python 
community is not the right one for you.

--
Robert Kern
[EMAIL PROTECTED]
"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Michael Hoffman wrote:
Ilias Lazaridis wrote:
Michael Hoffman wrote:
Can you please point me (and the readers) to this resource?
http://www.cygwin.com/
thank you.
as far as I know, the created executables are bounded to the GPL.
Thus this is not intresting to me.
Why don't you solve this problem and produce a patched version of 
Python that does what you want.
I'm not intrested in patching.
I'm intrested in a stable environment, supported by the original
implementors.
And the core developers [...]
please let them speak for themselves.
This does not increase my trust in python [e.g. as an exchange for JAVA].
You cannot run all Java programs on an open source compiler, so I guess
it's an imperfect world for you. And to get GCJ to run on MinGW you have to
add a lot of patches.
Python is from its nature open-source.
The requirement "open-source-tool-chain" fits naturally.
Now why haven't *you* produced a version of Python that is directly 
compileable with MinGW? Time's a-wasting.
I have stated already that I am a newcomer to python.
[you should really avoid this tenor.
And you should avoid yours. Your sense of entitlement is palpable.
Entitlements result out of reason.
I'm just pointing out.
I've stated simple questions [which are still unanswered]
And I've stated rationales.
Python is not an open-source project of a few teenies. It's a serious
programming-language, which could be adopted by e.g. more
phone-manufacturers (after Nokia)]
The idea that MinGW support would affect that is laughable.
The idea that the Python Foundation cares about user needs would affect 
that.

The idea that the Python Foundation manages to serve (out of one 
source-code-base) many platforms/compilers with binaries, due to an 
automated, community-supported build system.

This would affect that.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Michael Hoffman
Ilias Lazaridis wrote:
[REQUOTE]
Oh, I can play that game too:
>> [REQUOTE]
>> Identify what needs to be done and create a patch, and it will be
>> accepted if it is a good patch.
MinGW patches have been accepted before. Start submitting yours. As
you point out, there is stuff on the web that means you will escape the
bulk of the work. But not all of the work.
Since you are intent on whining rather than doing the work I'm
ignoring this thread now. Good luck.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Robert Kern wrote:
Ilias Lazaridis wrote:
David Fraser wrote:
Ilias Lazaridis wrote:
[...]
I do not "just complain".
I've spend already hours with writing down the questionaire [which you 
have successfully ignored].
Why don't you spend hours writing code and submitting working patches, 
instead? That's what I did years ago in the original effort to get mingw 
to compile Python extensions (one of the, woefully out-dated, web-pages 
you cite is mine. I have now edited it to clarify the situation so 
others do not come away from it as you did).
"This page is extremely out-of-date. Not much applies anymore. This page 
only remains because too many people still point to it. PExports may 
also still be useful to some people; I don't know. I do not use this 
platform any longer."
http://starship.python.net/crew/kernr/mingw32/Notes.html

very gentle.
up-to-date information is important, especially to avoid confusing 
newcomers.

[you see: even if I just complain, one positive change has already happen]
Just writing "questionnaires" *is* actually "just complaining."
of course not.
The answer to most of your questions is, "Because no one has yet 
volunteered their time and effort to get the job done."
this answer do not fit in most questions.
please review them again.
If this is important to you, you need to step up yourself and get it 
done and not expect other people to volunteer their unpaid time to 
satisfy your whims.

The open source Python community is driven by volunteerism, not a sense 
of entitlement. If this does not appeal to you, then perhaps the Python 
community is not the right one for you.
I ask some questions and suggest some things.
Voluntarlily and without beeing paid.
There are many commercial systems around python.
So please stop this volunteerism-stuff.
-
If you like to help me and other newcomers, please give me simple some 
answers on the initial questions.

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
>> Where does that requirement come from? If you want to create large
>> scale apps, the price for a msvc++ compiler shouldn't matter. And:
>> Windows is a non-free platform at first. If you have to or want to
>> develop on top of it, be prepared to pay. Its as simple as that. If
>> you want something cheaper - you'll have to put some effort into it.
>> Or use linux.
> 
> I will not go into this 'twisting' games.

Because it renders your point moot?

> the requirement "Use of an open-source tool-chain" is nothing special.

There is a OS-tool-chain supported on windows, cygwin. 

> MinGW is not "every imaginable platform/compliler".

Certainly not - but its one more dependency on an otherwise perfectly
working platform. Now why should there be any need to introduce this
dependency, if not a wide communitity desire is behind it - which seems not
to be the case. And recently, MS released a free version of its compiler.
I'm not sure if that's working for python - but if not, I think it would be
the more important thing to support on _windows_.

> I'm not intrested in creating an distribution.

Obviously nobody else is. 

> 
> I provide an analysis of the situation, context: newcomer, disapointed
> from JAVA.

That doesn't belong here. You don't get points for not liking java. And
beside that: I don't like it too, but if I have to use it because my
requirements analysis shows that it is the tool for the job - I use it.
Hopefully with jython somewhere. 

So if you find that missing mingw support renders python useless for you,
don't use it. But that would only be the case if you _actually_ create an
extension - something  I personally haven't the need for. And I developed
quite large python apps.

>>> c) Why are the following efforts not _directly_ included in the
>>> python source code base?
>>> 
>>> http://jove.prohosting.com/iwave/ipython/pyMinGW.html

Ask the author of the patch. We can't read minds here.

-- 
Regards,

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Fredrik Lundh
Ilias Lazaridis wrote

> The idea that the Python Foundation cares about user needs would affect that.

please let the users speak for themselves.

 



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


[PATCH] allow partial replace in string.Template

2005-02-14 Thread Stefan Behnel
Hi!
Here's a trivial patch against Lib/string.py that adds two new methods. The 
first replaces the template by a partially resolved substitution and the 
second creates a new, partially substituted template. I find those two useful 
enough for integration in the stdlib, especially the replacing one is very 
useful when pre-replacing some placeholders outside of string generation loops 
or when building a string from a template step by step.

Maybe the method names need some discussion. Also, the creation of a new 
Template does not handle sub-classes. I didn't know the best was to do this. 
Use type(self)? That doesn't necessarily mean the constructor of that type 
takes the same arguments...

Any comments?
Stefan
--- Lib/string.py~  2004-11-01 04:52:43.0 +0100
+++ Lib/string.py   2005-02-14 10:41:41.0 +0100
@@ -145,6 +145,12 @@
 raise ValueError('Invalid placeholder in string: line %d, col %d' %
  (lineno, colno))
+def partial_replace(self, *args, **kwargs):
+self.template = self.safe_substitute(*args, **kwargs)
+
+def partial_substitute(self, *args, **kwargs):
+return Template( self.safe_substitute(*args, **kwargs) )
+
 def substitute(self, *args, **kws):
 if len(args) > 1:
 raise TypeError('Too many positional arguments')
--- Lib/string.py~  2004-11-01 04:52:43.0 +0100
+++ Lib/string.py   2005-02-14 10:41:41.0 +0100
@@ -145,6 +145,12 @@
 raise ValueError('Invalid placeholder in string: line %d, col %d' %
  (lineno, colno))
 
+def partial_substitute(self, *args, **kwargs):
+return Template( self.safe_substitute(*args, **kwargs) )
+
+def partial_replace(self, *args, **kwargs):
+self.template = self.safe_substitute(*args, **kwargs)
+
 def substitute(self, *args, **kws):
 if len(args) > 1:
 raise TypeError('Too many positional arguments')
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: check if object is number

2005-02-14 Thread Mark English
Not sure if anyone's mentioned this yet, but just in case they haven't:
 Start bit o' Python 
>>> import operator
>>> operator.isNumberType(1)
True
>>> operator.isNumberType(1.01)
True
>>> operator.isNumberType('a')
False
>>> operator.isNumberType('1')
False
 End bit o' Python 
Haven't looked at the implementation (or the docs for a while) but for
everyday usage (not that I do this everyday) it's all the implementation
I need.


---
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
---

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread jfj
Michael Hoffman wrote:
Ilias Lazaridis wrote:

b) Why does the Python Foundation not ensure, that the python 
source-code is directly compilable with MinGW?

Why should they? It already runs on Windows with a freely available
compiler.
The point is that the freely available compiler wouldn't be free if
it wasn't for gcc.  Just for that I _believe_ python, being open source,
should support mingw as the default.  But I *don't care* and I don't 
mind, really ;)

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Robert Kern
Ilias Lazaridis wrote:
Robert Kern wrote:
[snip]
The answer to most of your questions is, "Because no one has yet 
volunteered their time and effort to get the job done."

this answer do not fit in most questions.
>
please review them again.
Against my better judgement, I have.
It certainly fits a, b, and c. It also fits d if you place an implicit 
"Yes, " in front of the answer. 4/6. I stick with my assessment.

If this is important to you, you need to step up yourself and get it 
done and not expect other people to volunteer their unpaid time to 
satisfy your whims.

The open source Python community is driven by volunteerism, not a 
sense of entitlement. If this does not appeal to you, then perhaps the 
Python community is not the right one for you.

I ask some questions and suggest some things.
Voluntarlily and without beeing paid.
Questions and suggestions are don't count for much in this community. 
Code and well-written patches do.

Stop wasting time on c.l.py and get to work! If you can't do that, then 
this is not the community you are looking for.

There are many commercial systems around python.
And yet there is not one company that has someone devoted full-time to 
developing Python. Not even Guido. Most of core-Python development 
happens in people's spare, unpaid time.

Volunteerism is the core of this community. Trust me.
So please stop this volunteerism-stuff.
No. You are asking others to volunteer their time, or perhaps, 
alternately, the PSF and other businesses to volunteer their money to 
fund people's time to satisfy *your* wants. I am asking you to volunteer 
*your* time to satisfy *your* wants, or alternately, stop writing 
questionnaires and bothering us.

Note that this reaction is pretty specific to you and not to other 
newcomers. Most newcomers do not carry around a sense of entitlement 
that could flatten a small village. Thus, they are treated with respect 
and helpfulness. We would appreciate it if you would emulate these 
people. On a purely pragmatic note, you have to admit that they are 
getting much better help than you are.

If you like to help me and other newcomers, please give me simple some 
answers on the initial questions.
I did provide some answers. Please review them again.
--
Robert Kern
[EMAIL PROTECTED]
"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Michael Hoffman wrote:
Ilias Lazaridis wrote:
[REQUOTE]
Oh, I can play that game too:
[REQUOTE]
Identify what needs to be done and create a patch, and it will be
accepted if it is a good patch.
"
c) Why are the following efforts not _directly_ included in the python 
source code base?

http://jove.prohosting.com/iwave/ipython/pyMinGW.html
"
MinGW patches have been accepted before. 
ok
I extract the answer to c)
"MinGW pathces have been accepted before, thus the efforts should be 
simply sent in form of patches to the python crew, which will most 
possibly accept them, as they are neccessary to compile python under the 
popular MinGW compiler"

Start submitting yours. 
I don't have
As
you point out, there is stuff on the web that means you will escape the
bulk of the work. But not all of the work.
If the Python Foundation detects the importancy, _every_ user will 
escape the 'bulk of the work', as it should be for a serious development.

There is no need that everyone runs in the same traps, due to some 
missing organization in the core-project.

Since you are intent on whining rather than doing the work I'm
ignoring this thread now. Good luck.
Thank you for your answers and your time.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter option_add for menu radiobutton

2005-02-14 Thread Eric Brunel
On Sun, 13 Feb 2005 15:31:18 -0700, Bob Greschke <[EMAIL PROTECTED]> wrote:
[snip]
Root.option_add("*Radiobutton*selectColor", "black")
also works fine for regular radiobuttons.  What I can't
do is get the selectColor of the radiobutton's in the
menu to be black...the x.add_radiobutton() ones.
Root.option_add("*Menu.Radiobutton*selectColor", "black")...nope
Root.option_add("*Menu*selectColor", "black")...no change
Strange... The last one works for me (as it should - see 
http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm). What platform are you on and what 
is your tcl/tk version?
 - Eric Brunel -
--
http://mail.python.org/mailman/listinfo/python-list


Re: FS: O'Reilly Python Pocket Reference

2005-02-14 Thread beliavsky
I think a better place than this newsgroup to offer used Python books
for sale is Amazon or Ebay or Alibris.

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


[newbie] Confused with raise w/o args

2005-02-14 Thread jfj
Hello.
I am a bit confused with 'raise' without any arguments.
Suppose the testcase below (i hope it's correct!):
##
import sys
class A:
  pass
class B:
  pass
def foo():
try:
  raise B
except:
  pass
def b1 ():
 try:
raise A
 except:
foo ()
 raise  # raises A
def b2 ():
 try:
   raise A
 except:
   try:
   raise B
   except:
pass
 raise  # raises B
def b3 ():
  foo ()
  raise # raises B
def b4 ():
 try:
raise A
 except:
pass
 foo ()
 raise  # raises A
#
try:
b1 ()
except:
print sys.exc_info()
try:
b2 ()
except:
print sys.exc_info()
try:
b3 ()
except:
print sys.exc_info()
try:
b4 ()
except:
print sys.exc_info()

The semantics of raise without arguments are that the exceptions
of the current scope have a higer priority.  That can be seen
in functions b1() and b2(), where although an exception of type
'B' was the last handled by python, b1() raises 'A'.
Although, b3() shows that the exceptions from other scopes *are*
available.
The b4() case demonstrates the confusion better.
IMHO, a more clean operation of raise would be either:
  1) raise w/o args allowed *only* inside an except clause to
 re-raise the exception being handled by the clause.
  2) always re-raise the last exception no matter the scope.
It appears to me that this behaviour is a bit weird and I would
like to ask:  Are the semantics of 'raise w/o args' a result of
python's implementation?  If python was re-designed, would that
be different?  In python 3000, would you consider changing this
and if yes, to what semantics?  May this be changed in 2.5?
Thanks
jfj
-
# don't hold back
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Brian Beck
Ilias Lazaridis wrote:
> this answer do not fit in most questions.
>
> please review them again.
Actually, it does. Please review them again.
My questions:
>
a) Why does the Python Foundation not provide additionally a binary version, compiled with MinGW or another open-source compiler?
Because no one has yet volunteered their time and effort to get the job 
done.

b) Why does the Python Foundation not ensure, that the python source-code is directly compilable with MinGW?
Because no one has yet volunteered their time and effort to get the job 
done.

c) Why are the following efforts not _directly_ included in the python source code base?
Because no one has yet volunteered their time and effort to get the job 
done.

d) Is it really neccessary that I dive into such adventures, to be able to do the most natural thing like: "developing python extensions with MinGW"?
Yes, because no one has yet volunteered their time and effort to get the 
job done.

f) Are there any official (Python Foundation) statements / rationales available, which explain why the MinGW compiler is unsupported, although parts of the community obviously like to use it? 
The most likely response you will get is: Because no one has yet 
volunteered their time and effort to get the job done.

I ask some questions and suggest some things.
Voluntarlily and without beeing paid.
What a martyr you are.
There are many commercial systems around python.
So please stop this volunteerism-stuff.
If the support you're looking for is beneficial to your commercial 
application a.k.a. business, then why aren't you making it happen? 
Obviously the existing commercial development teams are doing fine 
without it, otherwise it would exist. Even then, a commercial developer 
providing their development work to enhance the standard Python 
distribution IS volunteering.

--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Fredrik Lundh wrote:
Ilias Lazaridis wrote
The idea that the Python Foundation cares about user needs would affect that.
please let the users speak for themselves.
I have.
I've review several threads,publications, actions etc., that show that 
the users have this need.

please review the initial thread with care, i've pointed to some 
documents/thread.

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


gui scripting

2005-02-14 Thread Tonino
HI,

I have a 2 phase question:

Phase 1 is I am needing to automate a report generation from a
proprietary product.  Currently a person sits and input's the data into
a GUI frontend and clicks's the appropriate buttons to start the report
generation.  What I am wanting todo is automate this, but since the GUI
is from a proprietary product all I have is the GUI.

This is done on a Linux Xfree server.  Can anyone please point me in a
direction to a pythonic gui scripting module ?
Python is the best tool and we use it elsewhere - so it is the best
option.

Second phase will have this done on a Windows platform... but that is
second priority ...

Thanks

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


keeping a COM server alive

2005-02-14 Thread [EMAIL PROTECTED]
I have implemented a local COM Server with win32com framework where all
clients
use the same global object (test_obj). So far it works, but when the
last client
is closed the gobal object is deleted because the pythonw.exe is
closed. When I
create a new client a new pythonw process is started. I need that the
new client
gets the same global object. How can I prevent the Python COM
enviornment
(pythonw.exe) to close when no client exist. I figured out a
workaround, but
there must be real solution to the problem.



The code looks like:

class test:
...

test_obj=test()


class test_F:

_reg_clsid_ = ...
_reg_progid_ = "test.cl"
_reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER
_public_methods_ = ...


def __init__(self):
self.delegate=test_obj

...


Workaround to keep the local server alive
if not __name__=='__main__':
import win32com.client
dummy=win32com.client.Dispatch("test.cl")
##


if __name__=='__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(test_F, debug=0)

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Hello,
there is a thread in comp.lang.python, and a poster suggested that I ask
you directly.
possibly you can answer the question c), at least from your side.
Did you ever try to submit the patches to the main-source-code base of 
python?

Thank you for your pyMinGW work and your time.
-
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps? 
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553

-
I've download (as suggested) the python 2.4 installer for windows.
Now I have problems to compile python extension that some packages 
depend on.

I use the MinGW open-source compiler.
-
My questions:
a) Why does the Python Foundation not provide additionally a binary 
version, compiled with MinGW or another open-source compiler?

b) Why does the Python Foundation not ensure, that the python 
source-code is directly compilable with MinGW?

c) Why are the following efforts not _directly_ included in the
python source code base?
http://jove.prohosting.com/iwave/ipython/pyMinGW.html
above link found in this thread:
http://groups-beta.google.com/group/comp.lang.python/msg/c9f0444c467de525
d) Is it really neccessary that I dive into such adventures, to be
able to do the most natural thing like: "developing python extensions
with MinGW"?
http://starship.python.net/crew/kernr/mingw32/Notes.html
e) Is there any official statement available regarding the
msvcr71.dll and other MS licensing issues?
[see several threads "[Python-Dev] Is msvcr71.dll
re-redistributable?"]
http://mail.python.org/pipermail/python-dev/2005-February/thread.html
f) Are there any official (Python Foundation) statements / rationales
 available, which explain why the MinGW compiler is unsupported,
although parts of the community obviously like to use it?
http://groups-beta.google.com/group/comp.lang.python/msg/dc3474e6c8053336
-
I just want to understand.
Thankfull for any pointer to official documents / statements.
[google is _not_ a fried here. I like to have a stable development 
environment, which is supported by the official projects, thus it can
 pass quality-assurance without beeing afraid about every next
release.]
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Problem with nested lists as arrays

2005-02-14 Thread benjamin . cordes
Hello,

For a class modeling the block puzzle I use nested lists as arrays.
Within this class there is a method for swaping elements. I have lots
of trouble with that method but can't figure it out. It has probably to
do with my unuseful approach to nested lists, but I don't want to write
the code again. As I am a python newbie any other comments on the code
will be appreciated. Thanks for any help.

# Puzzle.py
# class for a sliding block puzzle

# an starting state of a 8-puzzle could look like the following:
# 
# | 7  2  4  |
# |  |
# | 5  X  6  |
# |  |
# | 8  3  1  |
# 

# the goal is to reach this state:
# 
# | X  1  2  |
# |  |
# | 3  4  5  |
# |  |
# | 6  7  8  |
# 

import copy

class Puzzle:

def __init__(self, dim):
   self.dim = dim
   self.elements = [[0 for column in range(dim)] for row in
range(dim) ]


def getEmptySlot(self):
i = 0
j = 0
while i  <= self.dim-1:
while j  <= self.dim-1:
if self.elements[j][i] == -1:
return [j, i]
j = j+1
j = 0
i = i + 1

def performMove(self, direction):
slot = self.getEmptySlot()

if (direction == "up"):
self.swapElements(slot[1], slot[0], slot[1]+1, slot[0])

elif (direction == "down"):
self.swapElements(slot[1], slot[0], slot[1]-1, slot[0])

elif direction == "left":
self.swapElements(slot[1], slot[0], slot[1], slot[0]-1)
elif (direction == "right"):
self.swapElements(slot[1], slot[0], slot[1], slot[0]+1)

def swapElements(self, fromx, fromy, tox, toy):
dummy = self.elements[toy][tox]

self.elements[toy][tox] = self.elements[fromy][fromx]
self.elements[fromy][fromx] = dummy

def getPossibleMoves(self):
emptySlot = self.getEmptySlot()
y = emptySlot[1]
x = emptySlot[0]
north = (y == 0)
south = (y == (self.dim-1))
west = (x == 0)
east = (x == (self.dim-1))

middle = not(north or south or west or east)

northwest = north and west
northeast = north and east
southwest = south and west
southeast = south and east
# orientation has to be distinct
# save original values
orignorth = north
origsouth = south
# original north or south
orignors = north or south

north = north and not (west or east)
south = south and not (west or east)
west = west and not (orignors)
east = east and not (orignors)

if middle:
return ["up", "down", "left", "right"]
elif north:
return ["up", "left", "right"]
elif south:
return ["down", "left", "right"]
elif west:
return ["up", "down", "left"]
elif east:
return ["up", "down", "right"]
elif northwest:
return ["up", "left"]
elif northeast:
return ["up", "right"]
elif southwest:
return ["down", "left"]
elif southeast:
return ["down", "right"]
   
# ~Puzzle.py

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Diez B. Roggisch wrote:
Where does that requirement come from? If you want to create large
scale apps, the price for a msvc++ compiler shouldn't matter. And:
Windows is a non-free platform at first. If you have to or want to
develop on top of it, be prepared to pay. Its as simple as that. If
you want something cheaper - you'll have to put some effort into it.
Or use linux.
I will not go into this 'twisting' games.
Because it renders your point moot?
no, my requirement renders your 'twisting' 'moot'.
see next line.
the requirement "Use of an open-source tool-chain" is nothing special.
There is a OS-tool-chain supported on windows, cygwin. 
this depends on cygwin.dll, which is GPL licensed
[or am I wrong?]
additionally: i like to use MinGW.
MinGW is not "every imaginable platform/compliler".
Certainly not - but its one more dependency on an otherwise perfectly
[...] - (twisting)
again twisting.
I have a simple requirement.
please do not ignore it.
I'm not intrested in creating an distribution.
Obviously nobody else is. 
Including the Python Foundation.
I provide an analysis of the situation, context: newcomer, disapointed
from JAVA.
That doesn't belong here. You don't get points for not liking java.
[...] - (off topic)
[Python Foundation/Community can use this, to attract more users.
The analysis is not the main topic here.]
An essential requirement is the topic.
c) Why are the following efforts not _directly_ included in the
python source code base?
http://jove.prohosting.com/iwave/ipython/pyMinGW.html
Ask the author of the patch. We can't read minds here.
you are right, this can clarify at least the one side.
I've contacted him, see my post in the root of this thread.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with nested lists as arrays

2005-02-14 Thread Diez B. Roggisch
Some general remarks:

> def getEmptySlot(self):
> i = 0
> j = 0
> while i  <= self.dim-1:
> while j  <= self.dim-1:
> if self.elements[j][i] == -1:
> return [j, i]
> j = j+1
> j = 0
> i = i + 1

make this:

def getEmptySlot(self):
for i in xrange(self.dim):
for j in xrange(self.dim):
if self.elements[i][j] == -1:
return (i,j)

> def getPossibleMoves(self):
> emptySlot = self.getEmptySlot()
> y = emptySlot[1]
> x = emptySlot[0]

make this:

x,y = self.getEmptySlot()



-- 
Regards,

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


Re: keeping a COM server alive

2005-02-14 Thread Do Re Mi chel La Si Do
Hi !

I had also make a Python-COM-server.
But, when I launch several clients, I obtain several instances of my
COM-server.

Finally, there are advantages and disadvantages in this established fact.
But I can't use this way for to exchange data between several clients. For
that, I use a TCP local server.

@-salutations
-- 
Michel Claveau



note : the same problem come with Microsoft's dictionnary COM server.




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


Re: Alternative to raw_input ?

2005-02-14 Thread Simon Brunning
On Fri, 11 Feb 2005 17:37:19 +0100, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
> It looks to ugly this way. I want to press
> any key without ENTER to continue

You'll only got your users complaining that they haven't got an 'any' key...

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Brian Beck wrote:
Ilias Lazaridis wrote:
this answer do not fit in most questions.
please review them again.
Actually, it does. Please review them again.
My questions:
a) Why does the Python Foundation not provide additionally a binary
 version, compiled with MinGW or another open-source compiler?
Because no one has yet volunteered their time and effort to get the
job done.
[...]
thank you for placing the answers in context.
I ask some questions and suggest some things.
Voluntarlily and without beeing paid.
What a martyr you are.
like all the open-source folks?
There are many commercial systems around python.
So please stop this volunteerism-stuff.
If the support you're looking for is beneficial to your commercial 
application a.k.a. business, then why aren't you making it happen? 
I am in the process of doing so.
First I have to analyze the status-quo.
Which is not very simple with such a community.
Obviously the existing commercial development teams are doing fine 
without it, otherwise it would exist. Even then, a commercial
developer providing their development work to enhance the standard
Python distribution IS volunteering.
One of the most funny things within open-source is that switching:
first:
"we have powerfull solutions which beat this and that"
then:
"hey, this is just volunteer work"
-
I was impressed by zope and plone.
But if those answers above were of official nature, I must seriously 
rethink if I can rely on _any_ system which is based on python, as the 
foundation and the community do not care about essential needs and 
requirements.

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


Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Nick Coghlan
a) Patches are more likely to be looked at if placed on the SF patch 
tracker.
b) I don't quite see the point, given how easy these are to spell using the 
basic safe_substitute. You're replacing one liners with one-liners.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Ilias Lazaridis
Robert Kern wrote:
Ilias Lazaridis wrote:
Robert Kern wrote:
[snip]
The answer to most of your questions is, "Because no one has yet 
volunteered their time and effort to get the job done."
this answer do not fit in most questions.
please review them again.
Against my better judgement, I have.
It certainly fits a, b, and c. It also fits d if you place an implicit 
"Yes, " in front of the answer. 4/6. I stick with my assessment.
see below.
[...]
I ask some questions and suggest some things.
Voluntarlily and without beeing paid.
Questions and suggestions are don't count for much in this community. 
Code and well-written patches do.

Stop wasting time on c.l.py and get to work! If you can't do that, then 
this is not the community you are looking for.
Please speak for yourself.
There are many commercial systems around python.
And yet there is not one company that has someone devoted full-time to 
developing Python. Not even Guido. 
Who's "Guido"?
Most of core-Python development happens in people's spare, unpaid time.
Volunteerism is the core of this community. Trust me.
even if:
Volunteerism does not exclude Professionalism.
So please stop this volunteerism-stuff.
No. You are asking others to volunteer their time, or perhaps, 
alternately, the PSF and other businesses to volunteer their money to 
fund people's time to satisfy *your* wants. I am asking you to volunteer 
*your* time to satisfy *your* wants, 
I'm already doing this.
or alternately, stop writing questionnaires and bothering us.
Feel free to ignore the threads.
And please speak for yourself.
Note that this reaction is pretty specific to you and not to other 
newcomers. Most newcomers do not carry around a sense of entitlement 
that could flatten a small village. Thus, they are treated with respect 
and helpfulness. We would appreciate it if you would emulate these 
people. On a purely pragmatic note, you have to admit that they are 
getting much better help than you are.
I get the help that I want.
If you like to help me and other newcomers, please give me simple some 
answers on the initial questions.
I did provide some answers. Please review them again.
Please have the gentleness [against me and the current/future readers] 
to answer within the context of the original writings.

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


Re: custom classes in sets

2005-02-14 Thread John Machin

vegetax wrote:
> How can i make my custom class an element of a set?
>
> the idea is that it accepts file paths and construct a set of unique
> files (the command "cmp" compares files byte by byte.),the files can
> have different paths but the same content
>

Q: How do I transport ten sumo wrestlers on a unicycle?

A: With extreme difficulty. You may well need a different vehicle.

Think about your requirements, then implement the most appropriate data
structure. If, as is likely, you need to know which and how many files
are identical, then a set won't do the job by itself. You may need a
union-find gadget.

Then before you rush and implement something, google around and look in
the Tools and Scripts directories in the Python distribution; I'm quite
sure I've seen something like a "duplicate file detector" written in
Python somewhere.

HTH,
John

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Duncan Booth
Ilias Lazaridis wrote:

>> There is a OS-tool-chain supported on windows, cygwin. 
> 
> this depends on cygwin.dll, which is GPL licensed
> 
> [or am I wrong?]

It is GPL licensed with an amendment which prevents the GPL spreading to 
other open source software with which it is linked.

"In accordance with section 10 of the GPL, Red Hat, Inc. permits programs 
whose sources are distributed under a license that complies with the Open 
Source definition to be linked with libcygwin.a without libcygwin.a itself 
causing the resulting program to be covered by the GNU GPL."
-- 
http://mail.python.org/mailman/listinfo/python-list


nested lists as arrays

2005-02-14 Thread [EMAIL PROTECTED]
Hi,

why can't I do this:

dummy = self.elements[toy][tox]

self.elements[toy][tox] = self.elements[fromy][fromx]
self.elements[fromy][fromx] = dummy

after initialising my nested list like this:

   self.elements = [[0 for column in range(dim)] for row in
range(dim) ]

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


Re: [newbie] Confused with raise w/o args

2005-02-14 Thread jfj
jfj wrote:
IMHO, a more clean operation of raise would be either:
  1) raise w/o args allowed *only* inside an except clause to
 re-raise the exception being handled by the clause.
Wait! second that. We would like to
###
def bar():
 raise
def b5():
try:
raise A
except:
bar ()
#
So, restricting raise into except clauses only, is not good.
Change the proposal to:
>   1) raise w/o args re-raises the exception being handled
>  or UnhandledException.
here is another confusing case:
###
import sys
class A:
 pass
class B:
 pass
def foo ():
try:
raise B
except:
pass
raise
def b1():
 try:
   raise A
 except:
   foo()
try:
b1 ()
except:
print sys.exc_info()[0]
##
This reports that __main__.B is raised but wouldn't it be better
to raise an 'A' since this is the currently handled exception?
jf
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Simon Brunning
On Mon, 14 Feb 2005 14:23:08 +0200, Ilias Lazaridis <[EMAIL PROTECTED]> wrote:

(snip)

> But if those answers above were of official nature, I must seriously
> rethink if I can rely on _any_ system which is based on python, as the
> foundation and the community do not care about essential needs and
> requirements.

I couldn't agree more. You need to find a community that *does* care
about essential needs. Might I recommend Perl or Ruby?

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Diez B. Roggisch
> One of the most funny things within open-source is that switching:
> 
> first:
> "we have powerfull solutions which beat this and that"
> 
> then:
> "hey, this is just volunteer work"
> 

I don't see the contradiction here. It beats a great deal of commercial
solutions in a lot of ways. But not on every single one of these. And the
_reason_ for beating commercial software in certain aspects is exactly that
somebody stood up and volunteered. Obviously you aren't interested in the
more labour-intensive parts of the os-development.

> 
> But if those answers above were of official nature, I must seriously
> rethink if I can rely on _any_ system which is based on python, as the
> foundation and the community do not care about essential needs and
> requirements.

They might not care about _your_ perceived essential needs. But as lots of
people use python and python based solutions with great commercial success,
you might think of reviewing your needs more critical. After all, there is
no _perfect_ system for all needs.

-- 
Regards,

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


Re: nested lists as arrays

2005-02-14 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote:

> Hi,
> 
> why can't I do this:
> 
> dummy = self.elements[toy][tox]
> 
> self.elements[toy][tox] = self.elements[fromy][fromx]
> self.elements[fromy][fromx] = dummy
> 
> after initialising my nested list like this:
> 
>self.elements = [[0 for column in range(dim)] for row in
> range(dim) ]

Works for me:

dim = 10
elements = [[0 for column in xrange(dim)] for row in
xrange(dim) ]

toy, tox = (2,5)
fromy, fromx = (7,5)

dummy =elements[toy][tox]
elements[toy][tox] = elements[fromy][fromx]
elements[fromy][fromx] = dummy


And use xrange instead of range.
-- 
Regards,

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


Re: nested lists as arrays

2005-02-14 Thread bruno modulix
[EMAIL PROTECTED] wrote:
Hi,
why can't I do this:
dummy = self.elements[toy][tox]
self.elements[toy][tox] = self.elements[fromy][fromx]
self.elements[fromy][fromx] = dummy
after initialising my nested list like this:
   self.elements = [[0 for column in range(dim)] for row in
range(dim) ]
Sorry, I'm not psychic enough to guess what is exactly your problem:
- what do you mean "can't do" ?  You have a traceback ? please post it. 
You have unexpected results ? please describe.
- what are self, dim, toy, tox, fromy, fromx ?
- is all that code in the same method ?
- etc etc

So please post more informations if you expect us to help you.
Note that the following code is correct:
>>> l = [[0 for i in range(3)] for y in range(3)]
>>> l
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
>>> l[0][0] = 1
>>> l
[[1, 0, 0], [0, 0, 0], [0, 0, 0]]
>>> l[0][0], l[0][1] = l[0][1], l[0][0]
>>> l
[[0, 1, 0], [0, 0, 0], [0, 0, 0]]
>>>
So I guess that your problem has nothing to do with nested lists.
(Also note BTW that, thanks to the magic of multiple assignement, you 
don't need the dummy stuff. The pythonic idiom for swapping 2 bindings is
a, b = b, a)


--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread bruno modulix
Simon Brunning wrote:
On Mon, 14 Feb 2005 14:23:08 +0200, Ilias Lazaridis <[EMAIL PROTECTED]> wrote:
(snip)

But if those answers above were of official nature, I must seriously
rethink if I can rely on _any_ system which is based on python, as the
foundation and the community do not care about essential needs and
requirements.

I couldn't agree more. You need to find a community that *does* care
about essential needs. Might I recommend Perl or Ruby?
Why do you hate Perl and Ruby community that much ?
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread bruno modulix
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps?
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
My trollometer's beeping...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Confused with raise w/o args

2005-02-14 Thread Fredrik Lundh
"jfj" <[EMAIL PROTECTED]> wrote:

> Wait! second that. We would like to

hmm.  are you seconding yourself, and refering to you and yourself as we?

> here is another confusing case:
>
> ###
> import sys
>
> class A:
>  pass
>
> class B:
>  pass
>
> def foo ():
> try:
> raise B
> except:
> pass
> raise
>
> def b1():
>  try:
>raise A
>  except:
>foo()
>
> try:
> b1 ()
> except:
> print sys.exc_info()[0]
> ##
>
> This reports that __main__.B is raised but wouldn't it be better
> to raise an 'A' since this is the currently handled exception?

no.  your foo() function raises B, and is called from the exception
handler in b1.  exception handlers are free to raise new exceptions
at any time.

maybe you should take a deep breath, and try to figure out exactly
what's confusing to you before posting more examples.

(btw, using traceback.print_exc() instead of print sys.exc_info may
give you more clues about what's really going on.)

 



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


Re: custom classes in sets

2005-02-14 Thread Fredrik Lundh
John Machin wrote:

> Then before you rush and implement something, google around and look in
> the Tools and Scripts directories in the Python distribution; I'm quite
> sure I've seen something like a "duplicate file detector" written in
> Python somewhere.

first google hit:

http://sebsauvage.net/python/doublesdetector.py

 



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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Simon Brunning
On Mon, 14 Feb 2005 14:12:57 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:
> 
> Why do you hate Perl and Ruby community that much ?

Oh, I don't. But fair's fair - we've carried our share of the burden, surely?

But-don't-get-me-started-on-those-Groovy-bastards-ly Y'rs,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Kill GIL

2005-02-14 Thread Dave Brueck
Donn Cave wrote:
Quoth Dave Brueck <[EMAIL PROTECTED]>:
...
| Another related benefit is that a lot of application state is implicitly and 
| automatically managed by your local variables when the task is running in a 
| separate thread, whereas other approaches often end up forcing you to think in
| terms of a state machine when you don't really care* and as a by-product you 
| have to [semi-]manually track the state and state transitions - for some 
| problems this is fine, for others it's downright tedious.

I don't know if the current Stackless implementation has regained any
of this ground, but at least of historical interest here, the old one's
ability to interrupt, store and resume a computation could be used to
As you may know, it used to be, in Stackless Python, that you could have
both.  Your function would suspend itself, the select loop would resume it,
for something like serialized threads.  (The newer version of Stackless
lost this continuation feature, but for all I know there may be new
features that regain some of that ground.)
Yep, I follow Stackless development for this very reason. Last I heard, a more 
automatic scheduler was in the works, without which in can be a little confusing 
about when non-I/O tasks should get resumed (and by who), but it's not 
insurmountable. Ideally with Stackless you'd avoid OS threads altogether since 
the interpreter takes a performance hit with them, but this can be tough if 
you're e.g. also talking to a database via a blocking API.

I put that together with real OS threads once, where the I/O loop was a
message queue instead of select.  A message queueing multi-threaded
architecture can end up just as much a state transition game.  
Definitely, but for many cases it does not - having each thread represent a 
distinct "worker" that pops some item of work off one queue, processes it, and 
puts it on another queue can really simplify things. Often this maps to 
real-world objects quite well, additional steps can be inserted or removed 
easily (and dynamically), and each worker can be developed, tested, and debugged 
independently.

I like threads when they're used in this way, as application components
that manage some device-like thing like a socket or a graphic user interface
window, interacting through messages.  Even then, though, there tend to
be a lot of undefined behaviors in events like termination of the main
thread, receipt of signals, etc.
That's how I tend to like using threads too. In practice I haven't found the 
undefined behaviors to be too much trouble though, e.g. deciding on common 
shutdown semantics for all child threads and making them daemon threads pretty 
much takes care of both expected and unexpected shutdown of the main thread.

Usings threads and signals can be confusing and troublesome, but often in cases 
where I would use them I end up wanting a richer interface anyway so something 
besides signals is a better fit.

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


Re: goto, cls, wait commands

2005-02-14 Thread Michael Hoffman
Erik Bethke wrote:
At least I thought this was funny and cool! -Erik
Thanks. ;)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help with embedding fully qualified script name

2005-02-14 Thread Kamilche
To avoid pathname headaches, I've taken to including the following 3
lines at the top of every script that will be double-clicked:

import os, sys
pathname, scriptname = os.path.split(sys.argv[0])
pathname = os.path.abspath(pathname)
os.chdir(pathname)

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


Re: For American numbers

2005-02-14 Thread Peter Hansen
Michael Hoffman wrote:
Peter Maas wrote:
This kibi-mebi thing will probably fail because very few can manage
to say "kibibyte" with a straight face :)
I agree, I can't do it yet. I can write kiB and MiB though with a
straight face, and find that useful.
And here I thought MiB meant "Men In Black"... ;-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Alternative to raw_input ?

2005-02-14 Thread Peter Hansen
Simon Brunning wrote:
On Fri, 11 Feb 2005 17:37:19 +0100, BOOGIEMAN <[EMAIL PROTECTED]> wrote:
It looks to ugly this way. I want to press
any key without ENTER to continue

You'll only got your users complaining that they haven't got an 'any' key...
That, of course, calls for this bit of abetting copyright
violation:
http://www.pusboil.com/anykey.wav
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


safest way to open files on all platforms

2005-02-14 Thread rbt
I believe that this is the safest way to open files on Windows, Linux, 
Mac and Unix, but I wanted to ask here just to be sure:

fp = file('filename', 'rb')
The 'b' on the end being the most important ingredient (especially on 
Windows as a simple 'r' on a binary file might cause some sort of 
corruption).

Anyway, am I right in saying this? That 'rb' is the safest way to open 
files for reading and that it should work well on *all* Python supported 
platforms?

Many thanks,
RBT
--
http://mail.python.org/mailman/listinfo/python-list


Re: safest way to open files on all platforms

2005-02-14 Thread Fredrik Lundh
"rbt" wrote:

>I believe that this is the safest way to open files on Windows, Linux, Mac and 
>Unix, but I wanted 
>to ask here just to be sure:
>
> fp = file('filename', 'rb')
>
> The 'b' on the end being the most important ingredient (especially on Windows 
> as a simple 'r' on a 
> binary file might cause some sort of corruption).
>
> Anyway, am I right in saying this? That 'rb' is the safest way to open files 
> for reading and that 
> it should work well on *all* Python supported platforms?

"rb" works on all platforms, yes.  but it doesn't work well if you're reading a 
text file.

(when reading text files, the "U" option may also be useful.  see doc for 
details)

 



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


Re: Problem using win32com

2005-02-14 Thread oleaw
I am having a similar problem with a com+ API created in delphi. is this a
win32com problem?




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


Re: Problem using win32com

2005-02-14 Thread oleaw
I am having a similar problem with a com+ API created in delphi. is this a
win32com problem?




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


Re: safest way to open files on all platforms

2005-02-14 Thread rbt
Fredrik Lundh wrote:
"rbt" wrote:

I believe that this is the safest way to open files on Windows, Linux, Mac and Unix, but I wanted 
to ask here just to be sure:

fp = file('filename', 'rb')
The 'b' on the end being the most important ingredient (especially on Windows as a simple 'r' on a 
binary file might cause some sort of corruption).

Anyway, am I right in saying this? That 'rb' is the safest way to open files for reading and that 
it should work well on *all* Python supported platforms?

"rb" works on all platforms, yes.  but it doesn't work well if you're reading a 
text file.
(when reading text files, the "U" option may also be useful.  see doc for 
details)
 
I'm using 'rb' in a situation where all files on the drive are opened. 
I'm not checking how the file is encoded before opening it (text, 
unicode, jpeg, etc.) That's why I though 'rb' would be safest.

Can 'U' be used with 'rb'? Should it be? From what I read, 'U' handles 
the different ways in which the OS handles the 'end of line' on text 
files, but other than that, I don't think it's useful for me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: safest way to open files on all platforms

2005-02-14 Thread Fredrik Lundh
"rbt" wrote:

> I'm using 'rb' in a situation where all files on the drive are opened. I'm 
> not checking how the 
> file is encoded before opening it (text, unicode, jpeg, etc.) That's why I 
> though 'rb' would be 
> safest.

if "safest way to open files" meant "safest way to open binary files", why
didn't you say so in your first post?

> Can 'U' be used with 'rb'? Should it be?

"U" is for text files, "b" is for binary files.  binary files contain bytes, 
text
files contain text.  if you're opening a file to read it as text (readline, 
read-
lines, iteration, etc), use "r" or "rU".  if you're opening a file to read it as
binary bytes (read), use "rb".

 



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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Ilias Lazaridis 
<[EMAIL PROTECTED]> writes
The answer to most of your questions is, "Because no one has yet 
volunteered their time and effort to get the job done."
this answer do not fit in most questions.
please review them again.
There you go. Failed the test. He is an AI. A human wouldn't make this 
mistake.

Stephen
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python UPS / FedEx Shipping Module

2005-02-14 Thread Gabriel Cooper

Tom Willis wrote:
Are the modules just accessing the published apis for their webservices?
I'm just wondering because I used to work for a logistics mgmt 
company that paid money to be a strategic partner with
FedEx/UPS/Airborn etc so that they could information on how to return
rates/print labels/generate edi's/calculate arrival times etc.

I'd get a good laugh out of it suddenly being freely available now.
Yes, they use the free API's that have always been freely available. 
They're just *Impossible* to find on either of UPS's OR FedEx's 
websites. It took me no less than an hour and likely more just to find 
the documentation pages on each site. As for putting them up on the web, 
I should be able to get them up by the end of the week.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
Hi Robert,
Note that this reaction is pretty specific to you and not to other 
newcomers.
I couldn't agree more. This guy is amazing, I think he is an AI or 
nowhere near as bright as he thinks he is. Seems to get the same 
reaction regardless of newsgroup or language. His reaction to the Ruby 
crowd almost seemed incendiary - pretty much accused them of having a 
lame language.

Most newcomers do not carry around a sense of entitlement that could 
flatten a small village.
That has to rate as one of the funniest things I've read on usenet in 
years.

Cheers
Stephen
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Ilias Lazaridis 
<[EMAIL PROTECTED]> writes
 And yet there is not one company that has someone devoted full-time 
to  developing Python. Not even Guido.
Who's "Guido"?
LOL Falling off my chair!!
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Ilias Lazaridis 
<[EMAIL PROTECTED]> writes
the community do not care about essential needs and requirements.
Wrong. They do. They just don't care about *your* essential needs and 
requirements which *you* want *others* to fulfill at *their* cost. As 
others have said, "do some work yourself".

Stephen
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Simon
Brunning <[EMAIL PROTECTED]> writes
>On Mon, 14 Feb 2005 14:12:57 +0100, bruno modulix <[EMAIL PROTECTED]> wrote:
>>
>> Why do you hate Perl and Ruby community that much ?
>
>Oh, I don't. But fair's fair - we've carried our share of the burden, surely?

He is already badgering the Ruby guys. Without about as much success as
this newsgroup. When he doesn't get what he wants a post along the lines
of

" lang is only suited to small projects and not real world
industrial projects"
or
"the community doesn't care"
will appear.

Its quite incredible - in the time he has spent complaining he could
have done his own research and written some useful tools. I know how
long it took me to write my first major C++ app that interfaced with
Python and Ruby. It was less time than he has spent complaining - and
that included rebuilding Python/Ruby, inspecting the source for what I
needed and performing many experiments before I succeeded.

Stephen
-- 
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Stefan Behnel

Nick Coghlan wrote
a) Patches are more likely to be looked at if placed on the SF patch 
tracker.
see your own b), I wanted to discuss them first.
b) I don't quite see the point, given how easy these are to spell using 
the basic safe_substitute. You're replacing one liners with one-liners.
Still, when I first tried out the Template class, I immediately stumbled over 
the fact that the substitute methods always return strings, and never Template 
objects. While it makes sense for their primary purpose, it totally restricts 
the usage of this module to one-show operations.

Being able to partially evaluate the Template is something that is absolutely 
missing in the implementation. I consider that a bug that should be fixed for 
2.5 at latest.

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


Re: For American numbers

2005-02-14 Thread Neil Benn
Scott David Daniels wrote:
Kind of fun exercise (no good for British English).

what's American about it?  If anything, it's more French than American ;-)
N
--
Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany
Tel : +49 (0)351 4173 154
e-mail : [EMAIL PROTECTED]
Cenix Website : http://www.cenix-bioscience.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python UPS / FedEx Shipping Module

2005-02-14 Thread Tom Willis
Good to know. 

i've always thought that python would make an excellent solution for
transportation and logistics software. I used to maintain a nasty vb6
solution, and a lot of the brick walls could have been overcome by
utilizing the dynamic nature of python.


But, there is not enough hours in the day. And writing a solution puts
you in an odd relationship with your partners(UPS/FexEx etc...).


On one hand you are helping them indirectly sell their services,  On
the other, you are sort of competing with them, so, those companies
have plenty of reason to screw with you by changing the specs, lot's
of hoops to jump through to contiuously be certified.

I guess I care anyway because the problem domain is so interesting to
me. Maybe it's because I'm running a fever. :)

Thanks for the info.



On Mon, 14 Feb 2005 09:51:35 -0500, Gabriel Cooper
<[EMAIL PROTECTED]> wrote:
> 
> 
> Tom Willis wrote:
> 
> >Are the modules just accessing the published apis for their webservices?
> >
> >I'm just wondering because I used to work for a logistics mgmt
> >company that paid money to be a strategic partner with
> >FedEx/UPS/Airborn etc so that they could information on how to return
> >rates/print labels/generate edi's/calculate arrival times etc.
> >
> >I'd get a good laugh out of it suddenly being freely available now.
> >
> Yes, they use the free API's that have always been freely available.
> They're just *Impossible* to find on either of UPS's OR FedEx's
> websites. It took me no less than an hour and likely more just to find
> the documentation pages on each site. As for putting them up on the web,
> I should be able to get them up by the end of the week.
> 
> Gabriel.
> 


-- 
Thomas G. Willis
http://paperbackmusic.net
-- 
http://mail.python.org/mailman/listinfo/python-list


PIG/IP Meeting (Python Interest Group In Princeton) Wed. Feb. 16.

2005-02-14 Thread [EMAIL PROTECTED]
The Python Interest Group In Princeton is a Central New Jersey
discussion and educational group for the Python computer language.

Next Meeting

What: PIG/IP meeting
When:  Wed, February 16th, 2005, at 7pm

Event Description:

PIG/IP will hold its second meeting on Feb. 16, 2005 at the
Lawrenceville Library (Room #2).  We will be reviewing the Python
Tutorial at http://www.python.org/doc/2.4/tut/tut.html
and then open discussion about Python will be encouraged. Anyone
interested in the Python language is invited to attend.

Contact Jon Fox at [EMAIL PROTECTED] for more information.

Learn more and RSVP at "meetup.org":http://python.meetup.com/156

More information about the library is
"here":http://www.mcl.org/branches/lawrbr.html.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Grant Edwards
On 2005-02-14, Ilias Lazaridis <[EMAIL PROTECTED]> wrote:
> Fredrik Lundh wrote:
>> Ilias Lazaridis wrote
>> 
>>>The idea that the Python Foundation cares about user needs would affect that.
>> 
>> please let the users speak for themselves.
>
> I have.
>
> I've review several threads,publications, actions etc., that show that 
> the users have this need.

This is open source.  You don't just order somebody else to do
what you want. You _do_ it and donate it to the community.

> please review the initial thread with care, i've pointed to
> some documents/thread.

So what?  You want it, you do it.

-- 
Grant Edwards   grante Yow!  I'm in ATLANTIC CITY
  at   riding in a comfortable
   visi.comROLLING CHAIR...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Stephen Kellett 
<[EMAIL PROTECTED]> writes
Hi Robert,
Weird, you hit "reply" and the newsreader does a "post". C'est la vie.
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


newbie question - identifying name of method

2005-02-14 Thread mirandacascade
Does Python provide some sort of mechanism for answering the question:
what method am I in?

Example: assume the file example1.py contains the following code:

def driver():
print 'hello world'
print __name__
print 'the name of this method is %s' % str(???)

The output I'd like to see is:

hello world
example1
driver

and I'd like to be able to see it without hardcoding the string
'driver' in the third print statement.  Is there anything I can
substitute for the ??? that answers the question: what method am I in?

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


Re: newbie question - identifying name of method

2005-02-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

> Does Python provide some sort of mechanism for answering the question:
> what method am I in?
>
> Example: assume the file example1.py contains the following code:
>
> def driver():
>print 'hello world'
>print __name__
>print 'the name of this method is %s' % str(???)
>
> The output I'd like to see is:
>
> hello world
> example1
> driver
>
> and I'd like to be able to see it without hardcoding the string
> 'driver' in the third print statement.  Is there anything I can
> substitute for the ??? that answers the question: what method am I in?

replace str(???) with

(sys._getframe().f_code.co_name or "???")

 



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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread jfj
bruno modulix wrote:
Ilias Lazaridis wrote:
I'm a newcomer to python:
[EVALUATION] - E01: The Java Failure - May Python Helps?
http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553
My trollometer's beeping...
When person 'A' calls person 'B' a troll, these are the possibilities:
1. 'A' is indeed a troll
2. 'B' is the troll
3. both 'A' and 'B' are trolls
4. nobody is a troll. they're computer scientists passionate about their 
ideas and they are trying to convince each other.

5. nobody is a troll and there is no trolling going on.
Now, it's rather common to accuse people of trolling these days.
The fact that Markus Wankus said that Ilias is a troll does not mean
that everybody should reply to him in that tone.
This is a one .vs many battle and it sucks.
gerald
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   >