Re: [Python-Dev] PEP: Adding data-type objects to Python
Travis E. Oliphant wrote: > It also bothers me that so many ways to describe binary data are > being used out there. This is a problem that deserves being solved. Is there a survey paper somewhere about binary formats? What formats are used in particle physics, bio-informatics, astronomy, etc? What software is used to read and write binary data? What descriptive languages are used for data (SQL, XML, etc)? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Repeated hangs during "make test"
CPython 3.3.0a2 (default, Apr 24 2012, 10:47:03) [GCC 4.4.5] Linux-2.6.32-5-amd64-x86_64-with-debian-6.0.4 little-endian Ran "make test". Hung during test_socket. Used CNTL-C to exit the test. test_ssl failed. Ran "./python -m test -v test_ssl". Test ok. Ran "./python -m test -v test_socket" which was ok. Ran "make test" again. Hung during test_concurrent_futures. Used CNTL-C to exit test_concurrent_futures. test_ssl failed. Ran "./python -m test -v test_ssl". Test ok. Ran "make test" a third time. Hung during test_io. Used CNTL-C to exit test_io. test_ssl failed. Ran "./python -m test -v test_ssl". Test ok. Did it again. Same behavior except the hang is in test_buffer. And again for test_httpservers. What is going on? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Debian wheezy, amd64: make not finding files for bz2 and other packages
I use up-to-date Debian testing (wheezy), amd64 architecture. I have made a "clone" of the developmental version of Python 3.3. "make -s -j3" prints: ... Python build finished, but the necessary bits to build these modules were not found: _bz2 _curses_curses_panel _dbm _gdbm _lzma _sqlite3 _ssl readline zlib To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _crypt nis [101752 refs] I looked into bz2. My system already contained the Debian packages libbz2-dev, libbz2-1.0, and bzip2. From the Debian website, I got the list of all the files in these three packages: Filelist of package libbz2-dev in wheezy of architecture amd64 /usr/include/bzlib.h /usr/lib/x86_64-linux-gnu/libbz2.a /usr/lib/x86_64-linux-gnu/libbz2.so /usr/share/doc/libbz2-dev Filelist of package libbz2-1.0 in wheezy of architecture amd64 /lib/x86_64-linux-gnu/libbz2.so.1 /lib/x86_64-linux-gnu/libbz2.so.1.0 /lib/x86_64-linux-gnu/libbz2.so.1.0.4 /usr/share/doc/libbz2-1.0/changelog.Debian.gz /usr/share/doc/libbz2-1.0/changelog.gz /usr/share/doc/libbz2-1.0/copyright Filelist of package bzip2 in wheezy of architecture amd64 /bin/bunzip2 /bin/bzcat /bin/bzcmp /bin/bzdiff /bin/bzegrep /bin/bzexe /bin/bzfgrep /bin/bzgrep /bin/bzip2 /bin/bzip2recover /bin/bzless /bin/bzmore /usr/share/doc/bzip2/changelog.Debian.gz /usr/share/doc/bzip2/changelog.gz /usr/share/doc/bzip2/copyright /usr/share/man/man1/bunzip2.1.gz /usr/share/man/man1/bzcat.1.gz /usr/share/man/man1/bzcmp.1.gz /usr/share/man/man1/bzdiff.1.gz /usr/share/man/man1/bzegrep.1.gz /usr/share/man/man1/bzexe.1.gz /usr/share/man/man1/bzfgrep.1.gz /usr/share/man/man1/bzgrep.1.gz /usr/share/man/man1/bzip2.1.gz /usr/share/man/man1/bzip2recover.1.gz /usr/share/man/man1/bzless.1.gz /usr/share/man/man1/bzmore.1.gz What is the problem? Does wheezy amd64 put files in unusual places? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Debian wheezy, amd64: make not finding files for bz2 and other packages
dpkg-architecture -qDEB_HOST_MULTIARCH gives x86_64-linux-gnu Installing dpkg-dev fixed the problem. Now both 3.3a3 and a developmental "clone" work. There is already a Debian package for 3.3 alpha3. See http://packages.debian.org/source/experimental/python3.3 A large diff for Debian Python is available at this url. The following should be installed before compiling python3. This list may be incomplete. This list may include unnecessary packages. dpkg-dev sharutils libreadline6-dev libreadline5 libncursesw5-dev libncursesw5 zlib1g-dev zlib1g libbz2-dev bzip2 liblzma-dev liblzma5 libgdbm-dev libgdbm3 libdb5.3-dev libdb5.3 tk8.5-dev tk8.5 blt-dev blt libssl-dev libssl1.0.0 libexpat1-dev libexpat1 libbluetooth-dev libbluetooth3 locales libsqlite3-dev libsqlite3 libffi-dev libffi5 libgpm2 libgpm-dev libtinfo-dev libtinfo5 mime-support netbase gdb xvfb xauth python-sphinx (Implemented in python 2) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Python 3.3 cannot find BeautifulSoup but Python 3.2 can
I use up-to-date Debian testing (wheezy), amd64 architecture. I compiled and installed Python 3.3.0 alpha 3 using "altinstall". Debian wheezy comes with python3.2 (and 2.6 and 2.7). I installed the Debian package python3-bs4 (BeautifulSoup). I also downloaded a "clone" developmental copy of 3.3. Python3.3a3 cannot find module bs4. Neither can the "clone". Python3.2 can find the module. Here is a session with the "clone": > ./python Python 3.3.0a3+ (default:10ccbb90a8e9, May 6 2012, 19:11:02) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import bs4 Traceback (most recent call last): File "", line 1, in File "", line 974, in _find_and_load ImportError: No module named 'bs4' [71413 refs] >>> What is the problem? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Python 3.3 cannot import BeautifulSoup but Python 3.2 can
I use up-to-date Debian testing (wheezy), amd64 architecture. I compiled and installed Python 3.3.0 alpha 3 using "altinstall". Debian wheezy comes with python3.2 (and 2.6 and 2.7). I installed the Debian package python3-bs4 (BeautifulSoup4 for Python3). I also downloaded a "clone" developmental copy of 3.3. Python3.3a3 cannot find module bs4. Neither can the "clone". Python3.2 can find the module. Here is a session with the "clone": > ./python Python 3.3.0a3+ (default:10ccbb90a8e9, May 6 2012, 19:11:02) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import bs4 Traceback (most recent call last): File "", line 1, in File "", line 974, in _find_and_load ImportError: No module named 'bs4' [71413 refs] >>> What is the problem? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] test_shutils.py fails for 2.4 install
I have a PC with an AMD cpu and Mandrake 10.1. While installing Python 2.4 "make test" failed in "test_shutils.py". Here is the output of "./python ./Lib/test/test_shutil.py": test_dont_copy_file_onto_link_to_itself (__main__.TestShutil) ... ok test_dont_move_dir_in_itself (__main__.TestShutil) ... ok test_on_error (__main__.TestShutil) ... FAIL test_rmtree_dont_delete_file (__main__.TestShutil) ... ok test_rmtree_errors (__main__.TestShutil) ... ok == FAIL: test_on_error (__main__.TestShutil) -- Traceback (most recent call last): File "./Lib/test/test_shutil.py", line 34, in test_on_error self.assertEqual(self.errorState, 2) AssertionError: 0 != 2 -- Ran 5 tests in 0.005s FAILED (failures=1) Traceback (most recent call last): File "./Lib/test/test_shutil.py", line 106, in ? test_main() File "./Lib/test/test_shutil.py", line 103, in test_main test_support.run_unittest(TestShutil) File "/usr/local/src/Python-2.4/Lib/test/test_support.py", line 290, in run_u run_suite(suite, testclass) File "/usr/local/src/Python-2.4/Lib/test/test_support.py", line 275, in run_s raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "./Lib/test/test_shutil.py", line 34, in test_on_error self.assertEqual(self.errorState, 2) AssertionError: 0 != 2 ___ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] RE: test_shutils.py fails for 2.4 install
The relevant bug appears to be 1076467 at SourceForge. ___ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Concurrency and Python
Today's Slashdot (http://slashdot.org/articles/05/01/07/158236.shtml?tid=137) points to: "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software" by Herb Sutter at "http://www.gotw.ca/publications/concurrency-ddj.htm";. Is Python a suitable language for concurrent programming? Should Python be a good language for concurrent programming? Python nicely satisfies several user needs now including teaching beginners, scripting, algorithm development, non time-critical code, and wrapping libraries. Which of these users will be needing concurrency? What is the state of programming theory for concurrency? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Exception needed: Not enough arguments to PyArg_ParseTuple
I had PyArg_ParseTuple(args, "s#s#i:compare", &p1, &bytes1, &p2, &bytes2) in a program. There are not enough arguments to PyArg_ParseTuple. Does PyArg_ParseTuple know how many arguments it is getting? If so, I suggest that an exception should be raised here. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Adding DBL_MANTISSA and such to Python
Recently I needed some information about the floating point numbers on my machine. So I wrote a tiny C99 program with the line printf("%a\n", DBL_EPSILON); The answer was "0x1p-52". A search of comp.lang.python shows that I was not alone. Here are some ideas. 1. Add to Python the constants in "float.h" and "limits.h". 2. Add the C99 "%a" format to the "%" operator for strings and allow it in floating point literals. 3. Add full "tostring" and "fromstring" capabilities for Python numeric types. "tostring(x)" would return a string containing the binary representation of x. For example, if x is a Python float, "tostring(x)" would have eight characters. "fromstring(s, atype)" does the reserve, so fromstring(tostring(x), type(x)) == x 4. Add some functions that process floating point types at a low level. I suggest borrowing from C (mantissa, exponent) = frexp(x) where mantissa is a float and exponent is an int. The mantissa can be 0.0 or 0.5 <= mantissa < 1.0. Also x = mamtissa * 2**exponent. If x == 0.0, the function returns (0.0, 0). (This is almost a quote from Harbison and Steele.) 5. Add the C99 constants and functions involving special floating point values: "FP_INFINITE", "FP_NAN", "FP_NORMAL", "FP_SUBNORMAL", "FP_ZERO", "fpclassify", "isfinite", "isinf", "isnan", "isnormal", "signbit", "copysign", "nan", "nextafter", and "nexttoward". There has been controversy about these in the past, but I am in favor of them. The documentation should discuss portability. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] defaultdict and on_missing()
Guido van Rossen wrote: > I think the pattern hasn't been commonly known; people have been > struggling with setdefault() all these years. I use setdefault _only_ to speed up the following code pattern: if akey not in somedict: somedict[akey] = list() somedict[akey].append(avalue) These lines of simple Python are much easier to read and write than somedict.setdefault(akey, list()).append(avalue) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Python Library Reference top page too long
The contents page for the Python Library Reference ("http://docs.python.org/dev/lib/lib.html";) has become much too long. I suggest that it should be designed like the top page for portal web sites. For example see "http://www.dmoz.org/";. I suggest that "lib.html" be replaced by "lib_index.html" and "lib_contents.html". The latter is the current "lib.html". "lib_index.html" should look something like: Front Matter Full Contents 1. Introduction 2. Built-in Objects functions, types, exceptions, constants 3. File and Directory Access open, file objects, os, os.path, ... 4. Generic Operating System Services os, time, optparse, ... 5. Python Runtime Services sys, __main__, __future__, ... 6. String Services type str, string, re, ... 7. Numeric and Mathematical Modules math, random, decimal, ... ... Both "lib_index.html" and "lib_contents.html" should be accessible from the top Python Documentation page. Here are two principles I feel would be useful to follow. References are to the Python 2.5 documentation at "http://docs.python.org/dev/lib/lib.html";. 1. Important, commonly used, or confusing modules should be near the top. The things I look up the most are os.path, os (files and directories), and string attributes. "sys" should also be near the top because of "sys.argv", "sys.stderr", and "sys.exit". Etc, etc. 2. Put cross-links everywhere. For example the documentation for built in function "file" has a link to "File Objects". There should also be a link to "open()" and to sections 13.1.2, 13.1.3, 13.1.4, and chapter 10. (What became of the often proposed and long overdue reorganization of "os"?) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Expose the array interface in Python 2.5?
"Travis E. Oliphant" <[EMAIL PROTECTED]> wrote: > It is very important for many people to get access to memory with some > description of how that memory should be interpreted as an array. > Several Python packages could benefit if Python had some notion of an > array interface that was at least supported in a duck-typing fashion. Which packages? Which people? Which constituencies? "Travis E. Oliphant" <[EMAIL PROTECTED]> also wrote: > My big quest is to get PIL, PyVox, WxPython, PyOpenGL, and so forth to > be able to use the same interface. Blessing the interface by > including it in the Python core would help. I'm also just wanting > people in py-dev to get the concept of an array interface on their > radar, as discussions of new bytes types emerges. I use PIL and numarray a lot. It would be nice if they used a common array format so I would not need to convert back and forth. But I survive quite well with the current arrangement. Many other packages besides PIL and Numeric / numarray / Numpy are involved here: byte, struct, ctypes, SWIG, PyTables, Psyco, PyPy, Pyrex, etc. There are some major issues that need to be dealt with which I will state concisely in an abstract way. A data structure without an API and thorough documentation is useless. Any proposal needs to include them from the very start. How should Python interact with low level data? By "low level data" I mean data as seen by C, C++, and FORTRAN as well as linear arrays of bytes. What changes in Python would make the packages listed above easier to write and use? Easier enough to write that the package owners would be willing to give up control of part of their packages. Does anyone know of any academic-type papers that have been written in the last few years on these matters? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] External Package Maintenance
Guido van Rossum wrote: > developers contributing code without wanting > to give up control are the problem. That hits the nail on the head. If something is added to the standard library, it becomes part of Python and must be controlled by whoever controls Python. Otherwise there will be chaos. If a developer puts his code into the standard library, it may or may not increase their status, ego, or income. Each developer must decide for himself. I suggest that the BDFL make a Pronouncement on this subject. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Switch statement
Python is a beautiful simple language with a rich standard library. Python has done fine without a switch statement up to now. Guido left it out of the original language for some reason (my guess is simplicity). Why is it needed now? What would be added next: do while or goto? The urge to add syntax should be resisted unless there is a high payoff (such as yield). There are much better ways for the developers to spend their time and energy (refactoring os comes to mind). Please keep Python simple. -1 on the switch statement. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] C api for built-in type set?
Is there a C API for the built-in type set? if not, why not? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] String exceptions in Python source
/usr/local/src/Python-2.4.1/Lib/SimpleXMLRPCServer.py: raise 'bad method' /usr/local/src/Python-2.4.1/Demo/classes/bitvec.py: raise 'FATAL', '(param, l) = %r' % ((param, l),) /usr/local/src/Python-2.4.1/Lib/plat-mac/FrameWork.py: raise 'Unsupported in MachoPython' /usr/local/src/Python-2.4.1/Lib/plat-mac/FrameWork.py: raise 'Can only delete last item of a menu' /usr/local/src/Python-2.4.1/Lib/plat-mac/MiniAEFrame.py: raise 'Cannot happen: AE callback without handler', (_class, _type) /usr/local/src/Python-2.4.1/Lib/plat-mac/PixMapWrapper.py: raise 'UseErr', "don't assign to .baseAddr -- assign to .data instead" /usr/local/src/Python-2.4.1/Lib/plat-mac/argvemulator.py: raise 'Cannot happen: AE callback without handler', (_class, _type) /usr/local/src/Python-2.4.1/Mac/Modules/waste/wastescan.py: raise 'Error: not found: %s', WASTEDIR /usr/local/src/Python-2.4.1/Mac/Tools/IDE/PyDebugger.py: raise 'spam' (3 times) /usr/local/src/Python-2.4.1/Mac/Tools/macfreeze/macfreeze.py: raise 'unknown gentype', gentype /usr/local/src/Python-2.4.1/Mac/Tools/macfreeze/macfreezegui.py: raise 'Error in gentype', gentype ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] PyTuple_Pack added references undocumented
According to the source code, PyTuple_Pack returns a new reference (it calls PyTuple_New). It also Py_INCREF's all the objects in the new tuple. Is this unusual behavior? None of these added references are documented in the API Reference Manual. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Example for "property" violates "Python is not a one pass compiler"
Here is an example from the "Python Library Reference", Section 2.1 "Built-in Functions": class C(object): def getx(self): return self.__x def setx(self, value): self.__x = value def delx(self): del self.__x x = property(getx, setx, delx, "I'm the 'x' property.") It works. But if I put the property statement first: class C(object): x = property(getx, setx, delx, "I'm the 'x' property.") def getx(self): return self.__x def setx(self, value): self.__x = value def delx(self): del self.__x I get the error: NameError: name 'getx' is not defined Does this violate the principle "Python is not a one pass compiler"? Normally I can use any method of a class anywhere in the definition of the class. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Adding a conditional expression in Py3.0
Guido van Rossum wrote: file = os.path.abspath(file) if file else '?' ... These are all unreadable. In C "a ? b : c" is not used very often. A quick check of the Python source found 476 occurences. -1 to conditional expressions. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] yield back-and-forth?
Guido van Rossum <[EMAIL PROTECTED]> wrote: The discussion about PEP 343 reminds me of the following. Bram Cohen pointed out in private email that, before PEP 342, there wasn't a big need for a shortcut to pass control to a "sub-generator" because the following for-loop works well enough: def main_generator(): ... for value in sub_generator(): yield value This is an important programming trick. It allows recursive use of generators for walking trees, etc. See the source code for os.walk for an example. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com