Re: Clarifications on compiling for Windows

2010-01-09 Thread Martin v. Loewis
> First of all, is the Windows FAQ fairly up to date? Fairly, yes. > Should people be > referring to section 6 if they are going to build an application with > an embedded Python interpreter? I think that's very selective in its view of problems - why would I be using SWIG, for example? (yet the

Re: sys.stdout vs. sys.stderr

2010-01-11 Thread Martin v. Loewis
> In Python 3.1 is there any difference in the buffering behavior of the > initial sys.stdout and sys.stderr streams? No. > Were they different at some earlier point in Python's evolution? That depends on the operating system. These used to be whatever the C library set up as stdout and stderr.

[ANN] Python 2.5.5 Release Candidate 1.

2010-01-14 Thread Martin v. Löwis
Enjoy this release, Martin Martin v. Loewis mar...@v.loewis.de Python Release Manager (on behalf of the entire python-dev team) -- http://mail.python.org/mailman/listinfo/python-list

Re: Executable standalone *.pyc after inserting "#!/usr/bin/python" or other options

2010-01-14 Thread Martin v. Loewis
> I've been playing with "Lua" and found something really cool that I'm > unable to do in "Python". With "Lua", a script can be compiled to byte > code using "luac" and by adding "#!/usr/bin/lua" at the top of the > binary, the byte code becomes a single file executable. After I found > this trick,

Re: Executable standalone *.pyc after inserting "#!/usr/bin/python" or other options

2010-01-14 Thread Martin v. Loewis
> This works great! Do you or anyone else have information on how to do > the same thing for Windows and/or Solaris. On Windows, just associate the .pyc extension with Python - the standard installation will already do that. On Solaris, I don't think something like this is supported. Regards, Ma

Re: Unicode and dictionaries

2010-01-17 Thread Martin v. Loewis
> This ought to be a bug; objects that compare equal and are hashable > must have the same hash code. It's not a bug. Changing the default encoding is not really supported, let alone changing it to anything but latin-1, precisely for the reasons you discuss. If you do change the default encoding,

Re: Unicode and dictionaries

2010-01-17 Thread Martin v. Loewis
> Thanks to all of you. This once again proves how deep you can get > yourself into a mess if you mix unicode and string objects in your > code! The specific issue is that you apparently changed the default encoding. Don't do that, Python will break if you do. Regards, Martin -- http://mail.pyth

Re: Unicode and dictionaries

2010-01-17 Thread Martin v. Loewis
>>> This ought to be a bug; objects that compare equal and are hashable >>> must have the same hash code. >> It's not a bug. Changing the default encoding is not really supported, >> let alone changing it to anything but latin-1, precisely for the reasons >> you discuss. >> >> If you do change the

Re: can i examine the svn rev used to build a python 3 executable?

2010-01-19 Thread Martin v. Loewis
> never mind. just discovered that while "python3 -V" won't do it, > executing it gives me: > > $ python3 > Python 3.2a0 (py3k:77609, Jan 19 2010, 04:10:16) > ... > > and it's that 77609 rev number i was after. If you want that in a command l

[ANN] Python 2.5.5 Release Candidate 2.

2010-01-24 Thread Martin v. Löwis
s are available from the Python 2.5 page, at http://www.python.org/2.5/highlights.html Enjoy this release, Martin Martin v. Loewis mar...@v.loewis.de Python Release Manager (on behalf of the entire python-dev team) -- http://mail.python.org/mailman/listinfo/python-list

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Python has had > previous major changes in the past (e.g. 1.5 to 2.0 and 2.1 to 2.2) and > hardly anyone made a complaint. I think this is actually false for the switch from 1.5 to 2.0. People complained a lot, and announced that they won't switch to Python 2 in any foreseeable future, and ind

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Well, I'd consider that an official release. Note that I didn't claim > there was no hope PSF wouldn't change it's mind on 2.8. I'd like to point out that the PSF formally doesn't have any say in this. Instead, releases are created by the release manager, who gets appointed by Guido van Rossum

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Why do I feel like there's less of an onus on Unladen Swallow to > _actually prove itself in substantial real world usage_ before > integration into CPython than there is on even the smallest of modules > for inclusion in the standard library? Because it's a VM change, not an end-user change. VM

