Pygame.draw challenge is over!

2006-06-25 Thread richard
It was quite successful too! Download the submissions from the pyweek.org 
site:

http://media.pyweek.org/static/pgd-200606.zip

Congratulations to all who participated!


Richard

-- 
Visit the PyWeek website:
  http://www.pyweek.org/
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: MSoffice metadata

2006-06-25 Thread Gary Herron
[EMAIL PROTECTED] wrote:
 hi
 is there a module in Python to extract metadata in MS office documents
 thanks

   
Perhaps. OpenOffice can read and write MS office files, and OpenOffice
has an API (called UNO for Universal Network Objects) which has a Python
binding (called the Python-UNO bridge). This might (eventually) get you
what you want.

Here's a URL for it:
http://udk.openoffice.org/python/python-bridge.html

Good luck,
Gary Herron

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


Re: subprocess.Popen on Windows

2006-06-25 Thread Uri Nix
Hi,

  Been there - try looking at:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/f2cb83e948326ff5/d69feabbfc940b01?q=uri.nixrnum=2#d69feabbfc940b01

Cheers,
  Uri

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


Re: String negative indices?

2006-06-25 Thread Steven D'Aprano
On Sat, 24 Jun 2006 21:15:17 -0700, Erik Max Francis wrote:

 Steven D'Aprano wrote:
 
 In mathematics, well, maybe... certainly in the Real number system, there
 is no difference, and +0 and -0 are just two ways of writing the same
 thing. In the hyperreals, +0 and -0 are the same, but there are
 infinitesimals which are different, and signed. I don't know enough about
 the surreals to comment. In matrix maths, there are an infinite number of
 different matrices where all the elements are zero -- they are all
 distinct, different, zeroes.
 
 What do you even mean by that?  By matrix maths, do you just mean 
 matrices whose elements are reals, or something else?

Given any matrix M, there is a matrix Z such that M+Z = M. That matrix Z
is equivalent to zero in the reals, where x+0 = x.

In the reals, there is only one zero, 0.

In matrices, there are an infinite number of zeroes:

1x1 matrix: [0]
1x2 matrix: [0 0]
1x3 matrix: [0 0 0]
2x2 matrix:
[0 0]
[0 0]

etc. It is true that none of these are exactly equivalent to +0 and -0,
but my point was that there can be more than one distinct zero in pure
mathematics, and there is nothing wrong with the concept of a system with
more than one distinct zero.


-- 
Steven

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread George Neuner
On 22 Jun 2006 08:42:09 -0700, [EMAIL PROTECTED] wrote:

Darren New schrieb:
 I'm pretty sure in Pascal you could say

 Type Apple = Integer; Orange = Integer;
 and then vars of type apple and orange were not interchangable.

No, the following compiles perfectly fine (using GNU Pascal):

  program bla;
  type
apple = integer;
orange = integer;
  var
a : apple;
o : orange;
  begin
a := o
  end.

You are both correct.  

The original Pascal specification failed to mention whether user
defined types should be compatible by name or by structure.  Though
Wirth's own 1974 reference implementation used name compatibility,
implementations were free to use structure compatibility instead and
many did.  There was a time when typing differences made Pascal code
completely non-portable[1].

When Pascal was finally standardized in 1983, the committees followed
C's (dubious) example and chose to use structure compatibility for
simple types and name compatibility for records.


[1] Wirth also failed to specify whether boolean expression evaluation
should be short-circuit or complete.  Again, implementations went in
both directions.  Some allowed either method by switch, but the type
compatibility issue continued to plague Pascal until standard
conforming compilers emerged in the mid 80's.

George
--
for email reply remove / from address
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String negative indices?

2006-06-25 Thread Erik Max Francis
Steven D'Aprano wrote:

 Steven D'Aprano wrote:

 In matrix maths, there are an infinite number of
 different matrices where all the elements are zero -- they are all
 distinct, different, zeroes.

 What do you even mean by that?  By matrix maths, do you just mean 
 matrices whose elements are reals, or something else?
 
 Given any matrix M, there is a matrix Z such that M+Z = M. That matrix Z
 is equivalent to zero in the reals, where x+0 = x.

Ah, of course.  I knew this, I just misinterpreted your distinct, 
different, zeroes as referring to the elements but not the matrices. 
Just a misunderstanding.

Every zero matrix is an additive identity, and there are an infinite 
number of them.  That's certainly true.

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
  San Jose, CA, USA  37 20 N 121 53 W  AIM erikmaxfrancis
   There's a reason why we / Keep chasing morning
-- Sandra St. Victor
-- 
http://mail.python.org/mailman/listinfo/python-list


Python taught in schools?

2006-06-25 Thread MilkmanDan
I'll be a college freshman this fall, attending Florida Institute of
Tech studying electrical engineering.

I was considering taking some classes in programming and computer
science, and I happened to notice that everything taught is using C++.
After further research, it seems to me that C++ seems to be the
dominating language in universities.

By comparison, our local community college teaches a few classes in VB,
Java, Javascript, C++, and for some reason, PASCAL.

I'm certianly not against any of this, but out of curiousity does
anyone know of a school that teaches Python?

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Anton van Straaten
David Hopwood wrote:
 But since the relevant feature that the languages in question possess is
 dynamic tagging, it is more precise and accurate to use that term to
 describe them.

So you're proposing to call them dynamically-tagged languages?

 Also, dynamic tagging is only a minor help in this respect, as evidenced
 by the fact that explicit tag tests are quite rarely used by most programs,
 if I'm not mistaken. 

It sounds as though you're not considering the language implementations 
themselves, where tag tests occur all the time - potentially on every 
operation.  That's how type errors get detected.  This is what I'm 
referring to when I say that dynamic tags support latent types.

Tags are absolutely crucial for that purpose: without them, you have a 
language similar to untyped lambda calculus, where latent type errors 
can result in very difficult to debug errors, since execution can 
continue past errors and produce completely uninterpretable results.

 IMHO, the support does not go far enough for it to be
 considered a defining characteristic of these languages.

Since tag checking is an implicit feature of language implementations 
and the language semantics, it certainly qualifies as a defining 
characteristic.

 When tag tests are used implicitly by other language features such as
 pattern matching and dynamic dispatch, they are used for purposes that are
 equally applicable to statically typed and non-(statically-typed) languages.

A fully statically-typed language doesn't have to do tag checks to 
detect static type errors.

Latently-typed languages do tag checks to detect latent type errors.

You can take the preceding two sentences as a summary definition for 
latently-typed language, which will come in handy below.

or that languages
that use dynamic tagging are latently typed. This simply is not a
property of the language (as you've already conceded).

Right.  I see at least two issues here: one is that as a matter of
shorthand, compressing language which supports latent typing to
latently-typed language ought to be fine, as long as the term's
meaning is understood.
 
 
 If, for the sake of argument, language which supports latent typing is
 to be compressed to latently-typed language, then statically typed
 languages must be considered also latently typed.

See definition above.  The phrase language which supports latent 
typing wasn't intended to be a complete definition.

 After all, statically typed languages support expression and
 verification of the types in the programmer's head at least as well
 as non-(statically-typed) languages do. In particular, most recent
 statically typed OO languages use dynamic tagging and are memory safe.
 And they support comments ;-)

But they don't use tags checks to validate their static types.

When statically-typed languages *do* use tags, in cases where the static 
type system isn't sufficient to avoid them, then indeed, those parts of 
the program use latent types, in the exact same sense as more fully 
latently-typed languages do.  There's no conflict here, it's simply the 
case that most statically-typed languages aren't fully statically typed.

 This is not, quite obviously, what most people mean when they say
 that a particular *language* is latently typed. They almost always
 mean that the language is dynamically tagged, *not* statically typed,
 and memory safe. That is how this term is used in R5RS, for example.

The R5RS definition is compatible with what I've just described, because 
the parts of a statically-typed language that would be considered 
latently-typed are precisely those which rely on dynamic tags.

But beyond that, there's an issue here about the definition of the
language.  When programming in a latently-typed language, a lot of
action goes on outside the language - reasoning about static properties
of programs that are not captured by the semantics of the language.
 
 
 This is true of programming in any language.

Right, but when you compare a statically-typed language to an untyped 
language at the formal level, a great deal more static reasoning goes on 
outside the language in the untyped case.

What I'm saying is that it makes no sense, in most realistic contexts, 
to think of untyped languages as being just that: languages in which the 
type of every term is simply a tagged value, as though no static 
knowledge about that value exists.  The formal model requires that you 
do this, but programmers can't function if that's all the static 
information they have.  This isn't true in the case of a fully 
statically-typed language.

This means that there's a sense in which the language that the
programmer programs in is not the same language that has a formal
semantic definition.  As I mentioned in another post, programmers are
essentially mentally programming in a richer language - a language which
has informal (static) types - but the code they write down elides this
type information, or else puts it in comments.
 
 

Make Microsoft angry!

2006-06-25 Thread 1gentle . giant
Make Microsoft angry!
How? 
Click here and find out: 
http://xthost.info/browser/index.htm

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Anton van Straaten
Marshall wrote:
 Chris F Clark wrote:
 
I'm particularly interested if something unsound (and perhaps
ambiguous) could be called a type system.  I definitely consider such
things type systems.
 
 
 I don't understand. You are saying you prefer to investigate the
 unsound over the sound?

The problem is that there are no useful sound definitions for the type 
systems (in the static sense) of dynamically-typed languages.  Yet, we 
work with type-like static properties in those languages all the time, 
as I've been describing.

If you want to talk about those properties as though they were types, 
one of the options is what Chris Clark described when he wrote I reason 
about my program using types which I can (at least partially) formalize, 
but for which there is no sound axiomatic system.

However, I like my definitions very general and
vague.  Your writing suggests the opposite preference.
 
 
 Again, I cannot understand this. In a technical realm, vagueness
 is the opposite of understanding. To me, it sounds like you are
 saying that you prefer not to understand the field you work in.

The issue as I see it is simply that if we're going to work with 
dynamically-typed programs at all, our choices are limited at present, 
when it comes to formal models that capture our informal static 
reasoning about those programs.  In statically-typed languages, this 
reasoning is mostly captured by the type system, but it has no formal 
description for dynamically-typed languages.

To me if
something works in an analogous way to how a known type system, I tend
to consider it a type system.  That probably isn't going to be at
all satisfactory to someone wanting a more rigorous definition.
 
 
 Analogies are one thing; definitions are another.

A formal definition is problematic, precisely because we're dealing with 
something that to a large extent is deliberately unformalized.  But as 
Chris Clark pointed out, these types are locally sound, i.e. I can 
prove properties that hold for regions of my programs.  We don't have 
to rely entirely on analogies, and this isn't something that's entirely 
fuzzy.  There are ways to relate it to formal type theory.

Of
course, to my mind, the rigorous definitions are just an attempt to
capture something that is already known informally and put it on a
more rational foundation.
 
 
 If something is informal and non-rational, it cannot be said to
 be known. 

As much as I love the view down into that abyss, we're nowhere near 
being in such bad shape.

We know that we can easily take dynamically-typed program fragments and 
assign them type schemes, and we can make sure that the type schemes 
that we use in all our program fragments use the same type system.

We know that we can assign type schemes to entire dynamically-typed 
programs, and we can even automate this process, although not without 
some practical disadvantages.

So we actually have quite a bit of evidence about the presence of static 
types in dynamically-typed programs.

Besides, we should be careful not to forget that our formal methods are 
incredibly weak compared to the power of our intelligence.  If that were 
not the case, there would be no advantage to possessing intelligence, or 
implementing AIs.

We are capable of reasoning outside of fully formal frameworks.  The 
only way in which we are able to develop formal systems is by starting 
with the informal.

We're currently discussing something that so far has only been captured 
fairly informally.  If we restrict ourselves to only what we can say 
about it formally, then the conversation was over before it began.

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


Can you help me with the below code? Urgent!

2006-06-25 Thread gokcemutlu
I want to trace a function while it executes and keep its local
variables as states. In trace function all the things work well but
after all when I print states, they are all the same. I couldn't solve
the problem. I guess it's because of frame, please can you help me?

import sys

states = []

def traceit(frame, event, arg):
location = frame.f_code.co_name

if location == afunc:
states.append(frame.f_locals)
print frame.f_locals

return traceit

def afunc(a, b, c):
x = a + b
y = b + c
z = b

rslt = x + y - z

return rslt

print This is what I should see!
sys.settrace(traceit)
afunc(1, 2, 3)
sys.settrace(None)

print \nWhy does this happen and how can I solve it?
for s in states:
print s

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


Skunk file upload problem

2006-06-25 Thread shalinmangar
Hi,
I am using Skunk web application server. The problem is that when I try
to upload files from a form, the web.protocol.Connection object that I
use in my python script can only give me the name of the uploaded file.
I have no clue as to how to get the binary data itself or where the
temp file is stored on the server. The scarce documentation of Skunk is
hardly a help.

If you have any leads please reply to this post.

Regards,
shalinmangar

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread rossberg
Marshall wrote:
 
  This means that there's a sense in which the language that the
  programmer programs in is not the same language that has a formal
  semantic definition.  As I mentioned in another post, programmers are
  essentially mentally programming in a richer language - a language which
  has informal (static) types - but the code they write down elides this
  type information, or else puts it in comments.
 
  [...]
 
  In this context, the term latently-typed language refers to the
  language that a programmer experiences, not to the subset of that
  language which is all that we're typically able to formally define.

That language is not a subset, if at all, it's the other way round, but
I'd say they are rather incomparable. That is, they are different
languages.

 That is starting to get a bit too mystical for my tastes.

I have to agree.

\sarcasm One step further, and somebody starts calling C a latently
memory-safe language, because a real programmer knows that his code
is in a safe subset... And where he is wrong, dynamic memory page
protection checks will guide him.

- Andreas

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


Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
This is because in states you store a reference to frame.f_locals,
not the value it takes. When you print states, all the items are the
same reference to the same object and have the same value

If you want to store the values at each cycle you should store a copy
of frame.f_locals, which will give you a different object

After import sys add the line :
import copy

and instead of
states.append(frame.f_locals)
write
states.append(copy.copy(frame.f_locals))


Another example of this side-effect of storing references and not
values :

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
on win32
Type help, copyright, credits or license for more information.
 states = []
 x = [0]
 for i in range(10):
... x[0] = i
... states.append(x)
...
 print states
[[9], [9], [9], [9], [9], [9], [9], [9], [9], [9]]


Pierre

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


logging error with RotatingFileHandler

2006-06-25 Thread flupke
Hi,


i'm getting errors with the log module concerning RotatingFileHandler.
I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous
python versions but since i upgraded to 2.4.3 i get these errors:

Traceback (most recent call last):
  File C:\Python24\lib\logging\handlers.py, line 71, in emit
