Re: PEP 382: Namespace Packages

2009-04-16 Thread Martin v. Löwis
> I've maybe missed some point, but doesn't the PEP requires > coordination so that *.pkg files have different names in each portion, > and the same if one want to provide a non empty __init__.py. To some degree, coordination is necessary. However, the PEP recommends that you use .pkg as the name;

Re: Interest in generational GC for Python

2009-04-19 Thread Martin v. Löwis
> Is there any interest in generational garbage collection in Python these days > ? > > Anyone working on it ? This is the time machine at work: the garbage collector in CPython *is* generational (with three generations). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Interest in generational GC for Python

2009-04-20 Thread Martin v. Löwis
> I'm lost there. Isn't CPython using reference counting (i.e updating the > object's state at each reference creation/deletion, and deleting the > objects as soon as they have no more references to them) ? It seemed to > me that generational GC only applied to periodic GCs, like tracing > garbage

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Martin v. Löwis
> Are they widespread? I haven't noticed, yet. > > I prefer to write it explicitly: > > if len(lst) > 0: I prefer to test explicitly for the truth value of the list. I don't want to test whether the length of the list is greater than 0 (in fact, I don't care about the length property of the list

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Martin v. Löwis
>> I don't want to test whether the length of the list >> is greater than 0 [...] - I want to know whether the >> list is empty (or not empty). > > I fail to see the difference between "length greater than 0" > and "list is not empty". They are, by definition, the same > thing, aren't they? Yes,

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Martin v. Löwis
>> I prefer to write it explicitly: >> >> if len(lst) > 0: >>... > > At the very least, IMO you should write this as > > if len(lst): > ... > > There's no reason to be explicit about the numeric comparison. I think in the mind-set that dislikes relying on boolean conversion of lists, re

PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-21 Thread Martin v. Löwis
I'm proposing the following PEP for inclusion into Python 3.1. Please comment. Regards, Martin PEP: 383 Title: Non-decodable Bytes in System Character Interfaces Version: $Revision: 71793 $ Last-Modified: $Date: 2009-04-22 08:42:06 +0200 (Mi, 22. Apr 2009) $ Author: Martin v. Löwis S

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-22 Thread Martin v. Löwis
> "correct" -> "corrected" Thanks, fixed. >> To convert non-decodable bytes, a new error handler "python-escape" is >> introduced, which decodes non-decodable bytes using into a private-use >> character U+F01xx, which is believed to not conflict with private-use >> characters that currently exist

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-22 Thread Martin v. Löwis
MRAB wrote: > Martin v. Löwis wrote: > [snip] >> To convert non-decodable bytes, a new error handler "python-escape" is >> introduced, which decodes non-decodable bytes using into a private-use >> character U+F01xx, which is believed to not conflict with privat

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-22 Thread Martin v. Löwis
>> The python-escape codec is only used/meaningful if the env encoding >> is not UTF-8. For any other encoding, it is assumed that no character >> actually maps to the private-use characters. > > Which should be true for any encoding from the pre-unicode era, but not > for UTF-16/32 and variants.

Re: and [True,True] --> [True, True]?????

2009-04-24 Thread Martin v. Löwis
>> Of course dicts and sets are sequences. But there are also sequences >> on which len doesn't work. > > That was my intuition, too. But Python takes a different stance: It's a sequence if it can be indexed by numbers in range(len(seq)). Neither dicts nor sets can be indexed that way. Regards

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-24 Thread Martin v. Löwis
> Why not use U+DCxx for non-UTF-8 encodings too? I thought of that, and was tricked into believing that only U+DC8x is a half surrogate. Now I see that you are right, and have fixed the PEP accordingly. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
>>> Ok... Then what's pythonic? Please give a pythonic implementation... >> Use the builtin a==b, similar to (equal a b) > > But how about extensibility? == is extensible. To compare two things for equality, use ==. This is what Carl Banks referred in his original posting. You just *don'

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> I don't get that impression from Lisp programmers. I observe a phenomenon on language fanatics, no matter what language, but in particular for the less-than-mainstream language: the desire to formulate trivial algorithms over and over again, just to enjoy the beauty of the result (and sometimes

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> A practical example: I have lists that contain strings, but I want > to compare them in an case-insensitive way... I'd claim that this is still theoretical: what are these strings, and why do you have lists of them that you want to compare? Why don't you try to lower-case the strings in the

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Martin v. Löwis
Cameron Simpson wrote: > On 22Apr2009 08:50, Martin v. Löwis wrote: > | File names, environment variables, and command line arguments are > | defined as being character data in POSIX; > > Specific citation please? I'd like to check the specifics of this. For example, on e

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Martin v. Löwis
> If the bytes are mapped to single half surrogate codes instead of the > normal pairs (low+high), then I can see that decoding could never be > ambiguous and encoding could produce the original bytes. I was confused by Markus Kuhn's original UTF-8b specification. I have now changed the PEP to avo

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread Martin v. Löwis
> Indeed the example I've given is purely theoretical. But still, I > could find a use case for such a thing: just imagine we are building a > small shell-like application that reads one line (the commands), > splits it by spaces and always expects to have 4 elements and that > each respects a

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Martin v. Löwis
> From your comments I understand that the only problem with my code > proposal are the function names... No, the problem is that you are using way too many functions, that do too little. The problem with that is then that you have to give names to all the functions, which then find people dif

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Martin v. Löwis
> So if I'm reading right you are saying something in the lines: > "using too many functions is bad just because it is unreadable and > non-understandable to average (could I say mediocre?) programmers"... No, this style is also unreadable to advanced programmers, in particular when you fail t

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-26 Thread Martin v. Löwis
> How about another str-like type, a sequence of char-or-bytes? That would be a different PEP. I personally like my own proposal more, but feel free to propose something different. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 382: Namespace Packages

2009-04-29 Thread Martin v. Löwis
syt wrote: > Another point: I don't like .pth, .pkg files. Isn't this pep an opportunity > to at least unify them? Can you propose a unification? I'm concerned that if I propose one, you may still not like it. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Silent install of Python software(2.5) for windows.

2009-04-29 Thread Martin v. Löwis
> Is it possible to "automate" the installation of python software(2.5) > without the need of pressing "Next" so many times? See http://www.python.org/download/releases/2.5/msi/ Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing Python 2.5.4 from Source under Windows

2009-04-29 Thread Martin v. Löwis
> I have looked and looked and looked. But I can not find any directions > > on how to install the version of Python build using Microsoft's > compiler. It builds. I get the dlls and the exe's. But there is no > documentation that says how to install what has been built. I have read > every readme

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-29 Thread Martin v. Löwis
> How do get a printable unicode version of these path strings if they > contain none unicode data? Define "printable". One way would be to use a regular expression, replacing all codes in a certain range with a question mark. > I'm guessing that an app has to understand that filenames come in tw

Re: Python SocketServer with IPv6

2009-04-29 Thread Martin v. Löwis
> I am working on a overlay network implementation with python. I need > to use both IPv4 and IPv6 at each node. Python socketserver is being > used for this task. can anybody pls suggest me how to input an IPv6 > address to the socketserver. I'm not quite sure I understand the question, so here i

Re: decode command line parameters - recomendend way

2009-04-30 Thread Martin v. Löwis
> I want add full Unicode support in my scripts. Now I have encoutered > theoretical > problem with command line parameters. I can't find anything in that mater. But > I develop solution which seems to work. Question is: Is it recommendend way to > decode command line parameters: > > lFileConfig

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Martin v. Löwis
>>> How do get a printable unicode version of these path strings if they >>> contain none unicode data? >> >> Define "printable". One way would be to use a regular expression, >> replacing all codes in a certain range with a question mark. > > What I mean by printable is that the string must be va

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-01 Thread Martin v. Löwis
> In either of the proposals on the table, what code would I write and > where to have a base package with a set of add-on packages? I don't quite understand the question. Why would you want to write code (except for the code that actually is in the packages)? PEP 382 is completely declarative -

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-01 Thread Martin v. Löwis
>>> In either of the proposals on the table, what code would I write and >>> where to have a base package with a set of add-on packages? >> >> I don't quite understand the question. Why would you want to write code >> (except for the code that actually is in the packages)? >> >> PEP 382 is complete

Re: Warning of missing side effects

2009-05-02 Thread Martin v. Löwis
> But I'm used to exploiting side effect, and sometimes forget this rule > in my own classes. IS THERE A WAY to have the following produce a > runtime error? > >def f(): > x = 5 > # no return > >y = f() Typically, this will produce a runtime error fairly quickly, namely whe

Re: Convert variable directly into a string (no ASCII)

2009-05-02 Thread Martin v. Löwis
> I need to print variables out over serial, however I need them to not be > in ASCII, ie if the variable is 5 then print 5 not "5". > > The function that writes to the serial port requires a string and I can > send non-variables out with the string "/x05" for 5. > > Is this even possible? So yo

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Martin v. Löwis
>> Ok, so create three tar files: >> >> 1. base.tar, containing >> >>simplistix/ >>simplistix/__init__.py > > So this __init__.py can have code in it? That's the point, yes. > And base.tar can have other modules and subpackages in it? Certainly, yes. > What happens if the base and an

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Martin v. Löwis
Zooko O'Whielacronx wrote: > .pth files are why I can't easily use GNU stow with easy_install. > If installing a Python package involved writing new files into the > filesystem, but did not require reading, updating, and re-writing any > extant files such as .pth files, then GNU stow would Just Wor

Re: [Python-Dev] PEP 382: little help for stupid people?

2009-05-09 Thread Martin v. Löwis
Chris Withers wrote: > Martin v. Löwis wrote: >>> So this __init__.py can have code in it? >> >> That's the point, yes. >> >>> And base.tar can have other modules and subpackages in it? >> >> Certainly, yes. > > Great, when is the

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Martin v. Löwis
>> If you always use --single-version-externally-managed with easy_install, >> it will stop editing .pth files on installation. > > It's --multi-version (-m) that does that. > --single-version-externally-managed is a "setup.py install" option. > > Both have the effect of not editing .pth files,

Re: Help needed with filenames

2009-05-10 Thread Martin v. Löwis
> Can anyone tell me what I should be doing here? The console uses the "OEM code page". The Windows conversion routine from Unicode to the OEM code page provides the lossy conversion that you observe in listing. Unfortunately, the OEM code page conversion is not available from Python. What you ca

Re: [Python-Dev] .pth files are evil

2009-05-10 Thread Martin v. Löwis
> GNU stow does handle these issues. If GNU stow solves all your problems, why do you want to use easy_install in the first place? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: how GNU stow is complementary rather than alternative to distutils

2009-05-10 Thread Martin v. Löwis
Zooko Wilcox-O'Hearn wrote: > On May 10, 2009, at 11:18 AM, Martin v. Löwis wrote: > >> If GNU stow solves all your problems, why do you want to use >> easy_install in the first place? > > That's a good question. The answer is that there are two separate jobs:

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread Martin v. Löwis
> lol - so simple... > > Thankfully, we got a quick answer by the package writing master himself.. > > but imho - package installation shouldn't be that tricky.. it should be > click and shoot... which is what i'm working on doing.. > > I have to say that I don't mind being corrected because I

Re: Configure options for minimal Python 2.6

2009-05-15 Thread Martin v. Löwis
> I want to compile a minimal Python 2.6 for Debian Etch without support > for optional features such as tk and sphinx. The configure script's > help says that features can be disabled with an '--without-PACKAGE', so > I guess disabling tk is '--without-tk', but where is there a list of the > feat

PEP 384: Defining a Stable ABI

2009-05-17 Thread Martin v. Löwis
Thomas Wouters reminded me of a long-standing idea; I finally found the time to write it down. Please comment! Regards, Martin PEP: 384 Title: Defining a Stable ABI Version: $Revision: 72754 $ Last-Modified: $Date: 2009-05-17 21:14:52 +0200 (So, 17. Mai 2009) $ Author: Martin v. Löwis Status

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-17 Thread Martin v. Löwis
>> Functions declared in the following header files are not part >> of the ABI: >> - cellobject.h >> - classobject.h >> - code.h >> - frameobject.h >> - funcobject.h >> - genobject.h >> - pyarena.h >> - pydebug.h >> - symtable.h >> - token.h >> - traceback.h > > What kind of effect does this have

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-17 Thread Martin v. Löwis
Dirkjan Ochtman wrote: > On Mon, May 18, 2009 at 12:07 AM, "Martin v. Löwis" > wrote: >> I fail to see the relationship, so: no effect that I can see. >> >> Why do you think that optimization efforts could be related to >> the PEP 384 proposal? > &

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-17 Thread Martin v. Löwis
Dino Viehland wrote: > Dirkjan Ochtman wrote: >> It would seem to me that optimizations are likely to require data >> structure changes, for exactly the kind of core data structures that >> you're talking about locking down. But that's just a high-level view, >> I might be wrong. >> > > > In part

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-17 Thread Martin v. Löwis
>>> It also might make it easier for alternate implementations to support >>> the same API so some modules could work cross implementation - but I >>> suspect that's a non-goal of this PEP :). >>> >> >> Indeed :-) I'm also skeptical that this would actually allow >> cross-implementation module

Re: Which C compiler?

2009-05-18 Thread Martin v. Löwis
Jive Dadson wrote: > I am using Python 2.4. I need to make a native Python extension for > Windows XP. I have both VC++ 6.0 and Visual C++ 2005 Express Edition. > Will VC++ 6.0 do the trick? That would be easier for me, because the > project is written for that one. If not, will the 2005 compil

Re: Determining 32 bit vs 64 bit Python and numpy

2009-05-25 Thread Martin v. Löwis
> I am looking for a robust, cross-platform way to determine if I am on a > 32 bit or a 64 bit Python and if the numpy installation is also 32 bit > or 64 bit. You can find out the size of a pointer with struct.calcsize("P") * 8. Numpy will have the same configuration if you can import it. Regard

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-26 Thread Martin v. Löwis
> Now, with the PEP, I have a feeling that the Python C-API > will in effect be limited to what's in the PEP's idea of > a usable ABI and open up the non-inluded public C-APIs > to the same rate of change as the private APIs. That's certainly not the plan. Instead, the plan is to have a stable ABI

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-26 Thread Martin v. Löwis
Functions declared in the following header files are not part of the ABI: - cellobject.h - classobject.h - code.h - frameobject.h - funcobject.h - genobject.h - pyarena.h - pydebug.h - symtable.h - token.h - traceback.h >>> I don't th

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-05-28 Thread Martin v. Löwis
> I think the problem is it should be built with v9.S for 64-bit, not > v8.S. Is that correct? If so, how do I get it to use the right one? The Solaris dynamic loader can't find it. Set LD_LIBRARY_PATH or LD_RUN_PATH appropriately, or use crle(8). Regards, Martin -- http://mail.python.org/mail

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-05-29 Thread Martin v. Löwis
>>> I think the problem is it should be built with v9.S for 64-bit, not >>> v8.S. Is that correct? If so, how do I get it to use the right one? >> The Solaris dynamic loader can't find it. Set LD_LIBRARY_PATH or >> LD_RUN_PATH appropriately, or use crle(8). >> > I'm not sure I understand. It app

Re: Python 2.6 for Windows 64-bit AMD

2009-05-30 Thread Martin v. Löwis
> Can anyone shed any light on what's up with this build of Python > 2.6.2? You probably tried to install the 32-bit version of PyParsing; this cannot work with the 64-bit version of Python. You either need to obtain a 64-bit version of pyparsing, or install the 32-bit version of Python. HTH, Mar

Re: Building PIL under Cygwin & Python 2.5

2009-06-01 Thread Martin v. Löwis
> I think this is an issue that probably needs to be addressed by PIL > maintainers that fully understand the root of the problem (and it > should probably go in the PIL FAQ), but in the meantime does anyone > out there know how to get around this issue? Why do you need to use Cygwin Python? Rega

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-06-01 Thread Martin v. Löwis
> Ok, so it looks like the only option here is to use LD_LIBRARY_PATH. Not really: there is also crle, and LD_RUN_PATH. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing 3.1 questions

2009-06-01 Thread Martin v. Löwis
> Seems to work, but I'd like to know where Python installs its items. I'm > wanting to test version 3.1 and downloaded the 'Bzipped source tar ball' > file (not sure of the difference between it and the 'Gzipped' one). Do I > need to run some sort of 'install' command from the Terminal to get

Re: Missing codecs in Python 3.0

2009-06-02 Thread Martin v. Löwis
samwyse wrote: > I have a Python 2.6 program (a code generator, actually) that tries > several methods of compressing a string and chooses the most compact. > It then writes out something like this: > { encoding='bz2_codec', data = '...'} > > I'm having two problems converting this to Py3. Firs

Re: Problem building 64-bit python 2.6.2 on Solaris 10

2009-06-03 Thread Martin v. Löwis
> I was able to compile ctypes with gcc4sparc without many changes to > the CFLAGS, etc. I had another weird error, but upgrading to the > latest gcc4sparc fixed it. One thing I'm not clear about is how > extensions are built. I noticed that my CFLAGS are not being passed > to gcc when building

Re: FILE object in Python3.0 extension modules

2009-06-03 Thread Martin v. Löwis
> The purpose is to dump the contents of a Python extension type to disk > as binary data using C's fwrite() function. This isn't really possible anymore - the Python IO library has stopped using stdio. There are a couple of alternatives: 1. don't use fwrite(3) to write the binary data, but inste

Re: How to get a window ID in linux using python?

2009-06-03 Thread Martin v. Löwis
> In Linux, we can get window info by executing 'xwininfo' and then > selecting the desired window manually. Can this be done automatically > in python? You can run "xwininfo -tree -root", and then parse the output. HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE 3.0a5 has problems with Unicode

2008-05-11 Thread Martin v. Löwis
> Is this a known bug if IDLE 3.0a5 which will be fixed in the final > release? No, it's now a known bug (at least I don't know it). Whether or not it gets fixed might depend on whether or not it gets reported to bugs.python.org. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-l

Re: Compiling Python using Microsoft Visual C++ 2008

2008-05-12 Thread Martin v. Löwis
> 1.I have both 2.5 and 2.6 but both appear, under Recent Projects, as > pcbuild. It would be helpful if the Python Version could be indicated. Hover over the link, and it will display the full path, which you can then infer to reason about the specific copy of Python you are using. In any case,

Re: Compiling Python using Microsoft Visual C++ 2008

2008-05-12 Thread Martin v. Löwis
>> See PCbuild/readme.txt. > > I presume that this is PCbuild8.txt As Christian says: PCbuild/readme.txt are the correct instructions (and had been since Python 2.0 or so). > Now, I would like to remove Python 2.5 from VS 2008 but see no obvious > way of getting rid of it. You might be able to

Re: Learning Python for no reason

2008-05-12 Thread Martin v. Löwis
> Hopefully this question even makes sense! I completely agree that you don't need to spend time on learning a language if you don't plan on using it; I'll leave alone the entire discussion of doing things for fun only (you don't *need* to eat ice cream, either - right?) OTOH: do you plan to do

