Re: "isinstance" question

2010-06-23 Thread Thomas Jollans
On 06/23/2010 08:39 AM, Satish Eerpini wrote: > > > I want to test whether an object is an instance of any > user-defined > class. "isinstance" is less helpful than one would expect. > > >>> import types > >>> class foo() : # define dummy class >

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Thomas Jollans
return fn(*args, **keywords): except: #... raise return wrapper class X(...): @exc_decor def foo(self, arg): pass (if targeting pre-decorator Python, the code would look different of course) This way, the function itself is decorated, and the function returned by the decorator is bound to the object. It'll just work as expected, no trickery required. -- Thomas > > Can anyone suggest anything? Is my technique to decorate bound methods > not a good one? How else should I decorate a bound method? > > Thanks in advance, > John. > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Instance method decorator garbage collection problem

2010-06-23 Thread Thomas Jollans
On 06/23/2010 02:56 PM, John Reid wrote: > > > Thomas Jollans wrote: >>> The InstanceCounted.count is 1 at the end. If I omit the call to >>> "self.method = print_exception_decorator(self.method)" then the instance >>> count goes down to 0 as

Re: Types missing from "types"module

2010-06-24 Thread Thomas Jollans
On 06/24/2010 08:29 AM, John Nagle wrote: > On 6/23/2010 10:08 PM, Stephen Hansen wrote: >> On Jun 23, 2010, at 9:24 PM, John Nagle wrote: >> >>> Here's dir(types), in Python 2.6.5: >>> >>> ['BooleanType', 'BufferType', 'BuiltinFunctionType', >>> 'BuiltinMethodType', 'ClassType', 'CodeType', 'Co

Re: use python as a calculator

2010-06-24 Thread Thomas Jollans
On 06/24/2010 05:42 PM, ilovesss2004 wrote: > If I run > 1.0/10**10 > python will return 0 > > How can I make python return 1e-10? It returns 1e-10. -- http://mail.python.org/mailman/listinfo/python-list

Re: deprecated string module issue

2010-06-24 Thread Thomas Jollans
l """The string module contains a number of useful constants and classes, as well as some deprecated legacy functions that are also available as methods on strings.""" Maybe it's deprecated in pylint-land, but the docs appear to disagree. And I'd say it's clear whose authority is higher. Thomas > > It just seems wrong, this all or nothing state. > > Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Emacs Form Feed (^L) Display Suggestion and Tips

2010-06-24 Thread Thomas Jollans
On 06/24/2010 03:14 PM, Xah Lee wrote: > On Jun 24, 5:41 am, Xah Lee wrote: >> • Emacs Form Feed (^L) Display Suggestion and Tips >> http://xahlee.org/emacs/modernization_formfeed.html > > a follow up question. > > when i was learning python in ~2005, i remember seeing it in python > code, but i

Re: mod_python and css

2010-06-24 Thread Thomas Jollans
On 06/24/2010 09:10 PM, Bradley Hintze wrote: > Hi all, about your question, no idea. > > the mod_python mailing list is pretty dead so I thought I'd try asking > my question here. It comes as no surprise to me that the mod_python mailing list is dead: nobody uses mod_python anymore. For all I

Re: reStructuredText format a part of a word

2010-06-25 Thread Thomas Jollans
On 06/25/2010 01:56 PM, Slafs wrote: > Hi there! > > Is it possible to format a word using reStructuredText in a way that > only a part of it is formatted (e.g. in bold)? > > I would like to do something like this: > > my l****ng word l\ ****\ nger word? > > where all th

Re: Python dynamic attribute creation

2010-06-25 Thread Richard Thomas
On Jun 25, 2:15 pm, WANG Cong wrote: > Hi, list! > > I have a doubt about the design of dynamic attribute creation by > assignments in Python. > > As we know, in Python, we are able to create a new attribute of > a class dynamically by an assignment: > > > > >>> class test: pass > ... > >>> test.a

Re: Help on finding word is valid as per English Dictionary through python

2010-06-25 Thread Thomas Jollans
On 06/25/2010 03:30 PM, anu python wrote: > Hi, > I have a text file , > a.txt > > > this is a lcose button > > where u can observer "lcose" is not a valid word.It's typing > mistake.Actual word is "close". > > How can i check that each word entered in tx

Re: value of: None is None is None

