[Python-Dev] PEP-228 (fw)

Moshe Zadka moshez@zadka.site.co.il
Fri, 17 Nov 2000 16:04:53 +0200


I'm forwarding this message about PEP-228, but I haven't fully
understood it. In any case, since PEP-228 is apparently not
a 2.1 candidate, I've told Michael that his remarks will be considered,
but they are not relevant yet.

------- Forwarded Message

From: Michael McLay <mclay@nist.gov>
Date: Fri, 17 Nov 2000 04:20:45 -0500 (EST)
To: pep@zadka.site.co.il
Subject: PEP:228

I've dropped off the Python mailing lists for the last couple years
because the volume is too high and I don't have time to contribute to
the discussion.  I do read the summaries and PEP:228 was mentioned in
reference to the 2.1 release.  I'd like to see this problem solve in
the 2.1 release and I have a few thoughts on the matter that may be of
use to this task.  Is there a mailing list specific to PEP:228 or
would I have to join python-dev to participate in the discussion?
Please feel free to forward my message to the python-dev list or use
my comments in PEP:228.

Python's use in the XML community is growing and broad-based XML
support in Python may be key to widespread adoption of Python.  There
is some support for XML Schema, the XML Schema Validation software is
written in Python, but there is no direct support in the core Python
XML library.  One problem area for an XML Schema implementation is
related to the numerical types in Python.  The ability to implement
XML Schema types could be improved if the requirements are considered
when creating the PEP:228 implementation.

And from the Python language perspective a review of the numerical
model used in XML Schema may be useful to the discussion of the
revised numerical model for Python.  The authors of the XML Schema
specification put a good deal of effort into defining a modern,
portable numerical model and I think it might be a good fit with the
Python object model.  I might also be possible that the XML Schema
type and entity definition mechanism would be helpful in the
discussion of defining type interfaces for Python.

A table of simple types built into XML Schema are defined in:

   http://www.w3.org/TR/xmlschema-0/#simpleTypesTable

These are defined more fully in "XML Schema Part 2: DataTypes" at:

    http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/

This includes a discussion of the difference between built-inprimitive
and built-inderived datatypes.

The derived types are defined in the XML Schema at: 

    http://www.w3.org/2000/10/datatypes.xsd

In this document, for instance, an integer is derived from a decimal
type in XML Schema. 

 <simpleType name="integer">
   <restriction base="decimal">
      <scale value="0" fixed="true"/>
   </restriction>
 </simpleType>

The use of XML Schema in conjunction with Python would be very helpful
to a soon to be large domain of applications.  I am working with a
group that is currently defining 20 standards using XML Schema and
this is probably just the tip of the iceburg.  I need to be able to
define constrained numerical types as defined in XML Schma.  In Python
this might look like:

  size = ConstrainedDecimal(initial=2, minInclusive=2, 
				       maxInclusive=3000, scale=0)

  for i in range(3000-2):
    size += 1

  print size

The  ConstrainedDecimal would define a restriction range on the value
of "size".  





------- End of Forwarded Message

-- 
Moshe Zadka <sig@zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!