Re: Cannot run Python 3.0a5 )-:

2008-05-12 Thread Martin v. Löwis
> Hi, I just tried to install Python 3.0a5 an another Windows PC. I did > what I have done yesterday at home: > > 1. Downloaded the daily snapshot > http://svn.python.org/snapshots/msi/python-3.0.14011.msi > 2. Installed to C:\Python30 > 3. Added C:\Python30 to the Path environment for all users.

Re: py3k concerns. An example

2008-05-12 Thread Martin v. Löwis
> Well, my concerns about 3.0 continue to be founded. Up until now I > have been just reading "What's New" docs, and relying on input from > others as to what changes I will have to make. Yesterday I downloaded > and installed 3.0a5, and it is clear that there is *no* way to have a > single code

Re: Python and Flaming Thunder

2008-05-13 Thread Andrii V. Mishkovskyi
You sound like a commercial. Is this your way of attracting costumers of FT? 2008/5/13 Dave Parker <[EMAIL PROTECTED]>: > > 5-10 times faster for what kind of code? > > Mostly numerical analysis and CGI scripting. All of Flaming Thunder's > library code is in assembly language, and Flaming Thun

Re: built in list generator?

2008-05-14 Thread Andrii V. Mishkovskyi
2008/5/14 Ethan Furman <[EMAIL PROTECTED]>: > > Ben Finney wrote: > > > Subject: Re: built in list generator? > > From: Ben Finney <[EMAIL PROTECTED]> > > Date: Wed, 14 May 2008 09:43:43 +1000 > > To: python-list@python.org > > To: python-list@python.org > > Newsgroups: comp.lang.python > > "Diez