2010-06-26 Thread Thomas Jollans
gt;> None is (None is None) > False > Chained comparisons - one of those language features that some of the time makes code enormously more readable, but the rest of the time are rather disconcerting to those of us coming from pretty much any other programming language. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: importing modules from higher level directory

2010-06-26 Thread Thomas Jollans
On 06/26/2010 01:35 AM, Tom Pacheco wrote: > from .. import module > or > from ..module import foo > > this is intended for use within packages. And it only works within nested packages. Also, please refrain from top posting. > > see > http://www.python.org/dev/peps/pep-0328/ > > also search

Re: Python-list Digest, Vol 81, Issue 266

2010-06-26 Thread Thomas Jollans
ls, the please quote ONLY what you're replying to, and change the subject line! I hope you're going to enjoy your further stay on python-list. Thomas > > > [ snip ] > -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dynamic attribute creation

2010-06-26 Thread Thomas Jollans
On 06/26/2010 05:39 AM, WANG Cong wrote: > On 06/26/10 00:11, Neil Hodgson wrote: > >> WANG Cong: >> >>> 4) Also, this will _somewhat_ violate the OOP princples, in OOP, >>> this is and should be implemented by inherence. >> >>Most object oriented programming languages starting with Smalltalk

Re: I strongly dislike Python 3

2010-06-26 Thread Thomas Jollans
eak things in order to fix old mistakes that couldn't have been fixed otherwise. > > To reiterate, I am strongly in disfavor of Python 3 and will stick to > Python 2, for as least as long as Python 3 breaks my scripts. I trust you've also read Stephen Hansen's post, which arrived while I was writing this. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: value of: None is None is None

2010-06-27 Thread Thomas Jollans
On 06/27/2010 01:45 PM, Lawrence D'Oliveiro wrote: > In message , Alan G Isaac wrote: > >> Surprising for a moment, if you don't >> immediatelyrecognize it as a chained comparison. > > Bugger. So much for a Python version of this >

Re: I strongly dislike Python 3

2010-06-27 Thread Thomas Jollans
for example) use print in what looks like internal diagnostics methods. That being said, Stephen's statement was very broad, but I think it's true: print is primarily used in small scripts, or script-like testing functions/methods. Thomas > > C:\Python26\Lib\abc.py > C:\Python26\Lib\aifc.py > [ ... ] -- http://mail.python.org/mailman/listinfo/python-list

Re: refactoring a group of import statements

2010-06-27 Thread Thomas Jollans
aybe you don't actually need the module - then why do you have to import it in the first place? (2) globals()[mod] = __import__(mod) (3) Why not try: import x import y import z except ImportError as exc: display_error_properly(exc) raise exc -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: refactoring a group of import statements

2010-06-27 Thread Thomas Jollans
On 06/28/2010 12:48 AM, rantingrick wrote: > On Jun 27, 5:18 pm, Thomas Jollans wrote: >> On 06/28/2010 12:06 AM, GrayShark wrote: >>> I have a large list of package files to import. I'm using a try/except >>> test to verify the import. Looks like: > > &

Re: I strongly dislike Python 3

2010-06-28 Thread Thomas Jollans
On 06/28/2010 03:21 AM, Stephen Hansen wrote: > On 6/27/10 6:11 PM, geremy condra wrote: >> On Sun, Jun 27, 2010 at 8:50 PM, Grant >> Edwards wrote: >>> If you install a real shell on Windows, then the hash-bang line works >>> fine. :) >> >> Might as well spare yourself the trouble and install lin

Re: [python-openid] 2.2.3 python package missing

2010-06-28 Thread Thomas Jollans
d. It will redirect you to an index page. Click "Python -- downloads". http://github.com/openid/python-openid/downloads Now was that really that difficult? - Thomas PS: okay, that doesn't include version 2.2.3. However, I expect that 2.2.5 will work just as well for you, and I a

Re: [python-openid] 2.2.3 python package missing

2010-06-28 Thread Thomas Jollans
On 06/28/2010 11:51 AM, Stéphane Klein wrote: > Le 28/06/2010 11:34, Thomas Jollans a écrit : >> On 06/28/2010 10:26 AM, Stéphane Klein wrote: >>> Hi, >>> >>> I write to you, to inform I can't install python-openid 2.2.3 version. >>> >>>

Re: I strongly dislike Python 3