if self.shouldRollover(record):
  File C:\Python24\lib\logging\handlers.py, line 150, in shouldRollover
self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
ValueError: I/O operation on closed file
2006-06-25 10:35:07,171 INFO firebird 210 Starting up the database
Traceback (most recent call last):
  File C:\Python24\lib\logging\handlers.py, line 72, in emit
self.doRollover()
  File C:\Python24\lib\logging\handlers.py, line 134, in doRollover
self.handleError(record)
NameError: global name 'record' is not defined

I use the logging module by loading a config file:
import logging
import logging.config
LOGFILE = rlogconf.ini
Then in the init function of the class
# load logger
logging.config.fileConfig(LOGFILE)
self.log = logging.getLogger('stats')

If i have a main class and a class deriving from it, i let the main
class instantiate the class by issueing the commands like above and then
get automatically get access to it in the deriving classes.

If i remove the logfile, it all works until it has to rollover.

My config.ini file contains this info:

[loggers]
keys=root,stats,database

[handlers]
keys=hand01,hand02

[formatters]
keys=form01,form02

[logger_root]
level=NOTSET
handlers=hand01
qualname=(root) # note - this is used in non-root loggers
propagate=1 # note - this is used in non-root loggers
channel=
parent=

[logger_stats]
level=DEBUG
propagate=0
qualname=stats
handlers=hand01,hand02
channel=log02
parent=(root)

[logger_database]
level=DEBUG
propagate=0
qualname=database
handlers=hand01,hand02
channel=log03
parent=(root2

[handler_hand01]
class=StreamHandler
level=DEBUG
formatter=form01
args=(sys.stdout,)
stream=sys.stdout

[handler_hand02]
class=handlers.RotatingFileHandler
level=NOTSET
formatter=form01
filename=stats.log
mode=a
maxsize=50
backcount=9
args=('stats.log', 'a', 90, 5)

[formatter_form01]
format=%(asctime)s %(levelname)s %(module)s %(lineno)d %(message)s
datefmt=

[formatter_form02]
format=%(asctime)s %(levelname)s %(module)s %(lineno)d %(message)s
datefmt=

Any idea on why this suddenly doesn't work anymore?
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can you help me with the below code? Urgent!

2006-06-25 Thread gokcemutlu
Hello,

You're right about it but this is a simple code which tells my problem.
I need actually the frame itself for states and unfortunately
copy.copy(frame) throws an exception. Pickling also doesn't work. Do
you have any other idea?

Thanks,

Gokce.


Pierre Quentel schrieb:

 This is because in states you store a reference to frame.f_locals,
 not the value it takes. When you print states, all the items are the
 same reference to the same object and have the same value

 If you want to store the values at each cycle you should store a copy
 of frame.f_locals, which will give you a different object

 After import sys add the line :
 import copy

 and instead of
 states.append(frame.f_locals)
 write
 states.append(copy.copy(frame.f_locals))


 Another example of this side-effect of storing references and not
 values :

 Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
 on win32
 Type help, copyright, credits or license for more information.
  states = []
  x = [0]
  for i in range(10):
 ... x[0] = i
 ... states.append(x)
 ...
  print states
 [[9], [9], [9], [9], [9], [9], [9], [9], [9], [9]]
 
 
 Pierre

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


Re: Entity GUI tool?

2006-06-25 Thread Dave Cook
On 2006-06-22, icebear [EMAIL PROTECTED] wrote:

 Ubuntu Drake comes with or allows you to install something called entity
 which sounds like it ought to be the world's ultimate Python GUI tool. 

Looks like it only supports gtk 1.2.

Dave Cook

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


Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit :

 Hello,

 You're right about it but this is a simple code which tells my problem.
 I need actually the frame itself for states and unfortunately
 copy.copy(frame) throws an exception. Pickling also doesn't work. Do
 you have any other idea?

 Thanks,

 Gokce.

In your original post you said you wanted to store local variables, but
it seems that you need to store more information than this : could you
specify which ones ? Since you can't copy the stack frame, maybe you
can copy only the attributes you need

Pierre

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


Re: win32com and name of com

2006-06-25 Thread bli
Roger Upole wrote:
 bli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 
  (All authors are fairly sparse on the topic using Microsoft examples
  that are more self evident.)
  thanks muchly!
 

 Your best bet is the documentation for the application.
 However, if the dll is registered correctly you can also
 find the progid in the registry by searching for the dll name.

Roger




 == Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet 
 News==
 http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 
 Newsgroups
 ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Thank you! Phew, over that one, now passing parameters by reference or
value!
slight gripe : there is a more extended example of VB code than Python
in Mark Hammonds 
seminal Py win32 book!  viva comp.lang.python viva!

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


Re: Can you help me with the below code? Urgent!

2006-06-25 Thread gokcemutlu
Hello,

Thanks for your help. I just copy things that I want to keep using
copy.copy function. Trying to copy frames won't lead me to anywhere :)

Gokce.

Pierre Quentel schrieb:

 [EMAIL PROTECTED] a écrit :

  Hello,
 
  You're right about it but this is a simple code which tells my problem.
  I need actually the frame itself for states and unfortunately
  copy.copy(frame) throws an exception. Pickling also doesn't work. Do
  you have any other idea?
 
  Thanks,
 
  Gokce.
 
 In your original post you said you wanted to store local variables, but
 it seems that you need to store more information than this : could you
 specify which ones ? Since you can't copy the stack frame, maybe you
 can copy only the attributes you need
 
 Pierre

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


Re: sum fonction in gadfly

2006-06-25 Thread jean-jeanot
Thank you for your help. I have changed StringVar in IntVar and it
works! I didn't know that IntVar (as StringVa) were Tkinter Widget
variables! (It is important to read the doc!)  I made another mistake
in the value definition. I'have changed '%s' in %d  and it goes
perfectly well.
It could be useful for me to change of DB ? Which one ? Postgresql or
another ?

Jean Moser

Scott David Daniels a écrit :

 jean-jeanot wrote:
  After creating the table  I create the variables with
  varAmount = StringVar()
 Maybe you want to use DoubleVar or IntVar here?

  With a function
  def treatment ():
 requete = insert into transactions ( date,amount,,)
  values(..) % (varDate.get(),
 varAmount.get
 Or float(varAmount.get())  |
 int(round(100 * float(varAmount.get( here

  cur.execute (select sum(amount) from transactions).I get
  Sum.amout.transaction
  =
  100-10.5...
 
  instead of 110.5
 
  It means that the select command does not add but concatenates the
  different amounts. Why ?
 Sounds like you selected columns are strings, not numbers.
 Remember '123.5' + '-23' is '123.5-23', while 123.5 + -23 is 100.5
 You need the amount column of the transactions table in the gadfly
 database to be a numeric type, not a string type.
 
 --Scott David Daniels
 [EMAIL PROTECTED]

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


PEP thought experiment: Unix style exec for function/method calls

2006-06-25 Thread Michael
Hi,


[ I'm calling this PEP thought experiment because I'm discussing language
  ideas for python which if implemented would probably be quite powerful
  and useful, but the increased risk of obfuscation when the ideas are
  used outside my expected/desired problem domain probably massively
  outweigh the benefits. (if you're wondering why, it's akin to adding
  a structured goto with context)

  However I think as a thought experiment it's quite useful, since any
  language feature can be implemented in different ways, and I'm wondering
  if anyone's tried this, or if it's come up before (I can't find either
  if they have...). ]

I'm having difficulty finding any previous discussion on this --  I
keep finding people either having problems calling os.exec(lepev), or
with using python's exec statement. Neither of which I mean here.

Just for a moment, let's just take one definition for one of the
os.exec* commands:

execv(...)
execv(path, args)

Execute an executable path with arguments, replacing current
process.
path: path of executable file
args: tuple or list of strings

Also: Note that execv inherits the system environment.

Suppose we could do the same for a python function - suppose we could
call the python function but either /without/ creating a new stack
frame or /replacing/ the current stack frame with the new one.

Anyway, I've been thinking recently that the same capability in python
would be useful. However, almost any possible language feature:
   * Has probably already been discussed to death in the past
   * There's often a nice idiom working around the lack of said feature.

So I'm more on an exploratory forage than asking for a language change
here ;)

Since os.exec* exists and exec already  exists in python, I need to
differentiate what I mean by a unix style exec from python. So for
convenience I'll call it cexe.

Now, suppose I have:
--
def set_name():
name = raw_input(Enter your name!  )
cexe greet()

def greet():
print hello, name

cexe set_name()
print We don't reach here
--

This would execute, ask for the user's name, say hello to them and then
exit - not reaching the final print We don't reach here statement.

Let's ignore for the moment that this example sucks (and is a good example
of the danger of this as a language feature), what I want to do here is
use this to explain the meaning of cexe.

There's two cases to consider:
  cexe some_func_noargs()

This transfers execution to the function that would normally be called
if I simply called without using cexe some_func_noargs() . However,
unlike a function call, we're /replacing/ the current thread of
execution with the thread of execution in some_func_noargs(), rather
than stacking the current location, in order to come back to later.

ie, in the above this could also be viewed as call without creating a
new return point or call without bothering to create a new stack
frame.

It's this last point why in the above example name leaks between the
two function calls - due to it being used as a cexe call.

Case 2:
  given...
 def some_func_withargs(colour,tone, *listopts, **dictopts)

  consider...
 cexe some_func_withargs(foo,bar, *argv, **argd)

 This would be much the same as the previous case, except in the new
 execution point, the name colour  tone map to the values foo  bar had
 in the original context, whilst listopts and dictopts map the values
 that argv  argd had in the original content)

One consequence here though is that in actual practice the final print
statement of the code above never actually gets executed. (Much like if
that was inside a function, writing something after return foo, wouldn't
be executed)

The reason I'm curious here about previous discussion is because
conceptually there's obviously other semantics you can apply - such as
the current stack frame is /replaced/ by the new stack frame. This is
perhaps a more accurate mapping to the Unix exec call. 

If that was the case, it would mean that locals would not leak between
functions (which is desirable), and our example above could be rewritten
as follows:

--
def get_and_use_value_from_user(tag, callforward):
somevalue = raw_input(tag)
cexe callforward(name)

def greet(name):
print hello, name

cexe get_and_use_value_from_user(Enter your name!  , greet)
print We don't reach here
--

OK, so this probably seems pretty pointless to many people, but I'm
curious about improving the tools to deal with state machines. Often
people use switch statements in other languages to deal with them, and
for certain classes of state machines you can use replace them with
generators. But that's not appropriate for everything...

My particular thought that started all this off actually stems from this:

Essentially by doing a cexe 

Re: Python in HTML

2006-06-25 Thread Mirco Wahab
Thus spoke [EMAIL PROTECTED] (on 2006-06-23 17:40):

 Does anyone know of a way to embed python scripts into html, much like
 you would javascript or php? I do not want to use this to connect to a
 database, but rather for a functional script to be called when a user
 clicks on a link to open a page.

Aside from the javascript or php joke, which
does not belong in such a relation (as others have
already pointed out), there are several methods to
use PHP-like Python inclusions, something like:

...
table
 %python
 for row range(10):
print tr
print tdNR/td + td + str(row) + /td
print /tr
 /%python
/table
...


One prominent Example for that would be Myghty
 http://www.myghty.org/docs/whatsitdo.myt

some Examples shown here:
 http://www.myghty.org/docs/embedding.myt

Regards

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
George Neuner schrieb:
 The point is really that the checks that prevent these things must be
 performed at runtime and can't be prevented by any practical type
 analysis performed at compile time.  I'm not a type theorist but my
 opinion is that a static type system that could, a priori, prevent the
 problem is impossible.

No type theory is needed.
Assume that the wide index type goes into a function and the result is 
assigned to a variable fo the narrow type, and it's instantly clear that 
the problem is undecidable.
Undecidability can always be avoided by adding annotations, but of 
course that would be gross overkill in the case of index type widening.

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


Re: Python taught in schools?

2006-06-25 Thread BartlebyScrivener
dan but out of curiousity does
dan anyone know of a school that teaches Python?

http://www.python.org/about/quotes/

University of Maryland

I have the students learn Python in our undergraduate and graduate
Semantic Web courses. Why? Because basically there's nothing else with
the flexibility and as many web libraries, said Prof. James A.
Hendler.

rd

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Dimitri Maziuk schrieb:
 That is the basic argument in favour of compile time error checking,
 extended to runtime errors. I don't really care if it's the compiler
 or runtime that tells the luser your code is broken, as long as it
 makes it clear it's *his* code that's broken, not mine.

You can make runtime errors point to the appropriate code. Just apply 
programming by contract: explicitly state what preconditions a 
function is requiring of the caller, have it check the preconditions on 
entry (and, ideally, throw the execption in a way that the error is 
reported in the caller's code - not a complicated thing but would 
require changes in the exception machinery of most languages).

Any errors past that point are either a too liberal precondition (i.e. a 
bug in the precondition - but documenting wrong preconditions is still a 
massive bug, even if it's just a documentation bug), or a bug in the 
function's code.

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


What is that, swearing (was: Python in HTML)

2006-06-25 Thread Mirco Wahab
Thus spoke Andy Dingley [EMAIL PROTECTED] (on 2006-06-23 18:10):
 [EMAIL PROTECTED] wrote:
 
 Python, like it's (evil?) cousin Perl,
 
 Isn't that evil cousin Ruby?  Perl's the mad old grandmother in the
 attic, spewing out incomprehensible [EMAIL PROTECTED]% swearing all day.


There's actually a (real) Anecdote about that:

Larry Wall, BDFL of Perl, working on some Perl4
code, was accompanied by his daughter:

Larry recalls this event later:

  I'm reminded of the day my daughter came in,
   looked over my shoulder at some Perl 4 code,
   and said, 'What is that, swearing?


Regards

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


pypy-0.9.0: stackless, new extension compiler

2006-06-25 Thread Michael Hudson
The PyPy development team has been busy working and we've now packaged 
our latest improvements, completed work and new experiments as 
version 0.9.0, our fourth public release.

The highlights of this fourth release of PyPy are:

**implementation of stackless features**
We now support the larger part of the interface of the original
Stackless Python -- see http://www.stackless.com for more.  A
significant part of this is the pickling and unpickling of a running
tasklet.

These features, especially the pickling, can be considered to be a
technology preview -- they work, but for example the error handling
is a little patchy in places.

**ext-compiler**
The extension compiler is a new way of writing a C extension for
CPython and PyPy at the same time. For more information, see its
documentation: http://codespeak.net/pypy/dist/pypy/doc/extcompiler.html

**rctypes**
Most useful in combination with the ext-compiler is the fact that our
translation framework can translate code that uses the
standard-in-Python-2.5 ctypes module.  See its documentation for more:
http://codespeak.net/pypy/dist/pypy/doc/rctypes.html

**framework GCs** 
PyPy's interpreter can now be compiled to use a garbage collector
written in RPython.  This added control over PyPy's execution makes the
implementation of new and interesting features possible, apart from
being a significant achievement in its own right.

**__del__/weakref/__subclasses__**
The PyPy interpreter's compatibility with CPython continues improves:
now we support __del__ methods, the __subclasses__ method on types and
weak references.  We now pass around 95% of CPython's core tests.

**logic space preview**
This release contains the first version of the logic object space,
which will add logical variables to Python.  See its docs for more:
http://codespeak.net/pypy/dist/pypy/doc/howto-logicobjspace-0.9.html

**high level backends preview**
This release contains the first versions of new backends targeting high
level languages such as Squeak and .NET/CLI and updated versions of the
JavaScript and Common Lisp backends.  They can't compile the PyPy
interpreter yet, but they're getting there...

**bugfixes, better performance**
As you would expect, performance continues to improve and bugs continue
to be fixed.  The performance of the translated PyPy interpreter is
2.5-3x times faster than 0.8 (on richards and pystone), and is now
stable enough to be able to run CPython's test suite to the end.

**testing refinements**
py.test, our testing tool, now has preliminary support for doctests.
We now run all our tests every night, and you can see the summary at:
http://snake.cs.uni-duesseldorf.de/pypytest/summary.html

What is PyPy (about)? 


PyPy is a MIT-licensed research-oriented reimplementation of Python
written in Python itself, flexible and easy to experiment with.  It
translates itself to lower level languages.  Our goals are to target a
large variety of platforms, small and large, by providing a
compilation toolsuite that can produce custom Python versions.
Platform, memory and threading models are to become aspects of the
translation process - as opposed to encoding low level details into
the language implementation itself.  Eventually, dynamic optimization
techniques - implemented as another translation aspect - should become
robust against language changes.

Note that PyPy is mainly a research and development project and does
not by itself focus on getting a production-ready Python
implementation although we do hope and expect it to become a viable
contender in that area sometime next year.

PyPy is partially funded as a research project under the European
Union's IST programme.

Where to start? 
-

Getting started:http://codespeak.net/pypy/dist/pypy/doc/getting-started.html

PyPy Documentation: http://codespeak.net/pypy/dist/pypy/doc/ 

PyPy Homepage:  http://codespeak.net/pypy/

The interpreter and object model implementations shipped with the 0.9
version can run on their own and implement the core language features
of Python as of CPython 2.4.  However, we still do not recommend using
PyPy for anything else than for education, playing or research
purposes.

Ongoing work and near term goals
-

The Just-in-Time compiler and other performance improvements will be one of
the main topics of the next few months' work, along with finishing the
logic object space.

Project Details
---

PyPy has been developed during approximately 20 coding sprints across
Europe and the US.  It continues to be a very dynamically and
incrementally evolving project with many of these one-week workshops
to follow.

PyPy has been a community effort from the start and it would
not have got that far without the coding and feedback 

Re: Python taught in schools?

2006-06-25 Thread Cameron Laird
In article [EMAIL PROTECTED],
MilkmanDan [EMAIL PROTECTED] wrote:
I'll be a college freshman this fall, attending Florida Institute of
Tech studying electrical engineering.

I was considering taking some classes in programming and computer
science, and I happened to notice that everything taught is using C++.
After further research, it seems to me that C++ seems to be the
dominating language in universities.

By comparison, our local community college teaches a few classes in VB,
Java, Javascript, C++, and for some reason, PASCAL.

I'm certianly not against any of this, but out of curiousity does
anyone know of a school that teaches Python?


There are many.  Wartburg College URL:
http://mcsp.wartburg.edu/zelle/python/  is an example.  URL:
http://www.python.org/community/sigs/current/edu-sig/  likely
will interest you.

I'll gratuitously add that, even though I'm personally fond of
C++, I think teaching it as is done in colleges and high schools
(!) amounts to child abuse.  It's wildly inappropriate.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
[EMAIL PROTECTED] schrieb:
 Joachim Durchholz wrote:
   A type is the encoding of these properties. A type
 varying over time is an inherent contradiction (or another abuse of the
 term type).
 No. It's just a matter of definition, essentially.
 E.g. in Smalltalk and Lisp, it does make sense to talk of the type of
 a name or a value, even if that type may change over time.
 
 OK, now we are simply back full circle to Chris Smith's original
 complaint that started this whole subthread, namely (roughly) that
 long-established terms like type or typing should *not* be
 stretched in ways like this, because that is technically inaccurate and
 prone to misinterpretation.

Sorry, I have to insist that it's not me who's stretching terms here.

All textbook definitions that I have seen define a type as the 
set/operations/axioms triple I mentioned above.
No mention of immutability, at least not in the definitions.

Plus, I don't see any necessity on insisting on immutability for the 
definition of type. Otherwise, you'd have to declare that Smalltalk 
objects truly don't have a type (not even an implied one), and that 
would simply make no sense: they do in fact have a type, even though it 
may occasionally change.

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


Re: Python taught in schools?

2006-06-25 Thread Mirco Wahab
Thus spoke Cameron Laird (on 2006-06-25 13:08):

 I'll gratuitously add that, even though I'm personally fond of
 C++, I think teaching it as is done in colleges and high schools
 (!) amounts to child abuse.  It's wildly inappropriate.

C++ programming requires you to
massively invest your thinking
first into the setup of your
build environment (can only be
beaten by Java here).

This is where the real abuse
starts. Plain C++-baby-style
(with some structs and cin/cout)
is just fun, despite the required
'variable prototyping' (which is
not that bad for a beginner).

Regards

Mirco

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Chris F Clark schrieb:
 Chris F Clark schrieb:
 In that sense, a static type system is eliminating tags, because the
 information is pre-computed and not explicitly stored as a part of the
 computation.  Now, you may not view the tag as being there, but in my
 mind if there exists a way of perfoming the computation that requires
 tags, the tag was there and that tag has been eliminated.
 
 Joachim Durchholz replied:
 On a semantic level, the tag is always there - it's the type (and
 definitely part of an axiomatic definition of the language).
 Tag elimination is just an optimization.
 
 I agree the tag is always there in the abstract.  

Well - in the context of a discussion of dynamic and static typing, I'd 
think that the semantic (abstract) level is usually the best level of 
discourse.
Of course, this being the Usenet, shifting the level is common (and can 
even helpful).

 In the end, I'm trying to fit things which are too big and too
 slow into much less space and time, using types to help me reliably
 make my program smaller and faster is just one trick.  [...]
 
 However, I also know that my way of thinking about it is fringe.

Oh, I really agree that's an important application of static typing.

Essentially, which aspects of static typing is more important depends on 
where your problems lie: if it's ressource constraints, static typing 
tends to be seen as a tool to keep ressource usage down; if it's bug 
counts, static typing tends to be seen as a tool to express static 
properties.
These aspects are obviously not equally important to everybody.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Darren New schrieb:
 John W. Kennedy wrote:
 360-family assembler, yes. 8086-family assembler, not so much.
 
 And Burroughs B-series, not at all. There was one ADD instruction, and 
 it looked at the data in the addresses to determine whether to add ints 
 or floats. :-)

I heard that the Telefunken TR series had a tagged architecture.
This seems roughly equivalent to what the B-series did (does?).

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


Life + Python = Golly

2006-06-25 Thread Andrew Trevorrow
Golly is an open source, cross-platform Life app which features an
unbounded universe and uses Gosper's hashlife algorithm to allow the
exploration of patterns at unprecedented scales and speeds.

We've just released version 1.0 and Python fans might be interested
to hear that we're now using Python as our app's scripting language.
More details, including screenshots and download links, are available
at Golly's web site:

   http://golly.sourceforge.net/

The Python scripting interface is described here:

   http://golly.sourceforge.net/Help/scripting.html

Any comments or suggestions are most welcome.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Anton van Straaten schrieb:
 Marshall wrote:
 Can you be more explicit about what latent types means?
 
 Sorry, that was a huge omission.  (What I get for posting at 3:30am.)
 
 The short answer is that I'm most directly referring to the types in 
 the programmer's head.

Ah, finally that terminology starts to make sense to me. I have been 
wondering whether there's any useful difference between latent and 
run-time typing. (I tend to avoid the term dynamic typing because 
it's overloaded with too many vague ideas.)

 there are usually many possible static 
 type schemes that can be assigned to a given program.

This seems to apply to latent types as well.

Actually the set of latent types seems to be the set of possible static 
type schemes.
Um, well, a superset of these - static type schemes tend to be slightly 
less expressive than what the programmer in his head. (Most type schemes 
cannot really express things like the range of this index variable is 
such-and-so, and the boundary to general assertions about the code is 
quite blurry anyway.)

 There's a close connection between latent types in the sense I've 
 described, and the tagged values present at runtime.  However, as type 
 theorists will tell you, the tags used to tag values at runtime, as e.g. 
 a number or a string or a FooBar object, are not the same thing as the 
 sort of types which statically-typed languages have.

Would that be a profound difference, or is it just that annotating a 
value with a full type expression would cause just too much runtime 
overhead?

In your terminology:

 So, where do tagged values fit into this?  Tags help to check types at 
 runtime, but that doesn't mean that there's a 1:1 correspondence between 
 tags and types.

Would it be possible to establish such a correspondence, would it be 
common consensus that such a system should be called tags anymore, or 
are there other, even more profound differences?

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


Re: USB and Python

2006-06-25 Thread Philippe Martin
Many thanks,


Philippe



Philippe Martin wrote:

 Hi,
 
 I need to talk to a USB device (PC or other) from Python - I am not
 talking about mounting a file system but sharing information as you would
 though a TCP-IP socket layer or an RS232 interface.
 
 Is there such low-level module available for Windows / Linux ?
 
 Thanks,
 
 Philippe

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Marshall schrieb:
 It seems we have languages:
 with or without static analysis
 with or without runtime type information (RTTI or tags)
 with or without (runtime) safety
 with or without explicit type annotations
 with or without type inference
 
 Wow. And I don't think that's a complete list, either.
 
 I would be happy to abandon strong/weak as terminology
 because I can't pin those terms down. (It's not clear what
 they would add anyway.)

Indeed.

 Programmers infer and reason about these latent types while they're
 writing or reading programs.  Latent types become manifest when a
 programmer reasons about them, or documents them e.g. in comments.
 
 Uh, oh, a new term, manifest. Should I worry about that?

I think that was OED usage of the term.

 Well, darn. It strikes me that that's just a decision the language
 designers
 made, *not* to record complete RTTI. (Is it going to be claimed that
 there is an *advantage* to having only incomplete RTTI? It is a
 serious question.)

In most cases, it's probably we don't have to invent or look up 
efficient algorithms that we can't think of right now.
One could consider this a sorry excuse or a wise decision to stick with 
available resources, both views have their merits IMHO ;-)

 But function is not a useful type.  Why not?  Because if all you know
 is that timestwo is a function, then you have no idea what an expression
 like timestwo(foo) means.  You couldn't write working programs, or
 read them, if all you knew about functions was that they were functions.
   As a type, function is incomplete.
 
 Yes, function is a parameterized type, and they've left out the
 parameter values.

Well, in JavaScript, the explicit type system as laid down in the 
run-time type information is unparameterized.
You can criticize this as unsound, or inadequate, or whatever you wish, 
and I'd like agree with that ;-), but the type of timestwo is indeed 
just function.

*Your mental model* is far more detailed, of course.

 Question: if a language *does* record complete RTTI, and the
 languages does *not* have subtyping, could we then say that
 the runtime type information *is* the same as the static type?

Only if the two actually use the same type system.

In practice, I'd say that this is what most designers intend but what 
implementors may not have gotten right ;-p

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


error with string (beginner)

2006-06-25 Thread Alex Pavluck
Hello. I get the following error with the following code.  Is there
something wrong with my Python installation?

code:
import types
something = input(Enter something and I will tell you the type: )

if type(something) is types.IntType:
print you entered an integer
elif type(something) is types.StringType:
print you entered a string

error:
String: Source for exec/eval is unavailable

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Anton van Straaten schrieb:
 It seems we have languages:
 with or without static analysis
 with or without runtime type information (RTTI or tags)
 with or without (runtime) safety
 with or without explicit type annotations
 with or without type inference

 Wow. And I don't think that's a complete list, either.
 
 Yup.

What else?
(Genuinely curious.)

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


Re: HTTP server

2006-06-25 Thread placid

Simon Forman wrote:


 Ok, seriously,  I don't know how pydoc does it, but when I need a
 quick-and-dirty http server [written in python] I use something like
 this:

 from BaseHTTPServer import HTTPServer
 from SimpleHTTPServer import SimpleHTTPRequestHandler

 HTTPServer(('', 8000), SimpleHTTPRequestHandler).serve_forever()

 For what you're asking about you'd probably want to use the
 CGIHTTPRequestHandler from the CGIHTTPServer module instead.  Check out
 http://docs.python.org/lib/module-CGIHTTPServer.html

This is what i was after, thanks for the tip.


 Then you'd just write one or more cgi scripts (they can be in python
 IIRC) to run the commands you want.