Re: help compiling Python on vs 2008!

2008-05-17 Thread Martin v. Löwis
> VS2005 seems to be officially supported. That impression is incorrect. There is the PCbuild8 directory, but it isn't maintained or tested in a systematic way. Users of it may need to adjust it before it can do something useful. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-l

Re: morning in Python

2008-05-18 Thread Martin v. Löwis
> Full day later, I think it, to emphasize state, would prioritize > context. The reason for the huge ramble was, believe it or not, > namespace conflict... as though any other states around here might > nose in. I think the namespace conflict is rather in cities than in states. For example, ther

Re: Access to sysctl on FreeBSD?

2008-05-20 Thread Martin v. Löwis
> How do I access the sysctl(3) call from Python on BSD? > > Specifically I want to retrieve: > > $ sysctl -d net.inet.ip.stats > net.inet.ip.stats: IP statistics (struct ipstat, netinet/ip_var.h) > > So I'll need some way of getting to struct ipstat from Python as well At the moment, only thro

Re: array of 64-bit ints?

2008-05-23 Thread Martin v. Löwis
> Is it possible to have an array of 64-bit-ints using the standard Python > array module? On my 64-bit architecture (AMD64, MSVC), both "int" and > "long int" are 32 bit integers. To declare 64-bit ints, one needs either > "long long int" or "size_t". However, according to the Python array

