Re: The Industry choice

2005-01-06 Thread Stefan Axelsson
Bulba! wrote:
I've read Novell license of internal development tools it provides
(which I reviewed for some purpose). This is I think relevant 
part:

I'm not saying licenses like you claim don't exist. Sure,
they may exist and they suck. 

The point is, they have _limited impact_ and by 
the very fact of their "exclusion" nature, this
aspect tends to repel users than attract them to 
use this thing.
Well, as I didn't catch that we were discussing development tools but 
even so, I thought the license you quoted rather strengthened my point 
in the section on 'reverse engineering?. (Then again I've seen other's 
where that was not the case, was it MS (?) quite a few years back that 
didn't allow you to develop an OS using their tool chain? And that was a 
binary license.) If you look at actual end user program licenses (such 
as Solaris/wxWorks etc) the picture is much clearer.

In any case, it's somewhat beside the point as even the license you 
chose to quote took away precisely all those rights that the GPL grants 
you. You weren't allowed to (in any way shape or form) to communicate 
anything you knew about that source to anyone else.

And I don't buy into your argument that a use of some source code would 
go against the 'intended' use by making it GPL. How the hell am I 
supposed to know what the author 'intends' if he doesn't tell me? 
Especially if, of all the available licenses, choses one that explicitly 
permits the sort of use that I envision? I mean, it's not as if many BSD 
fans complain that MS took much TCP/IP related code and put it in 
Windows (ftp etc). Without sharing anything back with the community. If 
that's OK, how am I supposed to know that my use isn't?

It's just the same situation as when I lock my house. That's intended as 
a means of communication with the rest of society. It communicates my 
intent that I'm not home (or don't want to be disturbed) and that I 
don't want them in the house, and it does so more strongly than mere 
social convention does. There are after all several members of community 
that needs this reminder; notably children. It's emphatically not to 
keep thieves out (much) as they won't be much hampered by the ordinary lock.

If you don't want me to use your code in the way I envision then tell 
me. The license is the *perfect* place to do so.