Re: myths about python 3

2010-01-30 Thread Martin v. Loewis
Christian Heimes wrote: > Blog wrote: >> WTF? Where'd you hear about version 2.8? FRI, 2.7 is and will be THE >> LAST version of the 2.x series - "the" End-Of-Life for Python 2 > > Where do you get your information from? It was discussed repeatedly on python-dev, last time when the release anno

Re: When is divmod(a,b)[0] == floor(a/b)-1 ?

2009-09-26 Thread Martin v. Löwis
>> In [21]: a = 10.0 > >> In [22]: b = 10.0 / 3.0 > >> In [24]: divmod(a, b)[0] >> Out[24]: 2.0 > >> In [25]: math.floor(a / b) - 1.0 >> Out[25]: 2.0 > > Wow. To me this stuff is just black magic, with a bit of voodoo > added for good measure... Maybe some day I'll understand it. I think thi

Re: Windows GCC Support (Mingw & Mingw-w64)

2009-10-04 Thread Martin v. Löwis
> Is there any chance of getting some of the devs or anyone familiar > enough with the source code to make this possibility become reality? Please take a look at http://bugs.python.org/issue4709 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple unicode question

2009-10-20 Thread Martin v. Löwis
> Where are the literals (i.e. u'\N{DEGREE SIGN}') defined? I found > http://www.unicode.org/Public/5.1.0/ucd/UnicodeData.txt > Is that the place to look? Correct - you are supposed to fill in a Unicode character name into the \N escape. The specific list of names depends on the version of the UCD

Re: repr(complex) in Py3.1

2009-10-24 Thread Martin v. Löwis
> I know at least that the float repr() was modified in Py3.1, but is the > above behaviour intentional? It certainly breaks doctests, and I don't see > a good reason for that. I don't know whether it was intentional, but it looks right to me. 2j is the complex number +0.0+2.0j (right?). Then, -(2

Re: Web development with Python 3.1

2009-10-27 Thread Martin v. Löwis
> I am very much new to Python, and one of my first projects is a simple > data-based website. I am starting with Python 3.1 (I can hear many of > you shouting "don't - start with 2.6"), but as far as I can see, none of > the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) > are P

Re: Publishing new release on PyPI: How?

2009-10-30 Thread Martin v. Löwis
> Well, maybe I'm completely blind but I can't find a way to add a new release > to PyPI index for python-ldap, not just a new file to an existing release > version. I recommend to run "python setup.py register", rather than using the HTML UI. > I'm the project owner and I did it several times in

Re: restricted mode???

2009-11-04 Thread Martin v. Löwis
> I thought that restricted mode died ages ago. > > Any ideas what could be causing this? Restricted mode is still available, and activated whenever a frame's builtins directory is different from the interpreter's; see PyFrame_IsRestricted. Regards, Martin -- http://mail.python.org/mailman/list

Re: DHT for Python 3.x?

2009-11-10 Thread Martin v. Löwis
Salim Fadhley wrote: > There are plenty of good DHT projects for Python 2.x, however from > what I can tell none of them have made the jump to 3.x yet. > > I'm really keen to support Python 3.x for a project I'm working on. I > know that many developers (correctly) consider switching to Python 3 >

Re: Python C api: create a new object class

2009-11-10 Thread Martin v. Löwis
> How can I create an instance class in Python, currently I do: > > class empty: > pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc > > Is there is a one line syntax to instantiate an instance? > > Any other ways than this: >

Re: DHT for Python 3.x?

2009-11-10 Thread Martin v. Löwis
Terry Reedy wrote: > Salim Fadhley wrote: >> There are plenty of good DHT > distributed hash table? I think it's that one. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: the unicode saga continues...

2009-11-14 Thread Martin v. Löwis
> Can anybody clue me in to what's going on here? It's as Mark says: the console encoding is cp437 on your system, cp1252. Windows has *two* default code pages at any point in time: the OEM code page, and the ANSI code page. Either one depends on the Windows release (Western, Japanese, etc.), and