Re: Python is slow

2008-05-23 Thread Andrii V. Mishkovskyi
2008/5/22 cm_gui <[EMAIL PROTECTED]>: > Python is slow.Almost all of the web applications written in > Python are slow. Zope/Plone is slow, sloow, so very slooow. Even > Google Apps is not faster. Neither is Youtube. > Facebook and Wikipedia (Mediawiki), written in PHP, are so much faster

Re: Reloading function obtained via 'from xxx import yyy'

2008-05-23 Thread Martin v. Löwis
> ...and I'd like to reload testFunc. How do I do so? 'from test import > testFunc' keeps the old definition around, and 'reload test' of course > doesn't > work becayse I didn't use 'import test' in the first place. Try all three of them, in sequence: import test reload(test) from test impo

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Martin v. Löwis
> I guess, Apache does some kind of memory caching for files, which are often > requested and small enough to fit into the system memory. Are you sure about this? I could not find anything in the documentation (other than mod_cache and friends, which is an unrelated functionality). Also, I don't

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Martin v. Löwis
>>> I guess, Apache does some kind of memory caching for files, which are often >>> requested and small enough to fit into the system memory. May be, that's >>> what the OP is referring to ... > >> I'm not aware of that, and I even more seriously doubt it. Because >> caching is a complicated, do