Stefan,
--
Stefan Axelsson  (email at http://www.cs.chalmers.se/~sax)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread Paul Rubin
Roman Suzi <[EMAIL PROTECTED]> writes:
> I do not like the idea of having stubs. Once I had an experience working with
> CPAN (I tried to install SpamAssassin and it required some specific modules.)
> "Magic" install shell, provided by Perl, upgraded half the Perl distro,
> including newer version of Perl!
> 
> So, I do like Python distutils better. it is not a major problem to
> install something even if it required something else. Of course,
> this depends on the package authors.

But distutils don't help the problem that the module requires stuff
that's missing.  That's what happened with the thing I downloaded last
week, that needed wxPython.  I don't understand why the author felt he
had to use wxPython instead of tkinter, since it wasn't a really fancy
gui, but after already-described hassles trying to instead wxPython, I
just used the application's command line interface instead, which
worked fine.  But if wxPython is so much better, maybe it's time for
Python to include it.

I want to start using Audacity pretty soon, which I think really does
depend on wxPython, so I'm going to have to deal with this wxPython
installation problem which is definitely not completely trivial.  What
a pain.  

> Yes, probably there could be a no-brainer script to run install
> directly from zip and/or tar.gz/bz2 file, but I usually check
> md5, pgp sigs and look inside anyway before running something.

I thought distutils doesn't have any code-signing features.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: smtp question

2005-01-06 Thread Tim Roberts
"Philippe C. Martin" <[EMAIL PROTECTED]> wrote:

>Hi,
>
>I am testing the smtp module and have the following question:
>
>in the code below (taken from net sample) prior to adding the "Subject:"
>field, the email client found the "From" and the "To". Without the
>"Subject:" field on I get this:
>
>Email client = Evolution: the "From" field is blank
>Email client = KMail: the "To" field is blank
>
>Any clue ?

Absolutely.

>server = smtplib.SMTP('smtp.sbcglobal.yahoo.com')
>server.set_debuglevel(1)
>server.login ('x','yyy')
>server.sendmail(fromaddr, toaddrs, 'Subject:from python\n\n'+msg)
>server.quit()

You have two newlines following the Subject: line.  That inserts a blank
line, which terminates the headers.  Everything else, including the From:
and To: lines, will be taken as part of the message body.  I assume you
meant to use \r\n, but \n will work just as well and is less error prone.

>print "Message length is " + repr(len(msg))

Easier is:
  print "Message length is", len(msg)
More efficient is:
  print "Message length is %d" % len(msg) 
-- 
- Tim Roberts, [EMAIL PROTECTED]
  Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread Roman Suzi
On Fri, 6 Jan 2005, Paul Rubin wrote:

>software when I buy a new computer, or at least a new hard drive.  I
>don't try to migrate system or configuration files.  I just install
>the OS distro from scratch and migrate my user files.
>
>> There are several parts to those frustrations. But you are presuming
>> that they would have been solved for you and put on a DVD with all
>> dependency problems resolved. Ok, let's assume that. In that case,
>> an installation stub module could just as well have the solution built
>> into it as to what versions etc are needed to make the module work.

I do not like the idea of having stubs. Once I had an experience working with
CPAN (I tried to install SpamAssassin and it required some specific modules.)
"Magic" install shell, provided by Perl, upgraded half the Perl distro,
including newer version of Perl!

So, I do like Python distutils better. it is not a major problem to
install something even if it required something else. Of course,
this depends on the package authors.

>How can it work just as well, when it requires a high-speed internet
>connection which I might not have?  And why is "just as well" good
>enough, given how inconvenient and error-prone it is, compared with
>just installing from a DVD once and for all?  To have any attraction
>what ever, the installation stub scheme (for me at least) has to work
>"an order of magnitude better", not "just as well", as a one-time
>complete install.
>
>> To bring a large collection into version-alignment ISTM you need a version
>> freeze across too many libraries of different kinds with different
>> development schedules and resources to make it reliable.
>
>One part of the problem is excessive version dependence between
>package X and package Y.  That's why I think there should be more
>integration within packages, i.e. the Python distro should include a
>lot more modules that you currently have to download from other
>places.
>
>> I realize this problem has been "solved" with various RPM and
>> app-loading methods, but I think python could wrap its solution
>> nicely. I don't think distutils and setup.py is easy enough to
>> create (at least I have been somewhat frustrated in using it
>> effectively), though it deals with a lot of what has to be done.
>
>Since all these schemes have failed whenever they've been tried, all I
>can think is that it's a harder problem than it sounds.

I have installed many packages with Distutils, and usually there were no
problems. If there were, they were no greater than installing some
devel library and/or adding an include directory. So, Distutils, IMHO,
are successful.

Yes, probably there could be a no-brainer script to run install
directly from zip and/or tar.gz/bz2 file, but I usually check
md5, pgp sigs and look inside anyway before running something.


Sincerely yours, Roman Suzi
-- 
[EMAIL PROTECTED] =\= My AI powered by GNU/Linux RedHat 7.3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread David Fraser
Alex Martelli wrote:
Carlos Ribeiro <[EMAIL PROTECTED]> wrote:
   ...
wish I could simply plug & play DBAPI modules in a totally seamlessly
way. Anyone who tried know how far are we of this dream.

If you manage to get there, you'll start fighting against the different
dialects of SQL supported by the various back-ends, as is well known by
anybody who tried, say, ODBC or ADO, which do manage good plug&play of
their components but still can't solve the real hard one:-(
I've found I can get by nicely by just supporting stock standard bottom 
end SQL and not using any database-specific features. Just requires a 
little wrapper code for some functions

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


Re: Other notes

2005-01-06 Thread Andrew Dalke
Bengt Richter:
> But it does look ahead to recognize += (i.e., it doesn't generate two
> successive also-legal tokens of '+' and '=')
> so it seems it should be a simple fix.

But that works precisely because of the greedy nature of tokenization.
Given "a+=2" the longest token it finds first is "a" because "a+"
is not a valid token.  The next token is "+=".  It isn't just "+"
because "+=" is valid.  And the last token is "2".

Compare to "a+ =2".  In this case the tokens are "a", "+", "=", "2"
and the result is a syntax error.

>  >>> for t in tokenize.generate_tokens(StringIO.StringIO('a=b+c; a+=2; 
> x..y').readline):print t
>  ...

This reinforces what I'm saying, no?  Otherwise I don't understand
your reason for showing it.

>  (51, '+=', (1, 8), (1, 10), 'a=b+c; a+=2; x..y')

As I said, the "+=" is found as a single token, and not as two
tokens merged into __iadd__ by the parser.

After some thought I realized that a short explanation may be helpful.
There are two stages in parsing a data file, at least in the standard
CS way of viewing things.  First, tokenize the input.  This turns
characters into words.  Second, parse the words into a structure.
The result is a parse tree.

Both steps can do a sort of look-ahead.  Tokenizers usually only look
ahead one character.  These are almost invariably based on regular
expressions.  There are many different parsing algorithms, with
different tradeoffs.  Python's is a LL(1) parser.  The (1) means it
can look ahead one token to resolve ambiguities in a language.
(The LL is part of a classification scheme which summarizes how
the algorithm works.)

Consider if 1..3 were to be legal syntax.  Then the tokenizer
would need to note the ambiguity that the first token could be
a "1." or a "1".  If "1." then then next token could be a "."
or a ".3".  In fact, here is the full list of possible choices

  <1.> <.> <3>same as getattr(1., 3)
  <1> <.> <.> 3   not legal syntax
  <1.> <.3>   not legal syntax
  <1> <..> <3>legal with the proposed syntax.

Some parsers can handle this ambiguity, but Python's
deliberately does not.  Why?  Because people also find
it tricky to resolve ambiguity (hence problems with
precedence rules).  After all, should 1..2 be interpreted
as 1. . 2 or as 1 .. 2?  What about 1...2?  (Is it 1. .. 2,
1 .. .2 or 1. . .2 ?)


Andrew
[EMAIL PROTECTED]

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


Re: curses is not imported under Linux (and Python 2.4)

2005-01-06 Thread Craig Ringer
On Fri, 2005-01-07 at 00:38, Konrad Koller wrote:
> import curses
> produces the ImportError: No module named _curses
> ("from _curses import *"  in line 15 in __init__.py)
> Of course imp.find_module ("_curses") reports the same error.
> How can I make use of the curses package for writing a Python script
> with curses?

What Linux distro?
Is the Python version you're running one you compiled, one that shipped
with the distro, or a 3rd party RPM?

At a guess, I'd say you compiled it yourself and you don't have the
ncurses development packages (providing the ncurses header files and
static libs) installed.

--
Craig Ringer

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


Re: Embedding a restricted python interpreter

2005-01-06 Thread Craig Ringer
On Thu, 2005-01-06 at 23:40, Steve Holden wrote:
> Jp Calderone wrote:
> 
> [...]
> > 
> > 
> >   A Python sandbox would be useful, but the hosting provider's excuse
> > for not allowing you to use mod_python is completely bogus.  All the 
> > necessary security tools for that situation are provided by the 
> > platform in the form of process and user separation.
> 
> Not sure this is strictly true: mod_python gets loaded into the server's 
> address space and gives the ability to add any type of handler. While 
> Apache might well be able to respawn failed subprocesses, it's not 
> something that most hosting providers would like to have to do all the 
> time for many hosted sites.

I wonder if SCGI or a similar "persistent CGI" solution might be more
practical for running CGI scripts under specific user accounts.

--
Craig Ringer

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


Re: File Handling Problems Python I/O

2005-01-06 Thread Craig Ringer
On Fri, 2005-01-07 at 02:06, Josh wrote:
> Peter,
> 
> Thank you for the rookie correction. That was my exact problem. I
> changed the address to use forward slashes and it works perfect. I did
> not know that a backslash had special meaning within a string, but now
> I do! Thanks again

There's another common mistake you might want to head off now, too.
Consider the following program:


directory = r"c:\mydata"
datafilename = "something.txt"

datafile = open(directory + datafilename,"r")
-

It's very common for this to happen, usually when the paths are
originally written with trailing slashes then changed to not have them
later.

Rather than saying "all paths must have trailing slashes", manually
formatting in slashes, or other platform-specific uglyness, consider
using the os.path module to take care of it:


import os

directory = r"c:\mydata"
datafilename = "something.txt"

datafile = open(os.path.join(directory,datafilename),"r")


This will work on any platform (so long as the literal paths are
correct) and will work no matter whether or not there are trailing path
separators on the input strings. os.path.join can take more than two
arguments, too.

os.path has lots of other handy tools, so I strongly recommend checking
it out.

--
Craig Ringer

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


Re: Python C Object Comparison

2005-01-06 Thread Craig Ringer
On Thu, 2005-01-06 at 18:34, Anand K Rayudu wrote:

> Here is my python code
> 
> import myModule
> 
> a=myModule.myAPI1("1")
> b=myModule.myAPI2("name")
> 
> # basically both above functions return same C pointer.
> # so i want to compare
> if(a==b): print "They are same"
> else : print "They are different"
> 
> python always prints they are different,
> I guess this is because in python layer we create PythonCObject for 
> every C pointer, and that is how it is exposed to python. Though both 
> the APIs are returning the same C pointer, they are different instances 
> of PythonCObject.

That sounds likely to me.

> So i guess that is the reason comparison is failing.
> How ever is it possible to make python to compare actual C pointer, 
> rather than the PythonCObject Pointer.

You might be able to subclass PyCObject and work with your subclassed
version (that adds a __eq__ method). In the end, though, I don't think
that's the right path to proceed down.

My understanding is that CObjects are for passing pointers through
Python code in a safe way. I don't think they're really intended for
uses where the Python code is actually working with the objects, only
pass them around as opaque objects.

If you want to actually work with the objects you're passing around, I'd
think about implementing my own type that better fits the API my
extension module wants to present to Python code.

I'm using PyCObjects as a temporary ugly hack in an embedded app I'm
working on... but it's seriously ugly. What I should do, and will soon
do now that I've tested the concept of what I'm doing and it works, is
move all my functions into a class and make the class own and manage the
C++ object (and pointer to it) that it owns.

Perhaps that's a better solution for you too? 

If you want any opinions from folks here about the best way to solve
your problem, you'll probably need to explain a bit more of your problem
- like what your extension module is doing that makes it have to pass
PyCObjects around and get Python code to work with them.

--
Craig Ringer

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


Re: Python evolution: Unease

2005-01-06 Thread Paul Rubin
[EMAIL PROTECTED] (Bengt Richter) writes:
> I agree 1000% !! Importing a stub should get you an imported stub that
> prints info as it imports, so you know its not functional. 

But I don't even understand why I'd even want to use these stubs,
instead of just having the full installation from day 1.

> >This may sound a little extreme but my distribution philosophy is I'd
> >like to get closer to an environment where users normally never
> >install any software of any type, ever.
> It makes a lot of sense for a "core" plus a delivered specific application
> base, but IMO if you try to cover the world with a monolith you will
> inevitably still have the problem of getting the latest version of
> particular packages for bug fixes or enhancements.

I might want the latest enhancements for particular programs that I'm
willing to devote a lot of attention to, but for the most part I don't
want to be a beta tester, I only want to use stable software, where
the definition of stable is that the latest version isn't much
different from the previous version.  I try quite hard to avoid ever
upgrading software ("upgrade" means replace an existing, working
version of something with a newer version) on my PC.  I only want new
software when I buy a new computer, or at least a new hard drive.  I
don't try to migrate system or configuration files.  I just install
the OS distro from scratch and migrate my user files.

> There are several parts to those frustrations. But you are presuming
> that they would have been solved for you and put on a DVD with all
> dependency problems resolved. Ok, let's assume that. In that case,
> an installation stub module could just as well have the solution built
> into it as to what versions etc are needed to make the module work.

How can it work just as well, when it requires a high-speed internet
connection which I might not have?  And why is "just as well" good
enough, given how inconvenient and error-prone it is, compared with
just installing from a DVD once and for all?  To have any attraction
what ever, the installation stub scheme (for me at least) has to work
"an order of magnitude better", not "just as well", as a one-time
complete install.

> To bring a large collection into version-alignment ISTM you need a version
> freeze across too many libraries of different kinds with different
> development schedules and resources to make it reliable.

One part of the problem is excessive version dependence between
package X and package Y.  That's why I think there should be more
integration within packages, i.e. the Python distro should include a
lot more modules that you currently have to download from other
places.

> When your wxPython-using program didn't work, wouldn't it have been nice
> to have downloaded a standard stub program (with older stub versions still
> available if you have an older system) and have it tell you what
> was missing that it needed before you decided to let it continue and
> get those things? Or choose not to? 

Huh?  Getting those stubs to work properly has to be even harder than
getting the distros to play nice with each other in the first place.
So I'd rather that the stub-writing effort instead be put into
eliminating the version conflicts.

> With broadband most apps will be ready before you can make fresh
> coffee, or maybe watch the Simpsons.

In reality, whenever I try to install or download anything, something
fails as often as not.  I don't think I've ever seen a CPAN download
work right on the first try.  Really, I just want to buy a new
computer, turn it on, and have everything there.  That's generally
impossible without running satanware from Redmond, so I approximate it
as best as I can by doing a DVD install on new computers.  I don't
care if the software I'm running isn't the bleeding-edge latest.  GCC
today isn't different from GCC five years ago in any way that I care
about.  With Emacs, it's more like 10 years.  I buy a new computer
every 2 years or so, which means that any software I'm using by then
will be at least 2 years old unless it's something I'm making special
effort to stay on top of.  If it's already a year or so old when I
first start running it, I'm ok with that.

> I realize this problem has been "solved" with various RPM and
> app-loading methods, but I think python could wrap its solution
> nicely. I don't think distutils and setup.py is easy enough to
> create (at least I have been somewhat frustrated in using it
> effectively), though it deals with a lot of what has to be done.

Since all these schemes have failed whenever they've been tried, all I
can think is that it's a harder problem than it sounds.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Another PythonWin Excel question

2005-01-06 Thread It's me
Okay, thanks.  That helps a lot.

"Mike Thompson"  wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > Yes, Mike,
> >
> > Others pointed that out as well.
>
> For good reason.
>
> >
> > The difficulty is that they are all in VBAs.   Most of them can be
> > translated to Python fairly easily, and some I can get from looking at
the
> > recorded macro - but some requires quite a bit of head scratching.
> >
> > For instance, I wanted to figure out how create a new window.   So, I
went
> > through the record macro process and looked at the VBA code,  it says:
> >
> > ActiveWindow.NewWindow
>
> app.ActiveWindow.NewWindow()
>
> >
> > Okay.  Now what???
> >
> > And for switching window, it says:
> >
> > Windows("Book1:1").Activate
>
> app.Windows.Item("Book1:1").Activate()
>
> -
>
> from win32com.client import Dispatch, constants
>
> app = Dispatch("Excel.Application")
> app.Visible = True
>
> workbook = app.Workbooks.Add()
>
> defaultWorksheet = workbook.Worksheets(1)
>
> app.ActiveWindow.NewWindow()
> app.ActiveWindow.NewWindow()
>
> # grab the capation (like 'Book1:1') from one of the windows
> thridWindowsCaption = app.Windows[2].Caption
>
> print thridWindowsCaption
> app.Windows.Item(thridWindowsCaption).Activate()
>
> 
>
> Sometimes its useful to look in the file generated by makepy. It details
> all the classes and their methods AND there are annotations in the form
> of comments.  Having said that, if you've never looked in a makepy
> generated module before, you're in for a shock -  it takes a while
> before you figure out what you are looking at.
>
> When you get stuck, trial & error and a good debuger are your friend.
>
> --
> Mike


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


Re: Embedding a restricted python interpreter

2005-01-06 Thread Craig Ringer
On Thu, 2005-01-06 at 23:05, Peter Maas wrote:
> Craig Ringer schrieb:

> It would certainly be difficult to track all harmful code constructs.
> But AFAIK the idea of a sandbox is not to look at the offending code
> but to protect the offended objects: files, databases, URLs, sockets
> etc. and to raise a security exception when some code tries to offend
> them.

That's a good point. I'm not sure it's really all that different in the
end though, because in order to control access to those resources you
have to restrict what the program can do.

It'd probably be valid to implement a restricted mode at CPython level
(in my still-quite-new-to-the-Python/C-API view) by checking at the
"exit points" for important resources such as files, etc. I guess that's
getting into talk of something like the Java sandbox, though - something
Java proved is far from trivial to implement. Of course, CPython is just
a /tad/ smaller than Java ;-) .

Personally, I'd be worried about the amount of time it'd take and the
difficulty of getting it right. One wouldn't want to impart a false
sense of security.

My original point, though, was that I don't think you can use the
standard interpreter to create a restricted environment that will be
both useful and even vaguely secure. I'd be absolutely delighted if
someone could prove me wrong.

> Python is a very well designed language but progress is made by
> criticism not by satisfaction ;)

Heh, I'm hardly complacent... I run into quite enough problems,
especially with embedding and with the C API. Maybe one day I'll have
the knowledge - and the time - to have a chance at tackling them.

I'd love a restricted mode - it'd be great. I'm just not very optimistic
about its practicality.

--
Craig Ringer

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


Re: Python Operating System???

2005-01-06 Thread Nick Vargish
Arich Chanachai <[EMAIL PROTECTED]> writes:

> He should just build around a linux core or use OS kit (if he is
> serious/determined).

There's Ubuntu Linux, a Debian-based distro with commercial backing
and a regular release schedule. One of the neat things about Ubuntu is
that Python use is encouraged. "Python scripting everywhere" is a
stated goal, and they have a number of bounties that concentrate on
deepening the use of Python in the OS:

http://www.ubuntulinux.org/community/bounties

I've been using it on a couple of desktops, and I've been impressed by
the overall quality of the distro. One thing I especially like is that
the root account is disabled by default, administrative tasks are
performed with sudo by users in the appropriate group (much like it is
in Mac OS X 10.3).

Nick

-- 
#  sigmask  ||  0.2  ||  20030107  ||  public domain  ||  feed this to a python
print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what is lambda used for in real code?

2005-01-06 Thread Steven Bethard
I wrote:
* Functions I don't know how to rewrite
Some functions I looked at, I couldn't figure out a way to rewrite them 
without introducing a new name or adding new statements.

[snip]
inspect.py: def formatargspec(args, varargs=None, varkw=None,
  ...
  formatvarargs=lambda name: '*' + name,
  formatvarkw=lambda name: '**' + name,
  formatvalue=lambda value: '=' + repr(value),
inspect.py: def formatargvalues(args, varargs, varkw, locals,
...
formatvarargs=lambda name: '*' + name,
formatvarkw=lambda name: '**' + name,
formatvalue=lambda value: '=' + repr(value),
Realized today that I do know how to rewrite these without a lambda, 
using bound methods:
def formatargspec(args, varargs=None, varkw=None,
  ...
  formatvarargs='*%s'.__mod__,
  formatvarkw='**%s'.__mod__,
  formatvalue='=%r'.__mod__,
I like this rewrite a lot because you can see that the function is 
basically just the given format string. YMMV, of course.

Similarly, if DEF_PARAM, DEF_BOUND and glob are all ints (or supply the 
int methods), I can rewrite

symtable.py:   self.__params = self.__idents_matching(lambda x:
  x & DEF_PARAM)
symtable.py:   self.__locals = self.__idents_matching(lambda x:
  x & DEF_BOUND)
symtable.py:   self.__globals = self.__idents_matching(lambda x:
   x & glob)
with the bound methods of the int objects:
self.__params = self.__idents_matching(DEF_PARAM.__rand__)
self.__locals = self.__idents_matching(DEF_BOUND.__rand__)
self.__globals = self.__idents_matching(glob.__rand__)
(Actually, I could probably use __and__ instead of __rand__, but 
__rand__ was the most direct translation.)

Ahh, the glory of bound methods... ;)
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread Terry Reedy

"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message 
news:[EMAIL PROTECTED]
> "Terry Reedy" <[EMAIL PROTECTED]> writes:
>> Would it be possible, at least for Windows, to write a Python script
>> implementing a 'virtual distribution'?  IE, download Python, install it,
>> download next package, install it, etc.  -- prefereably table driven?
>
> I just don't understand why you'd want to do that, instead of putting
> all the files in the distro in the first place.

For myself, I can imagine writing such a script using existing installers. 
I have no idea how to put, say, 20 packages together in one installer. 
Even if I could, I would not personally buy the bandwidth for gigabyte 
downloads.  I could, however, find somewhere to put a 1K or so script.

Terry J. Reedy




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


Re: Python evolution: Unease

2005-01-06 Thread Terry Reedy

"Peter Hansen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Terry Reedy wrote:
>> Would it be possible, at least for Windows, to write a Python script 
>> implementing a 'virtual distribution'?  IE, download Python, install it, 
>> download next package, install it, etc.  -- prefereably table driven?
>
> How would you run the script in the first place?

Duh... with my existing version of Python (which I have had some version of 
for so long that I had forgotten what it is to not have one handy) ;-).

Ok, 2 step process for first timers.

Terry J. Reedy



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


Re: Problem remotely shutting down a windows computer with python

2005-01-06 Thread EW
This does exactly what I needed!  Thanks!  Not sure what Windows
Management Instrumentation is, but I'll look into it now.

Eric

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


Re: Python Operating System???

2005-01-06 Thread John Roth
"David Brown" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hello. I recently came across a free operating system called Unununium (or
something like that) and it was developed in Python and Assembly.
Now, I have been looking for a way to make an operating system for a long
long time and the only possibilities I could find were C++ and assembly. I
don't mind assembly so much if I don't have to use it very often. But C++ 
is
so complicated and errors are pretty much impossible to find in the code 
for
me.

So, I was wondering if it would be possible to find a bootloader that 
loads
a python file at startup or something...

Is there an example somewhere of a Python OS?
As far as I know, there's no working example. Unununium is still
very early development, and it's going off in a quite interesting
direction that is hardly standard.
Writing an operating system is a lot of work. The approach I'd
take would be to start out with an existing micro-kernel and
enhance it with a kernel level Python system so that you wouldn't
need any C or Asm level code in a typical process.
Then I'd pursue a restricted subset of Python that could be
compiled directly to machine code, and start recoding the
various C and Asm parts in that. See the PyPy project for
the direction they're taking for writing the Python system in
Python.
Have fun with the project!
John Roth

Thanks!

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


This Program Realy Works

2005-01-06 Thread MIke
MAKE LOTS OF MONEY QUICKLY, GUARANTEED 100%, NO SCAM! 

Turn 6.00 into 42,000! This is true!! Read this carefully to find out 
how!! 

READING THIS WILL CHANGE YOUR LIFE! 
I found this on a bulletin board and decided to try it. A little while back, I 
was browsing through newsgroups, and came across an article similar to this 
that said you could make thousands of cash within weeks with only an initial 
investment of .00! So I thought, "Yeah right, this must be a scam", but like 
most of us, I was curious, so I kept reading. 

Before you get skeptical, just take a few minutes to finish reading. 

HERE'S HOW IT WORKS 
WITH THIS PLAN, YOU REALLY CAN MAKE TONS OF TOTALLY LEGAL, FAST AND EASY CASH 
MONEY!! IT WORKS!!! BUT YOU HAVE TO FOLLOW IT CAREFULLY FOR IT TO WORK 
CORRECTLY AND IN YOUR FAVOR WITH ALL THE MONEY YOU ARE GONNA MAKE, YOU WILL 
SOON GET EVERYTHING YOU'VE ALWAYS DREAMED OF 

ALL YOU DO IS...
All you do is send $1.00 to each of the 6 names and address stated in the 
article. You then place your own name and address in the bottom of the list at 
#6, and post the article in at least 200 newsgroups. (There are thousands.) No 
catch, that was it . So after thinking it over, and talking to a few people 
first, I thought about trying it. I figured, what have I got to lose except 6 
stamps and 6.00, right? Like most of us I was a little skeptical and a little 
worried about the legal aspects of it all. So I checked it out with the U.S. 
Post Office (1-800-725-2161) and they confirmed that it is indeed legal! 

AND THEN GUESS WHAT...
Then I invested the measly 6.00. Well, GUESS WHAT!!... Within 7 days, I started 
getting money just kept coming in. In my first week, I made about 25. By the 
end of the second week I had made a total of over 1,000! In the third week I 
had over 10,000 and it's still growing. This is now my fourth week and I have 
made a total of just over 42000, and it's still coming in rapidly. It's 
certainly worth 6. and 6 stamps. By the way, I have spent more than that on the 
lottery in the last month!! Let me tell you how this works and most 
importantly, why it works also, make sure you print a copy of this article 
NOW, So you can get the information off of it, as you need it. 

SO LET'S GET STARTED AND SEE WHAT HAPPENS

STEP 1: 
Get 6 separate pieces of paper and write the following on eash piece of paper, 
"PLEASE PUT MY NAME ON YOUR MAILING LIST." Also, be sure to include your name 
and address. Now, get 6 U.S. $1.00 bills and place ONE inside EACH of the 6 
pieces of paper so the bill will not be seen through the envelope, to prevent 
thievery. Next, place one paper in each of the 6 envelopes and seal them. You 
should now have 6 sealed envelopes, each with a piece of paper stating the 
above phrase, your name and address email , and a $1.00 bill. What you are 
doing is creating a service by this. THIS IS ABSOLUTELY LEGAL! 

STEP 2 :

Mail the 6 envelopes to the following addresses: 

#1 John Christensen 5446 Santa Barbara Sparks, NV 89436
#2 Randall Hines 22 Stature Dr. Newark DE 19713
#3 Mike Sharrer 921 West State St. Coopersburg PA 18036
#4 Travis Montgomery 2211 Elmers Lane Norfolk NE 68701
#5 James Adair the third 22 Over Rd. Feasterville PA 19053
#6 Michael Lescault 123 Rhode Island Ave. Pawtucket, RI. 02860

STEP 3:
Now take the #1 name off the list that you see above, move the other names up 
(6 becomes 5, 5 becomes 4, etc.) and add YOUR Name as number 6 on the list. 

STEP 4: 
Change anything you need to, but try to keep this article as close to original 
as possible. If you do not live in the U.S. or there is a foreign address, you 
must put an international stamp on your envelopes. Now, post your amended 
article to at least 200 newsgroups. ( I think there are close to 24,000 groups 
in all.) All you need is 200, but remember, the more you post, the more money 
you make!! 


DIRECTIONS FOR POSTING TO NEWSGROUP BULLETINS
STEP 1: You do not need to re-type this entire letter to do your own posting. 
Simply put you cursor at the beginning of this letter and drag your cursor to 
the bottom of this letter. Then select 'copy' from the edit menu. 
This will copy the entire letter into the computer's temporary memory. 

STEP 2: Open a blank 'notepad' or word processor file and place your cursor at 
the top of the blank page. From the 'edit' menu select 'paste'. This will paste 
a copy of the letter into notepad so that you can add your name to the list. 

STEP 3: Save your new notepad file as a *.txt file. If you want to do your 
postings in different sittings, you'll always have this file to fo back to. 

STEP 4: Use your Internet provider and search engines to find various 
newsgroups (on-line forums, message boards, chat sites, discussions). 

STEP 5: Visit these message boards and post this article as a new message by 
higlighting the text of this letter and selecting paste from the edit menu. 
Fill in the Subject, and this will be the header that ev

Re: The Industry choice

2005-01-06 Thread Steve Holden
Bulba! wrote:
On Thu, 06 Jan 2005 09:42:42 -0500, Steve Holden <[EMAIL PROTECTED]>
wrote:
You see, I'm not disagreeing with you that your model applies
_where it applies_. I only disagree that it applies in face of
stronger forces. Now what kind of forces is dominant in 
most frequent scenarios would have to be worked out in tedious
empirical research I think. Which I haven't done, because
learning some economics is just a hobby to me.

Yes, by all means let's just spout our opinions without any of that 
inconvenient tedious empirical research which might invalidate them.

Err, but what did I do that got you visibly pissed off?
I certainly did not mean offending anyone. If I did smth
that did, I apologize, but honestly I didn't mean that. I
just expressed my opinion and cited some small bits of evidence, 
which I think I'm entitled to.

I am probably not as pissed off as you might think, but I'm beginning to 
find (what I regard as) your naivety a little irritating. However, 
nothing I have said was intended to question your integrity.

[...]

Oh, and by the way that installation doesn't get used much.
Somebody at the office didn't check carefully enough the
energy prices before ordering it and later someone discovered 
that off-site specialized cutting firms that take advantage of 
energy available at low prices at special times in other countries
can get it produced cheaper. Moving it elsewhere or selling
is not an option, since it is a specially constructed, low, 50-meters
long hall that stands inside the huge manufacturing hall of the
company.

And you are using this example to try and argue that engineers are 
better-educated than sales people? 

Nope. The context was that behavior of companies tends to
be highly rational, optimized and not wasting resources. My 
naturally individual experience was that it was oft not the case, 
and that was the example. 

Well, anyone who *does* believe that companies are managed in a way 
that's any more rational than the way individual humans manage their own 
lives is deluding themselves. But perhaps I'm a little clearer now about 
*your* thinking on this.

Which was my point when explaining the clustering that
demonstrably happened: if the behavior of decisionmakers
is highly informed, rational and not really induced much by 
risk avoidance as Alex claims, then the clusters are created 
by "natural economic forces". 

The agent of economic forces, however, are always individual humans. It 
just isn't possible to factor them out.

However, if the process is not that rational, then maybe 
clusters are the correlation of "cover your ass" aspect
in managers' behavior all wanting to get their branch office 
in yesterday in Tokyo, today in Beijing, and during 
speculative craze in Russia in Moscow "because everybody
is doing that". Which observations  of Paul Krugman on 
"defective investors" seem to support. 

Now, I'm very strongly opposed to saying that all  that 
somehow invalidates economics, including economics 
of software, as _science_.

All I'm saying is that maybe this particular model is not
what some people think it is. This is the problem with
economics, people tend to get hot under the collar about 
it for some reason and it's oft hard to debate that calmly. 
Which personally I find a pity, because  e.g. economics 
of software is such an interesting subject..

I can live with that, I guess.

Who sold this installation? Who 
bought it? 

I have no idea, as I were not a manager there and it
didn't really pertain my work.
I was merely trying to point out that the sales people may well have 
worked a flanker on the "better educated" engineers who might have 
bought the plant.

I was utterly shocked. Having grown up in Soviet times I have
been used to seeing precious resources wasted by organizations
as if resources were growing on trees, but smth like this?! In a
shining ideal country of Germany?! Unthinkable.
 

Indeed not. Quite often the brown paper bag is a factor in purchases 
like this. I wouldn't be at all surprised if somebody with a major input 
to the decision-making process retired to a nice place in the country 
shortly afterwards. You appear to be making the mistake of believing 
that people will act in the larger interest, when sadly most individuals 
tend to put their own interests first (some would go as far as to define 
self-interest as the determinant of behavior).

But there is a subtler point here: most likely it was NOT in the
short-term personal interest to make this mistake (as I believe
corruption was not the case in this decision)! 

After all, whoever responsible was still running the considerable risk
of getting fired. It is an example that precisely negates either
collective or individual, long-term or short-term, interest was
primary factor in this decision.
 
Well, you would know better than me, but believe me when I say that such 
decisions being made for the economic benefit of a single individual are 
far from rare.


The fir

Re: Another PythonWin Excel question

2005-01-06 Thread Mike Thompson
It's me wrote:
Yes, Mike,
Others pointed that out as well.
For good reason.
The difficulty is that they are all in VBAs.   Most of them can be
translated to Python fairly easily, and some I can get from looking at the
recorded macro - but some requires quite a bit of head scratching.
For instance, I wanted to figure out how create a new window.   So, I went
through the record macro process and looked at the VBA code,  it says:
ActiveWindow.NewWindow
app.ActiveWindow.NewWindow()
Okay.  Now what???
And for switching window, it says:
Windows("Book1:1").Activate
app.Windows.Item("Book1:1").Activate()
-
from win32com.client import Dispatch, constants
app = Dispatch("Excel.Application")
app.Visible = True
workbook = app.Workbooks.Add()
defaultWorksheet = workbook.Worksheets(1)
app.ActiveWindow.NewWindow()
app.ActiveWindow.NewWindow()
# grab the capation (like 'Book1:1') from one of the windows
thridWindowsCaption = app.Windows[2].Caption
print thridWindowsCaption
app.Windows.Item(thridWindowsCaption).Activate()

Sometimes its useful to look in the file generated by makepy. It details
all the classes and their methods AND there are annotations in the form
of comments.  Having said that, if you've never looked in a makepy 
generated module before, you're in for a shock -  it takes a while 
before you figure out what you are looking at.

When you get stuck, trial & error and a good debuger are your friend.
--
Mike
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Terry Reedy

"Alan Gauld" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Thu, 30 Dec 2004 23:28:46 +1000, Nick Coghlan
> <[EMAIL PROTECTED]> wrote:
>
>> GvR has commented that he want to get rid of the lambda keyword for 
>> Python 3.0.
>> Getting rid of lambda seems like a worthy goal,
>
> Can I ask what the objection to lambda is?
> 1) Is it the syntax?
> 2) Is it the limitation to a single expression?
> 3) Is it the word itself?