2010-06-28 Thread Thomas Jollans
On 06/28/2010 04:36 PM, Stephen Hansen wrote: > On 6/28/10 2:20 AM, Thomas Jollans wrote: >> On 06/28/2010 03:21 AM, Stephen Hansen wrote: >>> On 6/27/10 6:11 PM, geremy condra wrote: >>>> On Sun, Jun 27, 2010 at 8:50 PM, Grant >>>> Edwards wrote: &g

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Thomas Jollans
On 06/28/2010 06:08 PM, Dave Pawson wrote: > Thanks for the replies (and Benjamin). > Not met with the subprocess idea. > > On 28 June 2010 16:29, D'Arcy J.M. Cain wrote: > >>> Main queries are: >>> Ease of calling out to bash to use something like imageMagick or Java? >> >> You don't need to ca

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Thomas Jollans
methods that are often a better choice, such as str.startswith or the ("xyz" in "vwxyz!") syntax. if you just want to get the matching lines, you could use list comprehension: matching = [ln for ln in file if ln.startswith(seek)] Just to present some of the ways you can do this in Python. I hope you're enjoying the language. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamically modify help text

2010-06-28 Thread Thomas Jollans
d__ = new__add__ >>> a.__add__(1) 'not at all' >>> a+1 'indeed' >>> >>> >>> class B: ... def __add__(self, other): ... return 'now this is old-style' ... >>> b = B() >>> b+1 'now this is old-style' >>> b.__add__ = new__add__ >>> b+1 'not at all' >>> I hate the fact that Python 2.x has two types of classes. Good riddance. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamically modify help text

2010-06-29 Thread Thomas Jollans
On 06/29/2010 02:37 AM, Ben Finney wrote: > Brian Blais writes: > >> On Jun 28, 2010, at 14:25 , Chris Rebert wrote: >>> __doc__ is normally defined on classes, e.g. `A`, not instances, >>> e.g. `a`. help() looks for __doc__ accordingly. >> >> so that gets back to my original question: can I chan

Re: validate string representation of a timedelta

2010-06-29 Thread Thomas Jollans
hat would be the string > representation of a timedelta object? If you want the end of the regexp to correspond to the end of the string, add a "$" at the end of the regexp. > > Alternately, is there an easier/more Pythonic approach to validate > this kind of string? > Or you could do something along the lines of: shrs, smins, ssecs = s.split(':') # convert, do things. — Thomas -- http://mail.python.org/mailman/listinfo/python-list

Infinite prime number generator

2010-06-29 Thread Thomas Jollans
p File "primes.py", line 21, in elim_mult for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p File "primes.py", line 21, in elim_mult for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p RuntimeError: maximum recursion depth exceeded >>> If you happen to have a copy of stackless lying around, I'd expect it to work! -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Infinite prime number generator

2010-06-29 Thread Thomas Mlynarczyk
Thomas Jollans schrieb: def primes(): yield 1 1 is not a prime number. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: 1.5.1 Py_XDECREF Core

2010-06-30 Thread Thomas Jollans
ything at that level. * see http://www.python.org/download/releases/1.6.1/ : --> What's new in release 1.6.1? - A core dump in the C API function PyList_Reverse() has been fixed. possibly relevant? -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: pyc runtime error

2010-06-30 Thread Thomas Jollans
sible in centos? With custom kernel compiling? The binfmt_misc module has to be loaded, which is presumably is, if /proc/sys/fs/binfmt_misc exists (not 100% sure on that) It's almost certainly provided by CentOS, even if it's not loaded by default. Assuming file.pyc was actually compiled by python2.6, and not some other version, it should work. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Ignorance and Google Groups (again)

2010-06-30 Thread Thomas Jollans
On 06/30/2010 10:55 PM, D'Arcy J.M. Cain wrote: > in all it's glory. > > :0: Hir > * ^List-Id:.*python-list.python.org > * ^From:@gmail.com > * ^Newsgroups: > /dev/null * X-Complaints-To: groups-ab...@google.com looks like a nice header to filter on -- http://mail.python.org/mailman/listi

Re: Extract doc strings

2010-07-01 Thread Thomas Jollans
turn False ... >>> f.__code__.co_consts ('doc string', 1, 2, 3) >>> g.__code__.co_consts (None, False) >>> Why else would g.__code__.co_consts[0] be None if that wasn't a docstring-specific special place. I don't know how you're creating you

Re: Python 2.4.2 Installation error