Re: Unicode lists and join (python 2.2.3)

2008-05-25 Thread Martin v. Löwis
> x = [u"\xeeabc2:xyz", u"abc3:123"] > u = "\xe7abc" u is not a Unicode string. > x.append("%s:%s" % ("xfasfs", u)) so what you append is not a Unicode string, either. > x.append(u"Hello:afddfdsfa") > > y = u'\n'.join(x) As a consequence, .join tries to convert the byte st

Re: set partition question

2008-05-25 Thread Martin v. Löwis
> s0 = set([1]) > s1 = set([1,2]) > s2 = set([2]) > S = set([s0,s1,s2]) > one answer we're searching for is s0 = s1 - s2 > > There may be arbitrarily many set elements (denoted by integers > 1,2,3,...) and arbitrarily many combinations of the elements composing > the sets s_i (s0, s1, ...). We can

Re: 22.800000 and a 1 on the end!!??

2008-05-25 Thread Martin v. Löwis
> ok where does the 1 in the come from? http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: set partition question

2008-05-25 Thread Martin v. Löwis
> There may be arbitrarily many set elements (denoted by integers > 1,2,3,...), arbitrarily many combinations of the elements composing > the sets s_i (s0, s1, ...). We can use any of python's set operations > or combination of those operations. That still allows for trivial solutions: Given s0,