Depending on the person, any of the 3.  Plus add
4) The constant complaints re: 2)

> I can sympathise with 1 and 2 but the 3rd seems strange since a
> lambda is a well defined name for an anonymous function used in
> several programming languages and originating in lambda calculus
> in math.

And that is why 'lambda' is wrong -- in Python, it is only an abbreviation 
for a restricted group of def statements, which is *not* its 'well defined' 
usage.  Hence complaints re 2.  If the syntax were def x: x + 2, etc, I 
suspect the complaints would be far fewer.

For some new programmers, 'lambda' is as meaningless as elle*.  All other 
Python keywords are English words or obvious abbreviations thereof.

> So why not retain the name lambda but extend or change the syntax
> to make it more capable rather than invent a wholly new syntax
> for lambdas?

That you suggest this illustrates, to me, what is wrong with the name ;-)

Terry J. Reedy

* The Spanish name for the letter 'll', pronounced el-yea, which comes 
after 'l' in their alphabet.



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


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Doug Holton
Alan Gauld wrote:
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. 
Getting rid of lambda seems like a worthy goal, 

Can I ask what the objection to lambda is? 
1) Is it the syntax?
2) Is it the limitation to a single expression?
3) Is it the word itself?

I can sympathise with 1 and 2 but the 3rd seems strange since a
lambda is a well defined name for an anonymous function used in
several programming languages and originating in lambda calculus
in math. Lambda therefore seems like a pefectly good name to
choose.
I agree with keeping lambda functionality, and I don't care what name is 
used, but there are people who do not like "lambda":
http://lambda-the-ultimate.org/node/view/419#comment-3069
The word "lambda" is meaningless to most people.  Of course so is "def", 
which might be why Guido van Robot changed it to "define": 
http://gvr.sourceforge.net/screen_shots/

Even a simple word like "type" can be difficult to explain to beginners:
http://lambda-the-ultimate.org/node/view/337
Python is easier for beginners to learn than other mainstream 
programming languages (like java or C++), but that's not to say it 
doesn't have some stumbling blocks for beginners of course: 
http://www.linuxjournal.com/article/5028

So why not retain the name lambda but extend or change the syntax
to make it more capable rather than invent a wholly new syntax
for lambdas?
Yes, I agree, and either keep the "lambda" keyword or else reuse the 
"def" keyword for anonymous methods.  See this page Steven Bethard 
created: http://www.python.org/moin/AlternateLambdaSyntax

I really don't think anyone should worry about lambda disappearing.
By the way, you've done great work with your learning to program site 
and all the help you've given on the python-tutor list:

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
--
http://mail.python.org/mailman/listinfo/python-list


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Jeff Shannon
Paul Rubin wrote:
Jeff Shannon <[EMAIL PROTECTED]> writes:
It seems to me that in other, less-dynamic languages, lambdas are
significantly different from functions in that lambdas can be created
at runtime.
What languages are those, where you can create anonymous functions
at runtime, but not named functions?!  That notion is very surprising
to me.
Hm, I should have been more clear that I'm inferring this from things 
that others have said about lambdas in other languages; I'm sadly 
rather language-deficient (especially as regards *worthwhile* 
languages) myself.  This particular impression was formed from a 
recent-ish thread about lambdas

http://groups-beta.google.com/group/comp.lang.python/messages/1719ff05118c4a71,7323f2271e54e62f,a77677a3b8ff554d,844e49bea4c53c0e,c126222f109b4a2d,b1c9627390ee2506,0b40192c36da8117,e3b7401c3cc07939,6eaa8c242ab01870,cfeff300631bd9f2?thread_id=3afee62f7ed7094b&mode=thread
(line-wrap's gonna mangle that, but it's all one line...)
Looking back, I see that I've mis-stated what I'd originally 
concluded, and that my original conclusion was a bit questionable to 
begin with.  In the referenced thread, it was the O.P.'s assertion 
that lambdas made higher-order and dynamic functions possible.  From 
this, I inferred (possibly incorrectly) a different relationship 
between functions and lambdas in other (static) languages than exists 
in Python.

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes:
> Would it be possible, at least for Windows, to write a Python script 
> implementing a 'virtual distribution'?  IE, download Python, install it, 
> download next package, install it, etc.  -- prefereably table driven?

I just don't understand why you'd want to do that, instead of putting
all the files in the distro in the first place.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a restricted python interpreter

2005-01-06 Thread Doug Holton
Rolf Magnus wrote:
Hi,
I would like to embed a python interpreter within a program, but since that
program would be able to automatically download scripts from the internet,
I'd like to run those in a restricted environment, which basically means
that I want to allow only a specific set of modules to be used by the
scripts, so that it wouldn't be possible for them to remove files from the
hard drive, kill processes or do other nasty stuff.
Is there any way to do that with the standard python interpreter?
Hi, there is a page on this topic here:
http://www.python.org/moin/SandboxedPython
The short answer is that it is not possible to do this with the CPython, 
but you can run sandboxed code on other virtual machines, such as Java's 
JVM with Jython, or .NET/Mono's CLR with Boo or IronPython.

In the future it may also be possible to do this with PyPy or Parrot.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Working with flat files [LDIF].

2005-01-06 Thread Michael Ströder
[EMAIL PROTECTED] wrote:
Scott A. McIntyre wrote:
I looked around but didn't see any LDIF tools for perl or python...
Did you ever get this issue resolved?  I have a similar need to merge
two LDIF files.
Use module LDIF which is part of http://python-ldap.sourceforge.net/. 
You can use it stand-alone without installing the rest.

Yes, docs are *very* sparse for this module but you can find sample code 
in directory Demo/Lib/ldif/ of the source distribution.

Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython clipboard

2005-01-06 Thread Lorenzo Bolognini
[EMAIL PROTECTED] wrote:
Ok well you should look at this module
http://www.rutherfurd.net/python/sendkeys/#id1
I then you could take frequent snapshots and use and OCR to find your
stuff.  Then use the above library to type to the window.
Ok the problem on Windows looks like solved but still I would have to 
check if Windows Scripting Host is enabled.

Anyway I'll keep u updated
Cheers Lorenzo
--
Get my PGP Public Key @ http://www.bolognini.net/LBolognini.txt
--
http://mail.python.org/mailman/listinfo/python-list


Re: Excluded and other middles in licensing

2005-01-06 Thread Robert Kern
Cameron Laird wrote:
In article <[EMAIL PROTECTED]>,
Alex Martelli <[EMAIL PROTECTED]> wrote:
.
.
.
One last reflection -- I believe there are or used to be some programs
written by people no doubt of very good will, distributed with all
sources and often with no profit motive at all, which are NOT open
source because they include in the license some restrictive clause, such
as "no military use", "no use by organizations which perform testing of
cosmetics on animals", or something of that kind.  These would be
examples of closed-source software which DO allow ALMOST any kind of use
-- any EXCEPT the specific one the authors dislike so intensely.
While most people may not think of such programs as "closed source",
they most definitely ARE: the definition of open source is very strict
about this aspect.
Alex

With my mathematical background, I'm consistent about calling
these "non-open" rather than "closed".  I don't insist others
adopt my nomenclature ...
I'm with Cameron on this one.
--
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: Python evolution: Unease

2005-01-06 Thread Robert Kern
Bulba! wrote:
On Wed, 05 Jan 2005 17:25:08 -0800, Robert Kern <[EMAIL PROTECTED]>
wrote:

I still think numarray is a good start for this. It handles more than 
just numbers. And RecArray (an array that has different types in each 
column, as you seem to require) can be subclassed to add these methods 
to it.

I have downloaded it, playing with it and like it. I esp. like things
like:

print a + a
[2 4 6]
or 


b.getshape()
(4,3)
Very Pythonic. :-)
However, not all things are generic enough like I meant. That
is not to criticize, but merely to point out that the library is for
obvious reasons slanted towards numerical work, so e.g. while the
following works:
.>>> from numarray import transpose
.>>> transpose([[1,2],[3,4]])
array([[1, 3],
   [2, 4]])
...this doesn't:

transpose([('phone1', 12345), ('phone2', 67890)])
Traceback (most recent call last):
  File "", line 1, in ?
[]
TypeError: Expecting a python numeric type, got something else.
Why would someone want to do such a thing: suppose he
wants 'phone1' and 'phone2' and number records sequenced 
horizontally instead vertically, while when he read that from
a file, such was the file structure. It's a boneheaded example, 
but you get the idea.
http://stsdas.stsci.edu/numarray/numarray-1.1.html/module-numarray.objects.html
In [1]: from numarray import objects, transpose
In [2]: a = objects.array([['phone1', 12345], ['phone2', 67890]])
In [3]: a
Out[3]:
ObjectArray([['phone1', 12345],
 ['phone2', 67890]])
In [4]: transpose(a)
Out[4]:
ObjectArray([['phone1', 'phone2'],
 [12345, 67890]])
Note the use of lists. Using tuples makes the constructor think you want 
a vector of tuple objects.

--
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: The Industry choice

2005-01-06 Thread Jeff Shannon
Bulba! wrote:
 And note that it
was definitely not in his personal interest, whoever that
was, a person or group of persons, as he/they risked getting 
fired for that.
This doesn't necessarily follow.  The decision-maker in question may 
have received a fat bonus for having found such a technically 
excellent manufacturing process, and then moved into a different 
position (or left the corporation altogether) before construction was 
complete and the power-cost issue was noticed.  That person may even 
have *known* about the power-cost issue, and forged ahead anyhow due 
to the likelihood of such a personal bonus, with the intention of no 
longer being in a bag-holding position once the problem became general 
knowledge.

Of course, this discussion highlights the biggest problem with 
economics, or with any of the other "social sciences" -- there's 
simply too many open variables to consider.  One can't control for all 
of them in experiments (what few experiments are practical in social 
sciences, anyhow), and they make any anecdotal evidence hazy enough to 
be suspect.

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Operating System???

2005-01-06 Thread Arich Chanachai
Roose wrote:
What exactly do you mean by an operating system?
If you don't want to program in C/C++ then you're going to have a hard time.
I don't want to be too discouraging, but with that attitude I doubt you
would get very far.
 

Indeed, this is very true.
It sounds like you want to make more of an OS shell -- no?  You can
implement a shell on top of any OS and probably do it in a language like
Python.
 

He should just build around a linux core or use OS kit (if he is 
serious/determined).

But if it is going to be a complete OS in pure Python, uh, it won't be!
You'll have to do a lot of stuff in C, at the least interface with the
hardware.
 

He could use something like O' caml or Oz no?  I might be confused, but 
I understood them to be C/C++ comparable in terms of power and in that 
they both compile vs. VMs and interpreters (for O' caml this is optional 
I think).  Or what about D?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Another PythonWin Excel question

2005-01-06 Thread It's me
Yes, Mike,

Others pointed that out as well.

The difficulty is that they are all in VBAs.   Most of them can be
translated to Python fairly easily, and some I can get from looking at the
recorded macro - but some requires quite a bit of head scratching.

For instance, I wanted to figure out how create a new window.   So, I went
through the record macro process and looked at the VBA code,  it says:

ActiveWindow.NewWindow

Okay.  Now what???

And for switching window, it says:

Windows("Book1:1").Activate

Okay.  ???

So, I look through the online information on msdn and viola!  No mentioning
of that anwhere

Would be nice if there's a Python specific of itbut just dreaming...

Back to reading MSDN.

Thanks,


"Mike Thompson"  wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > I followed the example in
> > http://stompstompstomp.com/weblog/technical/2004-05-20 and learned that
to
> > add a new worksheet to an Excel workbook, you would use the
> > workbook.Worksheets.Add() method.   That works.   However, the new
worksheet
> > got added *in front* of the last worksheet I was at.   How can I get it
to
> > add *after*?
> >
> > Thanks,
> >
> > --
> > Me
> >
> >
>
> Does this help?
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtomoveworksheetswithinworkbooks.asp
>
> --
> Mike


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


Re: Python Operating System???

2005-01-06 Thread Arich Chanachai




Carl Banks wrote:

  Arich Chanachai wrote:
  
  
But
then again, if you don't like C++, you probably won't like Java.

  
  They
  
  
can be very different languages, but in my experience, the reasons

  
  why
  
  