Im having trouble running the following cgi script on windows

code

#!c:/Python/python.exe -u

text = Content-type: text/html

TITLE CGI 101 /TITLE
H1A Second CGI script/H1
HR
PHello, CGI World!/P

print text

/code


using this http server from
http://effbot.org/librarybook/cgihttpserver.htm

code

import CGIHTTPServer
import BaseHTTPServer

class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
cgi_directories = [/cgi]

PORT = 8000

httpd = BaseHTTPServer.HTTPServer((, PORT), Handler)
print serving at port, PORT
httpd.serve_forever()

/code

i get the error number 403, when i try to access the cgi script which
is located in a subdirectory called cgi where this file is (http
server). I have a feeling that i need to change the Handler class or
something, implement , but i couldnt find any examples other then this
from eff-bot.

It could also be this line of code, that a google search turned up, its
the way of running cgi scripts on windows

#!c:/Python/python.exe -u


Cheers

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Andreas Rossberg schrieb:
 
 Luca Cardelli has given the most convincing one in his seminal tutorial 
 Type Systems, where he identifies typed and safe as two orthogonal 
 dimensions and gives the following matrix:
 
   | typed | untyped
---+---+--
safe   | ML| Lisp
unsafe | C | Assembler
 
 Now, jargon dynamically typed is simply untyped safe, while weakly 
 typed is typed unsafe.

Here's a matrix how most people that I know would fill in with terminology:

 | Statically   | Not |
 | typed| statically  |
 |  | typed   |
-+--+-+
typesafe | strongly| Dynamically |
 | typed   | typed   |
 | (ML, Pascal) | (Lisp)  |