2010-07-01 Thread Thomas Jollans
On 07/01/2010 06:21 PM, Dhilip S wrote: > Hello Everyone.. > > I'm using Ubuntu 10.04, i try to install Python 2.4.2 & Python 2.4.3 got > error message while doing make command. anybody can tell tell, How to > overcome this error Which error? > -- > with regards, > Dhilip.S > > -- h

Re: Python/C++ timer intermittent bug

2010-07-01 Thread Thomas Jollans
l the > time? I can't really help you - I have limited experience with the C API, let alone Python/C threading, and know next to nothing about Windows programming. Maybe you should ask in a more specialized (and quieter) forum, such as the CAPI-SIG mailing list, or python-win32. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: OT Komodo Edit, line selection gutter is one pixel wide?

2010-07-01 Thread Thomas Jollans
On 07/01/2010 06:39 PM, John Doe wrote: > Is there a way to increase the line selection gutter width? It > seems to be only one pixel wide. In other words... When I single > click on the left side of the line, in order to automatically > select the line, the pointer must be in a precise single pixe

Re: Ignorance and Google Groups (again)

2010-07-01 Thread Thomas Jollans
On 07/01/2010 08:20 PM, Stephen Hansen wrote: > On 7/1/10 11:05 AM, Mithrandir wrote: > >> Just thought of this last night: If you view the full header you can see >> this: >> >> Complaints-To: groups-ab...@google.com >> >> Try blocking posts with that in the header. :) > > Better idea: auto-forw

Re: Why defaultdict?

2010-07-02 Thread Thomas Jollans
ctory(key) I agree, this is a strange choice. However, nothing's stopping you from being a bit verbose about what you want and just doing it: class mydict(defaultdict): def __missing__(self, key): # ... the __missing__ method is really the more useful bit the defaultdict class adds, b

Re: Why defaultdict?

2010-07-02 Thread Thomas Jollans
On 07/02/2010 11:26 AM, Chris Rebert wrote: > On Fri, Jul 2, 2010 at 2:20 AM, Thomas Jollans wrote: >> On 07/02/2010 06:11 AM, Steven D'Aprano wrote: >>> I would like to better understand some of the design choices made in >>> collections.defaultdict. > >

Re: Python 2.4.2 Installation error

2010-07-02 Thread Thomas Jollans
rrect, to give us some context. It's better to post a bit too much than too little. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorators, with optional arguments

2010-07-02 Thread Thomas Jollans
On 07/02/2010 07:41 PM, Stephen Hansen wrote: > Okay, so! > > I actually never quite got around to learning to do deep and useful > magic with decorators. I've only ever done the most basic things with > them. Its all been a little fuzzy in my head: things like what order > decorators end up being

Re: The real problem with Python 3 - no business case for conversion (was "I strongly dislike Python 3")

2010-07-02 Thread Thomas Jollans
On 07/02/2010 09:07 PM, John Nagle wrote: > >What I'm not seeing is a deployment plan along these lines: > >1.Identify key modules which must be converted before Python 3 > can be used in production environments. That depends VERY strongly on the environment in question. > >

Re: delegation pattern via descriptor

2010-07-03 Thread Thomas Jollans
On 07/03/2010 10:59 AM, kedra marbun wrote: > if we limit our discussion to py: > why __{get|set|delete}__ don't receive the 'name' & 'class' from > __{getattribute|{set|del}attr}__ > 'name' is the name that is searched > 'class' is the class whose __dict__ has 'name' bound to descriptor http://us

Re: My extension code generator for C++

2010-07-03 Thread Thomas Jollans
ator[]" would also work, I assume? > > > > > and generates the code for a Python extension. > > [snip] > > I'm really interested in what people think of this little project. How does it deal with pointers? What if something returns a con

Re: SyntaxError not honoured in list comprehension?

2010-07-04 Thread Thomas Jollans
On 07/04/2010 03:49 PM, jmfauth wrote: > On 4 juil, 12:35, Carl Banks wrote: >> On Jul 4, 1:31 am, jmfauth wrote: >> > > > Thanks for having explained in good English my feelings. > > >> >> Some other places were keyword can follow a number: >> > > Note, that this does not envolve numbers on

Re: What is the name of the name space I am in?

2010-07-05 Thread Thomas Jollans
On 07/05/2010 11:07 AM, Anthra Norell wrote: > I try to use "new.new.classobj (name, baseclass, dict)" and have no clue > what the "dict" of the current name space is. I can name dicts of > imported modules, because their name exists in the current name space. > If, for instance, I import a module