one does not like C++ is usually due to a quality/flaw that can also

  
  be
  
  
found in Java.

  
  
Oh, brother.

The Zen of Python says that "simple is better than complex" and
"complex is better than complicated".  Java does pretty well here.  C++
didn't even get "complicated is better than convoluted" right.  There's
are a ton of flaws in C++ not found in Java.


  

I knew this would get blown out of proportion, but I posted
nevertheless.  I was saying that Java and C++ share flaws (some and
perhaps all of which could be perceived as qualities by someone) and
that these common flaws are often the reason why people do not like C++
or Java.  This is speaking from experience, not statistical evidence. 
In no way was I saying that both languages were the same or aligned at
particular levels of complexity/simplicity.  Both have flaws and
qualities the other does not.  Whether or not C++ has "a ton of flaws"
not found in Java or not, this was not my subject of discussion.  I was
not speaking in quantitative terms as I was referring purely to those
flaws which are common to both and coming to a conclusion based on
experience with people who do not like C++ or Java.

- Arich

P.S.  All in good fun but I am not your brother.  ;-)


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

Please Contribute Python Documentation!

2005-01-06 Thread Skip Montanaro

I'm changing the subject so that hopefully people who have long ago tuned
out the "Python evolution: Unease" subject will read this note.

John> I would like to contribute some documentation to Python.  I've got
John> the time, I write quite a bit, etc. I've got fairly strong
John> opinions about some things that need to be documented, (such as
John> all the new style class descriptor stuff from 2.2) and I have
John> relatively little difficulty matching the existing style.

John> However, I don't know TEX, Latex, CVS or Sourceforge. (The latter
John> two are on my "learn sometime soon so I can put PyFIT where it
John> belongs" list.)

John> I have no desire to install Perl to run the documentation
John> toolchain.  I also have no particular desire to write up a bunch
John> of final format stuff and drop it on someone else to put into the
John> latex format so it can be included.

I'm really not picking on John.  I just happen to be replying to his
message.  Others have echoed sentiments similar to his.  Let me emphasize
this.  You do not (repeat, *do not*) need to install any tools to contribute
content to the documentation.  Just whip out your favorite text editor and
type plain old text.  There are plenty of us around who know enough LaTeX to
markup anything you contribute.  Don't let lack of a specific set of tools
be a barrier to contribution!

The preferred way to submit documentation changes is by submitting a patch
to the Python project on SourceForge:

http://sourceforge.net/projects/python

If you discover an error that requires little more than calling attention to
the problem (or if you don't know how to fix it), just submit a bug report
instead of a patch.  In either case, select "Documentation" as the category.
There is no need to assign it to anyone.  It will get seen shortly.  The
correctness of a documentation fix is generally easier to verify than that
for a code fix, so they tend to get applied pretty quickly.  The only
(small) barrier to submitting bug reports and patches via SourceForge is
that you must register first.  We used to allow anonymous reports but found
that too often they were incomplete and required further input.  With no way
to contact the submitter of an anonymous report we had no choice but to hope
they returned to check for progress.  That only happened rarely, so the
usual resolution was simply to delete the report.

Fred Drake releases new development versions of the docs frequently
(typically once every month or two).  I normally use the development docs
instead of the regular ones for my day-to-day work.  They are available
here:

http://www.python.org/dev/doc/devel/

It's useful to check to see the most current status of the docs.  The only
thing more current is the source in CVS.

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


Re: Python Operating System???

2005-01-06 Thread Peter Hansen
Fuzzyman wrote:
There is/was a project (Peter Hansen ?) to produce a pure python file
system. that could be an interesting component.
Good memory... uh, sort of.  :-)  It was probably me you're
thinking of, but the point of the project was solely a
"virtual" file system, to be used exclusively as a tool
for supporting automated testing.  It has no concept of
persistence, no support for it in the design, and wouldn't
be what would help anyone in this respect.  Sorry.
(Work on it has actually not progressed lately, because
there is no additional requirement driving the work.
The primitive initial state of the tool suffices so far.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Operating System???

2005-01-06 Thread Roose
What exactly do you mean by an operating system?

If you don't want to program in C/C++ then you're going to have a hard time.
I don't want to be too discouraging, but with that attitude I doubt you
would get very far.

It sounds like you want to make more of an OS shell -- no?  You can
implement a shell on top of any OS and probably do it in a language like
Python.

But if it is going to be a complete OS in pure Python, uh, it won't be!
You'll have to do a lot of stuff in C, at the least interface with the
hardware.



"David Brown" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello. I recently came across a free operating system called Unununium (or
> something like that) and it was developed in Python and Assembly.
>
> Now, I have been looking for a way to make an operating system for a long
> long time and the only possibilities I could find were C++ and assembly. I
> don't mind assembly so much if I don't have to use it very often. But C++
is
> so complicated and errors are pretty much impossible to find in the code
for
> me.
>
> So, I was wondering if it would be possible to find a bootloader that
loads
> a python file at startup or something...
>
> Is there an example somewhere of a Python OS?
>
> Thanks!
>
>


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


Re: Python evolution: Unease

2005-01-06 Thread Peter Hansen
Terry Reedy wrote:
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message 
news:[EMAIL PROTECTED]


If I have a 400 gig hard drive, I don't see why I need 99.99% of it
empty instead of 99.0% after I do my OS install.

Even though I currently only have 80 megs (about the minimum one can 
currently buy), I've about decided you are right.  Having just installed a 
3 CD game last night, I realize that my stinginess with disk space for more 
serious stuff is obsolete.  (My first hard disk was 5 or 10 megs.)  A 
gigabyte would cover Python + Wxpython + numarray + scipy + pygame + a lot 
of other stuff.

Would it be possible, at least for Windows, to write a Python script 
implementing a 'virtual distribution'?  IE, download Python, install it, 
download next package, install it, etc.  -- prefereably table driven?
How would you run the script in the first place?
(Assuming that has one of the straightforward answers I
can think of, then I would say the answer to your question
is "certainly"... I think most installers support a "silent"
option so that they could be run from a script.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes:
> >I don't like what I perceive as end effect of what GPL license
> >writers are attempting to achieve: vendor lock-in. 

> And my counter-argument is that I believe your perception is wrong.  If
> I agreed with your focus on lock-in, I'd say that what the GPL is trying
> to lock in is a specific legal philosophy by subverting the existing
> system.

Bulba's perception is wrong in a different way too.  The GPL tries to
encourage the enlargement of a public resource, namely a codebase
shareable by a worldwide community of users and developers, a cyber
equivalent of a public park whose facilities anyone can visit and use
but nobody can take away and exclude others from using.  The idea of
referring to such a shared community resource as a "vendor" is just
bizarre.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 22:42:01 +0100, Peter Dembinski <[EMAIL PROTECTED]>
wrote:
>[...]
>
>> That's remarkable, first time I see smth like this - 
>> out of curiosity, could you say a word where was that?

>Are you the same Bulba I know from alt.pl.comp.os.hacking?

No, but I like to see I have an evil twin out there. :-)




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


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 14:27:55 -0800, Jeff Shannon <[EMAIL PROTECTED]>
wrote:
>>>That's generally the goal of the Free Software Foundation: they think 
>>>all users should have the freedom to modify and/or distribute your code. 
>> 
>> You have the freedom of having to wash my car then. ;-)

>A more accurate analogy would be, "You're free to borrow my car, but 
>if you do, you must wash it and refill the gas tank before you return it."

That analogy is an equivalent of LGPL. Not GPL. GPL in analogy would
require you to donate whatever you created thanks to studying the
construction of that car in the meantime. And yes, again, sure
that is what the borrower agreed to do, sure that NOT using it
at all does not result in such obligations, and again - that is not
the point.

>Note that the so-called 'viral' nature of GPL code only applies to 
>*modifications you make* to the GPL software.  The *only* way in which 
>your code can be 'infected' by the GPL is if you copy GPL source.
>Given the standard usage of closed-source software, you never even 
>have access to the source.  

Which means that standard closed-source software does not impose
itself on your software - except those detestable cases where
Stefan Axelsson pointed out, it prevents you from developing
smth similar if you agreed to such a pre-condition in EULA of this
thing.

It would appear that such a software attempts to economically
lock the user in using the only binary in the world that implements
this functionality; and FSF attempts to economically, indirectly
lock the developers - and indirectly users - in "being pressured
to give away" on the rationale of sharing being so good for 
everyone. 

Now, this may not be what they INTENDED - but from my 
viewpoint it seems like that is the RESULT.

Not only I see this as unfair, but also as counter-effective
in getting more of people into both using and developing
software with publicly available source code ("free software"
guys tend to get hot under the collar when they hear 
"open source"). 

Trying to bully people into this thing _for their own good_ 
tends to have the effect opposite to the intended. You
achieve more by showing positive attitude rather than via 
conspiracy theories and paranoia. It is also this mostly
friendly and relaxed aspect of Python community that I
like so much.

Again, agreeing / not agreeing and resulting use / walking
away _are not the issue_. I don't see MS defended like "well
if you don't like whatever MS does, just don't use their 
software, so shut up about whatever licenses MS actually 
has and about whatever it does!".

>If you use GPL software in the same way 
>that you use closed-source software, then the GPL cannot 'infect' 
>anything you do.

True, but that abstracts from source code issues, doesn't it?

>The 'infective' nature of the GPL *only* comes when you make use of 
>the *extra* privelidges that open source grants.  

Those extra privileges are the only way of _building_ large 
software systems, isn't it? So I would define it as "normal".

Yes, closed-source is sort of "crippled" in this regard. 

>So yes, those extra 
>privelidges come with a price (which is that you share what you've 
>done); but if you don't want to pay that price, you have the choice of 
>not using those privelidges.  This does not, in any way, prevent you 
>from using GPL'ed software as a user.

Obviously; but while what you wrote is true, it is not the crux of
the problem.

>(Problems may come if someone licenses a library under the GPL; that's 
>what the LGPL was invented for.  But the issue here is not that the 
>GPL is bad, it's that the author used the wrong form of it.)

>Personally, I'm not a big fan of the GPL.  I'm much more likely to use 
>BSD-ish licenses than [L]GPL.

Personally, I think that LGPL in abstract sense does make sense: if
you use and modify this thing, you should return back the _modified_
part - and this should apply regardless whether you keep it in private
or not, release in binary or in source to anybody.

However, it's definitely safer and since it also FEELS more benign,
BSD-like licenses are probably more productive in terms of motivating
people to  cooperate, so I agree with you on that point.

>  But it still bugs me to see the GPL 
>misrepresented as some plot to steal the effort of hardworking 
>programmers -- it is, instead, an attempt to *encourage* hardworking 
>programmers to share in a public commons, by ensuring that what's 
>donated to the commons remains in the commons.

OK, a quick sanity check: does Python not remain "in the commons"
because some people use it in closed-source applications? I would
say that ALL of software released under GPL, LGPL or other free / 
open source licenses remains in the commons.

All of the controversies seem to be about the derived works, don't
they?



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


Re: The Industry choice

2005-01-06 Thread Aahz
In article <[EMAIL PROTECTED]>,
Bulba!  <[EMAIL PROTECTED]> wrote:
>
>Nope. That is not what I'm arguing. Really, I think you have
>jumped to conclusion about that: I merely pointed out that
>I don't like what I perceive as end effect of what GPL license
>writers are attempting to achieve: vendor lock-in. 
>
>I think I stated that clearly.

And my counter-argument is that I believe your perception is wrong.  If
I agreed with your focus on lock-in, I'd say that what the GPL is trying
to lock in is a specific legal philosophy by subverting the existing
system.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

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


Re: Python evolution: Unease

2005-01-06 Thread Terry Reedy

"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message 
news:[EMAIL PROTECTED]

> If I have a 400 gig hard drive, I don't see why I need 99.99% of it
> empty instead of 99.0% after I do my OS install.

Even though I currently only have 80 megs (about the minimum one can 
currently buy), I've about decided you are right.  Having just installed a 
3 CD game last night, I realize that my stinginess with disk space for more 
serious stuff is obsolete.  (My first hard disk was 5 or 10 megs.)  A 
gigabyte would cover Python + Wxpython + numarray + scipy + pygame + a lot 
of other stuff.

Would it be possible, at least for Windows, to write a Python script 
implementing a 'virtual distribution'?  IE, download Python, install it, 
download next package, install it, etc.  -- prefereably table driven?

Terry J. Reedy



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


Re: The Industry choice

2005-01-06 Thread Terry Reedy

"Steve Holden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Absolutely not. Some people want to share under very specific conditions, 
> hence the proliferation of licenses in the open source world.

Indeed, Prof. Lessig at Standford University, I believe, recently designed 
the Creative Commons license with a checklist of options with the intention 
of allowing and thereby encouraging people to share under the specific 
conditions they are willing to share under.
http://creativecommons.org/licenses/

Terry J. Reedy



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


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Paul Rubin
Jeff Shannon <[EMAIL PROTECTED]> writes:
> It seems to me that in other, less-dynamic languages, lambdas are
> significantly different from functions in that lambdas can be created
> at runtime.

What languages are those, where you can create anonymous functions
at runtime, but not named functions?!  That notion is very surprising
to me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Contributor's List

2005-01-06 Thread Fuzzyman
My understanding is that the 2nd edition will *only* have new entries.
this may be entirely off the wall of course.
Regards,

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

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


Re: The Industry choice

2005-01-06 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes:
> > Which I find again wrong: suppose this developer used GPL-ed
> > library A, developed patches B and C. He provided you with
> > the source code of publicly available library A and a patch
> > C, but he doesn't want to release patch B.
> 
> Then he does not have to.  As I understand the GPL, as long as he does not 
> release (distribute) the patch in any form (in particular, binary), then 
> the GPL has no effect.

I think the hypothesis is that the developer distributed the patched
library.  The GPL then requires distributing source for all the
patches.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Bulba!
On 06 Jan 2005 15:38:53 -0800, Paul Rubin
 wrote:

>> Making derived work proprietary in no way implies that the base
>> work is publicly unavailable anymore.

>Since you want to be able to incorporate GPL code in your proprietary
>products,

Nope. That is not what I'm arguing. Really, I think you have
jumped to conclusion about that: I merely pointed out that
I don't like what I perceive as end effect of what GPL license
writers are attempting to achieve: vendor lock-in. 

I think I stated that clearly.

> and say there's no problem since the base work is still
>available from the same places it was available from before, fairness
>would say you shouldn't mind that people incorporate code from your
>products into THEIR products, since your version is still available
>from you.

I merely pointed out that previous poster's argument about
"hijacking" the OSS product: that it's just not possible
as long as this person is not in legal position to make _base_
work proprietary.

I think I stated clearly: base work is still available regardless
of whatever derived work creators do or don't do - esp. that
they tend to release only binaries, thus making it impossible
to create further derived works! 

>From the viewpoint of looking at availability of source code A, 
it's completely irrelevant if those guys are fishmongers or 
make derived work A' and redistribute only binary of A'. Not 
a single line of publicly available source code appeared or
disappeared as the result of whatever they do. Amounts of
binaries - yes, that is affected. But not the source code.

>Really, you're just a freeloader looking for handouts.

Rest assured this is not my motivation, esp. that I 
attempt not to use the GPL-ed software whenever
I reasonably can (e.g. it's rather hard to abstain from
using gcc sometimes, as you oft have a hard time
compiling this damn thing with anything else -- see,
the beginnings of vendor lock-in appear). And I thought 
I stated clearly that basically I have no problem with 
LGPL - which requires distributing modifications 
of the _base_ work, but not _your_ code. 

Oh, and "freeloading" argument really doesn't make much
sense: since that software is available to EVERYONE,
its availability / unavailability in the economic sense it 
is merely reducing / increasing costs equally for everyone
(ceteris paribus, assuming both vendor A and B find
that OSS product equally useful). I like to think of
OSS as a "tide that rises all boats".



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


Re: Python Operating System???

2005-01-06 Thread Christopher Koppler
On Thu, 06 Jan 2005 16:12:54 -0800, Carl Banks wrote:

> Arich Chanachai wrote:
>> But
>> then again, if you don't like C++, you probably won't like Java.
> They
>> can be very different languages, but in my experience, the reasons
> why
>> one does not like C++ is usually due to a quality/flaw that can also
> be
>> found in Java.
> 
> Oh, brother.
> 
> The Zen of Python says that "simple is better than complex" and
> "complex is better than complicated".  Java does pretty well here.  C++
> didn't even get "complicated is better than convoluted" right.  There's
> are a ton of flaws in C++ not found in Java.

Still, Java feels like C++ done right, while being more wrong >:-[

-- 
Christopher

If there was a scheme for Lisp world domination...

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


Re: The Industry choice

2005-01-06 Thread Bulba!
On 06 Jan 2005 14:16:13 -0800, Paul Rubin
 wrote:

>> Yes, apart from libraries and similar cases (frameworks etc), it's no
>> doubt rare for closed-source "end-user packages" to be sold with
>> licenses that include source and allow you to "do anything with it".
>> 
>> However, allowing customization (at least for internal use within the
>> customer organization), while rare, is far from unheard of.

>There's no obstacle to doing that with GPL'd software either.

Which is absolutely true, but generally it's not the main _expected
effect_ that license writers aim to achieve.. 




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


Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Jeff Shannon
Alan Gauld wrote:
Can I ask what the objection to lambda is? 
1) Is it the syntax?
2) Is it the limitation to a single expression?
3) Is it the word itself?