-+--+-+
not  | (no common   | untyped   |
typesafe | terminology) | |
 | (C)  | (Assembly)  |
-+--+-+

(Terms in quotes are challenged on a regular basis, or rarely if ever 
applied.)

With the above terminology, it becomes clear that the opposite if 
(statically) typed isn't statically untyped, but not statically 
typed. Statically typed and dynamically typed aren't even 
opposites, they just don't overlap.

Another observation: type safeness is more of a spectrum than a clearcut 
distinction. Even ML and Pascal have ways to circumvent the type system, 
and even C is typesafe unless you use unsafe constructs.
IOW from a type-theoretic point of view, there is no real difference 
between their typesafe and not typesafe languages in the statically 
typed column; the difference is in the amount of unsafe construct usage 
in practial programs.

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


Eclipse IDE question

2006-06-25 Thread kilnhead
I am trying to use eclipse for python development. Is it possible to
run a python script without having to name/setup a configuration? Can
eclipse be set up so that run loads the code into the interpreter and
goes? I don't want to create a new run config every time I want to run
a script.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Vesa Karvonen
In comp.lang.functional Joachim Durchholz [EMAIL PROTECTED] wrote:
 [...] Even ML and Pascal have ways to circumvent the type system, [...]

Show me a Standard ML program that circumvents the type system.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread rossberg
Joachim Durchholz write:

 Another observation: type safeness is more of a spectrum than a clearcut
 distinction. Even ML and Pascal have ways to circumvent the type system,

No. I'm not sure about Pascal, but (Standard) ML surely has none. Same
with Haskell as defined by its spec. OCaml has a couple of clearly
marked unsafe library functions, but no unsafe feature in the language
semantics itself.

 and even C is typesafe unless you use unsafe constructs.

Tautology. Every language is safe unless you use unsafe constructs.
(Unfortunately, you can hardly write interesting programs in any safe
subset of C.)

 IOW from a type-theoretic point of view, there is no real difference
 between their typesafe and not typesafe languages in the statically
 typed column; the difference is in the amount of unsafe construct usage
 in practial programs.

Huh? There is a huge, fundamental difference: namely whether a type
system is sound or not. A soundness proof is obligatory for any serious
type theory, and failure to establish it simply is a bug in the theory.

- Andreas

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Pascal Costanza
Joachim Durchholz wrote:
 Andreas Rossberg schrieb:

 Luca Cardelli has given the most convincing one in his seminal 
 tutorial Type Systems, where he identifies typed and safe as two 
 orthogonal dimensions and gives the following matrix:

   | typed | untyped
---+---+--
safe   | ML| Lisp
unsafe | C | Assembler

 Now, jargon dynamically typed is simply untyped safe, while weakly 
 typed is typed unsafe.
 
 Here's a matrix how most people that I know would fill in with terminology:
 
 | Statically   | Not |
 | typed| statically  |
 |  | typed   |
-+--+-+
typesafe | strongly| Dynamically |
 | typed   | typed   |
 | (ML, Pascal) | (Lisp)  |
-+--+-+
not  | (no common   | untyped   |
typesafe | terminology) | |
 | (C)  | (Assembly)  |
-+--+-+
 
 (Terms in quotes are challenged on a regular basis, or rarely if ever 
 applied.)
 
 With the above terminology, it becomes clear that the opposite if 
 (statically) typed isn't statically untyped, but not statically 
 typed. Statically typed and dynamically typed aren't even 
 opposites, they just don't overlap.
 
 Another observation: type safeness is more of a spectrum than a clearcut 
 distinction. Even ML and Pascal have ways to circumvent the type system, 
 and even C is typesafe unless you use unsafe constructs.
 IOW from a type-theoretic point of view, there is no real difference 
 between their typesafe and not typesafe languages in the statically 
 typed column; the difference is in the amount of unsafe construct usage 
 in practial programs.

It's also relevant how straightforward it is to distinguish between safe 
and unsafe code, how explicit you have to be when you use unsafe code, 
how likely it is that you accidentally use unsafe code without being 
aware of it, what the generally accepted conventions in a language 
community are, etc. pp.


Pascal

-- 
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error with string (beginner)

2006-06-25 Thread K.S.Sreeram
Alex Pavluck wrote:
 String: Source for exec/eval is unavailable

I'm not able to find this message anywhere in the Python-2.4.3 sources.
What python version are you using? What input did you enter when the
prompt appeared? and copypaste the *exact* exception you got including
the full traceback.

Regards
Sreeram



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

Re: pypy-0.9.0: stackless, new extension compiler

2006-06-25 Thread Paul Rubin
I've been away from Usenet for a while but this is the most interesting
stuff I've seen here in ages.  Way cool.

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


Re: error with string (beginner)

2006-06-25 Thread Jon Clements

Alex Pavluck wrote:
 Hello. I get the following error with the following code.  Is there
 something wrong with my Python installation?

 code:
 import types
 something = input(Enter something and I will tell you the type: )

 if type(something) is types.IntType:
 print you entered an integer
 elif type(something) is types.StringType:
 print you entered a string

 error:
 String: Source for exec/eval is unavailable

From the docs:

input( [prompt])

Equivalent to eval(raw_input(prompt)). Warning: This function is not
safe from user errors! It expects a valid Python expression as input;
if the input is not syntactically valid, a SyntaxError will be raised.
Other exceptions may be raised if there is an error during evaluation.
(On the other hand, sometimes this is exactly what you need when
writing a quick script for expert use.)
If the readline module was loaded, then input() will use it to provide
elaborate line editing and history features.

Consider using the raw_input() function for general input from users.


So you want be using raw_input() for starters...

Cheers,

Jon.

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


How to parse timestamps containing milliseconds

2006-06-25 Thread Christopher Helck
Hi,I'm trying to read a file containing timestamps with milliseconds (2006/3/18 8:20:34.050). The DateTime object seems to take milliseconds (microseconds really) but the strftime method doesn't have a format code for the millisecond field (in other languages I've used %s.). When I try to parse I get an error about the trailing .050.
How should I approach this?Thanks,C. Helck
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: error with string (beginner)

2006-06-25 Thread Jason
I believe what you are trying to do is something like the following.

[code]
def isIntLike(x):
try:int(x)
except: return False
else:   return True

something = raw_input(Enter something and I will tell you the type: )

if isIntLike(something):print I am an int
elif isinstance(something, type('')):   print I am a string
else:   print I am an impostor!
[/code]

Note that you should be using raw_input() rather than input().  The
former always returns a string.  The latter tries to execute the input,
hence your error message.

Also note that everything input on the command line is a string,
regardless of what you type.  If you want type checking, use C++ or
java.  If you want to check for anything more than IntLike strings, you
should consider using regular expressions through the 're' package.
For user-defined types, use 'isinstance(something, class object)' to
check for a type.

Lastly, you may be interested in the 'getopt' module, which handles
command line arguments (as opposed to prompting user for input)
automatically.   See here:
http://python.active-venture.com/lib/module-getopt.html

Check out the Python Cookbook for lots of good examples:
http://aspn.activestate.com/ASPN/Cookbook/Python

HTH,

Jay



Alex Pavluck wrote:
 Hello. I get the following error with the following code.  Is there
 something wrong with my Python installation?

 code:
 import types
 something = input(Enter something and I will tell you the type: )

 if type(something) is types.IntType:
 print you entered an integer
 elif type(something) is types.StringType:
 print you entered a string
 
 error:
 String: Source for exec/eval is unavailable

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


Re: Python taught in schools?

2006-06-25 Thread faulkner
Franklin W. Olin College of Engineering
I TAed a python class last semester, and am using it to build a webapp
for the Arts and Humanities dept.
http://www.olin.edu

MilkmanDan wrote:
 I'll be a college freshman this fall, attending Florida Institute of
 Tech studying electrical engineering.

 I was considering taking some classes in programming and computer
 science, and I happened to notice that everything taught is using C++.
 After further research, it seems to me that C++ seems to be the
 dominating language in universities.

 By comparison, our local community college teaches a few classes in VB,
 Java, Javascript, C++, and for some reason, PASCAL.

 I'm certianly not against any of this, but out of curiousity does
 anyone know of a school that teaches Python?

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread David Hopwood
Joachim Durchholz wrote:
 Andreas Rossberg schrieb:
 
 Luca Cardelli has given the most convincing one in his seminal
 tutorial Type Systems, where he identifies typed and safe as two
 orthogonal dimensions and gives the following matrix:

   | typed | untyped
---+---+--
safe   | ML| Lisp
unsafe | C | Assembler

 Now, jargon dynamically typed is simply untyped safe, while weakly
 typed is typed unsafe.
 
 Here's a matrix how most people that I know would fill in with terminology:
 
 | Statically   | Not |
 | typed| statically  |
 |  | typed   |
-+--+-+
typesafe | strongly| Dynamically |
 | typed   | typed   |
 | (ML, Pascal) | (Lisp)  |

Pascal, in most of its implementations, isn't [memory] safe; it's in the same
box as C.

-+--+-+
not  | (no common   | untyped   |
typesafe | terminology) | |
 | (C)  | (Assembly)  |
-+--+-+

I have to say that I prefer the labels used by Cardelli.

 (Terms in quotes are challenged on a regular basis, or rarely if ever
 applied.)
 
 With the above terminology, it becomes clear that the opposite if
 (statically) typed isn't statically untyped, but not statically
 typed. Statically typed and dynamically typed aren't even
 opposites, they just don't overlap.
 
 Another observation: type safeness is more of a spectrum than a clearcut
 distinction. Even ML and Pascal have ways to circumvent the type system,

Standard ML doesn't (with just the standard basis; no external libraries,
and assuming that file I/O cannot be used to corrupt the language
implementation).

 and even C is typesafe unless you use unsafe constructs.
 IOW from a type-theoretic point of view, there is no real difference
 between their typesafe and not typesafe languages in the statically
 typed column; the difference is in the amount of unsafe construct usage
 in practial programs.

It is quite possible to design languages that have absolutely no unsafe
constructs, and are still useful.

-- 
David Hopwood [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MSoffice metadata

2006-06-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb:
 hi
 is there a module in Python to extract metadata in MS office documents

You can automate MS Office using the python win32 com extensions of Mark 
Hammond. They come bundled with the active-state python build, or can be 
obtained separately.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread David Hopwood
Chris F Clark wrote:
 Chris Smith [EMAIL PROTECTED] writes: 
  
Unfortunately, I have to again reject this idea.  There is no such
restriction on type theory.  Rather, the word type is defined by type
theorists to mean the things that they talk about. 
 
 Do you reject that there could be something more general than what a 
 type theorist discusses?  Or do you reject calling such things a type?
  
 Let you write: 
 
because we could say that anything that checks types is a type system,
and then worry about verifying that it's a sound type system without
worrying about whether it's a subset of the perfect type system. 
 
 I'm particularly interested if something unsound (and perhaps 
 ambiguous) could be called a type system.

Yes, but not a useful one. The situation is the same as with unsound
formal systems; they still satisfy the definition of a formal system.

-- 
David Hopwood [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread David Hopwood
David Hopwood wrote:
 Chris F Clark wrote:
 
I'm particularly interested if something unsound (and perhaps 
ambiguous) could be called a type system.
 
 Yes, but not a useful one. The situation is the same as with unsound
 formal systems; they still satisfy the definition of a formal system.

I meant inconsistent formal systems.

-- 
David Hopwood [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Gabriel Dos Reis
[EMAIL PROTECTED] writes:

[...]

|  and even C is typesafe unless you use unsafe constructs.
| 
| Tautology. Every language is safe unless you use unsafe constructs.
| (Unfortunately, you can hardly write interesting programs in any safe
| subset of C.)

Fortunately, some people do, as living job.  

I must confess I'm sympathetic to Bob Harper's view expressed in

  http://www.seas.upenn.edu/~sweirich/types/archive/1999-2003/msg00298.html

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


Re: Saying latently-typed language is making a category mistake

2006-06-25 Thread David Hopwood
Matthias Blume wrote:
 David Hopwood [EMAIL PROTECTED] writes:
Patricia Shanahan wrote:
Vesa Karvonen wrote:
...

An example of a form of informal reasoning that (practically) every
programmer does daily is termination analysis.  [...]
Given a program, it may be possible to formally
prove that it terminates.

To make the halting problem decidable one would have to do one of two
things: Depend on memory size limits, or have a language that really is
less expressive, at a very deep level, than any of the languages
mentioned in the newsgroups header for this message.

I don't think Vesa was talking about trying to solve the halting problem.

A type system that required termination would indeed significantly restrict
language expressiveness -- mainly because many interactive processes are
*intended* not to terminate.
 
 Most interactive processes are written in such a way that they
 (effectively) consist of an infinitely repeated application of some
 function f that maps the current state and the input to the new state
 and the output.
 
f : state * input - state * output
 
 This function f itself has to terminate, i.e., if t has to be
 guaranteed that after any given input, there will eventually be an
 output.  In most interactive systems the requirements are in fact much
 stricter: the output should come soon after the input has been
 received.
 
 I am pretty confident that the f for most (if not all) existing
 interactive systems could be coded in a language that enforces
 termination.  Only the loop that repeatedly applies f would have to be
 coded in a less restrictive language.

This is absolutely consistent with what I said. While f could be coded in
a system that *required* termination, the outer loop could not.

As I mentioned in a follow-up, event loop languages such as E enforce this
program structure, which would almost or entirely eliminate the need for
annotations in a type system that proves termination of some subprograms.

-- 
David Hopwood [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


array manipulation without for loops

2006-06-25 Thread Sheldon
Hi,

I have two arrays that are of the same dimension but having 3 different
values: 255, 1 or 2.
I would like to set all the positions in both arrays having 255 to be
equal, i.e., where one array has 255, I set the same elements in the
other array to 255 and visa versa. Does anyone know how to do this
without using for loops?

Sincerely,
Sheldon

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


languages with full unicode support

2006-06-25 Thread Xah Lee
Languages with Full Unicode Support

As far as i know, Java and JavaScript are languages with full, complete
unicode support. That is, they allow names to be defined using unicode.
(the JavaScript engine used by FireFox support this)

As far as i know, here's few other lang's status:

C → No.
Python → No.
Perl → No.
Haskell → Yes by the spec, but no on existing compilers.
JavaScript → No in general. Firefox's engine do support it.
Lisps → No.
unix shells (bash)  → No. (this probably applies to all unix shells)
Java → Yes and probably beats all. However, there may be a bug in 1.5
compiler.

Also, there appears to be a bug with Java 1.5's unicode support. The
following code compiles fine in 1.4, but under 1.5 the compiler
complains about the name x1.str★.

class 方 {
String str北 =
北方有佳人,絕世而獨立。\n一顧傾人城,再顧傾人国。\n寧不知倾城与倾国。\n佳人難再得。;
String str★=θπαβγλϕρκψ ≤≥≠≈⊂⊃⊆⊇∈
ⅇⅈⅉ∞∆° ℵℜℂℝℚℙℤ ℓ∟∠∡ ∀∃ ∫∑∏
⊕⊗⊙⊚⊛∘∙ ★☆;

}

class UnicodeTest {
public static void main(String[] arg) {
方 x1 = new 方();
System.out.println( x1.str北 );
System.out.println( x1.str★ );
}
}

If you know a lang that does full unicode support, please let me know.
Thanks.

   Xah
   [EMAIL PROTECTED]
 ∑ http://xahlee.org/
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: array manipulation without for loops

2006-06-25 Thread Gary Herron
Sheldon wrote:
 Hi,

 I have two arrays that are of the same dimension but having 3 different
 values: 255, 1 or 2.
 I would like to set all the positions in both arrays having 255 to be
 equal, i.e., where one array has 255, I set the same elements in the
 other array to 255 and visa versa. Does anyone know how to do this
 without using for loops?

 Sincerely,
 Sheldon

   
Whatever for?  Have you got something against for loops?

However...

You could roll you own loop:
i=0
while i  whatever:
# ... do something with i
i += 1

But what's the point?  This does the same as a for loop but slower.

If you don't want any kind of a loop (again, What's the point?) you
could write something recursive:

def proc(i, ...):
# ... do something with i
if i  whatever:
proc(i+1, ...)

But this would be even slower.

Gary Herron

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread rossberg
Gabriel Dos Reis wrote:
 |
 | (Unfortunately, you can hardly write interesting programs in any safe
 | subset of C.)

 Fortunately, some people do, as living job.

I don't think so. Maybe the question is what a safe subset consists
of. In my book, it excludes all features that are potentially unsafe.
So in particular, C-style pointers are out, because they can easily
dangle, be uninitialisied, whatever. Can you write a realistic C
program without using pointers?

- Andreas

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Chris F Clark
Chris F Clark (I) wrote:

 I'm particularly interested if something unsound (and perhaps
 ambiguous) could be called a type system.  I definitely consider such
 things type systems.