Re: Documentation bugs in 3.1 - C-API - TypeObjects

2009-11-14 Thread Martin v. Löwis
> This cannot work, because Foo_Type is no PyObject but a PyVarObject > (independent > of the use of PyVarObject_HEAD_INIT or PyObject_HEAD_INIT). The code > line would > work so: > > ((PyObject *)&Foo_Type)->ob_type = &PyType_Type However, this is not what you should use. Instead, use Py_Type(&

Re: Documentation bugs in 3.1 - C-API - TypeObjects

2009-11-15 Thread Martin v. Löwis
DreiJane wrote: > Thanks a second time - the picture has > gotten clearer indeed. But for third-party > readers the complexities of this matter > require the correction, that > > "Py_Type(&Foo_Type) = &PyType_Type" > > must be: > "Py_TYPE(&Foo_Type) = &PyType_Type " > > - or am i completely wron

Re: Documentation bugs in 3.1 - C-API - TypeObjects

2009-11-15 Thread Martin v. Löwis
> Still there remains the difference to what is told with the > Noddy_Type in the tutorial. Please report that to bugs.python.org. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python 3.x support Unicode-named attributes?

2009-11-20 Thread Martin v. Löwis
> Does Python 3.x support Unicode-named attributes? Most certainly, yes. All identifiers (and thus all attribute names) are Unicode strings in Python 3.x. > There are several modules which operate on HTML and try to > hammer HTML/XML into Python object attributes. I've had > BeautifulSou

Re: xmlrpc idea for getting around the GIL

2009-11-23 Thread Martin v. Löwis
> What I meant was that I am *not allowed* to make calls to the CPython > API from the threads I currently have because these threads are high > priority and are never allowed to make blocking calls. Fortunately, > each of these threads can have a completely separate interpreter, so > my idea was t

Re: PEP 3147 - new .pyc format

2010-01-31 Thread Martin v. Loewis
> Naming files using magic numbers is really beyond me. The fact that the > above needs comments to explain what's what already shows to me that > there's a problem with this naming scheme. What if for one reason or > another I want to delete all pyc files for Python 2.5? Where do I look > up the m

Re: PEP 3147 - new .pyc format

2010-01-31 Thread Martin v. Loewis
> True. You might also want to note that "Python 2.6 -U" appears to have a > different magic number from "Python 2.6" and "Python 2.6 -O". > > I don't know whether they always change for each new version. Here is a recent list of magic numbers: Python 2.6a0: 62151 (peephole optimizations a

Re: recv_into(bytearray) complains about a "pinned buffer"

2010-01-31 Thread Martin v. Loewis
> In Python 2.6 I can't socket.recv_into(a byte array instance). I get a > TypeError which complains about a "pinned buffer". I have only an > inkling of what that means. A pinned buffer is one that cannot move in memory, even if another thread tries to behind your back. Typically, resizable conta

Re: recv_into(bytearray) complains about a "pinned buffer"

2010-02-01 Thread Martin v. Loewis
Antoine Pitrou wrote: > Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit : >>> Is this a bug in Python 2.6 or a deliberate choice regarding >>> implementation concerns I don't know about? >> It's actually a bug also that you pass an array; doing so

Re: recv_into(bytearray) complains about a "pinned buffer"

2010-02-02 Thread Martin v. Loewis
> Clearly it was added to work with an array, and it's > being used with an array. Why shouldn't people use it > with Python 2.x? Because it's not thread-safe; it may crash the interpreter if used incorrectly. Of course, if you don't share the array across threads, it can be safe to use. Regards

Re: Hashing in python

2010-02-14 Thread Martin v. Loewis
> floor(x) returns an integer Why do you say that? Assuming you are talking about math.floor, it works differently for me: py> math.floor(10.0/3) 3.0 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Hashing in python

2010-02-14 Thread Martin v. Loewis
> CELL_SIZE = 4 > > def key(point): > > return ( > int((floor(point[0]/CELL_SIZE))*CELL_SIZE), > int((floor(point[1]/CELL_SIZE))*CELL_SIZE), > int((floor(point[2]/CELL_SIZE))*CELL_SIZE) > ) > > > Since python allows keys to be tuples, I think that this should wor

Re: Pure virtual functions in Python?

2010-02-20 Thread Martin v. Loewis
lallous wrote: > Hello > > How can I do something similar to pure virtual functions in C++ ? See, for example http://code.activestate.com/recipes/266468/ Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Pure virtual functions in Python?

2010-02-20 Thread Martin v. Loewis
>> class C1: >> >> # Pure virtual >> def cb(self, param1, param2): >> """ >> This is a callback >> >> @param param1: ... >> @param param2: ... >> """ >> raise NotImplementedError, "Implement me" >> >> # Dispatcher function that calls '

Re: Compiling and running 32-bit Python on 64-bit server?

2010-02-20 Thread Martin v. Loewis
> How one could create 32-bit Python run-time enviroment, preferable > virtualenv, on 64-bit Linux (VPS), reducing memory usage? I'd install a 32-bit Linux on the hardware, and install a bigmem kernel if it has more than 3GB of main memory. > I assume this involves having lib32 libs and compiling

Re: Pure virtual functions in Python?

2010-02-21 Thread Martin v. Loewis
>> That's not true. Currently, the hasattr() call would report that cb is >> available, when it is actually not implemented. It would be possible to >> do something like >> >> if hasattr(c, 'cb') and not is_pure(c.cb): >> c.cb("Hello", "World") >> >> is_pure could, for example, look at a fu

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
John Nagle wrote: >I know there's a performance penalty for running Python on a > multicore CPU, but how bad is it? I've read the key paper > ("www.dabeaz.com/python/GIL.pdf"), of course. It would be adequate > if the GIL just limited Python to running on one CPU at a time, > but it's worse t

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
> It's far from scientific, but I've seen behaviour that's close to a 100% > performance penalty on a dual-core linux system: > >http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2 > > Short story: a particular test suite of mine used to run in around 25 > seconds, but a bit of ctypes

Re: String is ASCII or UTF-8?

2010-03-09 Thread Martin v. Loewis
> I can create ASCII strings containing byte values between 127 and 255. No, you can't - or what you create wouldn't be an ASCII string, by definition of ASCII. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't install ssl for Python2.5

2010-03-10 Thread Martin v. Loewis
> I don't know how to solve this problem and I am looking forward for > help. Try running "python setup.py install" directly, after downloading and unpacking the package. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-11 Thread Martin v. Loewis
>> I have a Windows 7 (64bit AMD) machine This is somewhat imprecise: is it a) that your CPU is AMD64, and thus supports 64-bit mode, or b) that *in addition*, your Windows 7 installation is a 64-bit installation, or c) that *in addition*, your Python installation is also a 64-bit installation

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-11 Thread Martin v. Loewis
> I’m sorry everyone. I didn’t realise I had installed the 64-bit > version of Python. Well, at least someone else might find have the > same problem. But I think that there is going to be a bit of a rough > patch as everyone moves over to 64-bit. Expect that move to take a few more years. 64-bit

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-12 Thread Martin v. Löwis
> Not sure if this is a bug I think it is. It seems that the cross-build support in msvc9compiler has been tested only in a build tree of Python (where there is no Libs directory). For released copies of Python, I could change that to distribute the AMD64 pythonXY.lib in libs/amd64. [FWIW, I'm st

Re: Unicode characters in btye-strings

2010-03-12 Thread Martin v. Loewis
>> Can somebody explain what happens when I put non-ASCII characters into a >> non-unicode string? My guess is that the result will depend on the >> current encoding of my terminal. > > Exactly right. To elaborate on the "what happens" part: the string that gets entered is typically passed as a b

Re: Unicode characters in btye-strings

2010-03-12 Thread Martin v. Loewis
Michael Rudolf wrote: > Am 12.03.2010 21:56, schrieb Martin v. Loewis: >> (*) If a source encoding was given, the source is actually recoded to >> UTF-8, parsed, and then re-encoded back into the original encoding. > > Why is that? Why is what? That string literals get reen

Re: using Python distutils bdist_msi to create installer for large complicated package

2010-03-21 Thread Martin v. Löwis
> I've been re-thinking the UpLib Windows installer technology, and it > occurred to me to wonder why I can't just use the nice bdist_msi module > in Python to build my packages. I took a look, and it seems almost > doable. Presumably you wrote it? Correct. > UpLib is a big package, with lots o

Re: Unicode blues in Python3

2010-03-23 Thread Martin v. Loewis
nn wrote: > > Stefan Behnel wrote: >> nn, 23.03.2010 19:46: >>> Actually what I want is to write a particular byte to standard output, >>> and I want this to work regardless of where that output gets sent to. >>> I am aware that I could do >>> open('nnout','w',encoding='latin1').write(mychar) but

Re: RELEASED Python 2.6.5

2010-03-24 Thread Martin v. Loewis
> Is anyone else having trouble with the 2.6.5 Windows x86 installer? Not me. Run msiexec /i py...msi /l*v py.log and inspect py.log for errors (post it to bugs.python.org if you can't determine the cause of the problems). Are you using SUBST by any chance? Regards, Martin

Re: subprocess only good for win32?

2010-03-31 Thread Martin v. Loewis
> WindowsError: [Error 14001] The application has failed to start > because its side-by-side configuration is incorrect. Please see the > application event log for more detail This is a configuration error on your system. The application you are trying to start is incorrectly installed - it's not

Re: Is it possible to store data in a Python file in a way similar to Ruby's __END__ section?

2010-04-02 Thread Martin v. Loewis
Christopher Roach wrote: > I have a script that I am working on to process a bunch of data. A > good portion of the Tk-based GUI is driven by a large set of YAML data > and I'd love to store that data inside of the script so that I can > send just a single file to my colleague. Ruby has a mechanism

Re: regenerating unicodedata for py2.7 using py3 makeunicodedata.py?

2010-11-18 Thread Martin v. Loewis
> Thanks for the confirmation Martin! > > Do you think, it the mentioned omission of the character names of some > CJK ranges in unicodedata intended, or should it be reported to the > tracker? It's certainly a bug. So a bug report would be appreciated, but much more so a patch. Ideally, the pat

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Martin v. Loewis
Am 22.11.2010 22:43, schrieb Martin Lundberg: > Hi, > > I want to be able to let the user enter paths like this: > > apps/name/**/*.js > > and then find all the matching files in apps/name and all its > subdirectories. However I found out that Python's glob function > doesn't support the recursi

Re: Pypi (Cheeseshop) Score - derivation of ?

2010-11-25 Thread Martin v. Loewis
> Occurrence of search term weighted by field (name, summary, keywords, > description, author, maintainer) > > I thought PyPI used to offer a 'kwality' score for packages, based on > the presence of installers, doc files, tests etc. Does anyone know > what happened to that? There was indeed a kwa

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> Does anyone know what I need to do to read filenames from stdin with > Python 3.1 and subsequently open them, when some of those filenames > include characters with their high bit set? If your files on disk use file names encoded in iso-8859-1, don't set your locale to a UTF-8 locale (as you app

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Löwis
> It'd be great if all programs used the same encoding on a given OS, > but at least on Linux, I believe historically filenames have been > created with different encodings. IOW, if I pick one encoding and go > with it, filenames written in some other encoding are likely to cause > problems. So I

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> The world does not revolve around Python. Unix filenames have been > encoding-agnostic long before Python was around. If Python3 does not > support this then it's a regression on Python's part. Fortunately, Python 3 does support that. Regards, Martin -- http://mail.python.org/mailman/listinf

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> This sounds like a strong prospect for how to get things working (I > didn't realize open would accept a bytes argument for the filename), > but I'm also interested in whether reading filenames from stdin and > subsequently opening them is supposed to "just work" given a suitable > encoding - lik

Re: Comparison with False - something I don't understand

2010-12-05 Thread Martin v. Loewis
> result = myfunction (vars) > > if not result: > # error condition > > Now above I first realized that the function can also return an empty > list under some conditions and so changed it to If your function returns a list when successful, it should not return False in the error case. Ins

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 18:33, schrieb Perry Johnson: > Python's re module does not support POSIX character classes, for > example [:alpha:]. It is, of course, trivial to simulate them using > character ranges when the text to be matched uses the ASCII character > set. Sadly, my problem is that I need to pro

Re: Bind C++ program for use with both Python 2.x and 3.x

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 23:41, schrieb Peter C.: > Hello, I am looking at the possibility of making a program in C++. The > catch is it will require the ability to work with binding for use with > scripting in both Python 2.x and 3.x for various tool plugins. Is > there any way to bind a C++ app to work with

Re: while True or while 1

2010-12-12 Thread Martin v. Loewis
>> Python is designed to provide readable code. Writing >> >> while True: >> ... >> >> is much more legible than its pre-True couterpart >> >> while 1: >> ... > > No argue with that! I actually want to argue with that: I find "while 1" more legible. That's probably because

Re: "Download/windows" site page

2010-12-13 Thread Martin v. Loewis
Am 13.12.2010 23:38, schrieb Cristian Consonni: > Dear all, > > I'm not sure this is the right place to point this out, but on this page: > > http://www.python.org/download/windows/ > > It is not mentioned "Windows 7". > > Is there some problem with 7 or it is simply an omission? It's simply a

Re: Python 3.2 beta 2

2010-12-21 Thread Martin v. Loewis
Am 21.12.2010 22:56, schrieb Luis M. González: > I wonder if Unladen Swallow is still being considered for merger with > Python 3.3. > Is it? 3.2 isn't even released yet, and 3.3 will appear 18 months after it (so in Summer 2012). It's much too early to tell. OTOH, to answer you literal question:

Re: round in 2.6 and 2.7

2010-12-23 Thread Martin v. Loewis
> Type "help", "copyright", "credits" or "license" for more information. 9.95 > 9.9493 "%.16g" % 9.95 > '9.949' round(9.95, 1) > 10.0 > > So it seems that Python is going out of its way to intuitively round > 9.95, while the repr retains the unnecessary digit

Re: round in 2.6 and 2.7

2010-12-28 Thread Martin v. Loewis
>> "Float-to-string and string-to-float conversions are correctly rounded. >> The round() function is also now correctly rounded." >> >> Not sure that this is correct English; I think it means that the >> round() function is now correct. > > Well, the correct result of the example the OP gave woul

Re: Is there anyway to run JavaScript in python?

2010-12-30 Thread Martin v. Loewis
Am 30.12.2010 14:52, schrieb crow: > Hi, I'm writing a test tool to simulate Web browser. Is there anyway > to run JavaScript in python? Thanks in advance. See PyV8: http://pypi.python.org/pypi/PyV8 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3 Web Framework

2010-12-31 Thread Martin v. Loewis
Am 31.12.2010 08:47, schrieb Aman: > Hey all... I just started with Python, and I chose Python3 because it > seemed a subtle choice as compared to doing Pthon 2.x now and then > porting to Python3.x later... I plan to start with Web Development > soon... I wanted to know what all web frameworks are

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
>> To support older Python versions, you need to write your own wrapper >> functions for bytes literals that do nothing in Python 2 and convert the >> literal back to a bytes literal in Python 3. That's ugly, but there's no >> other way to do it. > > I think the developers expected that most maint

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
> 1. Code running in multiple versions has to be syntactically correct in > every detail all versions in order to be compiled without error. > However, version specific syntax *can* be used in modules that are > conditionally imported and therefore conditionally compiled and executed. I also encou

Re: How to dump a Python 2.6 dictionary with UTF-8 strings?

2011-01-11 Thread Martin v. Loewis
> What's the right way to get the strings in UTF-8? This will work. I doubt you can get it much simpler in 2.x; in 3.x, your code will work out of the box (with proper syntactical adjustments). import pprint, cStringIO class UniPrinter(pprint.PrettyPrinter): def format(self, obj, context, ma

Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Martin v. Loewis
>> CGI is still used in some places today, hello? > > Yeah, James Cameron made a *ton* of money using it to make Avatar. He used compacted graphite iron in Avatar? I didn't know that. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient python 2-d arrays?

2011-01-17 Thread Martin v. Loewis
> Using numpy, I can create large 2-dimensional arrays quite easily. IIUC (please confirm), you don't need a generic two-dimensional array, but rather an Nx2 array, where N may be large (but the other dimension will always have a magnitude of 2). > Since I want to keep the two elements together d

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
> I know I've seen problems executing .pyc files from the shell in the > past... perhaps I was conflating details of something else. Ah, I know! > > [steve@sylar ~]$ chmod u+x toto.pyc > [steve@sylar ~]$ ./toto.pyc > : command not found �� > ./toto.pyc: line 2: syntax error near unexpected token

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
> But you got me thinking... how far back does this behaviour go? = ==> Release 1.1 (11 Oct 1994) <== = - Passing the interpreter a .pyc file as script argument will execute the code in that file. (On the Mac such files can be do

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
>> Segmentation fault >> >> [Actually this is the first time in my 10 years of python that Ive >> seen a pure python module segfault :-) ] > > Congratulations genius! However if you are really smart you would have > read the note in the source that says "tested on windows only!". > Segfault. Thank

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
> For something as common as displaying a file browser, it should be as > simple as this: > > import gui_toolkit # whichever > path = gui_toolkit.select_file() > > Something like zenity: > > [steve@sylar ~]$ zenity --file-selection > /home/steve/python/findsingle.py And indeed, it is that si

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
> WxPython Challenge 1 code updated... > > * Fixed tab traveral > * Removed hand-holding code > * Removed some cruft > > https://sites.google.com/site/thefutureofpython/home/code-challenges > > Good luck! Still crashes the interpreter. Regards, Martin -- http://mail.python.org/mailman/li

Re: WxPython versus Tkinter.

2011-01-24 Thread Martin v. Loewis
> Well i did "expect" that you would at least include some info as to > your OS and version. OS is Linux, wxPython is Debian python-wxgtk2.6 2.6.3.2.2-5+b1. > That would be helpful also. Obviously the > wx.ImageList is barfing. Do you have the Bitmap folder containing the > three images. Did you

Re: WxPython versus Tkinter.

2011-01-25 Thread Martin v. Loewis
> You'll find that nearly all software used in Europe (and most other parts) > is internationalized or it wouldn't stand a chance. You mean, in lines of code? I very much doubt that. A lot of software gets written, in particular for web servers, that is only German, around here. Nobody thinks this

Re: Python 32-bit on Windows 64-bit

2011-02-11 Thread Martin v. Loewis
Am 11.02.2011 19:41, schrieb Craig Yoshida: > what kind of memory limitations to processes running on 32-bit python > (with 32-bit C extensions like scipy) have on 64-bit Windows? I'm > having occasional MemoryErrors when running a python program on > 64-bit Windows 7 that runs fine on my OS X ma

Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Martin v. Loewis
> eps would be a better name than e. py> ε = 10.0 ** -7; n = 0; z = c = complex(-0.75, ε) py> while abs(z) < 2.0: ... n += 1 ... z = z * z + c ... py> π = n * ε py> print(π) 3.1415926 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 and html.escape function

2011-02-21 Thread Martin v. Loewis
> Well, I just learned something, thank you. I was under the mistaken > impression that adding new functionality after the first alpha release > was not permitted by the Python devs. It's the first beta release after which no new functionality could be added. Regards, Martin -- http://mail.pyt

Re: Looking for some PyPI query help

2011-02-22 Thread Martin v. Loewis
Am 23.02.2011 07:53, schrieb Travis Griggs: > Howdy Python brethren. I'm a Smalltalker, doing a bit of research on > packaging ecospaces, in other languages and environments (I just > finished examining Debian for example). I found what seems to be the > big repository at PyPI. Correct. There is a

Re: Py3: Read file with Unicode characters

2010-04-08 Thread Martin v. Loewis
Gnarlodious wrote: > Attempting to read a file containing Unicode characters such as ±: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position > 5007: ordinal not in range(128) > > I did succeed by converting all the characters to HTML entities such > as "±", but I want the charact

Re: Py3: Read file with Unicode characters

2010-04-08 Thread Martin v. Loewis
Gnarlodious wrote: > On Apr 8, 9:14 am, "Martin v. Loewis" wrote: > >> When opening the file, you need to specify the file encoding. > > OK, I had tried this: > > open(path, 'r').read().encode('utf-8') No, when *opening* the file, you n

Re: [Possibly OT] Comments on PyPI

2010-04-11 Thread Martin v. Loewis
Steven D'Aprano wrote: > How do I leave comments on PyPI? There's a checkbox "Allow comments on > releases" which I have checked, but no obvious way to actually post a > comment. You need to login in order to rate or comment. A more specific place to ask PyPI questions is catalog-...@python.org

Download Visual Studio Express 2008 now

2010-04-12 Thread Martin v. Loewis
Microsoft has just released Visual Studio 2010, along with its free (of charge) Express edition. Following a tradition, they are likely to withdraw support and availability for VS 2008 Express some time in the future. Python 2.6, 2.7, and 3.1 are all built with that release (i.e. 2008). Because of

Re: Startup problems with Python 3.1.2 and PythonPath under XP

2010-04-12 Thread Martin v. Loewis
tkp...@hotmail.com wrote: > I fixed the problem by creating a file call MyPath.pth that has only > one line > H:/Python > > and placing it in the C:\Python31\Lib\site-packages directory. So as a > practical matter, my problem is solved. That said, I'm still puzzled > by why Python 3.1 acts up when

Re: missing dll follow-up

2010-04-14 Thread Martin v. Loewis
> I said "msvcr90.dll", but I meant "msvcp90.dll". In either case, I > cannot locate the dll to include in my project and I am not sure what > else I can do. The vcredist_x86 was, I thought, supposed to give me > the dll, but it does not seem to have done so. Try the VS 2008 SP1 redistributables,

Re: missing dll follow-up

2010-04-14 Thread Martin v. Löwis
>> Try the VS 2008 SP1 redistributables, from >> http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2 > > That looks like Microsoft's German site. I wonder if their VS 2008 > runtimes are localized for specific languages? Apparently so; just

Re: Windows installer of Python

2010-04-15 Thread Martin v. Loewis
moerchendiser2k3 wrote: > Hm, I thought there will be installed something > like the Microsoft Redistributable 2008 Package to make Python run? No, the Python installer integrates the Microsoft Merge Module for the Visual Studio Runtime Dynamic Link Libraries. That removes the need to install the

Re: Download Visual Studio Express 2008 now

2010-04-16 Thread Martin v. Löwis
Brian Blais wrote: > On Apr 12, 2010, at 16:36 , Martin v. Loewis wrote: > >> If you are planning to build Python extension modules in the next five >> years, I recommend that you obtain a copy of VS Express > > Am I missing something here? I have heard this before, but

Re: Download Visual Studio Express 2008 now

2010-04-16 Thread Martin v. Loewis
>> Python 2.6, 2.7, and 3.1 are all built with that release (i.e. 2008). >> Because of another long tradition, Python extension modules must be >> built with the same compiler version (more specifically, CRT version) as >> Python itself. So to build extension modules for any of these releases, >> y

Re: What license/copyright text to include and where to include it when selling a commercial Python based application?

2010-04-16 Thread Martin v. Loewis
> 1. What Python license text/copyright text should I place in our > printed user manual? > > 2. What Python license text/copyright text should I include in > our online documentation? > > 3. What Python license text/copyright text should I include in > product's license text file? > > 4. What P

Re: Python 2.7b1 and argparse's version action

2010-04-18 Thread Martin v. Loewis
> What do you think? If you want something to happen, you need to bring this up on python-dev. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

<    18   19   20   21   22   23   24   25   >