I can sympathise with 1 and 2 but the 3rd seems strange since a
lambda is a well defined name for an anonymous function used in
several programming languages and originating in lambda calculus
in math. Lambda therefore seems like a pefectly good name to
choose.
I think that the real objection is a little bit of 1), and something 
that's kinda close to 2), but has nothing to do with 3).

The issue isn't that lambdas are bad because they're limited to a 
single expression.  The issue is that they're an awkward special case 
of a function, which was added to the language to mollify 
functional-programming advocates but which GvR never felt really "fit" 
into Python.  Other, more pythonic functional-programming features 
have since been added (like list comprehensions and iterators).

It seems to me that in other, less-dynamic languages, lambdas are 
significantly different from functions in that lambdas can be created 
at runtime.  In Python, *all* functions are created at runtime, and 
new ones can be defined at any point in execution, so lambdas don't 
get that advantage.  Thus, their advantages are limited to the fact 
that they're anonymous (but names are treated differently in Python 
than in most other languages, so this is of marginal utility), and 
that they can be created inline.  This last bit makes them suitable 
for creating quick closures (wrapping a function and tweaking its 
parameters/return values) and for creating a delayed-execution object 
(e.g. callbacks), so there's a lot of pressure to keep them, but 
they're still a special case, and "special cases aren't special enough 
to break the rules".

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Operating System???

2005-01-06 Thread Carl Banks
Arich Chanachai wrote:
> But
> then again, if you don't like C++, you probably won't like Java.
They
> can be very different languages, but in my experience, the reasons
why
> one does not like C++ is usually due to a quality/flaw that can also
be
> found in Java.

Oh, brother.

The Zen of Python says that "simple is better than complex" and
"complex is better than complicated".  Java does pretty well here.  C++
didn't even get "complicated is better than convoluted" right.  There's
are a ton of flaws in C++ not found in Java.


-- 
CARL BANKS

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


Re: Python Operating System???

2005-01-06 Thread Fuzzyman
The bootloader would have to be a 'python-core'. Ideally a fast
implementation of just the python syntax and language features. Now
*that* would be an excellent basis for a restricted mode python
interpreter - which could make 'python applets' closer to a reality. It
would also make python for embedded systems and embedding python in
larger programs easier as well. A purely 'core language' implementation
with no libraries.

Obviously you'd need file systems, drivers, and something to create the
functionality of the os and sys libraries. Basing it on the existing
Linux kernel would seem like a much more sensible idea

There is/was a project (Peter Hansen ?) to produce a pure python file
system. that could be an interesting component.

Regards,

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



David Brown wrote:
> Hello. I recently came across a free operating system called
Unununium (or
> something like that) and it was developed in Python and Assembly.
>
> Now, I have been looking for a way to make an operating system for a
long
> long time and the only possibilities I could find were C++ and
assembly. I
> don't mind assembly so much if I don't have to use it very often. But
C++ is
> so complicated and errors are pretty much impossible to find in the
code for
> me.
>
> So, I was wondering if it would be possible to find a bootloader that
loads
> a python file at startup or something...
> 
> Is there an example somewhere of a Python OS?
> 
> Thanks!

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


Re: Embedding a restricted python interpreter

2005-01-06 Thread Michael Sparks
Rolf Magnus wrote:

> I would like to embed a python interpreter within a program, but since
> that program would be able to automatically download scripts from the
> internet, I'd like to run those in a restricted environment, which
> basically means that I want to allow only a specific set of modules to be
> used by the scripts, so that it wouldn't be possible for them to remove
> files from the hard drive, kill processes or do other nasty stuff.
> Is there any way to do that with the standard python interpreter?

Current advice seems to be essentially "no". 