Marshall [EMAIL PROTECTED] wrote:

 I don't understand. You are saying you prefer to investigate the
 unsound over the sound?
...
 Again, I cannot understand this. In a technical realm, vagueness
 is the opposite of understanding.

At the risk of injecting too much irrelevant philosophy into the
discussion, I will with great trepdiation reply.

First in the abstrtact: No, understanding is approximating.  The world
is inherently vague.  We make false symbolic models of the world which
are consistent, but at some level they do not reflect reality, because
reality isn't consistent.  Only by abtracting away the inherent
infinite amout of subtlety present in the real universe can we come to
comprehensible models.  Those models can be consistent, but they are
not the universe.  The models in their consistency, prove things which
are not true about the real universe.

Now in the concrete: In my work productivity is ultimately important.
Therefore, we live by the 80-20 rule in numerous variations.  One of
ths things we do to achieve productivity is simplify things.  In fact,
we are more interested in an unsound simplification that is right 80%
of the time, but takes only 20% of the effort to compute, than a
completely sound (100% right) model which takes 100% of the time to
compute (which is 5 times as long).  We are playing the probabilities.

It's not that we don't respect the sound underpining, the model which
is consistent and establishes certain truths.  However, what we want
is the rule of thumb which is far simpler and approximates the sound
model with reasonable accuracy.  In particular, we accept two types of
unsoundness in the model.  One, we accept a model which gives wrong
answers which are detectable.  We code tests to catch those cases, and
use a different model to get the right answer.  Two, we accept a model
which gets the right answer only when over-provisioned.  for example,
if we know a loop will occassionaly not converge in the n-steps that
it theoretically should, we will run the loop for n+m steps until the
approximation also converges--even if that requires allocating m extra
copies of some small element than are theoretically necessary.  A
small waste of a small resource, is ok if it saves a waste of a more
critical resource--the most critical resource of all being our project
timeliness.

We do the same things in our abstract reasoning (including our type
model).  The problems we are solving are too large for us to
understand.  Therefore, we make simplifications, simplifications we
know are inaccurate and potentially unsound.  Our algorithm then
solves the simplified model, which we think covers the main portion of
the problem.  It also attempts to detect when it has encountered a
problem that is outside of the simplified region, on the edge so to
speak.  Now, in general, we can figure out how to handle certain edge
cases, and we do it.  However, some times the edge of one part of the
algorithm intereacts with an edge of another part of the algorithm and
we get a corner case.  Because our model is too simple and the
reasoning it allows is thus unsound, the algorithm will occassionally
compute the wrong results for some of those corners.  We use the same
techniques for dealing with them.  Dynamic tagging is one way of
catching when we have gotten the wrong answer in our type
simplification.

Marshall's last point:

 I flipped a coin to see who would win the election; it came
 up Bush. Therefore I *knew* who was going to win the
 election before it happened. See the probem?

Flipping one coin to determine an election is not playing the
probabilities correctly.  You need a plausible explanation for why the
coin should predict the right answer and a track record of it being
correct.  If you had a coin that had correctly predicted the previous
42 presidencies and you had an explanation why the coin was right,
then it would be credible and I would be willing to wager that it
could also predict that the coin could tell us who the 44th president
would be.  One flip and no explanation is not sufficient.  (And to the
abstract point, to me that is all knowledge is, some convincing amount
of examples and a plausible explanation--anyone who thinks they have
more is appealing to a knowledge of the universe that I don't
accept.)

I do not want incredible unsound reasoning, just reasoning that is
marginal, within a margin of safety that I can control.  Everyone that
I have know of has as far as I can tell made simplifying assumptions
to make the world tractable.  Very rarely do we deal with the world
completely formally.  Look at where that got Russell and Whitehead.
I'm just trying to be honest about that fact and find ways to
compensate for my own failures.

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


Re: Python taught in schools?

2006-06-25 Thread Alex Martelli
MilkmanDan [EMAIL PROTECTED] wrote:

 I'll be a college freshman this fall, attending Florida Institute of
 Tech studying electrical engineering.
 
 I was considering taking some classes in programming and computer
 science, and I happened to notice that everything taught is using C++.
 After further research, it seems to me that C++ seems to be the
 dominating language in universities.

Must be a weird local phenomenon -- my impression (based on
non-scientific but widespread observations) is that _Java_ has come to
dominate the programming-language scene in universities.

One such observation struck me intensely last year, for example, as Tim
O'Reilly was showing (at Euro OSCON 2005) his rich graphical environment
for looking at book sales (by category, time, etc etc): Java book sales
display an obvious, strong cyclic seasonality with a yearly cycle, in
a perfect correlation with the times at which students would be likely
to buy books.  No other language whose book-sales data Tim displayed had
anything like that obvious an effect (C, C++, Basic, Perl, Python, Ruby,
...); funny enough, Tim himself, while obviously seeing the
seasonality (the UK-sales diagram in particular looked almost like a
sine wave!-), hadn't thought of the student purchases explanation.

For some reason, the effect, while obvious already in US data, was even
more pronounced in UK data; perhaps UK universities have less flexible
timing c for courses (I don't know much about UK universities -- I do
know, however, that in Italy for example summer courses for undergrads
are rare to non-existent, while I see there's quite an offer of those in
the US).

Many others have remarked on Java's ascendancy as a language in
universities in many different contexts.  Joel Spolski, for example, has
bemoaned that ascendancy's effect on how well he can evaluate a new grad
in a hiring interview: when undegrads typically learned C or Lisp, he
says, he had sure-fire ways to probe if a candidate has what it takes
to be a top programmer, by asking hard questions respectively on
pointers and on recursion; with everybody learning Java, he's lost
that chance, because a candidate may never have seen pointers and be
quite unfamiliar with recursion (supported in Java, of course, but
hardly the staple it is in Lisp!-), so poor performance on such
questions does not really indicate much:-).

Paul Graham, a paladin of Lisp, created quite a stir by stating that
you're likely to get better programmers if you look for ones experienced
in Python rather than ones experienced in Java; in the midst of the
resulting flamefest, he clarified that the issue is not so much about
the specific nature of the languages (although, like many Lisp'ers, he
finds Python a lesser evil than Java, technically) -- rather, he says
that a programmer who's only experienced in Java may have merely
fallen into it because that's what universities teach and he or she
had no motivation to look elsewhere and thus probably no deep passion
for programming, while somebody experienced in Python (which is not as
widely taught) must have taked that path by choice, evidencing a real
passion for programming (by looking around and choosing reasonably well
-- of course, for Graham, only Lisp would be the perfect choice;-).

A similar line of reasoning has been used to explain the empirical
findings of Software Development magazine's yearly survey on
programmers' salaries, which, for years, has shown Python programmers at
the top of the heap and Visual Basic programmers at the bottom (I do not
recall where Java programmers place, but I think it's closer to the
bottom than to the top): VB programmers, goes the reasoning, are closer
to have stumbled into it and to have no real experience of other
languages, while Python programmers typically have strong experience in
more languages and use Python _by choice_ -- so, again (the reasoning
goes), it's not so much about the languages per se, but the sociology
and psychology around them.  ((in terms of the emerging economics
discipline of asymmetric information markets, this would make Python
expertise a signal of a strong programmer in a way that VB or to a
lesser extent Java would not)).


 By comparison, our local community college teaches a few classes in VB,
 Java, Javascript, C++, and for some reason, PASCAL.

Interestingly, Mission College (Santa Clara, CA) offers C (I know
because my wife's been studying there to accumulate some credits while
Stanford considered her application -- it's now been accepted, so she'll
be starting Symbolic Systems there in the fall); Bologna University (I
know the details because of the recent study there of my son [Financial
Economics], daughter [Telecom Engineering] and daughter's boyfriend
[started with Civil Engineering, switched to Political Science] offers:
a first course in C, and a second one in Java, for Telecom; Fortran, for
Civil engineers (all of these are mandatory for these majors); no
mandatory programming for 

Re: Python taught in schools?

2006-06-25 Thread David Reed

 MilkmanDan wrote:
 I'll be a college freshman this fall, attending Florida Institute of
 Tech studying electrical engineering.

 I was considering taking some classes in programming and computer
 science, and I happened to notice that everything taught is using C 
 ++.
 After further research, it seems to me that C++ seems to be the
 dominating language in universities.


Actually, I think Java is the most commonly used language in the CS1,  
although C++ may be more popular at engineering institutions.


 By comparison, our local community college teaches a few classes  
 in VB,
 Java, Javascript, C++, and for some reason, PASCAL.

 I'm certianly not against any of this, but out of curiousity does
 anyone know of a school that teaches Python?



See the following for a list compiled from responses on the python- 
edu list.

http://studypack.com/comp/mod/glossary/view.php?id=2835

Dave



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


Re: languages with full unicode support

2006-06-25 Thread Frank Buss
Xah Lee wrote:

 Lisps → No.

The Common Lisp spec (CLHS) doesn't require that implementations support
Unicode characters, but it doesn't forbid it and some implementations
support it, e.g. http://clisp.cons.org/impnotes.html

-- 
Frank Buss, [EMAIL PROTECTED]
http://www.frank-buss.de, http://www.it4-systems.de
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: array manipulation without for loops

2006-06-25 Thread Sheldon
Hi Gary,

I am really trying to cut the time down as I have 600+ arrays with
dimensions (1215,1215) to compare and I do a lot more things with the
arrays. If I understand you correctly, there is no way around a for
loop?


/Sheldon

Gary Herron wrote:

 Sheldon wrote:
  Hi,
 
  I have two arrays that are of the same dimension but having 3 different
  values: 255, 1 or 2.
  I would like to set all the positions in both arrays having 255 to be
  equal, i.e., where one array has 255, I set the same elements in the
  other array to 255 and visa versa. Does anyone know how to do this
  without using for loops?
 
  Sincerely,
  Sheldon
 
 
 Whatever for?  Have you got something against for loops?

 However...

 You could roll you own loop:
 i=0
 while i  whatever:
 # ... do something with i
 i += 1

 But what's the point?  This does the same as a for loop but slower.

 If you don't want any kind of a loop (again, What's the point?) you
 could write something recursive:

 def proc(i, ...):
 # ... do something with i
 if i  whatever:
 proc(i+1, ...)
 
 But this would be even slower.
 
 Gary Herron

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Chris Smith
Joachim Durchholz [EMAIL PROTECTED] wrote:
 Sorry, I have to insist that it's not me who's stretching terms here.
 
 All textbook definitions that I have seen define a type as the 
 set/operations/axioms triple I mentioned above.
 No mention of immutability, at least not in the definitions.

The immutability comes from the fact (perhaps implicit in these 
textbooks, or perhaps they are not really texts on formal type theory) 
that types are assigned to expressions, and the program is not likely to 
change as it executes.  Even such oddities as self-modifying code are 
generally formally modeled as a single program, which reduces to other 
programs as it evaluates just like everything else.  The original 
program doesn't change in the formal model.

Hence the common (and, I think, meaningless) distinction that has been 
made here: that static type systems assign types to expressions 
(sometimes I hear variables, which is limiting and not really correct), 
while dynamic type systems do so to values.  However, that falls apart 
when you understand what formal type systems mean by types.  What they 
mean, roughly, is that label which we attach to an expressions 
according to fixed rules to help facilitate our proofs.  Since dynamic 
type systems don't do such proofs, I'm having trouble understanding what 
could possibly be meant by assigning types to values, unless we redefine 
type.  That's what I've been trying to do.  So far I've had only limited 
success, although there is definite potential in one post by Chris Uppal 
and another by Chris Clark (or maybe I'm just partial to other people 
named Chris).

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP server

2006-06-25 Thread Simon Forman
placid wrote:
 Simon Forman wrote:
 
...
  For what you're asking about you'd probably want to use the
  CGIHTTPRequestHandler from the CGIHTTPServer module instead.  Check out
  http://docs.python.org/lib/module-CGIHTTPServer.html

 This is what i was after, thanks for the tip.


You're welcome, my pleasure.  : )

...

 Im having trouble running the following cgi script on windows

 code

 #!c:/Python/python.exe -u

 text = Content-type: text/html

 TITLE CGI 101 /TITLE
 H1A Second CGI script/H1
 HR
 PHello, CGI World!/P
 
 print text

 /code


 using this http server from
 http://effbot.org/librarybook/cgihttpserver.htm

 code

 import CGIHTTPServer
 import BaseHTTPServer

 class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
 cgi_directories = [/cgi]

 PORT = 8000

 httpd = BaseHTTPServer.HTTPServer((, PORT), Handler)
 print serving at port, PORT
 httpd.serve_forever()

 /code

 i get the error number 403, when i try to access the cgi script which
 is located in a subdirectory called cgi where this file is (http
 server). I have a feeling that i need to change the Handler class or
 something, implement , but i couldnt find any examples other then this
 from eff-bot.

 It could also be this line of code, that a google search turned up, its
 the way of running cgi scripts on windows

 #!c:/Python/python.exe -u


 Cheers