Re: UTF-8 and stdin/stdout?

2008-05-28 Thread Martin v. Löwis
> $ cat utf8_from_stdin.py > import sys > data = sys.stdin.read() > print "length of data =", len(data) sys.stdin is a byte stream in Python 2, not a character stream. To make it a character stream, do sys.stdin = codecs.getreader("utf-8")(sys.stdin) HTH, Martin -- http:/

Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

2008-05-30 Thread Martin v. Löwis
>> File >> "/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py", >> line 281, in execute >> sql = unicode(sql, self.Encoding) >> LookupError: unknown encoding: utf_8_euro > > At the application (DABO) mailing list, they have pointed that this has > to be a Python i

Re: Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

2008-05-30 Thread Martin v. Löwis
> The function first normalizes the "@" away and then looks for it. Is that > the expected behaviour? I believe this functionality is broken by design. Python can't possibly know correctly what each locale name on each system means, and what encoding is used in the locale. Instead, the system's A

Re: python, dlls, and multiple instances

2008-06-01 Thread Martin v. Löwis
> Is it a correct to assume that you can use multiple instances of > python altogether if each is loaded from a separate dll? For instance, > if I write a couple of dll/so libs, and each has python statically > linked in, is it safe to assume that since dlls use their own address > space DLLs don'

Re: ValueError: unknown locale: UTF-8