Re: black console window of executing os.chmod() and os.access()

2010-07-05 Thread Thomas Jollans
as no this problem. > > Anybody know how to remove the black console window? Does the script actually work for remote folders? Does the same problem occur for other file operations on remote systems? Maybe someone else knows an answer, otherwise maybe my thoughts will be of some help. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ImportError: DLL load failed: The specified module could not be found, SWIG, life, etc

2010-07-05 Thread Thomas Jollans
e a way round this > without moving on from VC6? > Shouldn't be a problem, as long as the calling convention hasn't change, which it hasn't. If you're on a 64-bit system there might be a problem there with Python and some DLLs being built for different architectures? Cheers, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting pyparsing to backtrack

2010-07-06 Thread Thomas Jollans
On 07/06/2010 04:21 AM, Dennis Lee Bieber wrote: > On Mon, 05 Jul 2010 15:19:53 -0700, John Nagle > declaimed the following in gmane.comp.python.general: > >>I'm working on street address parsing again, and I'm trying to deal >> with some of the harder cases. >> > > Hasn't it been sugg

Re: Python-list Digest, Vol 82, Issue 48

2010-07-06 Thread Thomas Jollans
On 07/06/2010 12:03 PM, francisco dorset wrote: > i need resources or books on how to embedding python into c/c++...and > also extending it > > [snip] What is the digest doing at the end of your message then? Anyway: http://docs.python.org/py3k/c-api/index.html http://docs.python.org/py3k/exten

Re: Python GUI for C program [was: ]

2010-07-06 Thread Thomas Jollans
k with plain C, have a look at GTK+. Cheers, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
On 07/06/2010 05:50 PM, sturlamolden wrote: > It is possible to build C and Fortran extensions for official Python > 2.6/2.7 binaries on x86 using mingw. AFAIK, Microsoft's compiler is > required for C++ or amd64 though. (Intel's compiler requires VS2008, > which has now perished.) mingw gcc shoul

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
On 07/06/2010 06:58 PM, Christian Heimes wrote: > Am 06.07.2010 18:21, schrieb Thomas Jollans: >> mingw gcc should work for building C++ extensions if it also works for C >> extensions. There's no difference on the binding side - you simply have >> to include everything

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
On 07/06/2010 06:49 PM, sturlamolden wrote: > On 6 Jul, 18:21, Thomas Jollans wrote: > >> mingw gcc should work for building C++ extensions if it also works for C >> extensions. > > No, it uses an incompatible statically linked C++ runtime. We need to > use msvc

Re: re.sub unexpected behaviour

2010-07-06 Thread Thomas Jollans
('123', '123', '123\n') > '123\n' Again, the behaviour is correct: you're not asking for "whatever was passed to sub()", but for '123', and that's what you're getting. > > Is there any explanation for this? If I&#

Re: The real problem with Python 3 - no business case for conversion (was "I strongly dislike Python 3")

2010-07-06 Thread Thomas Jollans
On 07/06/2010 07:17 PM, Terry Reedy wrote: > docs.python.org / dev/3.0/howto/cporting.html http://docs.python.org/py3k/howto/cporting.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Embedding Importing relative modules

2010-07-06 Thread Thomas Jollans
On 07/06/2010 09:11 PM, Aahz wrote: > In article <4a3f0ca7-fef0-4f9c-b265-5370e61ed...@d8g2000yqf.googlegroups.com>, > moerchendiser2k3 wrote: >> Aahz: >>> >>> Set sys.path to include each script's base dir before running it, then >>> restore after each script. >> >> That works, but doesnt solve

Re: Python install has difficulties with accented characters in path

2010-07-06 Thread Thomas Jollans
On 07/06/2010 11:17 PM, Pierre Thibault wrote: > I am building from the source and installing Python on my machine. > > I added these tests failed: > > test_doctest > test_httpservers > test_logging > > But I moved the Python installation folder on another directory and > the failed tests vanish

Re: A question about the posibility of raise-yield in Python