I've been pondering adding limited scripting to some personal apps I've
written and due to this toyed around with the idea of simple but parser
that only used ":" and whitespaces for indicating blocks with the aim of
being a generic/"universal"(*) language parser that could be used for many
little "languages". (ie no keywords, just "pure" structure)

   (*) By "universal" I mean something that allows a variety of different
   styles of syntax to be used, whilst technically still sharing the
   same underlying syntax. (Since that's a rather bogus statement,
   that's why it has quotes :)

In the end I sat down and wrote such a beast largely as a fun exercise. (It
uses PLY and is an SLR grammar) It *doesn't* have any backend so you get to
decided how restricted it can be, but, for example, the following code
would parse happily:
   (It's not quite python, but it's close syntactically)

class Grammar(object):
   from Lexer import Tokens as tokens
   precedence = ( ( "left", "DOT"))
   def p_error(self,p):
  print "Syntax error at", p
   end
end

This parses as follows:

A class function is provided with 3 arguments:
   * Grammar(object)
   * A code block
   * A lexical token "end" (Which could be anything)

The code block then contains 3 statements
   * The first is a function call, to a function called "from"
   * The second is an assignment statement
   * The third is a function call to the function "def" (which in turn takes
 3 arguments - a signature, a codeblock and a trailing token (the
 trailing token allows "else" clauses and try/except style blocks)

etc

However it will also parse happily:

EXPORT PROC compare(field::PTR TO person,type=>NIL) OF person:
   DEF result=FALSE
   IF type:
  SELECT type:
 CASE NAME:
result:=compare_name(self.name,field)
 CASE PHONE:
result:=compare_telephone(self.telephone,field)
 CASE ADDRESS:
result:=compare_address(self.address,field)
 ENDCASES
  ENDSELECT
   ELSE:
  result:=compare_name(self.name,field,ORDER) # if type = NIL, ordering
   ENDIF
ENDPROC result

And also programs of the form:

shape square:
   pen down
   repeat 4:
  forward 10
  rotate 90
   end
   pen up
end

repeat (360/5):
   square()
   rotate 5
end

and so on.

If you're prepared to write backends to traverse an AST then you might find
it useful. (I also wrote the parser as an exercise in trying to generate a
parser in a test first manner)

If you're curious as to the sorts of languages it could parse the test cases
are here:
   * http://thwackety.com/viewcvs/viewcvs.cgi/Scratch/SWP/progs/

Some rather random examples are:
  29, A copy of the parser file at that point in time, but rewritten in a
  python-esque language parsable by the parser
  33, A simple program in a logo type language
  34, A simple program based on declarative l-systems for modelling
  biological growth systems.
  35, A simple SML-like language file implementing a stack
  37, An implementation of a "Person" object module in an Amiga-E like
  language.

(NB, here "language" means whatever AST a given backend might understand,
since they're all technically the same language)

http://thwackety.com/viewcvs/viewcvs.cgi/Scratch/SWP/README?rev=1.1

Describes the grammar, etc. (31 explicit rules, or alternatively 13
aggregate rules)

If you think it might be useful to you, feel free to do an anonymous
checkout:

cvs -d :pserver:[EMAIL PROTECTED]:2401/home/cvs/cvsroot login
cvs -d :pserver:[EMAIL PROTECTED]:2401/home/cvs/cvsroot co Scratch/SWP/

Since there is *no* backend at all at present this would be a bit of work.
(I've been tempted to investigate putting a lisp backend on the back, but
not found the time to do so. If I did though this would be a brackets free
lisp :) You can fine PLY here: http://systems.cs.uchicago.edu/ply/ .

Best Regards,


Michael.

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


Re: The Industry choice

2005-01-06 Thread Terry Reedy

"Bulba!" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Which I find again wrong: suppose this developer used GPL-ed
> library A, developed patches B and C. He provided you with
> the source code of publicly available library A and a patch
> C, but he doesn't want to release patch B.

Then he does not have to.  As I understand the GPL, as long as he does not 
release (distribute) the patch in any form (in particular, binary), then 
the GPL has no effect.

What strikes me as funny about GPL sniping is that many programmers, 
including I am sure some of the snipers, sign Terms of Employment contracts 
far more restrictive of their freedom than one could possibly accuse the 
GPL of being.  But I have seen little or no discussion of this (at least on 
clp).  In fact, I wonder if the GPL might be a substitute target.

Terry J. Reedy



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


Re: How do I make Windows Application with Python ?

2005-01-06 Thread Rob Emmons
On Wed, 05 Jan 2005 04:49:05 -0800, Fuzzyman wrote:

> Couple of corrections - neither pypy nor starkiller are compilers.
> Starkiller isn't available yet and *may* be helpful in building
> compilers. Pyrex is an alternative language - a python/C hybrid that
> can be compiled.
> 
> If you want to release an application then innosetup, starkit, and upx
> might help - but they're not python related. You will need something
> like py2exe, cx_freeze, or mcmillan installer. (Which are specific to
> python - py2exe seems to be the more mature tool).
> 
> Alternatively you could consider 'Movable Python' - a frozen
> distribution of python that doesn't need isntalling. See
> http://sourceforge.net/projects/movpy

Great summary.  I was hoping someone would fill in the blanks.  I've been
interested in this area for some time -- but have not had time to look
into it more than keep a list of interesting projects I wanted to research
in the future.  I'll add your comments to my list.

Again, thanks.

Rob

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


python reading/writing ms-project files?

2005-01-06 Thread zslist
any existing or pointers on how to do this?

thanks.

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


Re: The Industry choice

2005-01-06 Thread Aahz
In article <[EMAIL PROTECTED]>,
Jeff Shannon  <[EMAIL PROTECTED]> wrote:
>
>Note that the so-called 'viral' nature of GPL code only applies to 
>*modifications you make* to the GPL software.  The *only* way in which 
>your code can be 'infected' by the GPL is if you copy GPL source.

That's not true -- consider linking to a GPL library.
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

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


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 10:38:53 -0800, Jeff Shannon <[EMAIL PROTECTED]>
wrote:

>It's also noteworthy to consider that many times, waste happens not 
>because of corruption or self-interest, but simply because of errors 
>of judgement.  

Precisely.

That is one of the main points I was trying to get across in
discussion with Alex. I have no reason to make conspiracy
theories that bribes were involved in that bad decision
at that German company. No, it _seemed_ like it was simple
mistake, because somebody responsible for this did not
research the issue in enough depth. And note that it 
was definitely not in his personal interest, whoever that
was, a person or group of persons, as he/they risked getting 
fired for that.

>Humans being as we are, it's inevitable that over time, 
>some "obvious" important details will escape our attention, and the 
>resulting imperfect information will result in poor decisions.  This 
>is a simple fact of human nature, and (ob-Python ;) ) it's one of the 
>reasons that Python is designed as it is -- it makes a serious effort 
>to reduce the number of details that might escape detection.

I suspect it is one of the reasons why many people switch from
learning Perl to learning Python (at least I did - I simply
could not remember after a month or two what the hell
I concocted in this place in Perl program, it felt as if this 
were somebody else's code).

>(One should also consider that many business failures are a case of 
>simply having played the odds and lost.  Many ventures depend on 
>outside events playing in a certain way; when by chance those events 
>happen, the decision-makers are called "bold and insightful", but if 
>things don't work out, they're called foolish or misguided. 

Again, I agree with you - all that I can add is that it this is what
may be a rational element in the otherwise irrational decisionmaking
process - managers may get hit if it goes wrong, but not rewarded
if it goes right. Consider this:

"Moreover the fact that a CEO can command does not mean that other
employees will obey. Instructions can be given, but they need to be
obeyed enthusiastically by others for them to mean anything. CEOs have
tools to win the enthusiasm of their subordinates: the rhetoric of
shared accomplishment of action and vision; the carrots of promotions,
salary increases, and bonuses; the sticks of demotion and dismissal.
But even with these tools, managing a large bureaucratic organization
is a difficult task. And changing its direction away from that of mere
business-as-usual requires great skill and luck."

http://www.j-bradford-delong.net/Econ_Articles/Command_Corporations.html




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


Re: The Industry choice

2005-01-06 Thread Paul Rubin
Bulba! <[EMAIL PROTECTED]> writes:
> Making derived work proprietary in no way implies that the base
> work is publicly unavailable anymore.

Since you want to be able to incorporate GPL code in your proprietary
products, and say there's no problem since the base work is still
available from the same places it was available from before, fairness
would say you shouldn't mind that people incorporate code from your
products into THEIR products, since your version is still available
from you.

Really, you're just a freeloader looking for handouts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython clipboard

2005-01-06 Thread flaxeater
Ok well you should look at this module
http://www.rutherfurd.net/python/sendkeys/#id1
I then you could take frequent snapshots and use and OCR to find your
stuff.  Then use the above library to type to the window.

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


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 09:42:42 -0500, Steve Holden <[EMAIL PROTECTED]>
wrote:
>> You see, I'm not disagreeing with you that your model applies
>> _where it applies_. I only disagree that it applies in face of
>> stronger forces. Now what kind of forces is dominant in 
>> most frequent scenarios would have to be worked out in tedious
>> empirical research I think. Which I haven't done, because
>> learning some economics is just a hobby to me.

>Yes, by all means let's just spout our opinions without any of that 
>inconvenient tedious empirical research which might invalidate them.

Err, but what did I do that got you visibly pissed off?

I certainly did not mean offending anyone. If I did smth
that did, I apologize, but honestly I didn't mean that. I
just expressed my opinion and cited some small bits of evidence, 
which I think I'm entitled to.

>> Capital investments per worker in auto industries are reportedly 
>> very high. Simple physical tasks are done largely by machines, 
>> like this 100 million Deutschmark costing laser-cutting installation
>> that I've seen there, where a pile of iron bars is pulled in at one
>> end and the pile of ready components is spitted out of the other end
>> (unlike typical thermal cutting,  laser has the advantage of not
>> destroying the metal structure adjacent to the cut, so the parts 
>> of the machines subject to high-stress are oft produced this way). 
 
>The same is true of plasma-arc cutting for thicker steels, and I believe 
>it's still not possible to cut 3-inch stainless with a laser. But what's 
>your point?

 I was just explaining the issue for someone who could
wonder "why bother with cutting that with laser". The components
of those machines, even bigger ones, typically were not as thick 
as 3 inches. 

>> Oh, and by the way that installation doesn't get used much.
>> Somebody at the office didn't check carefully enough the
>> energy prices before ordering it and later someone discovered 
>> that off-site specialized cutting firms that take advantage of 
>> energy available at low prices at special times in other countries
>> can get it produced cheaper. Moving it elsewhere or selling
>> is not an option, since it is a specially constructed, low, 50-meters
>> long hall that stands inside the huge manufacturing hall of the
>> company.

>And you are using this example to try and argue that engineers are 
>better-educated than sales people? 

Nope. The context was that behavior of companies tends to
be highly rational, optimized and not wasting resources. My 
naturally individual experience was that it was oft not the case, 
and that was the example. 

Which was my point when explaining the clustering that
demonstrably happened: if the behavior of decisionmakers
is highly informed, rational and not really induced much by 
risk avoidance as Alex claims, then the clusters are created 
by "natural economic forces". 

However, if the process is not that rational, then maybe 
clusters are the correlation of "cover your ass" aspect
in managers' behavior all wanting to get their branch office 
in yesterday in Tokyo, today in Beijing, and during 
speculative craze in Russia in Moscow "because everybody
is doing that". Which observations  of Paul Krugman on 
"defective investors" seem to support. 

Now, I'm very strongly opposed to saying that all  that 
somehow invalidates economics, including economics 
of software, as _science_.

All I'm saying is that maybe this particular model is not
what some people think it is. This is the problem with
economics, people tend to get hot under the collar about 
it for some reason and it's oft hard to debate that calmly. 
Which personally I find a pity, because  e.g. economics 
of software is such an interesting subject..

>Who sold this installation? Who 
>bought it? 

I have no idea, as I were not a manager there and it
didn't really pertain my work.

>> I was utterly shocked. Having grown up in Soviet times I have
>> been used to seeing precious resources wasted by organizations
>> as if resources were growing on trees, but smth like this?! In a
>> shining ideal country of Germany?! Unthinkable.
 
>Indeed not. Quite often the brown paper bag is a factor in purchases 
>like this. I wouldn't be at all surprised if somebody with a major input 
>to the decision-making process retired to a nice place in the country 
>shortly afterwards. You appear to be making the mistake of believing 
>that people will act in the larger interest, when sadly most individuals 
>tend to put their own interests first (some would go as far as to define 
>self-interest as the determinant of behavior).

But there is a subtler point here: most likely it was NOT in the
short-term personal interest to make this mistake (as I believe
corruption was not the case in this decision)! 

After all, whoever responsible was still running the considerable risk
of getting fired. It is an example that precisely negates either
collective or individual, long-term or short-

RE: Pre/Postconditions with decorators

2005-01-06 Thread Robert Brewer
Stephen Thorne wrote:
> On 6 Jan 2005 13:33:42 -0800, Rittersporn 
> <[EMAIL PROTECTED]> wrote:
> > @condition("number>0 and number<2","result>=0")
> > def sqrt(number):
> > import math
> > return math.sqrt(number)
> > 
> > @condition("list(seq) is not None","sum(seq)==result")
> > def my_sum(seq):
> > tmp=0
> > for element in seq:
> > tmp+=element
> > return tmp
> > 
> > print sqrt(1.2)
> > print my_sum([1,2,3])
> 
> I think it would be nicer to have the pre and post conditions 
> being compilable.

Me too.

> @condition((list(seq) is not None for seq in args), (sum(seq)==result
> for ((seq,), result) in (args, result))
> 
> or something silly like that.

Ian Bicking was just talking about @require decorators:
http://blog.ianbicking.org/already-under-our-noses.html

@require(int, int)
def gcd(a, b):
...

If we made a "checker" module for such things in the stdlib, we could
write most of that:

from checker import *

@args((list, itemsnotNone, ))
@returns((any, ))
def my_sum(seq):
tmp=0
for element in seq:
tmp+=element
return tmp


Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Operating System???

2005-01-06 Thread Arich Chanachai
David Brown wrote:
Hello. I recently came across a free operating system called Unununium (or
something like that) and it was developed in Python and Assembly.
Now, I have been looking for a way to make an operating system for a long
long time and the only possibilities I could find were C++ and assembly. I
don't mind assembly so much if I don't have to use it very often. But C++ is
so complicated and errors are pretty much impossible to find in the code for
me.
So, I was wondering if it would be possible to find a bootloader that loads
a python file at startup or something...
Is there an example somewhere of a Python OS?
Thanks!
 

People don't make Python OSs because it's a serious pain in the 
Deng-Xiao-ping.  J/k, I am half kidding.  Go to google groups, and 
search for Python OS.  You will find that this topic has been discussed 
numerous times.  There was another project other than Unununium which 
was Python based, but it is not being developed any longer and I fail to 
remember what it was called.  So search away, you will find many 
results!  Alternatively you could contact the Unununium folks for help. 

Note also that there are Java OSs as well (and probably others).  But 
then again, if you don't like C++, you probably won't like Java.  They 
can be very different languages, but in my experience, the reasons why 
one does not like C++ is usually due to a quality/flaw that can also be 
found in Java.
--
http://mail.python.org/mailman/listinfo/python-list


Re: project

2005-01-06 Thread Arich Chanachai




jerry wise wrote:

  Thank you for responding. I have responded to Jeff several times, but he has not sent me anything back. I have read several of the pymedia docs, but truthfully they mean nothing to me because like I said, I have no experience in computer programming. You told me to look at the pymedia docs and subscribe to the list to help solve the .wav to .mp3 problem, but if the 10 files were .mp3 to begin with then all the combinations of the 10 would come out as .mp3s which would solve the space issue and there would be no need for any conversion, right?
  

You will notice a dearth of contributions from me here at this
community, and it can be inferred that this is a direct result of my
being _extremely_ busy working for a small software engineering company
in Boston which works its employees to near death.  But nevermind that,
I like to help people as much as I can.  

You are entirely correct: you could manually convert your Wave files to
mp3 or ogg or else and then implement and execute an algorithm which
spits out each combination in the desired format etc...  yes, you could
do this.  You would need to specify how to name the files and so
forth.  It is a learning process.  First you need to write out all the
steps at a level of detail correlating to your level of programming
knowledge (you say nil?).  Then you can ask us here how to implement
the various pieces in Python, given that you have already
carefully read the Python documentation on the relevant topics.  

I will keep responding to your messages, but I imagine I won't be much
use to you given my time constraints and your complete inexperience in
programming in general.  If you have never programmed before, you need
to start with the Python beginner's tutorial on the Python website and
you need to play with the language and the various aspects of
programming so you can do something meaningful (as you intend to do).

Best Wishes.

- Arich


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

Re: Pb encodage & import

2005-01-06 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi !

Wilk had give me a solution pour UnicodeDecode Error.
But no ideas for other problems.




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


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 09:27:49 -0500, Steve Holden <[EMAIL PROTECTED]>
wrote:


>>>I'd go further.  It's not possible to force anyone to share, but the
>>>GPL aims to remove software from a system that instead aims to force
>>>people NOT to share.

>> Nope. IMHO, GPL attempts to achieve the vendor lock-in. For different
>> purposes than another well-known vendor, but it still does.

>Well you are entitled to your opinion. But *my* opinion is that the GPL 
>attempts to ensure that if you re-use code by an author who so desires, 
>then redistribution of your code is only possible by making your own 
>extensions to it available on the same terms. This gives you a clear choice.

I agree with you. However, I don't see how your statement contradicts 
mine. 

>To put it another way, it allows an author to specify that their code 
>can't be hijacked for proprietary purposes *in distributed programs*. 

How can the source code that is _guaranteed to stay as public
availability_ be _hijacked_?

If it's hijacked, it's not available anymore. 

Making derived work proprietary in no way implies that the base
work is publicly unavailable anymore.

>I 
>will specifically point out that there is *nothing* in the GPL that 
>requires you to reveal the source of program you write but do not 
>distribute, even when such programs incorporate tons of GPL'd code.

Again, I don't see why that negates my thesis of vendor lock-in:
whatever software that uses GPLed code crosses inter-organizational 
or inter-personal border, it has to be released with source.

>> It's actually even worse: the only thing you can't share  on a
>> well-known vendor's platform is the software written by that
>> well-known vendor -- you can choose to share or choose not to 
>> share whatever you or other people write on this platform. 

>Well that's way over-simplified. And if you mean Microsoft, *say*( 
>Microsoft. 

Oh can't you take a little joke, why do we have to be so serious..

If my allusion was not funny, well, sorry.

>The GPL folks are quite happy to have you "share" anything that *you* 
>create. 

Oh absolutely, and I would be happy with them washing my car
for free.  ;-)

>Their simply-stated and elegantly-achieved intent is that you 
>don't "share" anything that *they* create except on the terms they have 
>required for their creations.

But their base work is available anyway, regardless of whatever
I do or don't do.

>So, it seems to me, you are whining because the authors of GPL'd code 
>don't want you to release *their* code except under the GPL.

If that was limited to _primary_ effects, that would be
understandable. Which is why I'm rather fine with LGPL for 
instance.

However, an openly stated goal is an indirect effect: achieving
the goal of "all the software in the world being free" (as in
their definition of freedom). 

Which means that indirect, _economic_  result they hope to 
achieve is precisely creating a practical context when this author
would have hard time to release his work under license other
than GPL. 

Why do they call "library GPL" a "lesser" GPL, Steve, and
do not really like it? Is it not for the sake of this goal? 

Watch this carefully: if what you claim was ALL they
care for, there would be no big difference for them between
LGPL and GPL. And yet for them it is quite a big deal.

>What gives 
>*you* the right to dictate to them? 

Conversely, what gives them the right to dictate the authors
of derived works of what they do with THEIR part of work?

>How would you like it if Richard 
>Stallman insisted that you release your code under the GPL? Which, of 
>course, he doesn't.

Oh but he does - just indirectly. He's attempting to create such
context. GPL is a sort of wolf in a sheep's skin, while Stallman
pretends it's not really a wolf, and then preaches how wonderful
it will be when we will sit with millions of such sheep at the
table and vote what's for lunch.

>>> As the MPAA knows, people do want to share, and
>>>forcing them not to do so is impossible without turning the world into
>>>a police state. 

>Socialism is unpopular for many reasons, and many of them are indeed to 
>do with maintaining the separation between individuals and thereby 
>retaining the ability to treat them as separate economic units. But we 
>aren't going to change that by insisting on particular software 
>licenses. Realize this is a very small part of a very large debate.

Absolutely. I have discussed intellectual property rights issues with 
friends to great lengths, not just regarding the software. 
 
>And that is their choice. They should realize, however, that some 
>licenses (including the more recent Python licenses) are cleared as 
>"GPL-compatible". I believe this means that if I receive software 
>licensed under a GPL-compatible license, I am at liberty to distribute 
>it under the GPL.

>I suspect that this point is far too infrequently stressed.

I really don't find it very important: where the main battle 
is, and where som

Excluded and other middles in licensing (was: The Industry choice)

2005-01-06 Thread Cameron Laird
In article <[EMAIL PROTECTED]>,
Alex Martelli <[EMAIL PROTECTED]> wrote:
.
.
.
>One last reflection -- I believe there are or used to be some programs
>written by people no doubt of very good will, distributed with all
>sources and often with no profit motive at all, which are NOT open
>source because they include in the license some restrictive clause, such
>as "no military use", "no use by organizations which perform testing of
>cosmetics on animals", or something of that kind.  These would be
>examples of closed-source software which DO allow ALMOST any kind of use
>-- any EXCEPT the specific one the authors dislike so intensely.
>
>While most people may not think of such programs as "closed source",
>they most definitely ARE: the definition of open source is very strict
>about this aspect.
>
>
>Alex

With my mathematical background, I'm consistent about calling
these "non-open" rather than "closed".  I don't insist others
adopt my nomenclature ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pre/Postconditions with decorators

2005-01-06 Thread Stephen Thorne
On 6 Jan 2005 13:33:42 -0800, Rittersporn <[EMAIL PROTECTED]> wrote:
> @condition("number>0 and number<2","result>=0")
> def sqrt(number):
> import math
> return math.sqrt(number)
> 
> @condition("list(seq) is not None","sum(seq)==result")
> def my_sum(seq):
> tmp=0
> for element in seq:
> tmp+=element
> return tmp
> 
> print sqrt(1.2)
> print my_sum([1,2,3])

I think it would be nicer to have the pre and post conditions being compilable.

@condition((list(seq) is not None for seq in args), (sum(seq)==result
for ((seq,), result) in (args, result))

or something silly like that.

Personally, I'd prefer this:
@precondition(list(seq) is not None for seq in args)
@postcondition(sum(seq)==result for ((seq,), result) in (args, result))

(this is, of course, using the framehack lambda replacement presented
in a thread about a week ago).

Stephen.


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


Re: The Industry choice

2005-01-06 Thread Paul Rubin
Jeff Shannon <[EMAIL PROTECTED]> writes:
> Note that the so-called 'viral' nature of GPL code only applies to
> *modifications you make* to the GPL software.  

Well, only under an unusually broad notion of "modification".  The GPL
applies to any program incorporating GPL'd components, e.g. if I
distribute a Python compiler that incorporates some component from
GCC, then my entire Python compiler must be GPL'd even though the GCC
component is isolated inside the Python compiler and I wrote the rest
of the Python compiler myself.  If I don't like this, I have an
obvious recourse, which is don't use GCC components in my Python
compiler.

The notion here is that the GCC components are attractive enough that
being able to use them provides an incentive to GPL my Python
compiler, which I might not do otherwise.  

> (Problems may come if someone licenses a library under the GPL; that's
> what the LGPL was invented for.  But the issue here is not that the
> GPL is bad, it's that the author used the wrong form of it.)

The "problem" is not a problem except that in the case of some
libraries, simply being able to use a library module is often not
enough incentive to GPL a large application if the library module's
functionality is available some other way (including by
reimplemntation).  If the library does something really unique and
difficult, there's more reason to GPL it instead of LGPL'ing it.

> The 'infective' nature of the GPL *only* comes when you make use of
> the *extra* privelidges that open source grants.  So yes, those extra
> privelidges come with a price (which is that you share what you've
> done); but if you don't want to pay that price, you have the choice of
> not using those privelidges.  This does not, in any way, prevent you
> from using GPL'ed software as a user.

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


Re: Download .jpg from web

2005-01-06 Thread Adam DePrince
On Thu, 2005-01-06 at 13:49, GMane Python wrote:
> Hello All.
>   Using a network camera with built-in webserver, I'd like to have a python
> program download .jpg files on a local lan.  the location is
> http:///jpg/image.jpg.
> 
>   Currently, I'm importing urllib and using urlopen to the address, then
> read()-ing it, saving it to a binary file.  All that is working great, but
> maybe a bit slowly.  I'm getting ~2.3 frames per second, and would like
> between 5-10 frames per second.

I don't think that connection persistance is the problem you are
facing.  Perhaps the camera's TCP stack is really slow, but I just don't
see the overhead of reconnecting being anywhere near high enough to
account for the difference between what you have and what you think you
should have.

* What kind of camera are you using ... is it capable of handling more
frames per second?  I sounds like what you really want is a camera that
can stream an avi or mpeg.

* What is the bandwidth between the camera cluster and your server and
what is the average size of an image?  Lets be sure you are not
bandwidth constrained.

* Are you doing any post processing on these images?

If all you are doing is:

open( "somefilename.jpg").write( urllib.open( ... ).read() )

then what you are looking to do is a premature optimization.

Also, you may want to consider saving the images in a format other than
a stream or jpegs.  The Ogg Vorbis Theora codec is pretty mature right
now and, assuming that consequtive images are similar, will compress way
better than just saving jpegs.

- Adam

> 
>   Am I approaching this incorrectly?  I have to do a urlopen, then .read()
> for each image.  Is there any way to 'persist' the urlopen so I just have to
> keep read()-ing or maybe is there a type of streaming read?  I have many
> cameras, so there are many threads simultaneously reading and dropping them
> in a central Queue for saving later.
> 
>   I appreciate it!
> -Dave
> 
>  WebImage = urllib.urlopen("http:///jpg/image.jpg").read()
>  QueuePacket = []
>  QueuePacket.append(WebImage)
> 
Adam DePrince 


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


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 12:20:35 +0100, Stefan Axelsson
<[EMAIL PROTECTED]> wrote:

>> If GPL folks had their way, it would not be possible not to "share"
>> _anything_ you create. It is widely acknowledged that GPL
>> license has the "viral" aspect of extending itself on your 
>> software - can you point to closed-source licenses that would 
>> have this aspect? None of the licenses I've read except GPL has 
>> this aspect.  

>Then you haven't read very many source code licenses, many (perhaps 
>most?) that state that if you've as much as looked at the code you're 
>not even allowed to write somethings similar twenty years down the line, 
>or anything that remotely resembles something similar. 

I've read Novell license of internal development tools it provides
(which I reviewed for some purpose). This is I think relevant 
part:

"Novell grants you a non-exclusive license to use the 
Software free of charge if (a) you are [...] (b) you are 
a contracted vendor (c) your use of the Software is for 
the purpose of  evaluating whether to purchase an ongoing 
license to the  Software.  
[...]
You may not:
* permit other individuals to use the Software except
  under the terms listed above;
* permit concurrent use of the Software;
* modify, translate, reverse engineer, decompile,
  disassemble (except to the extent applicable laws 
  specifically prohibit such restriction), or create 
  derivative works based on the Software;
* copy the Software other than as specified above;
* rent, lease, grant a security interest in, or
  otherwise transfer rights to the Software; or
* remove any proprietary  notices or labels on the
  Software.

Novell may have patents or pending patent applications, 
trademarks, copyrights, or other intellectual property 
rights covering the Software.  You are not granted any 
license to these patents, trademarks, copyrights, or other 
intellectual property rights except as expressly provided 
herein.  Novell reserves all rights not expressly granted."

Other than that, the license had to do only with usual
stuff of disclaimers, different jurisdictions, export
controls, "US govt restricted rights", etc. Didn't find
there anything that forbids me to develop smth similar,
unless it's very well hidden in hooking into the technicalities
of specific intellecatual property laws.

I've also read similar IBM licenses -- granted, not very 
carefully.

The thing that pissed off various bosses most strongly
in my impression was that the EULAs typically limited
or prohibited transferring the rights to use this thing, 
e.g. to spin-offs or organizations cooperating with us. 
It's bothersome in practice. None of that had anything 
to do with source code or reverse-engineering or 
developing similar products (if we wanted to develop
similar products, we would not be using this thing
in the first place, except for 'discovery' purposes). 

I'm not saying licenses like you claim don't exist. Sure,
they may exist and they suck. 

The point is, they have _limited impact_ and by 
the very fact of their "exclusion" nature, this
aspect tends to repel users than attract them to 
use this thing.

>(Most do in fact 
>Now, Stallman might or might not want to achieve world domination, not 
>by sharks with lasers on their heads, but by aiming for all software to 
>be free software, but the GPL is actually a lot less ambitious than 
>that. All the GPL says is that: if you received a binary, the person who 
>  provided you with it, must provide you with the source code that built 
>it. *All* the source code, not just what he happened to receive, on the 
>off chance that he's modified it. 

Which I find again wrong: suppose this developer used GPL-ed 
library A, developed patches B and C. He provided you with
the source code of publicly available library A and a patch
C, but he doesn't want to release patch B.

Now, I know that it would cost you the effort to recreate 
patch B or maybe it wouldn't work without modifying 
patch C. But that's an economic concern, which is orthogonal
to GPL, as GPL is (supposedly) about "free as in speech, not 
free as in beer".

>And as having the source code without 
>being able to modify it would be rather pointless, you're allowed to do 
>that too, it's a given. If you don't want to distribute binaries, that's 
>fine, and all of the GPL falls. The GPL doesn't *force* you to share 
>anything. It only says what must happen if you do.

True, not directly.

However, by attempting to create the context in which it's IMPRACTICAL
to use any non-GPLed software, it's attempting to achieve vendor
lock-in effect, and while in such situation you FORMALLY would not
have to give away, you PRACTICALLY would have to give away.

It's not there in license that you "have to give away whatever you 
create". It's just attempting to create particular _economic_
context with those licenses, just like the licenses and practices
of a well-known vendor do, even though that is not spelled out
explicitly, obviously.

Re: Securing a future for anonymous functions in Python

2005-01-06 Thread Alan Gauld
On Thu, 30 Dec 2004 23:28:46 +1000, Nick Coghlan
<[EMAIL PROTECTED]> wrote:

> GvR has commented that he want to get rid of the lambda keyword for Python 
> 3.0. 
> Getting rid of lambda seems like a worthy goal, 

Can I ask what the objection to lambda is? 
1) Is it the syntax?
2) Is it the limitation to a single expression?
3) Is it the word itself?

I can sympathise with 1 and 2 but the 3rd seems strange since a
lambda is a well defined name for an anonymous function used in
several programming languages and originating in lambda calculus
in math. Lambda therefore seems like a pefectly good name to
choose.

So why not retain the name lambda but extend or change the syntax
to make it more capable rather than invent a wholly new syntax
for lambdas?

Slightly confused, but since I only have time to read these
groups regularly when I'm at home I have probably missed the bulk
of the discussion over the years.

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a restricted python interpreter

2005-01-06 Thread Paul Rubin
Gerhard Haering <[EMAIL PROTECTED]> writes:
> > But mod_python is an apache module and runs in the same apache process
> > with other users' scripts.
> 
> Which is why it's a good idea for each customer to have it's own
> system user and their virtual hosts running under this uid. Which
> was the idea for the perchild MPM for Apache 2 - which is abandoned
> now :-( muxmpm is a replacement project in beta.

I'm not familiar with perchild MPM or muxmpm, but it sounds like you'd
need a separate process per user for it to work.  That would seriously
increase the cost of operating mass vhosts.  It's not uncommon for one
apache/mod_php server to support thousands of users.

> - go back to Apache 1.3.x, missing some nice improvements
> - use different webservers per user, put them together with mod_proxy (yuck!)

If it's for low-traffic vhosts without enormous processing complexity,
you could use Python cgi's instead of mod_python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Jeff Shannon
Bulba! wrote:
On Thu, 06 Jan 2005 08:39:11 GMT, Roel Schroeven
<[EMAIL PROTECTED]> wrote:
That's generally the goal of the Free Software Foundation: they think 
all users should have the freedom to modify and/or distribute your code. 
You have the freedom of having to wash my car then. ;-)
A more accurate analogy would be, "You're free to borrow my car, but 
if you do, you must wash it and refill the gas tank before you return it."

Note that the so-called 'viral' nature of GPL code only applies to 
*modifications you make* to the GPL software.  The *only* way in which 
your code can be 'infected' by the GPL is if you copy GPL source.

Given the standard usage of closed-source software, you never even 
have access to the source.  If you use GPL software in the same way 
that you use closed-source software, then the GPL cannot 'infect' 
anything you do.

The 'infective' nature of the GPL *only* comes when you make use of 
the *extra* privelidges that open source grants.  So yes, those extra 
privelidges come with a price (which is that you share what you've 
done); but if you don't want to pay that price, you have the choice of 
not using those privelidges.  This does not, in any way, prevent you 
from using GPL'ed software as a user.

(Problems may come if someone licenses a library under the GPL; that's 
what the LGPL was invented for.  But the issue here is not that the 
GPL is bad, it's that the author used the wrong form of it.)

Personally, I'm not a big fan of the GPL.  I'm much more likely to use 
BSD-ish licenses than [L]GPL.  But it still bugs me to see the GPL 
misrepresented as some plot to steal the effort of hardworking 
programmers -- it is, instead, an attempt to *encourage* hardworking 
programmers to share in a public commons, by ensuring that what's 
donated to the commons remains in the commons.

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a restricted python interpreter

2005-01-06 Thread Paul Rubin
Peter Maas <[EMAIL PROTECTED]> writes:
> I think PHP has a safe mode which solves the probem of isolating
> scripts of different users on application level. This is not optimal
> but better than nothing. Best solution would probably be to create
> a thread for each request that can operate only with the id of an
> authenticated user. But this seems to be a problem with Apache or
> with Linux?

Threads wouldn't do it--you'd need separate processes.  For example,
multiple threads in the same process can access each other's file
descriptors.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes:
> Yes, apart from libraries and similar cases (frameworks etc), it's no
> doubt rare for closed-source "end-user packages" to be sold with
> licenses that include source and allow you to "do anything with it".
> 
> However, allowing customization (at least for internal use within the
> customer organization), while rare, is far from unheard of.

There's no obstacle to doing that with GPL'd software either.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Operating System???

2005-01-06 Thread Lucas Raab
David Brown wrote:
Hello. I recently came across a free operating system called Unununium (or
something like that) and it was developed in Python and Assembly.
Now, I have been looking for a way to make an operating system for a long
long time and the only possibilities I could find were C++ and assembly. I
don't mind assembly so much if I don't have to use it very often. But C++ is
so complicated and errors are pretty much impossible to find in the code for
me.
So, I was wondering if it would be possible to find a bootloader that loads
a python file at startup or something...
Is there an example somewhere of a Python OS?
Thanks!

Hasn't there been numerous discussions about this in the past??
--
http://mail.python.org/mailman/listinfo/python-list


Re: Another PythonWin Excel question

2005-01-06 Thread Mike Thompson
It's me wrote:
I followed the example in
http://stompstompstomp.com/weblog/technical/2004-05-20 and learned that to
add a new worksheet to an Excel workbook, you would use the
workbook.Worksheets.Add() method.   That works.   However, the new worksheet
got added *in front* of the last worksheet I was at.   How can I get it to
add *after*?
Thanks,
--
Me

Does this help?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtomoveworksheetswithinworkbooks.asp
--
Mike
--
http://mail.python.org/mailman/listinfo/python-list


Re: Download .jpg from web

2005-01-06 Thread ralobao
You could try using: urlllib.urlretrieve ...it may be faster.

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


[OT] Re: The Industry choice

2005-01-06 Thread Peter Dembinski
Bulba! <[EMAIL PROTECTED]> writes:

[...]

> That's remarkable, first time I see smth like this - 
> out of curiosity, could you say a word where was that?

Are you the same Bulba I know from alt.pl.comp.os.hacking?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 15:44:03 GMT, Roel Schroeven
<[EMAIL PROTECTED]> wrote:

>I was thinking more of end-user packages: if you somehow could lay your 
>hands on the source code of Visual Studio itself, you're still not 
>allowed to do anything with it.

And why would anybody want to waste their time reading the 
source code of Visual Studio? ;-) 



No, honestly, after all most of the time what programmers learn
is just API. The very point of having libraries after all is not 
having to learn the low-level mechs of this thing, but just
using them in a push-button manner!

My boss read the C-tree code. I was programming reports 
and other "peripheral" stuff, so I never had to do it. I was
just using a subset of the C-tree functionality, and even that
was a very small subset actually. Now I'm sure that B-trees
used in there are a wonder of engineering - however, I simply
have other goals and not enough time to learn them to 
appreciate that.

Personally, I think that for most people the _direct_ benefits 
of access to source code are greatly exagerrated. I would
place much, much more emphasis on indirect, derived 
benefits of availability of source code. 

Yes, you CAN read the source code. But the point is, you
DON'T WANT TO. 

Because economically speaking, division of labor applies,
and idealistically speaking, it's better to stand on the shoulders
of giants.



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


Pre/Postconditions with decorators

2005-01-06 Thread Rittersporn
My humble attempt to model pre/postconditions with 
decorators :-) It's also my first experiment 
with decorators. 
  If you have any ideas or thoughts on how to 
improve the code snippet, I'll be happy to  
learn more.

Enjoy :-)
 
def condition(pretext,posttext=""):
precode=compile(pretext or "True","","eval")
postcode=compile(posttext or "True","","eval")

# function -> decorated(function)
def decorate_condition(function):
# FIXME: Does not work with wrapped functions
argcount=function.func_code.co_argcount
var=function.func_code.co_varnames[0:argcount]

 # arguments -> closure(assertion)
def evaluate_condition(*args,**kargs):
# FIXME: check if "var" always contains ordered list of 
arguments
# map arguments and
args_seq=[(argname,args[pos]) for pos,argname in 
enumerate(var)]
# key-arguments to value
kargs_seq=[(k,v) for k,v in kargs.itervalues()]
environment=args_seq+kargs_seq

# precondition
assert eval(precode,{},dict(environment)),pretext
tmp=function(*args,**kargs)
environment2=environment+[('result',tmp)]

# postcondition
assert eval(postcode,{},dict(environment2)),posttext
return tmp

return  evaluate_condition

return decorate_condition

@condition("number>0 and number<2","result>=0")
def sqrt(number):
import math
return math.sqrt(number)

@condition("list(seq) is not None","sum(seq)==result")
def my_sum(seq):
tmp=0
for element in seq:
tmp+=element
return tmp

print sqrt(1.2)
print my_sum([1,2,3])
-- 
http://mail.python.org/mailman/listinfo/python-list


Really OT (was Re: OT: spacing of code in Google Groups)

2005-01-06 Thread Peter Hansen
Alex Martelli wrote:
Peter Hansen <[EMAIL PROTECTED]> wrote:
This "cat equivalent" thing is a red-herring.  I can rarely type more
I tried offering a red herring to my cat to check this out, and, sure
enough, she indignantly refused it and miaowed loudly for less smelly
food.  So, you may have a point here.
Going totally off-topic (except for those who define anything
that ridicules Bill Gates as inherently on-topic), just as
I read your reply I saw the following two "related" articles
as I was reading some news online:
On red herrings (and silly Bill screwing up another demo):
http://www.redherring.com/Article.aspx?a=8&hed=Glitz%2C+glitches+and+Gates+at+CES§or=Profiles&subsector=Companies
On cats (bouncing dead ones, anyway):
http://yahoo.reuters.com/financeQuoteCompanyNewsArticle.jhtml?duid=mtfh79805_2005-01-06_17-20-03_n06358600_newsml
(My reticular formation must be working fine today...)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Industry choice

2005-01-06 Thread Bulba!
On Thu, 06 Jan 2005 08:39:11 GMT, Roel Schroeven
<[EMAIL PROTECTED]> wrote:

>> If GPL folks had their way, it would not be possible not to "share" 
>> _anything_ you create.

>That's generally the goal of the Free Software Foundation: they think 
>all users should have the freedom to modify and/or distribute your code. 

You have the freedom of having to wash my car then. ;-)