2008-06-01 Thread Martin v. Löwis
> ValueError: unknown locale: UTF-8 > > This is on open bug or is there more to it? Do you have an environment variable set who is named either LANG or starts with LC_? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: unknown locale: UTF-8

2008-06-02 Thread Martin v. Löwis
> Actually, yes: > > LC_CTYPE=UTF-8 > > where is it coming from? This is basically on a clean new machine... > who might be setting it? There are many possible places. grep in your Library, as a starting point. As on Macintosh lists. > It is coming from a program elsewhere on the > system? How

Re: robotparser behavior on 403 (Forbidden) robot.txt files

2008-06-02 Thread Martin v. Löwis
> I just discovered that the "robotparser" module interprets > a 403 ("Forbidden") status on a "robots.txt" file as meaning > "all access disallowed". That's unexpected behavior. That's specified in the "norobots RFC": http://www.robotstxt.org/norobots-rfc.txt - On server response indicating a

Re: Ideas for master's thesis

2008-06-03 Thread Andrii V. Mishkovskyi
2008/6/4 Larry Bugbee <[EMAIL PROTECTED]>: >> I would like to do something with this language, yet >> I don't know if there are any needs/science fields, that could be used >> as a basis for a thesis. > > Personally, I'd like to see *optional* data typing added to Python > perhaps along the lines o

Re: How to make py2.5 distutil to use VC2005?

