A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-February/097965.html below:

[Python-Dev] PEP 3188: Implementation Questions

[Python-Dev] PEP 3188: Implementation QuestionsMeador Inge meadori at gmail.com
Fri Feb 26 05:51:13 CET 2010
Hi All,

Recently some discussion began in the issue 3132 thread (
http://bugs.python.org/issue3132) regarding
implementation of the new struct string syntax for PEP 3118.  Mark Dickinson
suggested that I bring the discussion on over to Python Dev.  Below is a
summary
of the questions\comments from the thread.

Unpacking a long-double
===================

1. Should this return a Decimal object or a ctypes 'long double'?
2. Using ctypes 'long double' is easier to implement, but precision is
    lost when needing to do arithmetic, since the value for cytpes 'long
double'
    is converted to a Python float.
3. Using Decimal keeps the desired precision, but the implementation would
    be non-trivial and architecture specific (unless we just picked a
    fixed number of bytes regardless of the architecture).
4. What representation should be used for standard size and alignment?
    IEEE 754 extended double precision?

Pointers
======

1. What is a specific pointer?  For example, is '&d' is a pointer to a
    double?
2. How would unpacking a pointer to a Python Object work out?  Given an
    address how would the appropriate object to be unpacked be determined?
3. Can pointers be nested, e.g. '&&d' ?
4. For the 'X{}' format (pointer to a function), is this supposed to mean a
    Python function or a C function?


String Syntax
==========

The syntax seems to have transcended verbal description.  I think we
need to put forth a grammar.  There are also some questions regarding
nesting
levels and mixing specifiers that could perhaps be answered more clearly by
having a grammar:

   1. What nesting level can structures have? Arbitrary?
   2. The new array syntax claims "multi-dimensional array of whatever
follows".
      Truly whatever? Arrays of structures? Arrays of pointers?
   3. How do array specifiers and pointer specifiers mix?  For example,
      would '(2, 2)&d' be a two-by-two array of pointers to doubles?
      What about '&(2, 2)d'?  Is this a pointer to an two-by-two array of
      doubles?

An example grammar is contained in a diff against the PEP attached to this
mail.  NOTE:  I am *not* actually submitting a patch against the PEP.  This
was just the clearest way to present the example grammar.

Use Cases
========

   1. What are the real world use cases for these struct string extensions?
      These should be fleshed out and documented.


-- Meador
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100225/f272c6d1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pep-3118.diff
Type: application/octet-stream
Size: 7378 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100225/f272c6d1/attachment.obj>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4