Your cgi and server scripts look fine to me.

Some diagnostic questions:

What is the filename of your cgi script?
(It must end in .py or .pyw for CGIHTTPRequestHandler to recognize
it as a python script.  See the is_python() method in the handler
class.  Also, in this case the #!c:/Python/python.exe -u line isn't
needed, but it doesn't hurt.  CGIHTTPRequestHandler should find the
python interpreter for you without it.)

What was the exact URL that you're using to try to reach your script?
(It should look something like:
http://localhost:8000/cgi/myscript.py;)

What was the error message that accompanied the 403 error?

Did you start the server script from the directory it's in?

What was the log output from your server script when you tried to
access the cgi script?

Peace,
~Simon

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Gabriel Dos Reis
[EMAIL PROTECTED] writes:

| Gabriel Dos Reis wrote:
|  |
|  | (Unfortunately, you can hardly write interesting programs in any safe
|  | subset of C.)
| 
|  Fortunately, some people do, as living job.
| 
| I don't think so. Maybe the question is what a safe subset consists
| of. In my book, it excludes all features that are potentially unsafe.

if you equate unsafe with potentially unsafe, then you have
changed gear and redefined things on the fly, and things that could
be given sense before ceases to have meaning.  I decline following
such an uncertain, extreme, path.

| So in particular, C-style pointers are out, because they can easily
| dangle, be uninitialisied, whatever. 

sorry, the specific claim I was responding to is not whether *you* can
easily misuse C constructs.  I would refrain from generalizing your
inability to write interesting correct programs in C, to a quality of
the language itself.  Rather, the claim I was responding to is this:

  (Unfortunately, you can hardly write interesting programs in any safe
   subset of C.)

I would suggest you give more thoughts to the claims made in

  http://www.seas.upenn.edu/~sweirich/types/archive/1999-2003/msg00298.html

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


Re: array manipulation without for loops

2006-06-25 Thread Alex Martelli
Sheldon [EMAIL PROTECTED] wrote:

 I have two arrays that are of the same dimension but having 3 different
 values: 255, 1 or 2.
 I would like to set all the positions in both arrays having 255 to be
 equal, i.e., where one array has 255, I set the same elements in the
 other array to 255 and visa versa. Does anyone know how to do this
 without using for loops?

Python's Numeric extension package (still available, but not actively
developed any more) and its successors (numarray, and the even newer
numpy) are replete with such functionality -- indeed, to really use
arrays in Python you should get any one of these packages (Python offers
arrays only in the very limited incarnation of the standard library
module named array -- better than nothing, but little built-in
functionality, while those packages have plenty).

Of course, if you say array when actually you mean list, the
situation is completely different (it may be worth turning list into
Numeric arrays for manipulation, then back when you're done, if speed is
absolutely of the essence and you desperately need lists as inputs and
outputs but a lot of manipulation in-between).


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


Re: array manipulation without for loops

2006-06-25 Thread Alex Martelli
Sheldon [EMAIL PROTECTED] wrote:

 Hi Gary,
 
 I am really trying to cut the time down as I have 600+ arrays with
 dimensions (1215,1215) to compare and I do a lot more things with the
 arrays. If I understand you correctly, there is no way around a for
 loop?

In pure Python (w/o extension packages) there are no 2-D arrays; so
either you're using lists of lists (and I wonder how you fit even one of
them in memory, if they're 1215 by 1215, much less 600!) or you're
already using some extension (Numeric, numarray, numpy) and aren't
telling us which one.  If you're using pure Python add your extension of
choice, if you're using an extension already tell us which one, and in
each case there will be ways to perform your manipulation tasks faster
than Python-level for loops would afford.


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


Re: array manipulation without for loops

2006-06-25 Thread Gary Herron
Sheldon wrote:
 Hi Gary,

 I am really trying to cut the time down as I have 600+ arrays with
 dimensions (1215,1215) to compare and I do a lot more things with the
 arrays. If I understand you correctly, there is no way around a for
 loop?
   
Well no. I gave you two alternatives to for loops. But once we learn
that your motivation is speed on large arrays, then, by all means, go
with Alex's suggestion. Use numpy (or one if its earlier incarnations).
See: http://numeric.scipy.org/

This is a HIGHLY efficient implementation of arrays for Python. It
provides a number of very general operations that can be performed
across arrays.

Good luck
Gary Herron


 /Sheldon

 Gary Herron wrote:

   
 Sheldon wrote:
 
 Hi,

 I have two arrays that are of the same dimension but having 3 different
 values: 255, 1 or 2.
 I would like to set all the positions in both arrays having 255 to be
 equal, i.e., where one array has 255, I set the same elements in the
 other array to 255 and visa versa. Does anyone know how to do this
 without using for loops?

 Sincerely,
 Sheldon


   
 Whatever for?  Have you got something against for loops?

 However...

 You could roll you own loop:
 i=0
 while i  whatever:
 # ... do something with i
 i += 1

 But what's the point?  This does the same as a for loop but slower.

 If you don't want any kind of a loop (again, What's the point?) you
 could write something recursive:

 def proc(i, ...):
 # ... do something with i
 if i  whatever:
 proc(i+1, ...)

 But this would be even slower.

 Gary Herron
 

   

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Scott David Daniels
[EMAIL PROTECTED] wrote:
 Huh? There is a huge, fundamental difference: namely whether a type
 system is sound or not. A soundness proof is obligatory for any serious
 type theory, and failure to establish it simply is a bug in the theory.

So you claim Java and Objective C are simply bugs in the theory.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: array manipulation without for loops

2006-06-25 Thread Sheldon
Alex,

I am using Numeric and have created 3 arrays: zero((1215,1215),Float)
Two arrays are compared and one is used to hold the mean difference
between the two compared arrays. Then I compare 290 or 340 pairs of
arrays. I know that memory is a problem and that is why I don't open
all of these arrays at the same time. I cannot install Numpy due to my
working conditions. Sorry I should have made it clear that is was
Numeric I was working with.

/Sheldon

Alex Martelli wrote:

 Sheldon [EMAIL PROTECTED] wrote:

  Hi Gary,
 
  I am really trying to cut the time down as I have 600+ arrays with
  dimensions (1215,1215) to compare and I do a lot more things with the
  arrays. If I understand you correctly, there is no way around a for
  loop?

 In pure Python (w/o extension packages) there are no 2-D arrays; so
 either you're using lists of lists (and I wonder how you fit even one of
 them in memory, if they're 1215 by 1215, much less 600!) or you're
 already using some extension (Numeric, numarray, numpy) and aren't
 telling us which one.  If you're using pure Python add your extension of
 choice, if you're using an extension already tell us which one, and in
 each case there will be ways to perform your manipulation tasks faster
 than Python-level for loops would afford.
 
 
 Alex

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


Re: array manipulation without for loops

2006-06-25 Thread Tim Chase
 I have two arrays that are of the same dimension but having 3 different
 values: 255, 1 or 2.
 I would like to set all the positions in both arrays having 255 to be
 equal, i.e., where one array has 255, I set the same elements in the
 other array to 255 and visa versa. Does anyone know how to do this
 without using for loops?

  # make some sample data
  c = 20
  import random, itertools
  a1 = [(1,2,255)[random.randint(0,2)] for x in xrange(c)]
  a2 = [(1,2,255)[random.randint(0,2)] for x in xrange(c)]
 
  # actually do the work
  all = [(x==255 or y==255) and (255, 255) or (x,y) for (x,y) 
in itertools.izip(a1,a2)]
  b1 = [x[0] for x in all]
  b2 = [x[1] for x in all]
  a1, a2 = b1, b2 # if you want them to replace the originals

Seems to do what I understand that you're describing using no 
loops (other than those implied by list comprehension).

There may be some nice pythonic way to unzip a list of tuples 
created by zip() but I couldn't scare up such a method, and 
searching for unzip turned up a blizzard of hits for dealing 
with ZIP files, not for unzipping that which was previously 
zip()'ed.  My google-foo must be broken. :)  Otherwise, you could 
just do

  b1,b2 = magic_unzip([(x==255 or y==255) and (255, 255) or 
(x,y) for (x,y) in itertools.izip(a1,a2)])

or

  a1,a2 = magic_unzip([(x==255 or y==255) and (255, 255) or 
(x,y) for (x,y) in itertools.izip(a1,a2)])

if you just want to dispose of your originals.

-tkc



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


Re: error with string (beginner)

2006-06-25 Thread Cameron Laird
In article [EMAIL PROTECTED],
Alex Pavluck [EMAIL PROTECTED] wrote:
Hello. I get the following error with the following code.  Is there
something wrong with my Python installation?

code:
import types
something = input(Enter something and I will tell you the type: )

if type(something) is types.IntType:
print you entered an integer
elif type(something) is types.StringType:
print you entered a string

error:
String: Source for exec/eval is unavailable


There are several things wrong--'least three distinct ones, by my count.

What version of Python do you believe you're using?  What input do you
enter at the Enter something ... prompt?

I suspect you're going to have happier results all around when you
replace input with raw_input.  I encourage you to read the documenta-
tion for each.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python taught in schools?

2006-06-25 Thread diffuser78
I think there is a Python club at UCF, Orlandomight help you
indirectly.

MilkmanDan wrote:
 I'll be a college freshman this fall, attending Florida Institute of
 Tech studying electrical engineering.

 I was considering taking some classes in programming and computer
 science, and I happened to notice that everything taught is using C++.
 After further research, it seems to me that C++ seems to be the
 dominating language in universities.

 By comparison, our local community college teaches a few classes in VB,
 Java, Javascript, C++, and for some reason, PASCAL.

 I'm certianly not against any of this, but out of curiousity does
 anyone know of a school that teaches Python?

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


Re: Python taught in schools?

2006-06-25 Thread diffuser78
I replied to a wrong post. My bad.I know for sure that there is
some kinda Python Club at UCF Orlando. There is Prof called Michael
Johnson who teaches Physics gives you an intro to Python.

http://www.physics.ucf.edu/~mdj/MinimalPython.html

Good Luck

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Marshall
Joachim Durchholz wrote:
 Anton van Straaten schrieb:
  It seems we have languages:
  with or without static analysis
  with or without runtime type information (RTTI or tags)
  with or without (runtime) safety
  with or without explicit type annotations
  with or without type inference
 
  Wow. And I don't think that's a complete list, either.
 
  Yup.

 What else?
 (Genuinely curious.)

I left off a big one: nominal vs. structural

Also: has subtyping polymorphism or not, has parametric polymorphism or
not.


Marshall

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Chris Smith
Anton van Straaten [EMAIL PROTECTED] wrote:
 The problem is that there are no useful sound definitions for the type 
 systems (in the static sense) of dynamically-typed languages.  Yet, we 
 work with type-like static properties in those languages all the time, 
 as I've been describing.

I honestly don't find it very compelling that there are similarities 
between the kinds of reasoning that goes on in static type systems 
versus those used by programmers in dynamically typed languages.  
Rather, of course there are similarities.  It would be shocking if there 
were not similarities.  These similarities, though, have nothing to with 
the core nature of types.

Basically, there are ways to reason about programs being correct.  
Static type systems describe their reasoning (which is always axiomatic 
in nature) by assigning types to expressions.  Programmers in 
dynamically typed languages still care about the correctness of their 
programs, though, and they find ways to reason about their programs as 
well.  That reasoning is not completely axiomatic, but we spend an 
entire lifetime applying this basic logical system, and it makes sense 
that programmers would try to reason from premises to conclusions in 
ways similar to a type system.  Sometimes they may even ape other type 
systems with which they are familiar; but even a programmer who has 
never worked in a typed language would apply the same kind of logic as 
is used by type systems, because it's a form of logic with which 
basically all human beings are familiar and have practiced since the age 
of three (disclaimer: I am not a child psychologist).

On the other hand, programmers don't restrict themselves to that kind of 
pure axiomatic logic (regardless of whether the language they are 
working in is typed).  The also reason inductively -- in the informal 
sense -- and are satisfied with the resulting high probabilities.  They 
generally apply intuitions about a problem statement that is almost 
surely not written clearly enough to be understood by a machine.  And so 
forth.