2010-07-06 Thread Thomas Jollans
" expression exactly once, then the code continues, and the state is lost. In Scheme, you can pass the state around, save it, and return there as often as you want. Kind of "go-back-to-this-particular-frame-state" as opposed to "go-back-into-that-(co)routine" Everything that you can do with the coroutine facilities in languages like Python, Ruby, and Lua, Scheme's call/cc allows you to do as well. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
ich can improve or worsen the > issues) is incredibly convoluted, and poorly documented (they expect > you to use MS tool and not to try to understand how it works). Cheers, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
On 07/07/2010 12:38 AM, Martin v. Loewis wrote: >>> - many things which are runtime independent on unix are not on >>> windows (file descriptor: AFAIK, a file descriptor as returned from >>> open can be dealt with in any C runtime on unix) >> >> Are you telling me that file descriptors (it's a fli

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread Thomas Jollans
On 07/07/2010 01:14 AM, sturlamolden wrote: > On 7 Jul, 01:07, Thomas Jollans wrote: > >> It's not managed code in the "runs on .net" sense, but in principle, it >> is managed, in that garbage collection is managed for you. > > I think you are conf

Re: Argh! Name collision!

2010-07-06 Thread Richard Thomas
On Jul 7, 3:11 am, "Alf P. Steinbach /Usenet" wrote: > Donald Knuth once remarked (I think it was him) that what matters for a > program > is the name, and that he'd come up with a really good name, now all he'd had > to > do was figure out what it should be all about. > > And so considering Stu

Re: The real problem with Python 3 - no business case for conversion

2010-07-07 Thread Thomas Jollans
On 07/07/2010 10:58 AM, Paul Rubin wrote: > Paul McGuire writes: >> is completely forward and backward incompatible. The workaround is to >> rewrite as: >> >> except ExceptionType: >> ex = sys.exc_info()[0] >> >> which works just fine in 2.x and 3.x. > > Are you sure? I wonder if th

Re: Python -- floating point arithmetic

2010-07-07 Thread Thomas Jollans
On 07/07/2010 02:05 PM, david mainzer wrote: > today i create some slides about floating point arithmetic. I used an > example from > > http://docs.python.org/tutorial/floatingpoint.html > > so i start the python shell on my linux machine: > > d...@maxwell $ python > Python 2.6.5 (release26-main

Re: Error message repetition

2010-07-07 Thread Thomas Jollans
On 07/07/2010 05:10 PM, Tambet wrote: > Hello! > > I have such problem that: > > * My console shows maximally x last lines, then truncates > * Error message takes 2 line > * In case of very big stack trace, there will be 2*x error lines > * In such case I do not see any debug outp

Re: Issues compiling 2.6.5 on AIX 6.1

2010-07-08 Thread Thomas Jollans
u --disable-shared ? I expect you want the shared library, but - does it work? Just some random thoughts -- I know nothing about AIX and little about cross-UNIX portability beyond, to an extent, GNU vs BSD. Cheers, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Multi-Channel Audio

2010-07-08 Thread Thomas Jollans
On 07/08/2010 09:17 PM, Alex Karpinski wrote: > I'm looking for some module or system of modules that can help me do a few > things with audio > > 1. Playback of files (at least .wavs, other codecs would be nice but, hey, > converting to a wav is easy) > 2. Seek within the file > 3. Control volu

Re: Python scripts from DOS

2010-07-09 Thread Thomas Jollans
On 07/09/2010 11:37 AM, Mark Carter wrote: > On my machine, I can go to a DOS shell, and type >myscript.py > This will cause the script to be run as a python script. So that bit > works. > > On another machine, on which python was set up without admin > privileges, if I type Which operating s

Re: Issues compiling 2.6.5 on AIX 6.1

2010-07-09 Thread Thomas Jollans
On 07/08/2010 04:36 PM, Stopp, Bryan wrote: > building '_struct' extension > > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes -I. -I/build/tools/src/Python-2.6.5/./Include > -I/build/tools/include -I. -IInclude -I./Include -I/usr/local/include > -I/build/tool

Re: how do you print an object?

2010-07-09 Thread Thomas Jollans
On 07/09/2010 03:24 PM, Rene Veerman wrote: > hi. > > i'm a recent convert from php because google appengine runs python. > i have a whole cms backend to convert (also to bigtable, but thats > another story) to python now. > > the first item on my agenda is the printing of python objects to json

Re: Why there is no "setdefaultencoding" in sys module?

2010-07-09 Thread Thomas Jollans
On 07/09/2010 06:06 PM, crow wrote: > On Jul 10, 12:04 am, Steven D'Aprano cybersource.com.au> wrote: >> On Fri, 09 Jul 2010 08:58:35 -0700, crow wrote: >>> So, my questions: why there is no setdefaultencoding in sys module? if I >>> want to change system's default encoding, what should I do? >> >

Re: zipimport (.pyd & .so) files.

2010-07-09 Thread Thomas Jollans
way) So you'd have to extract the file, and make it available through the file system. This would typically mean creating a file under /tmp (or possibly under $HOME/.cache/...) Cheers Thomas > > Cheers > > Prashant > -- http://mail.python.org/mailman/listinfo/python-list