2008-06-05 Thread Martin v. Löwis
> I really really wonder how to *force* distutil to use my specified compile. > eg: (pseudo) You need to make sure that both MSSdk and DISTUTILS_USE_SDK are set, see http://docs.python.org/dist/module-distutils.msvccompiler.html Regards, Martin -- http://mail.python.org/mailman/listinfo/python-l

time.clock() or Windows bug?

2008-06-08 Thread Theo v. Werkhoven
hi, In this code I read out an instrument during a user determined period, and save the relative time of the sample (since the start of the test) and the readback value in a csv file. #v+ from datetime import * from time import * from visa import * from random import * [..] for Reading in range

Re: time.clock() or Windows bug?

2008-06-08 Thread Theo v. Werkhoven
The carbonbased lifeform Nick Craig-Wood inspired comp.lang.python with: > Theo v. Werkhoven <[EMAIL PROTECTED]> wrote: >> Output: >> Sample 1, at 0.0 seconds from start; Output power is: 8.967 dBm > [snip] >> Sample 17, at 105.7 seconds from start; Output power i

Re: Cannot install python under Win32

2008-06-10 Thread Martin v. Löwis
e installer with msiexec /i /l*v py.log, then study py.log to find out what went wrong. Are you by any chance running the installer from a SUBSTed drive? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot install python under Win32

2008-06-10 Thread Martin v. Löwis
> DEBUG: Error 2356: Couldn't locate cabinet in stream: python. That sounds bad indeed. In the original file, that stream is definitely present, so most likely, you experienced a corruption in download. Please check the md5 sum of the MSI file; if it differs, download again (preferably using a di

Re: time.clock() or Windows bug?

2008-06-12 Thread Theo v. Werkhoven
The carbonbased lifeform Tim Roberts inspired comp.lang.python with: > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> >>Hmmm, 10,000,000 cycles (40 ms @2.5GHz) is nowhere near the ~90,000 >>second jump in time.clock() output reported by the OP. I wonder if >>there could be a different cause? > > Ju

Re: Making wxPython a standard module?

2008-06-12 Thread Martin v. Löwis
> Just out of curiosity, what are the chances of this happening (sort of like > what happened with sqlite)? As a starting point, the author(s) of wxPython would need to contribute it to Python (and then also give the PSF the permission to relicense it). If no such contribution is made, chances ar

Re: python compilation on macosx with icc

2008-06-13 Thread Martin v. Löwis
> checking for wchar.h... yes > checking for wchar_t... yes > checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) > > what can I do ? Read config.log. If that doesn't help, use gcc. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Was the move to Python 2.0 as big a deal?

2008-06-14 Thread Martin v. Löwis
> Just curious if people put up any resistance to 2.0 like some people do > for 3.0. IIRC, yes, it was. People have continued to use Python 1.5.2 afterwards for several years. > Was it as big of a change in the language, or was the > transition smoother? The changes were significantly smaller,

Re: bpython - fancy Python shell

2008-06-15 Thread Andrii V. Mishkovskyi
2008/6/15, Bob Farrell <[EMAIL PROTECTED]>: > > I released this a while ago but did some work recently to fix some bugs > so I thought I may as well post it here. To quickly summarise: > In-line syntax highlighting > Auto complete with suggestions as you type > Pastebin stuff, save to file > "Rewin

Re: Making wxPython a standard module?

2008-06-15 Thread Martin v. Löwis
> I know there must be at least a few very solid answers to this, but, > just to hear it from the Pythonistas: Why can't there be several GUI > toolkits on the standard library? Why do you think there can't be several GUI toolkits in the standard library? There is nothing that prohibits such a thi

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-16 Thread Martin v. Löwis
> ``odict.byindex(index)`` > > Index-based lookup is supported by ``byindex()`` which returns > the key/value pair for an index, that is, the "position" of a > key in the ordered dict. 0 is the first key/value pair, -1 > the last. > > >>> d.byindex(2)

<    15   16   17   18   19   20   21   22   23   24   >