>Most people who use the GPL don't feel that way; they think that each 
>author should have the freedom to choice if and how he chooses to share 
>code. 

Whatever they feel, GPL is designed in such a way that essentially
is an attempt to extend itself onto all the software in the world. 

>They just see the GPL as an appropriate way to share their code.

And why is that?

Suppose they want to ensure "no forking" or that "bugfixes
and enhancements of original software are given back". 

OK, LGPL is fine for this goal. When you say "they see it
as appropriate way to share their code", there's nothing
in this statement that openly and honestly indicates what
is the goal of this method.

>> It is widely acknowledged that GPL license has the "viral" aspect of
>> extending itself on your software - can you point to closed-source
>> licenses that would have this aspect?

>Can you point to closed-source licenses that allow using the code *at 
>all*? 

Which code?

_Their_ code? I.e. written by them?

Back then in days of yore I was using C-tree DB library for some
time, that came with source - or actually in practical terms "as
source". My boss wrote quite a lot of nice C++ wrappings thanks
to that (that I didn't bother to use, because I could not be
bothered to learn C++ :-). They still sell it that way:

http://www.faircom.com/products/ctree/

I don't remember being forbidden to redistribute source
code of what _we_ wrote at the company. Just the redistribution
of C-tree source code itself was not allowed. Redistribution of
the compiled binary with the product was OK (and no royalties
were required).

>With GPL, you have the choice: either you agree with its terms on 
>distributing the code and then you can use the code, or you don't agree 
>with it and you don't use (which is still no worse than closed source).

With all due respect, this is a universal statement that applies
to all the licenses - obviously, if you don't agree to the terms,
you can't use it. 

However, it's not aboot agreement to conditions per se, this is 
aboot the freedom of speech, err, this is aboot what those 
conditions actually are.  

>Some people call that viral, but I think it's a distortion of the truth.

How so? If you combine source of your program with GPLed source,
your source no longer can have the license of your choosing - it
has to have GPL license, or at least contain the key GPL conditions.
Other licenses do not require you to disclose _your_ source. It's
a really, really weird world in which having to put "obnoxious 
advertising clause" is considered as more of imposing yourself on
other people than requiring them to disclose your source. 

This is "money with strings attached" approach. It's just ignored
for sake of Grand Goal that few people actually believe into, along
the lines "end justifies means". 

OK, I rambled enough, this group should not degenerate into *.advocacy
trash dump. :-)



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


Re: Download .jpg from web

2005-01-06 Thread Istvan Albert
GMane Python wrote:
  Using a network camera with built-in webserver
The first thing that might be worth investigating
is this webserver. What kind of throughput is it
capable of? How does it handle repeated
requests etc.
Your program won't be faster than the server
that provides it with the data.
Istvan.
--
http://mail.python.org/mailman/listinfo/python-list


Python Operating System???

2005-01-06 Thread David Brown
Hello. I recently came across a free operating system called Unununium (or
something like that) and it was developed in Python and Assembly.

Now, I have been looking for a way to make an operating system for a long
long time and the only possibilities I could find were C++ and assembly. I
don't mind assembly so much if I don't have to use it very often. But C++ is
so complicated and errors are pretty much impossible to find in the code for
me.

So, I was wondering if it would be possible to find a bootloader that loads
a python file at startup or something...

Is there an example somewhere of a Python OS?

Thanks!


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


Pb encodage & import

2005-01-06 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Bonsoir !Hi !

My english is short, therefore, I do short.

Two scripts, "i1.py" and "i2.py" :

i1.py :
import i2
print i2.GlobalA

i2.py :
GlobalA ="azerty"




Like this, it's OK ; but :



i1.py :
import i2
print i2.GlobalA

i2.py :
GlobalA = "azerty"

OK

==

i1.py :
import i2
print i2.GlobalA

i2.py :
# -*- coding: cp1252 -*-

GlobalA = "azerty"

SyntaxError

==

i1.py :
import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = "azerty"

OK

==

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = "azerty"

OK

==

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: cp1252 -*-

GlobalA = "azerty"

SyntaxError

==

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
GlobalA = u"azérty"  #see unicode & accent

OK

==

i1.py :
# -*- coding: utf-8 -*-

import i2
print i2.GlobalA

i2.py :
# -*- coding: utf-8 -*-

GlobalA = u"azérty"  #see unicode & accent