Re: zipimport (.pyd & .so) files.

2010-07-09 Thread Thomas Jollans
On 07/09/2010 06:36 PM, King wrote: > Hi, > > The 'zipimport' modules can only import (.py & .pyc) files from a zip > file and doesn't support importing .pyd & .so files. Recently I was > examining the code of Py2Exe (python package deployment tool) and I > have found that it is using a module 'zi

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Thomas Jollans
On 07/11/2010 03:37 PM, Gelonida wrote: > # > import os > def is_below_dir(fname,topdir): > relpath = os.path.relpath(fname,topdir) > return not relpath.startswith('..'+os.sep) > > print is_below_dir(path1,path2) > ###

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Thomas Jollans
uld you expect, after this code, that (L1 == L2) and (L1 is L2)? I think it would surprise a lot of people. Better clearly separate modifying an object and functionally processing an object. Cheers Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-11 Thread Thomas Jollans
one code base, let alone in one user interface, is destined to be a nightmare and induce suicides. The above might have been very slightly exaggerated. Cheers! Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Thomas Jollans
On 07/11/2010 06:28 PM, Nathan Rice wrote: > Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]])) > > Though TBH sometimes get annoyed at this behavior myself. There are a > lot of people who are very vocal in support of returning none, and it > makes sense in some ways. Since reversed returns

Re: Easy questions from a python beginner

2010-07-11 Thread Thomas Jollans
coped variables in python? > See for example: http://evanjones.ca/python-pitfall-scope.html No. exception: nested functions. if you really want, you can always del variables after use. > > 6. Is there a Python Checker that enforces Strunk and White and is > bad English grammar anti-python? (Only half joking) > http://www.python.org/dev/peps/pep-0008/ Huh? - Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-11 Thread Thomas Jollans
s-and-their-parameters On the other hand, python scoping and namespace rules, while they may be different to those in other languages, are nice and simple. > Will try to avoid namespace mangling until next week. Cheers - Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: grailbrowser now running under python 2.5 (probably above too)

2010-07-12 Thread Thomas Jollans
On 07/12/2010 01:44 AM, rantingrick wrote: > On Jul 11, 11:31 am, Thomas Jollans wrote: >> On 07/11/2010 07:44 AM, rantingrick wrote: > >>> Congratulations on this effort Luke. However you know what project i >>> would really like to see the community get around? .

Re: how to delete "\n"

2010-07-12 Thread Thomas Jollans
On 07/12/2010 11:29 PM, pyt...@bdurham.com wrote: > Jia, > > print ''.join( open( 'Direct_Irr.txt' ).read().split() ) > > Broken out: > > - open(): open file > - read(): read its entire contents as one string > - split(): split the contents into a list of lines > (splits lines at \n; does not

Re: adodb.NewADOConnection('postgres') returns None

2010-07-13 Thread Thomas Jollans
with psycopg2, which is probably quite different in some way - otherwise it would be called the same. - Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes' c_longdouble: underflow error (bug?)

2010-07-14 Thread Thomas Jollans
precision, you need a new/different type. ctypes won't help you. Cython and NumPy may or may not be useful here. - Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: High Performance solutions are needed to do things like urlretrieve

2010-07-14 Thread Thomas Jollans
On 07/14/2010 07:49 PM, David wrote: > > urlretrieve works fine. However, when file size get very large. It > goes on forever, and even fails. > > For instance, one of download .zip file is of 363,096KB. > > Particularly, when trying to get, with urlretrieve, a zipped folder of > a very large

Re: adodb.NewADOConnection('postgres') returns None

2010-07-14 Thread Thomas Jollans
On 07/14/2010 02:14 PM, micayael wrote: > On Jul 13, 5:35 pm, Thomas Jollans wrote: >> On 07/13/2010 09:55 PM, micayael wrote: >> >>> Hi. >> >>> I'm trying to use adodb for postgres. I had instaled in ubuntu 9.10 >>> the adodb and psycopg2

Re: Errno 9] Bad file descriptor