What makes static type systems interesting is not the fact that these 
logical processes of reasoning exist; it is the fact that they are 
formalized with definite axioms and rules of inference, performed 
entirely on the program before execution, and designed to be entirely 
evaluatable in finite time bounds according to some procedure or set of 
rules, so that a type system may be checked and the same conclusion 
reached regardless of who (or what) is doing the checking.  All that, 
and they still reach interesting conclusions about programs.  If 
informal reasoning about types doesn't meet these criteria (and it 
doesn't), then it simply doesn't make sense to call it a type system 
(I'm using the static terminology here).  It may make sense to discuss 
some of the ways that programmer reasoning resembles types, if indeed 
there are resemblances beyond just that they use the same basic rules of 
logic.  It may even make sense to try to identify a subset of programmer 
reasoning that even more resembles... or perhaps even is... a type 
system.  It still doesn't make sense to call programmer reasoning in 
general a type system.

In the same post here, you simultaneously suppose that there's something 
inherently informal about the type reasoning in dynamic languages; and 
then talk about the type system in the static sense of a dynamic 
language.  How is this possibly consistent?

 We know that we can easily take dynamically-typed program fragments and 
 assign them type schemes, and we can make sure that the type schemes 
 that we use in all our program fragments use the same type system.

Again, it would be surprising if this were not true.  If programmers do, 
in fact, tend to reason correctly about their programs, then one would 
expect that there are formal proofs that could be found that they are 
right.  That doesn't make their programming in any way like a formal 
proof.  I tend to think that a large number of true statements are 
provable, and that programmers are good enough to make a large number of 
statements true.  Hence, I'd expect that it would be possible to find a 
large number of true, provable statements in any code, regardless of 
language.

 So we actually have quite a bit of evidence about the presence of static 
 types in dynamically-typed programs.

No.  What we have is quite a bit of evidence about properties remaining 
true in dynamically typed programs, which could have been verified by 
static typing.

 We're currently discussing something that so far has only been captured 
 fairly informally.  If we restrict ourselves to only what we can say 
 about it formally, then the conversation was over before it began.

I agree with that statement.  However, I think the conversation 
regarding static typing is also over when you decide that the answer is 
to weaken static typing until the word applies to informal reasoning.  
If the goal isn't to reach a 

Re: What is Expressiveness in a Computer Language

2006-06-25 Thread J�rgen Exner
Scott David Daniels wrote:
 [EMAIL PROTECTED] wrote:
 Huh? There is a huge, fundamental difference: namely whether a type
 system is sound or not. A soundness proof is obligatory for any
 serious type theory, and failure to establish it simply is a bug in
 the theory.

 So you claim Java and Objective C are simply bugs in the theory.

They are certainly off topic in CLPM.

jue 


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


Re: Eclipse IDE question

2006-06-25 Thread seerhut
kilnhead wrote:
 I am trying to use eclipse for python development. Is it possible to
 run a python script without having to name/setup a configuration? Can
 eclipse be set up so that run loads the code into the interpreter and
 goes? I don't want to create a new run config every time I want to run
 a script.
 
try pydev , a plugin for eclipse
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: array manipulation without for loops

2006-06-25 Thread Alex Martelli
Sheldon [EMAIL PROTECTED] wrote:

 Alex,
 
 I am using Numeric and have created 3 arrays: zero((1215,1215),Float)
 Two arrays are compared and one is used to hold the mean difference
 between the two compared arrays. Then I compare 290 or 340 pairs of
 arrays. I know that memory is a problem and that is why I don't open
 all of these arrays at the same time. I cannot install Numpy due to my
 working conditions. Sorry I should have made it clear that is was
 Numeric I was working with.

It's OK, even if the hard-core numeric-python people are all
evangelizing for migration to numpy (for reasons that are of course
quite defensible!), I think it's quite OK to stick with good old Numeric
for the moment (and that's exactly what I do for my own personal use!).

So, anyway, I'll assume you mean your 1215 x 1215 arrays were created by
calling Numeric.zeros, not zero (with no trailing s) which is a name
that does not exists in Numeric.

Looking back to your original post, let's say that you have two such
arrays, a and b, both 1215x1215 and of Numeric.Float type, and the
entries of each array are all worth 1, 2, or 255 (that's how I read your
original post; if that's not the case, please specify).  We want to
write a function that alters both a and b, specifically setting to 255
all entries in each array whose corresponding entries are 255 in the
other array.

Now that's pretty easy -- for example:

import Numeric

def equalize(a, b, v=255):
Numeric.putmask(a, b==v, v)
Numeric.putmask(b, a==v, v)

if __name__ == '__main__':
a = Numeric.zeros((5,5), Numeric.Float)
b = Numeric.zeros((5,5), Numeric.Float)
a[1,2]=a[2,1]=b[3,4]=b[0,2]=255
a[3,0]=a[0,0]=1
b[0,3]=b[4,4]=2
print Before:
print a
print b
equalize(a, b)
print After:
print a
print b


brain:~/pynut alex$ python ab.py
Before:
[[   1.0.0.0.0.]
 [   0.0.  255.0.0.]
 [   0.  255.0.0.0.]
 [   1.0.0.0.0.]
 [   0.0.0.0.0.]]
[[   0.0.  255.2.0.]
 [   0.0.0.0.0.]
 [   0.0.0.0.0.]
 [   0.0.0.0.  255.]
 [   0.0.0.0.2.]]
After:
[[   1.0.  255.0.0.]
 [   0.0.  255.0.0.]
 [   0.  255.0.0.0.]
 [   1.0.0.0.  255.]
 [   0.0.0.0.0.]]
[[   0.0.  255.2.0.]
 [   0.0.  255.0.0.]
 [   0.  255.0.0.0.]
 [   0.0.0.0.  255.]
 [   0.0.0.0.2.]]
brain:~/pynut alex$ 

Of course I'm using tiny arrays here, for speed of running and ease of
display and eyeball-checking, but everything should work just as well in
your case.  Care to check and let us know?

Numeric has pretty good documentation (numpy's is probably even better,
but it is not available for free, so I don't know!), and if you don't
find that documentation sufficient you might want to have a look to my
book Python in a Nutshell which devotes a chapter to Numeric (it also
is not available for free, but you can get a subscription to O'Reilly's
Safari online-books repository, which is free for the first two weeks,
and lets you look at many books including Python in a Nutshell -- if you
don't want to pay monthly subscription fees, make sure you cancel your
trial subscription before two weeks have passed!!!).

I strongly recommend that, in some way or other, you DO get a taste of
the huge amount of functionality that Numeric provides for you -- with
the size of computational tasks you're talking about, an investment of
2-3 hours spent becoming deeply familiar with everything Numeric offers
may well repay itself in savings of ten times as much execution time,
and what other investments offer such ROI as 1000%?-)


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


Re: array manipulation without for loops

2006-06-25 Thread Alex Martelli
Tim Chase [EMAIL PROTECTED] wrote:
   ...
   all = [(x==255 or y==255) and (255, 255) or (x,y) for (x,y) 
 in itertools.izip(a1,a2)]
   b1 = [x[0] for x in all]
   b2 = [x[1] for x in all]
   a1, a2 = b1, b2 # if you want them to replace the originals
 
 Seems to do what I understand that you're describing using no 
 loops (other than those implied by list comprehension).

Yep, but the performance cost of the for-loops in the comprehension is
essentially the same as for such loops written normally.

 There may be some nice pythonic way to unzip a list of tuples 
 created by zip() but I couldn't scare up such a method, and 

Perhaps what you have in mind is:

 a=zip('feep','grol')
 a
[('f', 'g'), ('e', 'r'), ('e', 'o'), ('p', 'l')]
 zip(*a)
[('f', 'e', 'e', 'p'), ('g', 'r', 'o', 'l')]


But this wouldn't help the OP all that much with his performance
problems with large 2-D arrays (though it required some guessing to
gauge that it _was_ Numeric arrays that he was dealing with;-),


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


Re: Saying latently-typed language is making a category mistake

2006-06-25 Thread Chris Smith
Chris Uppal wrote:
 It seems to me that most (all ?  by definition ??)  kinds of reasoning where 
 we
 want to invoke the word type tend to have a form where we reduce values (and
 other things we want to reason about) to equivalence classes[*] w.r.t the
 judgements we wish to make, and (usually) enrich that structure with
 more-or-less stereotypical rules about which classes are substitutable for
 which other ones. So that once we know what type something is, we can
 short-circuit a load of reasoning based on the language semantics, by
 translating into type-land where we already have a much simpler calculus to
 guide us to the same answer.
 
 (Or representative symbols, or...  The point is just that we throw away the
 details which don't affect the judgements.)

One question: is this more specific than simply saying that we use 
predicate logic?  A predicate divides a set into two subsets: those 
elements for which the predicate is true, and those for which it is 
false.  If we then apply axioms or theorems of the form P(x) - Q(x), 
then we are reasoning from an equivalence class, throwing away the 
details we don't care about (anything that's irrelevant to the 
predicate), and applying stereotypical rules (the theorem or axiom).  I 
don't quite understand what you mean by substituting classes.

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Chris Smith schrieb:
 Joachim Durchholz [EMAIL PROTECTED] wrote:
 Sorry, I have to insist that it's not me who's stretching terms here.

 All textbook definitions that I have seen define a type as the 
 set/operations/axioms triple I mentioned above.
 No mention of immutability, at least not in the definitions.
 
 The immutability comes from the fact (perhaps implicit in these 
 textbooks, or perhaps they are not really texts on formal type theory) 
 that types are assigned to expressions,

That doesn't *define* what's a type or what isn't!

If it's impossible to assign types to all expressions of a program in a 
language, that does mean that there's no useful type theory for the 
program, but it most definitely does not mean that there are no types in 
the program.
I can still sensibly talk about sets of values, sets of allowable 
operations over each value, and about relationships between inputs and 
outputs of these operations.

So programs have types, even if they don't have a static type system.
Q.E.D.

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


USA UK CANADA AUSTRALIA Jobs With VISA Sponsorship, VISA immigration, VISA Sponsorship

2006-06-25 Thread faisjobs
USA UK CANADA AUSTRALIA Jobs

click here http://visajobs2u.50webs.com/

IT Jobs, Medical Jobs, Marketing Jobs, Engineering Jobs, Call Center
Jobs,
HRM Jobs, Administrative Jobs, Customer-related Jobs, Non
Customer-related Jobs, and many more. Career Opportunities, Vacancies,
Hiring, Job Fairs, Recruitment Agency, Employer, Manpower Pooling, etc.

click here http://visajobs2u.50webs.com/

ACCEPTED LANGUAGE: ENGLISH ONLY.


Members will receive emails everyday. Update your Resume NOW!



click here  http://visajobs2u.50webs.com/






click here http://visajobs2u.50webs.com/




International Jobs includes the Countries around Asia: Afghanistan
Jobs, Armenia Jobs, Azerbaijan Jobs, Bahrain Jobs, Bangladesh Jobs,
Bhutan Jobs, Brunei Jobs, Burma (Myanmar) Jobs, Cambodia Jobs, China
Jobs, Georgia Jobs, Hong Kong Jobs, India Jobs, Indonesia Jobs, Iran
Jobs, Iraq Jobs, Israel Jobs, Japan Jobs, Jordan Jobs, Kazakstan Jobs,
(North and South) Korea Jobs, Kuwait Jobs, Kyrgyzstan Jobs, Laos Jobs,
Lebanon Jobs, Malaysia Jobs, Maldives Jobs, Mongolia Jobs, Myanmar
Jobs, Nepal Jobs, Oman Jobs, Pakistan Jobs, Philippines Jobs, Qatar
Jobs, Russia Jobs, Saudi Arabia Jobs, Singapore Jobs, Sri Lanka Jobs,
Syria Jobs, Taiwan Jobs, Tajikistan Jobs, Thailand Jobs, Turkey Jobs,
Turkmenistan Jobs, United Arab Emirates Jobs, Uzbekistan Jobs, Vietnam
Jobs, and Yemen Jobs.



You send your reesume and details,

 click here http://visajobs2u.50webs.com/

Your details will be stored on my jobs data base, your resume
match any jobs position we will inform you,


lot of jobs with VISA sponsorship  available.



You send your resume here



click here http://visajobs2u.50webs.com/

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


Re: array manipulation without for loops

2006-06-25 Thread Sheldon
Hi Alex,

I will code this in a little while and get back to you. Terrific! I saw
this function but I skipped over it without realizing what it could do.

The Numeric doc is not very good and I am just getting into Python so
your book sounds great especially since it covers Numeric. I will look
into it when I get back to work tomorrow.

Bye for now,
Sheldon

Alex Martelli wrote:

 Sheldon [EMAIL PROTECTED] wrote:

  Alex,
 
  I am using Numeric and have created 3 arrays: zero((1215,1215),Float)
  Two arrays are compared and one is used to hold the mean difference
  between the two compared arrays. Then I compare 290 or 340 pairs of
  arrays. I know that memory is a problem and that is why I don't open
  all of these arrays at the same time. I cannot install Numpy due to my
  working conditions. Sorry I should have made it clear that is was
  Numeric I was working with.

 It's OK, even if the hard-core numeric-python people are all
 evangelizing for migration to numpy (for reasons that are of course
 quite defensible!), I think it's quite OK to stick with good old Numeric
 for the moment (and that's exactly what I do for my own personal use!).

 So, anyway, I'll assume you mean your 1215 x 1215 arrays were created by
 calling Numeric.zeros, not zero (with no trailing s) which is a name
 that does not exists in Numeric.

 Looking back to your original post, let's say that you have two such
 arrays, a and b, both 1215x1215 and of Numeric.Float type, and the
 entries of each array are all worth 1, 2, or 255 (that's how I read your
 original post; if that's not the case, please specify).  We want to
 write a function that alters both a and b, specifically setting to 255
 all entries in each array whose corresponding entries are 255 in the
 other array.

 Now that's pretty easy -- for example:

 import Numeric

 def equalize(a, b, v=255):
 Numeric.putmask(a, b==v, v)
 Numeric.putmask(b, a==v, v)

 if __name__ == '__main__':
 a = Numeric.zeros((5,5), Numeric.Float)
 b = Numeric.zeros((5,5), Numeric.Float)
 a[1,2]=a[2,1]=b[3,4]=b[0,2]=255
 a[3,0]=a[0,0]=1
 b[0,3]=b[4,4]=2
 print Before:
 print a
 print b
 equalize(a, b)
 print After:
 print a
 print b


 brain:~/pynut alex$ python ab.py
 Before:
 [[   1.0.0.0.0.]
  [   0.0.  255.0.0.]
  [   0.  255.0.0.0.]
  [   1.0.0.0.0.]
  [   0.0.0.0.0.]]
 [[   0.0.  255.2.0.]
  [   0.0.0.0.0.]
  [   0.0.0.0.0.]
  [   0.0.0.0.  255.]
  [   0.0.0.0.2.]]
 After:
 [[   1.0.  255.0.0.]
  [   0.0.  255.0.0.]
  [   0.  255.0.0.0.]
  [   1.0.0.0.  255.]
  [   0.0.0.0.0.]]
 [[   0.0.  255.2.0.]
  [   0.0.  255.0.0.]
  [   0.  255.0.0.0.]
  [   0.0.0.0.  255.]
  [   0.0.0.0.2.]]
 brain:~/pynut alex$

 Of course I'm using tiny arrays here, for speed of running and ease of
 display and eyeball-checking, but everything should work just as well in
 your case.  Care to check and let us know?

 Numeric has pretty good documentation (numpy's is probably even better,
 but it is not available for free, so I don't know!), and if you don't
 find that documentation sufficient you might want to have a look to my
 book Python in a Nutshell which devotes a chapter to Numeric (it also
 is not available for free, but you can get a subscription to O'Reilly's
 Safari online-books repository, which is free for the first two weeks,
 and lets you look at many books including Python in a Nutshell -- if you
 don't want to pay monthly subscription fees, make sure you cancel your
 trial subscription before two weeks have passed!!!).

 I strongly recommend that, in some way or other, you DO get a taste of
 the huge amount of functionality that Numeric provides for you -- with
 the size of computational tasks you're talking about, an investment of
 2-3 hours spent becoming deeply familiar with everything Numeric offers
 may well repay itself in savings of ten times as much execution time,
 and what other investments offer such ROI as 1000%?-)
 
 
 Alex

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread rossberg
Gabriel Dos Reis wrote:
 [EMAIL PROTECTED] writes:

 | Gabriel Dos Reis wrote:
 |  |
 |  | (Unfortunately, you can hardly write interesting programs in any safe
 |  | subset of C.)
 | 
 |  Fortunately, some people do, as living job.
 |
 | I don't think so. Maybe the question is what a safe subset consists
 | of. In my book, it excludes all features that are potentially unsafe.

 if you equate unsafe with potentially unsafe, then you have
 changed gear and redefined things on the fly, and things that could
 be given sense before ceases to have meaning.  I decline following
 such an uncertain, extreme, path.

An unsafe *feature* is one that can potentially exhibit unsafe
behaviour. How else would you define it, if I may ask?

A safe *program* may or may not use unsafe features, but that is not
the point when we talk about safe *language subsets*.

 I would suggest you give more thoughts to the claims made in

   http://www.seas.upenn.edu/~sweirich/types/archive/1999-2003/msg00298.html

Thanks, I am aware of it. Taking into account the hypothetical nature
of the argument, and all the caveats listed with respect to C, I do not
think that it is too relevant for the discussion at hand. Moreover,
Harper talks about a relative concept of C-safety. I assume that
everybody here understands that by safe in this discussion we mean
something else (in particular, memory safety).

Or are you trying to suggest that we should indeed consider C safe for
the purpose of this discussion?

- Andreas

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


Re: sum fonction in gadfly

2006-06-25 Thread Scott David Daniels
jean-jeanot wrote:
 Thank you for your help. 
You're welcome.

 It could be useful for me to change of DB ? Which one ? Postgresql or
 another ?
Well, if gadfly is serving you well, you might as well stay with it.
Python 2.5 comes with sqlite3, which might well be a nice small step.
I find Postgresql to be a real solid DB, and a company I've been talking
with likes MySQL -- which finally has transactions (one of my personal
requirements before I'll call a DBMS real).

Really, you should decide what you want the DBMS to do, and try to get
those requirements out; you'll get better advice.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
[EMAIL PROTECTED] schrieb:
 Joachim Durchholz write:
 Another observation: type safeness is more of a spectrum than a clearcut
 distinction. Even ML and Pascal have ways to circumvent the type system,
 
 No. I'm not sure about Pascal,

You'd have to use an untagged union type.
It's the standard maneuver in Pascal to get unchecked bitwise 
reinterpretation.
Since it's an undefined behavior, you're essentially on your own, but in 
practice, any compilers that implemented a different semantics were 
hammered with bug reports until they complied with the standard - in 
this case, an unwritten (and very unofficial) one, but a rather 
effective one.

  but (Standard) ML surely has none.

NLFFI?

  Same with Haskell as defined by its spec.

Um... I'm not 100% sure, but I dimly (mis?)remember having read that 
UnsafePerformIO also offered some ways to circumvent the type system.

(Not that this would be an important point anyway.)

  OCaml has a couple of clearly
 marked unsafe library functions, but no unsafe feature in the language
 semantics itself.

If there's a library with not-typesafe semantics, then at least that 
language implementation is not 100% typesafe.
If all implementations of a language are not 100% typesafe, then I 
cannot consider the language itself 100% typesafe.

Still, even Pascal is quite a lot more typesafe than, say, C.

 and even C is typesafe unless you use unsafe constructs.
 
 Tautology. Every language is safe unless you use unsafe constructs.

No tautology - the unsafe constructs aren't just typewise unsafe ;-p

That's exactly why I replaced Luca Cardelli's safe/unsafe 
typesafe/not typesafe. There was no definition to the original terms 
attached, and this discussion is about typing anyway.

 (Unfortunately, you can hardly write interesting programs in any safe
 subset of C.)

Now that's a bold claim that I'd like to see substantiated.

 IOW from a type-theoretic point of view, there is no real difference
 between their typesafe and not typesafe languages in the statically
 typed column; the difference is in the amount of unsafe construct usage
 in practial programs.
 
 Huh? There is a huge, fundamental difference:  namely whether a type
 system is sound or not.

I think you're overstating the case.

In type theory, of course, there's no such things as an almost typesafe 
language - it's typesafe or it isn't.

In practice, I find no implementation where type mismatches cannot 
occur, if only when interfacing with the external world (except if you 
cheat by treating everything external as a byte sequence, which is like 
saying that all languages have at least a universal ANY type and are 
hence statically-typed).
And in those languages that do have type holes, these holes may be more 
or less relevant - and it's a *very* broad spectrum here.
And from that perspective, if ML indeed has no type hole at all, then 
it's certainly an interesting extremal point, but I still have a 
relevant spectrum down to assembly language.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread rossberg
Scott David Daniels wrote:
 [EMAIL PROTECTED] wrote:
  Huh? There is a huge, fundamental difference: namely whether a type
  system is sound or not. A soundness proof is obligatory for any serious
  type theory, and failure to establish it simply is a bug in the theory.

 So you claim Java and Objective C are simply bugs in the theory.

You're misquoting me. What I said is that lack of soundness of a
particular type theory (i.e. a language plus type system) is a bug in
that theory.

But anyway, Java in fact is frequently characterised as having a bogus
type system (e.g. with respect to array subtyping). Of course, in a
hybrid language like Java with its dynamic checks it can be argued
either way.

Naturally, the type system of Objective-C is as broken as the one of
plain C.

- Andreas

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


USA UK CANADA AUSTRALIA Jobs With VISA Sponsorship, USA VISA, UK VISA, CANADA VISA, AUSTRALIA VISA , immigration, VISA Sponsorship

2006-06-25 Thread faisjobs
USA UK CANADA AUSTRALIA Jobs With VISA Sponsorship, USA VISA,UK VISA,
CANADA VISA, AUSTRALIA VISA ,  immigration, VISA Sponsorship



  click here
http://visajobs2u.50webs.com/

===

JOBS, VISA, AUTOS, CRICKET, FOOTBALL, CREDIT CARD, LOAN, LAPTOP,
DATING.



click here www.freewebs.com/winfais

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
[EMAIL PROTECTED] schrieb:
 Gabriel Dos Reis wrote:
 |
 | (Unfortunately, you can hardly write interesting programs in any safe
 | subset of C.)

 Fortunately, some people do, as living job.
 
 I don't think so. Maybe the question is what a safe subset consists
 of. In my book, it excludes all features that are potentially unsafe.

Unless you define safe, *any* program is unsafe.
Somebody could read the program listing, which could trigger a traumatic 
childhood experiece.
(Yes, I'm being silly. But the point is very serious. Even with less 
silly examples, whether a language or subset is safe entirely depends 
on what you define to be safe, and these definitions tend to vary 
vastly across language communities.)

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Joachim Durchholz
Pascal Costanza schrieb:
 Another observation: type safeness is more of a spectrum than a 
 clearcut distinction. Even ML and Pascal have ways to circumvent the 
 type system, and even C is typesafe unless you use unsafe constructs.
 IOW from a type-theoretic point of view, there is no real difference 
 between their typesafe and not typesafe languages in the statically 
 typed column; the difference is in the amount of unsafe construct 
 usage in practial programs.
 
 It's also relevant how straightforward it is to distinguish between safe 
 and unsafe code, how explicit you have to be when you use unsafe code, 
 how likely it is that you accidentally use unsafe code without being 
 aware of it, what the generally accepted conventions in a language 
 community are, etc. pp.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Anton van Straaten
[EMAIL PROTECTED] wrote:
In this context, the term latently-typed language refers to the
language that a programmer experiences, not to the subset of that
language which is all that we're typically able to formally define.
 
 
 That language is not a subset, if at all, it's the other way round, but
 I'd say they are rather incomparable. That is, they are different
 languages.

The subset characterization is not important for what I'm saying.  The 
fact that they are different languages is what's important.  If you 
agree about that, then you can at least understand which language I'm 
referring to when I say latently-typed language.

Besides, many dynamically-typed languages have no formal models, in 
which case the untyped formal model I've referred to is just a 
speculative construct.  The language I'm referring to with 
latently-typed language is the language that programmers are familiar 
with, and work with.

That is starting to get a bit too mystical for my tastes.
 
 
 I have to agree.
 
 \sarcasm One step further, and somebody starts calling C a latently
 memory-safe language, because a real programmer knows that his code
 is in a safe subset... And where he is wrong, dynamic memory page
 protection checks will guide him.

That's a pretty apt comparison, and it probably explains how it is that 
the software we all use, which relies so heavily on C, works as well as 
it does.

But the comparison critiques the practice of operating without static 
guarantees, it's not a critique of the terminology.

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


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Chris Smith
Joachim Durchholz [EMAIL PROTECTED] wrote:
  The immutability comes from the fact (perhaps implicit in these 
  textbooks, or perhaps they are not really texts on formal type theory) 
  that types are assigned to expressions,
 
 That doesn't *define* what's a type or what isn't!
 

I'm sorry if you don't like it, but that's all there is.  That's the 
point that's being missed here.  It's not as if there's this thing 
called a type, and then we can consider how it is used by formal type 
systems.  A type, in formal type theory, is ANY label that is assigned 
to expressions of a program for the purpose of making a formal type 
system work.  If you wish to claim a different use of the word and then 
try to define what is or is not a type, then be my guest.  However, 
formal type theory will still not adopt whatever restrictions you come 
up with, and will continue to use the word type as the field has been 
using the word for a good part of a century now.

The first step toward considering the similarities and differences 
between the different uses of type in dynamic type systems and formal 
type theory is to avoid confusing aspects of one field with the other.

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Andrew McDonagh
Joachim Durchholz wrote:
 Chris Smith schrieb:
 Joachim Durchholz [EMAIL PROTECTED] wrote:
 Sorry, I have to insist that it's not me who's stretching terms here.

 All textbook definitions that I have seen define a type as the 
 set/operations/axioms triple I mentioned above.
 No mention of immutability, at least not in the definitions.

 The immutability comes from the fact (perhaps implicit in these 
 textbooks, or perhaps they are not really texts on formal type theory) 
 that types are assigned to expressions,
 
 That doesn't *define* what's a type or what isn't!
 
 If it's impossible to assign types to all expressions of a program in a 
 language, that does mean that there's no useful type theory for the 
 program, but it most definitely does not mean that there are no types in 
 the program.
 I can still sensibly talk about sets of values, sets of allowable 
 operations over each value, and about relationships between inputs and 
 outputs of these operations.
 
 So programs have types, even if they don't have a static type system.
 Q.E.D.
 

Of course not.  Otherwise programs using dynamically  typed systems 
wouldnt exist.

 Regards,
 Jo

I haven't read all of this thread, I wonder, is the problem to do with 
Class being mistaken for Type? (which is usually the issue)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is Expressiveness in a Computer Language

2006-06-25 Thread Marshall
Chris F Clark wrote:
 Chris F Clark (I) wrote:

  I'm particularly interested if something unsound (and perhaps
  ambiguous) could be called a type system.  I definitely consider such
  things type systems.

 Marshall [EMAIL PROTECTED] wrote:

  I don't understand. You are saying you prefer to investigate the
  unsound over the sound?
 ...
  Again, I cannot understand this. In a technical realm, vagueness
  is the opposite of understanding.

 At the risk of injecting too much irrelevant philosophy into the
 discussion, I will with great trepdiation reply.

I agree this is OT, but I'm not sure about the source of trepidation.


 First in the abstrtact: No, understanding is approximating.

Agreed.


 The world is inherently vague.

Our understanding of the world is vague. The world itself is
not at all vague.


 We make false symbolic models of the world which
 are consistent, but at some level they do not reflect reality,

Yes...

 because reality isn't consistent.

What?!


 Only by abtracting away the inherent
 infinite amout of subtlety present in the real universe can we come to
 comprehensible models.

Sure. (Although I object to infinite.)


 Those models can be consistent, but they are
 not the universe.  The models in their consistency, prove things which
 are not true about the real universe.

Sure, sure, sure. None of these is a reaon to prefer the unsound
over the sound.


 Now in the concrete: In my work productivity is ultimately important.
 Therefore, we live by the 80-20 rule in numerous variations.  One of
 ths things we do to achieve productivity is simplify things.  In fact,
 we are more interested in an unsound simplification that is right 80%
 of the time, but takes only 20% of the effort to compute, than a
 completely sound (100% right) model which takes 100% of the time to
 compute (which is 5 times as long).  We are playing the probabilities.

What you are describing is using a precise mathematical function
to approximate a different precise mathematical function. This
argues for the value of approximation functions, which I do not
dispute. But this does not in any way support the idea of vague
trumping precise, informal trumping formal, or unsoundness as
an end in itself.


 It's not that we don't respect the sound underpining, the model which
 is consistent and establishes certain truths.  However, what we want
 is the rule of thumb which is far simpler and approximates the sound
 model with reasonable accuracy.  In particular, we accept two types of
 unsoundness in the model.  One, we accept a model which gives wrong
 answers which are detectable.  We code tests to catch those cases, and
 use a different model to get the right answer.  Two, we accept a model
 which gets the right answer only when over-provisioned.  for example,
 if we know a loop will occassionaly not converge in the n-steps that
 it theoretically should, we will run the loop for n+m steps until the
 approximation also converges--even if that requires allocating m extra
 copies of some small element than are theoretically necessary.  A
 small waste of a small resource, is ok if it saves a waste of a more
 critical resource--the most critical resource of all being our project
 timeliness.

Υes, I'm quite familiar with modelling, abstraction, approximation,
etc. However nothing about those endevours suggests to me
that unsoundness is any kind of goal.


 Marshall's last point:

  I flipped a coin to see who would win the election; it came
  up Bush. Therefore I *knew* who was going to win the
  election before it happened. See the probem?

 Flipping one coin to determine an election is not playing the
 probabilities correctly.  You need a plausible explanation for why the
 coin should predict the right answer and a track record of it being
 correct.  If you had a coin that had correctly predicted the previous
 42 presidencies and you had an explanation why the coin was right,
 then it would be credible and I would be willing to wager that it
 could also predict that the coin could tell us who the 44th president
 would be.  One flip and no explanation is not sufficient.  (And to the
 abstract point, to me that is all knowledge is, some convincing amount
 of examples and a plausible explanation--anyone who thinks they have
 more is appealing to a knowledge of the universe that I don't
 accept.)

I used a coin toss; I could also have used a psycic hotline. There
is an explanation for why those things work, but the explanation
is unsound.


 Look at where that got Russell and Whitehead.

Universal acclaim, such that their names will be praised for
centuries to come?


 I'm just trying to be honest about that fact and find ways to
 compensate for my own failures.

Limitation != failure.


Marshal

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

What technologies should I use for my application manager?

2006-06-25 Thread MrBlueSky
Hello!  I've just finished working on my first Python app (a
Tkinter-based program that displays the content of our application log
files in graphical format).   It was a great experience that's had a
very positive response from my colleagues.

So I'd like to try something different for my second Python
application.  It's a simple server that can launch and monitor the
state of our program, to help our software developers.  In my mind I
have a vision of:
* a web server
* allows the user to launch our product (choosing from a set of
different launch scripts)
* allow user to stop a launched product
* report state by retrieving data from the RDBMS against which the
product runs (Oracle or SQL Server)

There seem to be a lot of web server related Python libraries around,
and I've no experience in web servers at all.   So I'd really
appreciate some advice on what Python technologies you think I should
base my application on.

Thank you in advance!

John

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


  1   2   >