UnicodeDecodeError

==


All files are recorded in ANSI ; tests with Python 2.4 on Win-XP.



Ideas, ou suggests  ?




@-salutations
-- 
Michel Claveau





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


Re: File Handling Problems Python I/O

2005-01-06 Thread Peter Hansen
Josh wrote:
He is the function where I am making the call. If I change the open
statment to another file, say "c:\test.txt", a file I know exists, it
will error out stating the file does not exist. Thanks
def GetStartVars(self):
try:
DOWNFILE = open("c:\fixes.txt","r")
Josh, it's surprising that this example worked for you,
given that \f is another string escape (in this case
it's an ASCII FF (formfeed), character code 12, instead
of the TAB (code 8) character that c:\test.txt gives you.
Are you sure this was one of the names that worked?
BTW, the following link in the docs provides a list of
all the recognized escape sequences:
http://www.python.org/doc/current/ref/strings.html
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Other notes

2005-01-06 Thread Bengt Richter
On Thu, 06 Jan 2005 19:24:52 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote:

>Me
> (BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted
> as the floating point value "1.0".)<
>
>Steve Holden:
>> Indeed, but if ".." is defined as an acceptable token then there's 
>> nothing to stop a strict LL(1) parser from disambiguating the cases in 
>> question. "Token" is not the same thing as "character".
>
>Python's tokenizer is greedy and doesn't take part in the
>lookahead.  When it sees 1..12 the longest match is for "1."
>
But it does look ahead to recognize += (i.e., it doesn't generate two
successive also-legal tokens of '+' and '=')
so it seems it should be a simple fix.

 >>> for t in tokenize.generate_tokens(StringIO.StringIO('a=b+c; a+=2; 
 >>> x..y').readline):print t
 ...
 (1, 'a', (1, 0), (1, 1), 'a=b+c; a+=2; x..y')
 (51, '=', (1, 1), (1, 2), 'a=b+c; a+=2; x..y')
 (1, 'b', (1, 2), (1, 3), 'a=b+c; a+=2; x..y')
 (51, '+', (1, 3), (1, 4), 'a=b+c; a+=2; x..y')
 (1, 'c', (1, 4), (1, 5), 'a=b+c; a+=2; x..y')
 (51, ';', (1, 5), (1, 6), 'a=b+c; a+=2; x..y')
 (1, 'a', (1, 7), (1, 8), 'a=b+c; a+=2; x..y')
 (51, '+=', (1, 8), (1, 10), 'a=b+c; a+=2; x..y')
 (2, '2', (1, 10), (1, 11), 'a=b+c; a+=2; x..y')
 (51, ';', (1, 11), (1, 12), 'a=b+c; a+=2; x..y')
 (1, 'x', (1, 13), (1, 14), 'a=b+c; a+=2; x..y')
 (51, '.', (1, 14), (1, 15), 'a=b+c; a+=2; x..y')
 (51, '.', (1, 15), (1, 16), 'a=b+c; a+=2; x..y')
 (1, 'y', (1, 16), (1, 17), 'a=b+c; a+=2; x..y')
 (0, '', (2, 0), (2, 0), '')

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


Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
Micheal,

Thanks for the advice as the programming I am doing will be run on both
Windows and Linux based PC's, that being the main reason for my venture
into Python. I'm glad to see that people are willing to help out even
the newbie's.  

Josh

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


Re: sorting on keys in a list of dicts

2005-01-06 Thread Jeff Shannon
Jp Calderone wrote:
L2 = [(d[key], i, d) for (i, d) in enumerate(L)]
L2.sort()
L = [d for (v, i, d) in L2]
Out of curiosity, any reason that you're including the index?  I'd 
have expected to just do

L2 = [(d[key], d) for d in L]
L2.sort()
L = [d for (v, d) in L2]
I suppose that your version has the virtue that, if the sortkey value 
is equal, items retain the order that they were in the original list, 
whereas my version will sort them into an essentially arbitrary order. 
 Is there anything else that I'm missing here?

Jeff Shannon
Technician/Programmer
Credit International
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python evolution: Unease

2005-01-06 Thread Jarek Zgoda
Iwan van der Kleyn wrote:
But I see little to no efforts from the core python team to address my 
needs as listed above. They seem mainly to focus on the core attributes 
and syntax of the language. Very little or no efforts are taken to 
improve the infrastructure around the language.

And then I read the following sentence by Van Rossum:
"In order to make type inferencing a little more useful, I'd like to 
restrict certain forms of extreme dynamic behavior in Python"

In the end, it's mindset which counts. And I think that mindset is going 
to be determine the way foreward for Python: more features, increased 
complexity, less dynamism. Lots of syntax crud, without addressing the 
need to improve the infrastructure around the language.
I saw this once somewhere:
http://groups.google.com/groups?selm=cf38ph%242f8%241%40namru.matavnet.hu
--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a restricted python interpreter

2005-01-06 Thread Peter Maas
Jp Calderone schrieb:
But mod_python is an apache module and runs in the same apache process
with other users' scripts.

  I am uncertain as to how this differs from mod_php (the alternative 
discussed in the OP's story).  I've been away from PHP for a while, so 
perhaps mod_php has gained some features of which I am unaware?
I think PHP has a safe mode which solves the probem of isolating
scripts of different users on application level. This is not optimal
but better than nothing. Best solution would probably be to create
a thread for each request that can operate only with the id of an
authenticated user. But this seems to be a problem with Apache or
with Linux?
--
---
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: File Handling Problems Python I/O

2005-01-06 Thread mhartl
Sorry, the BASE variable should be 'C:\\' on Windows:

>>> BASE = 'C:\\'
>>> import os
>>> os.path.join(BASE, 'foo', 'bar', 'baz')
'C:\\foo\\bar\\baz'

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


Re: What could 'f(this:that=other):' mean?

2005-01-06 Thread Jeff Shannon
Jonathan Fine wrote:
Jeff Shannon wrote:
Jonathan Fine wrote:
Giudo has suggested adding optional static typing to Python.
(I hope suggested is the correct word.)
  http://www.artima.com/weblogs/viewpost.jsp?thread=85551
An example of the syntax he proposes is:
 > def f(this:that=other):
 > print this


I'm going to suggest a different use for a similar syntax.
In XML the syntax
 >  
is used for name spaces.
Name spaces allow independent attributes to be applied to an
element.  For example, 'fo' attributes for fonts and layout.
XSLT is of course a big user of namespaces in XML.
Namespaces seems to be a key idea in allow independent
applications to apply attributes to the same element.
[...]
Here's an example of how it might work.  With f as above:
 > f(this:that='value')
{'that': 'value'}

I fail to see how this is a significant advantage over simply using 
**kwargs.  It allows you to have multiple dictionaries instead of just 
one, that's all.  And as you point out, it's trivial to construct your 
own nested dicts.

This argument could be applied to **kwargs (and to *args).  In other
words, **kwargs can be avoided using a trivial construction.
The use of *args and **kwargs allows functions to take a variable 
number of arguments.  The addition of ***nsargs does not add 
significantly.  Note that *args and **kwargs should always be used 
together, because to do otherwise would require the function caller to 
know details of the function's implementation (i.e. which arguments 
are expected to be positional and which must be keywords).  Since we 
*want* the caller to not need to know this, then ***nsargs would 
always need to be used together with *args and **kwargs.  (A function 
defined 'def f(***nsargs): ...' could not be called with 'f(1)'.  This 
means that all you're gaining is an extra bag to put variable numbers 
of arguments in.  The value here is that it maintains a parallel with 
*args and **kwargs when one allows 'namespaced' arguments -- if one 
allows that, then ***nsargs is required for consistency's sake, but it 
does not simplify anything by itself.

So really, we need to look at what gains we'd get from having 
'namespaced' arguments.  What's the real advantage here?

When using 'namespace' arguments, instead of standard keyword 
arguments, the function body would be given a dictionary instead of a 
set of local variables, right?  'def f1(arg1, arg2, arg3, arg4)' 
creates four names in locals(), where 'def f2(ns1:arg1, ns1:arg2, 
ns1:arg3, ns1:arg4) creates a single dict named ns1 in locals(), which 
contains four items (keyed on 'arg1', 'arg2', etc.), and 'def 
f3(ns1:arg1, ns1:arg2, ns2:arg3, ns2:arg4)' creates two dicts (ns1 and 
ns2) with two entries each.

Okay, now, let's take a look at how these functions will be used.
   f1(1, 2, 3, 4)
   f1(arg1=1, arg2=2, arg3=3, arg4=4)
Note that f1 doesn't care which of these methods of calling is 
employed -- both result in the same situation inside of f1().

So what's the intended way of calling f2()?  I'd presume that it 
shouldn't care whether keywords or namespaces are specified, so that 
the following should all be equivalent:

   f2(1, 2, 3, 4)
   f2(1, 2, arg3=3, arg4=4)
   f2(1, 2, arg3=3, ns1:arg4=4)
Note that this doesn't *add* any utility.  The function caller hasn't 
gained anything.  Since arg4 is unambiguous regardless of whether it's 
referred to as arg4 or ns1:arg4, the only time that the caller has any 
reason to specify the namespace is if argnames within different 
namespaces clash -- that is, if we allow something like 'def 
f4(ns1:arg1, ns1:arg2, ns2:arg1, ns2:arg2)'.

Now, though, we've lost the ability to specify *only* the argname and 
not the namespace as well -- that is, you *cannot* call f4 with 
keywords but not namespaces.  From the caller's vantage point, this 
means that they need to know the full namespace spec of the function, 
which makes it no different than simply using longer (but unique) 
keyword names.

So, we can see that allowing namespaces and ***nsargs doesn't add any 
utility from the caller's perspective.  How much does the callee gain 
from it?

Well, the following functions would be equivalent:
def g1(arg1, arg2, arg3, arg4):
ns1 = {'arg1':arg1, 'arg2':arg2, 'arg3':arg3, 'arg4':arg4}
return ns1
def g2(ns1:arg1, ns1:arg2, ns1:arg3, ns1:arg4):
return ns1
You might say "Wow, look at all that repetetive typing I'm saving!" 
But that *only* applies if you need to stuff all of your arguments 
into dictionaries.  I suspect that this is a rather small subset of 
functions.  In most cases, it will be more convenient to use your 
arguments as local variables than as dictionary entries.

def gcd1(a, b):
while a:
a, b = b%a, a
return b
def gcd2(ns1:a, ns1:b):
while ns1['a']:
ns1['a'], ns1['b'] = ns1['b']%ns1['a'], ns1['a']
return ns1['b']
Speaking of repetetive typing :P
Besides, another function equivalent 

Re: File Handling Problems Python I/O

2005-01-06 Thread mhartl
You can use the os module to build path names in a platform-independent
manner.  On my Linux box, I can type

>>> BASE = '/'
>>> import os
>>> os.path.join(BASE, 'foo', 'bar', 'baz')
'/foo/bar/baz'

On a Windows machine, you get

>>> BASE = 'C:'
>>> import os
>>> os.path.join(BASE, 'foo', 'bar', 'baz')
'C:\\foo\\bar\\baz'

This is a little more cumbersome that just typing the string, but using
os.path.join makes it easy to port your scripts to a new platform.
Check out http://docs.python.org/lib/module-os.path.html for more
information.
Cheers,

Michael

--
Michael Hartl
http://michaelhartl.org/

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


Re: Python evolution: Unease

2005-01-06 Thread Bulba!
On Wed, 05 Jan 2005 17:25:08 -0800, Robert Kern <[EMAIL PROTECTED]>
wrote:

>> Yes, I know, it can be written by hand. But by this line of logic why
>> bother learning VHLL and not just stay with C? 

>I'm not sure what you mean by "written by hand." 

I mean the same way as you do mylist.sort() in Python
instead of writing the list sorting function yourself in
the application / script.

>Someone is going to 
>have to write the functions in the first place. Sure, they can be 
>written once, well, and placed in the standard library so they don't 
>have to be *re*written by anyone else again.

Well of course - the only point I mean here is getting
high-level stuff is one of the main motives of getting
into VHLL (aside from issues like automatic memory 
management, of course). 

>I still think numarray is a good start for this. It handles more than 
>just numbers. And RecArray (an array that has different types in each 
>column, as you seem to require) can be subclassed to add these methods 
>to it.

I have downloaded it, playing with it and like it. I esp. like things
like:

>>> print a + a
[2 4 6]

or 

>>> b.getshape()
(4,3)

Very Pythonic. :-)

However, not all things are generic enough like I meant. That
is not to criticize, but merely to point out that the library is for
obvious reasons slanted towards numerical work, so e.g. while the
following works:

.>>> from numarray import transpose
.>>> transpose([[1,2],[3,4]])
array([[1, 3],
   [2, 4]])

...this doesn't:

>>> transpose([('phone1', 12345), ('phone2', 67890)])
Traceback (most recent call last):
  File "", line 1, in ?
[]
TypeError: Expecting a python numeric type, got something else.

Why would someone want to do such a thing: suppose he
wants 'phone1' and 'phone2' and number records sequenced 
horizontally instead vertically, while when he read that from
a file, such was the file structure. It's a boneheaded example, 
but you get the idea.

It's obvious why that exception happens: in recarray I have to have
the same type of the data type in every column, so transpose(recarray)
cannot  be done.

This is not the situation with other builtin Python data types, where
whatever with can be mixed, i.e. placed in any "cell" of data type 
and all the functions will still work as long as the operand type is
proper.

This is obviously the consequence of numarray being based on
the matrices designed for working on numerical data, so it's
probably very fast and I'm sure people who use it find it useful.

But personally I would happily sacrifice much or even most of that
speed for sake of flexibility. Because, sure, I can keep the
matrix header with strings separately in a list, do the transformation
just on numbers, adjust the list as well - it's not like I'm just lazy
to make an additional programming effort, but that eliminates
one of the greatest advantages of Python: terseness without
foregoing clarity.

Yes, now it's probably much harder to do once the simpler things
have been done. All I'm saying is that it would be so frigging nice
to have it with even richer data structures.

>> and clear_ manipulations of rich data structures in Python. Why not
>> extend them with flexible tables / matrices / arrays that would work
>> in as "Pythonic" ways as dictionaries and lists already do?

>Sure. We're working on it! 

Excellent! Great, I'm really grateful to you all for doing that.
Honestly.

>Come check out numarray; I think you'll like 
>it. And if, along the way, you write a CSV-to-RecArray converter, we'd 
>*love* to include it in the distribution. 

First I have to learn Python (and programming in general) well enough
to produce smth that isn't as bug-infested as a software of certain
well-known vendor and that I would not be ashamed of to show to the
world. :-)  I'm afraid it will take me some time.

>I think that a more complete 
>integration with the other core Python facilities like the csv module 
>will help numarray become more suited for inclusion into the standard 
>library.

I'm sure people would find it useful. I play with numarray to get the
idea how I could apply it in my work. 




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


Re: Embedding a restricted python interpreter

2005-01-06 Thread Bengt Richter
On Thu, 6 Jan 2005 16:53:23 +0100, Gerhard Haering <[EMAIL PROTECTED]> wrote:

>
>--rwEMma7ioTxnRzrJ
>Content-Type: text/plain; charset=us-ascii
>Content-Disposition: inline
>Content-Transfer-Encoding: quoted-printable
>
>On Thu, Jan 06, 2005 at 07:32:25AM -0800, Paul Rubin wrote:
>> Jp Calderone <[EMAIL PROTECTED]> writes:
>> >   A Python sandbox would be useful, but the hosting provider's excuse
>> > for not allowing you to use mod_python is completely bogus.  All the=20
>> > necessary security tools for that situation are provided by the=20
>> > platform in the form of process and user separation.
>>=20
>> But mod_python is an apache module and runs in the same apache process
>> with other users' scripts.
>
>Which is why it's a good idea for each customer to have it's own system user
>and their virtual hosts running under this uid. Which was the idea for the
>perchild MPM for Apache 2 - which is abandoned now :-( muxmpm is a replacem=
>ent
>project in beta.
Note to self. Another thing to catch up on ;-/
>
>This really sucks when you use Apache2. I myself did make the switch some t=
>ime
>ago, then noticed that this (for me) important feature was missing. It now
>works, somehow, but to make it work properly I'd need to either:
>
>- go back to Apache 1.3.x, missing some nice improvements
And maybe have to recompile to enable the setuid stuff. But IIRC after that you
can run cgi with everything private and serve only generated stuff to the world
if you want.

>- use different webservers per user, put them together with mod_proxy (yuck=
>!)

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


  1   2   3   >