2010-07-14 Thread Thomas Jollans
On 07/14/2010 01:21 PM, joblack wrote: >> | >> | Starting point: >> | ... >> | self.status['text'] = 'Processing ...' >> | try: >> | cli_main(argv) >> | except Exception, e: >> | self.status['text'] = 'Error: ' + str(e) >> | return >> | ..

Is Python portable/Can I install it on an USB Stick?

2010-07-14 Thread Thomas Tundor
Is Python portable? Can I install it on an USB Stick? Or is Python installing (at least on WinXP) services or register some DLLs or write something into Registry? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] inflect.py: generate plurals, ordinals, numbers to words...

2010-07-15 Thread Thomas Jollans
On 07/15/2010 01:00 PM, Paul wrote: > > > I'm pleased to announce the release of inflect.py v0.1.8, a module that > correctly generates: > > * the plural of singular nouns and verbs > * the singular of plural nouns > * ordinals > * indefinite articles > * present participles > * and converts num

Re: ctypes' c_longdouble: underflow error (bug?)

2010-07-15 Thread Thomas Jollans
On 07/15/2010 06:41 PM, kj wrote: > In Thomas Jollans > writes: > >> http://docs.python.org/library/ctypes.html#fundamental-data-types > >> c_longdouble maps to float > > Thanks for pointing this out! > ~K > (Does it make *any difference at all* to use c_l

Re: Code generator and visitor pattern

2010-07-15 Thread Thomas Jollans
On 07/15/2010 07:58 PM, Karsten Wutzke wrote: > Hello, > > this is obviously a Python OO question: > > Since Python isn't stringly typed, I expect this is an innocent typo, and you mean strictly. > single-dispatch isn't available per se. So is the "double-dispatch" Visitor > pattern, Wait, wh

Re: Code generator and visitor pattern

2010-07-15 Thread Thomas Jollans
On 07/15/2010 08:45 PM, Karsten Wutzke wrote: > On 15 Jul., 20:28, Thomas Jollans wrote: >> On 07/15/2010 07:58 PM, Karsten Wutzke wrote: >> >>> Hello, >> >>> this is obviously a Python OO question: >> >>> Since Python isn't stringly t

Re: Possible to include \n chars in doctest code samples or output?

2010-07-15 Thread Thomas Jollans
On 07/15/2010 11:14 PM, pyt...@bdurham.com wrote: > I'm working with some Python 2.6 code that is using the doctest module > for unittests. > > I tried adding tests whose code and results required newlines (\n). > Apparently newlines in string constants breaks the doctest code. > > Any workarou

Re: Possible to include \n chars in doctest code samples or output?

2010-07-16 Thread Thomas Jollans
On 07/16/2010 07:26 AM, pyt...@bdurham.com wrote: > Thomas, > >> Recall that doctest doesn't parse the code, it extracts the docstrings. And >> docstrings are just strings, and are parsed like strings. > > I understand what you're saying, but I'm strugglin

Re: Python 3 and setuptools

2010-07-16 Thread Thomas Jollans
http://pypi.python.org/pypi/distribute Cheers - Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: rstrip()

2010-07-16 Thread Thomas Jollans
On 07/16/2010 06:58 PM, Jason Friedman wrote: > $ python > Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) > [GCC 4.4.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. "x.vsd-dir".rstrip("-dir") > 'x.vs' > > I expected 'x.vsd' as a return value. >>> "x-vs

Re: Code generator and visitor pattern

2010-07-16 Thread Thomas Jollans
On 07/16/2010 11:00 AM, Jean-Michel Pichavant wrote: > Karsten Wutzke wrote: >>> Yes, typo, I meant strictly. >>> >>> >> >> Damn, I mean strongly. At least not for identifying which methods to >> call depending on the type/s. >> >> Karsten >> > Stringly is the perfect combination of strictl

Re: Identify the Color of an Image

2010-07-16 Thread Thomas Jollans
On 07/15/2010 09:13 AM, Monyl wrote: >> Please be clearer about what you want. >> >> 1. Animagedoes not "have" acolor, although each pixel in animage >> does have acolor. >> >> 2. Text in a web page does not (necessarily) have a font, although the >> display engine will use a font of its choice t

<    24   25   26   27   28   29   30   31   32   33   >