Re: The rap against "while True:" loops

2009-10-20 Thread Hendrik van Rooyen
On Monday, 19 October 2009 09:43:15 Steven D'Aprano wrote: > On Mon, 19 Oct 2009 08:51:44 +0200, Hendrik van Rooyen wrote: > > The point I was trying to make > > subliminally, was that there is a relative cost of double lookup for all > > cases versus exceptions for some cases. - Depending on the f

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread Steven D'Aprano
On Mon, 19 Oct 2009 13:29:52 -0700, Ethan Furman wrote: > Your arguments are most persuasive. Consider me convinced. > > Even if the worst-case scenario is true (homework problem, ack!), either > the poster will learn from the answer in which case all is well, or the > poster will not, in which

Re: File not closed on exception

2009-10-20 Thread Gabriel Genellina
En Tue, 20 Oct 2009 03:23:49 -0300, [email protected] escribió: On Oct 19, 5:56 pm, "Gabriel Genellina" wrote: En Mon, 19 Oct 2009 09:45:49 -0200, [email protected]   escribió: > I thought that file objects were supposed to be garbage-collected and > automatically closed once they

Re: pylab/matplotlib large plot memory management - bug? or tuning parameter needed?

2009-10-20 Thread Johan Grönqvist
bdb112 skrev: Summary: It is not straightforward to avoid memory leaks/consumption in pylab. If we define x = arange(1e6) # adjust size to make the increment visible, yet fast enough to plot # then repetition of plot(x,hold=0) # consumes increasing memory according to ubuntu system monitor

Re: File not closed on exception

2009-10-20 Thread [email protected]
On 20 Okt, 09:40, "Gabriel Genellina" wrote: > En Tue, 20 Oct 2009 03:23:49 -0300, [email protected]   > escribió: > > > > > > > On Oct 19, 5:56 pm, "Gabriel Genellina" > > wrote: > >> En Mon, 19 Oct 2009 09:45:49 -0200, [email protected]   > >> escribió: > > >> > I thought that file

Re: Frameworks

2009-10-20 Thread Bruno Desthuilliers
Emmanuel Surleau a écrit : Django : very strong integration, excellent documentation and support, huge community, really easy to get started with. And possibly a bit more mature and stable... One strong point in favour of Django: it follows Python's philosophy of "batteries included", and feat

Re: Frameworks

2009-10-20 Thread Bruno Desthuilliers
flebber a écrit : (snip) In short it seems to me that Django and Web2py include more "magic" in assisting oneself to create you web/application, whilst Pylons and Werkzueg leave more control in the users hands hopefully leading to greater expression and power. I can't tell much about web2py - n

Re: How about adding slice notation to iterators/generators?

2009-10-20 Thread Jaime Buelta
El 16/10/2009 3:29, Eloff escribió: > I was just working with a generator for a tree that I wanted to skip > the first result (root node.) > > And it occurs to me, why do we need to do: > > import sys > from itertools import islice > > my_iter = islice(my_iter, 1, sys.maxint) > > When we could simp

Re: efficient running median

2009-10-20 Thread denis
Yet another link: http://en.wikipedia.org/wiki/Median_filter --> Perreault + Hebert, Median Filtering in Constant Time, nice 6-page paper + 400 lines well-documented C code: http://nomis80.org/ctmf.html (for 2d images, dropping to 1d must be possible :) They're also in opencv, which I haven't trie

Re: The rap against "while True:" loops

2009-10-20 Thread Iain King
On Oct 19, 7:51 am, Hendrik van Rooyen wrote: > On Sunday, 18 October 2009 11:31:19 Paul Rubin wrote: > > > Hendrik van Rooyen writes: > > > Standard Python idiom: > > > > if key in d: > > >   d[key] += value > > > else: > > >   d[key] = value > > > The issue is that uses two lookups.  If that's

What am I doing wrong with SWIG in OS X Snow Leopard?

2009-10-20 Thread Zectbumo
Here are the steps I am doing that cause me to get the error ImportError: No module named _hi. I'm running OS X 10.6.1 What am I doing wrong? mkdir -p /tmp/my_swig_test cd /tmp/my_swig_test cat >hi.c<<. #include void hello(void) {printf("Hello World\n");} . gcc -shared -o libhi.dylib hi.c cat >hi

InteractiveConsole executed in another thread.

2009-10-20 Thread Germán Diago
Hello. I have an application written in python (it's a wrapper for a c++ application). The application has : a window (an SDL window), and a GUI, which has the window embedded inside. I would like to use InteractiveConsole to send commands to the SDL window. I have an API that allows me to do th

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2009-10-20 Thread John O'Hagan
On Mon, 19 Oct 2009, Aahz wrote: > In article , > > John O'Hagan wrote: > >I'm getting input for a program while it's running by using raw_input in a > >loop in separate thread. This works except for the inconvenience of not > > having a command history or the use of backspace etc. > > > >That ca

structread

2009-10-20 Thread Lawrence D'Oliveiro
This routine is so useful, I wonder there's nothing like it in module struct, or anywhere else I'm aware of: def structread(fromfile, decode_struct) : """reads sufficient bytes from fromfile to be unpacked according to decode_struct, and returns the unpacked results."""

Re: File not closed on exception

2009-10-20 Thread Ulrich Eckhardt
[email protected] wrote: > On Oct 19, 3:48 pm, Ethan Furman wrote: >> [email protected] wrote: [...] >>> def create(): >>> f = file("tmp", "w") >>> raise Exception >>> >>> try: >>> create() >>> finally: >>> os.remove("tmp") >>> [...] >> When an exception is raised, the e

Re: The rap against "while True:" loops

2009-10-20 Thread NiklasRTZ
On Oct 19, 2:51 am, Hendrik van Rooyen wrote: > On Sunday, 18 October 2009 11:31:19 Paul Rubin wrote: > > > Hendrik van Rooyen writes: > > > Standard Python idiom: > > > > if key in d: > > >   d[key] += value > > > else: > > >   d[key] = value > > > The issue is that uses two lookups.  If that's

Re: Is __mul__ sufficient for operator '*'?

2009-10-20 Thread Mick Krippendorf
Gabriel Genellina schrieb: > http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-classes Ok. That explains a lot. And your explanation tells the rest. Thank you. > In short, you have to define the __mul__ method on the type itself or > any of its bases. I found this

Re: File not closed on exception

2009-10-20 Thread Mel
[email protected] wrote: > I agree, but like I said, I've been told that this (implicit closing > of files) is the correct style by more merited Python developers, so > that made me think I was probably wrong .. It would be nice. The trouble is that CPython is not the only Python. Jython,

Separate namespace from file hierarchy?

2009-10-20 Thread Peng Yu
Suppose I have the dirname/both.py, which has the definitions of classes A and B. I can use this module in the following code. # import dirname.both a=dirname.both.A() b=dirname.both.B() When the definitions of A and B become too long, it is better that I put

Re: File not closed on exception

2009-10-20 Thread Ethan Furman
[email protected] wrote: On Oct 19, 3:48 pm, Ethan Furman wrote: [email protected] wrote: Hi I thought that file objects were supposed to be garbage-collected and automatically closed once they go out of scope, at least that's what I've been told by more merited Python programme

SQLObject 0.12.0

2009-10-20 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.12.0, the first stable release of branch 0.12 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be e

Re: File not closed on exception

2009-10-20 Thread Bruno Desthuilliers
[email protected] a écrit : On Oct 19, 4:14 pm, Grant Edwards wrote: On 2009-10-19, [email protected] wrote: I thought that file objects were supposed to be garbage-collected and automatically closed once they go out of scope, At some point after they go out of scope, they will be

Re: Separate namespace from file hierarchy?

2009-10-20 Thread Diez B. Roggisch
Peng Yu wrote: > Suppose I have the dirname/both.py, which has the definitions of > classes A and B. I can use this module in the following code. > > # > import dirname.both > > a=dirname.both.A() > b=dirname.both.B() > > > When the definitions of A and B be

Re: Separate namespace from file hierarchy?

2009-10-20 Thread yuky
On Oct 20, 3:51 pm, Peng Yu wrote: > Suppose I have the dirname/both.py, which has the definitions of > classes A and B. I can use this module in the following code. > > # > import dirname.both > > a=dirname.both.A() > b=dirname.both.B() > > > When the definiti

Re: Separate namespace from file hierarchy?

2009-10-20 Thread Bruno Desthuilliers
yuky a écrit : (snip) Or there is other variant: import dirname.A as dirname a = dirname.A() I wouldn't recommand this "variant", which is highly confusing. -- http://mail.python.org/mailman/listinfo/python-list

Re: pylab/matplotlib large plot memory management - bug? or tuning parameter needed?

2009-10-20 Thread Carl Banks
On Oct 19, 12:15 pm, bdb112 wrote: > Summary: > > It is not straightforward to avoid memory leaks/consumption in pylab. > If we define > x = arange(1e6)     # adjust size to make the increment visible, yet > fast enough to plot > # then repetition of > plot(x,hold=0)   # consumes increasing memory

Decimal values in wx.slider

2009-10-20 Thread Wanderer
Is there way to get decimal values displayed in wx.slider? I would like to use a slider to set values like 3.11. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple unicode question

2009-10-20 Thread Scott David Daniels
Mark Tolonen wrote: Is there a better way of getting the degrees? It seems your string is UTF-8. \xc2\xb0 is UTF-8 for DEGREE SIGN. If you type non-ASCII characters in source code, make sure to declare the encoding the file is *actually* saved in: # coding: utf-8 s = '''48° 13' 16.80" N'

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread Benjamin Middaugh
Actually I was working on a program to test the so-called 196-algorithm as an extracurricular activity. MRAB was most helpful with pointing out what I should have already thought of. My previous attempts were hampered by my limited knowledge of python, and I had already mentally committed to my

Re: Frameworks

2009-10-20 Thread Massimo Di Pierro
> So does web2py allow for raw sql if there is an advanced procedure or query that needs to be performed that is outside the scope of the web2pr orm Yes db.executesql("whatever you want") http://www.web2py.com/examples/static/epydoc/web2py.gluon.sql.SQLDB-class.html Massimo -- http://mail.

Re: Frameworks

2009-10-20 Thread mdipierro
On Oct 19, 9:01 am, flebber wrote: > In short it seems to me that Django and Web2py include more "magic" in > assisting oneself to create you web/application, whilst Pylons and > Werkzueg leave more control in the users hands hopefully leading to > greater expression and power. it depends on how

ctypes issues involving a pointer to an array of strings

2009-10-20 Thread Nathaniel Hayes
I am working on creating a python API for a dll for a daqboard we have here. I have the documentation for the library, as well as the C, Delphi and VB api. I have decided to use ctypes for the project, and most is working out alright. However I have run in to considerable headaches when dealing

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread MRAB
Benjamin Middaugh wrote: Actually I was working on a program to test the so-called 196-algorithm as an extracurricular activity. MRAB was most helpful with pointing out what I should have already thought of. My previous attempts were hampered by my limited knowledge of python, and I had already

ctypes issues involving a pointer to an array of strings

2009-10-20 Thread Nathaniel Hayes
I am working on creating a python API for a dll for a daqboard we have here. I have the documentation for the library, as well as the C, Delphi and VB api. I have decided to use ctypes for the project, and most is working out alright. However I have run in to considerable headaches when dealing

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread Ethan Furman
Steven D'Aprano wrote: On Mon, 19 Oct 2009 13:29:52 -0700, Ethan Furman wrote: Your arguments are most persuasive. Consider me convinced. Even if the worst-case scenario is true (homework problem, ack!), either the poster will learn from the answer in which case all is well, or the poster wi

Re: re.sub question (regular expressions)

2009-10-20 Thread Chris Seberino
On Oct 16, 9:51 am, MRAB wrote: > What do you mean "blow up"? It worked for me in Python v2.6.2. My bad. False alarm. This was one of those cases where a bug in another area appears like a bug in a different area. Thank for the help. cs -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes issues involving a pointer to an array of strings

2009-10-20 Thread MRAB
Nathaniel Hayes wrote: I am working on creating a python API for a dll for a daqboard we have here. I have the documentation for the library, as well as the C, Delphi and VB api. I have decided to use ctypes for the project, and most is working out alright. However I have run in to considera

Re: Poll on Eval in Python

2009-10-20 Thread Nobody
On Wed, 14 Oct 2009 23:48:11 +0200, Kazimir Majorinc wrote: >> (note: exec in python is more in spirit of eval then C-style exec >> functions) > > I thought about that, but decided not to ask about it > in poll, because I wanted to compare opinions on eval > specifically, not on all similar featu

Spam reported

2009-10-20 Thread Peter Pearson
Spam reported to Google. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Spam reported

2009-10-20 Thread Peter Pearson
Reported. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Spam reported

2009-10-20 Thread Peter Pearson
Reported. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread rurpy
On 10/19/2009 03:24 PM, [email protected] wrote: > You think that was homework? Perhaps so but for the record > here are some posts by some other people who suspected > homework in the very recent past... Updated... 2009-10-20 http://groups.google.com/group/comp.lang.python/browse_frm/thread/f7a8

unittest wart/bug for assertNotEqual

2009-10-20 Thread Zac Burns
Using the assertNotEqual method of UnitTest (synonym for failIfEqual) only checks if first == second, but does not include not (first != second) According to the docs: http://docs.python.org/reference/datamodel.html#specialnames There are no implied relationships among the comparison operators. Th

Re: Spam reported

2009-10-20 Thread Grant Edwards
On 2009-10-20, Peter Pearson wrote: > Reported to Google's groups-abuse. What are these postings supposed to mean? -- Grant Edwards grante Yow! I've read SEVEN at MILLION books!! visi.c

Re: Frameworks

2009-10-20 Thread mdipierro
One more clarification to avoid confusion. Django has "admin" and it is great. Web2py also has something called "admin" but that is not apples to apples. The closest thing to Django "admin" in web2py is called "appadmin" (it comes with it). For example consider the following complete program:

Re: a simple unicode question

2009-10-20 Thread George Trojan
Thanks for all suggestions. It took me a while to find out how to configure my keyboard to be able to type the degree sign. I prefer to stick with pure ASCII if possible. 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

Re: ctypes issues involving a pointer to an array of strings

2009-10-20 Thread MRAB
Nathaniel Hayes wrote: On Tue, Oct 20, 2009 at 12:12 PM, MRAB > wrote: The digits in that pointer value look suspiciously like the character codes of a string rather than an actual address: >>> "\x42\x71\x61\x44" 'BqaD' It looks like t

Re: Poll on Eval in Python

2009-10-20 Thread TerryP
On Oct 20, 4:30 pm, Nobody wrote: > One language's "eval" isn't the same as another's. E.g. there's a big > difference between Lisp's "eval" (which takes an s-expression as an > argument) and an "eval" which takes a string as an argument. > > The former is fine; the latter should be prohibited by

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call last): > >  File "ftp.pyo", line 70, in conn

A stupid newbie question about output...

2009-10-20 Thread J
Can someone explain why this code results in two different outputs? > for os in comp.CIM_OperatingSystem (): > print os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion > osVer = os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion > print osVer the first print s

Re: unittest wart/bug for assertNotEqual

2009-10-20 Thread Mark Dickinson
On Oct 20, 6:20 pm, Zac Burns wrote: > Using the assertNotEqual method of UnitTest (synonym for failIfEqual) > only checks if first == second, but does not include not (first != > second) It looks as though this is fixed in Python 2.7 (and also in 3.1): http://svn.python.org/view?view=rev&revisi

Re: File not closed on exception

2009-10-20 Thread [email protected]
On 20 Okt, 16:00, Bruno Desthuilliers wrote: > What's your problem with the with ??? No problem whatsoever, but I believe I wrote this utility function before the keyword was available, and it might be good to support older Python versions. > But anyway : explicitely releasing resources such as

Re: list to tuple and vice versa

2009-10-20 Thread David C Ullrich
On Sun, 18 Oct 2009 14:33:17 +1100, Ben Finney wrote: > Jabba Laci writes: > >> Hi, >> >> I have some difficulties with list -> tuple conversion: >> >> t = ('a', 'b') >> li = list(t) # tuple -> list, works print li # ['a', 'b'] >> >> tu = tuple(li) # list -> tuple, error print tu # what

Re: A stupid newbie question about output...

2009-10-20 Thread nn
On Oct 20, 2:23 pm, J wrote: > Can someone explain why this code results in two different outputs? > > > for os in comp.CIM_OperatingSystem (): > >  print os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion > >  osVer = os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVe

Re: A stupid newbie question about output...

2009-10-20 Thread Ethan Furman
J wrote: Can someone explain why this code results in two different outputs? for os in comp.CIM_OperatingSystem (): print os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion osVer = os.Name.split("|")[0] + " Service Pack", os.ServicePackMajorVersion print osVer the first pri

Re: a splitting headache

2009-10-20 Thread David C Ullrich
On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: > All I wanted to do is split a binary number into two lists, a list of > blocks of consecutive ones and another list of blocks of consecutive > zeroes. > > But no, you can't do that. > c = '001110' c.split('0') > ['', '', '1',

Re: A stupid newbie question about output...

2009-10-20 Thread J
On Tue, Oct 20, 2009 at 14:53, Ethan Furman wrote: > osVer = "%s Service Pack %d" % (os.Name.split("|")[0], >        os.ServicePackMajorVersion) > > This way, osVer is a string, and not a tuple. Thanks for the help... The tuple thing is a new concept to me... at least the vocabulary is, I'll go

Re: ftplib connection fails with multiple nics

2009-10-20 Thread Sean DiZazzo
On Oct 19, 10:23 pm, Tim Roberts wrote: > Sean DiZazzo wrote: > > >I'm trying to connect to an ftp site from a windows machine with two > >nics going to two different networks, but I keep getting the below > >exception: > > >Traceback (most recent call last): > >  File "ftp.pyo", line 70, in conn

Re: File not closed on exception

2009-10-20 Thread Gabriel Genellina
En Tue, 20 Oct 2009 04:47:02 -0300, [email protected] escribió: On 20 Okt, 09:40, "Gabriel Genellina" wrote: En Tue, 20 Oct 2009 03:23:49 -0300, [email protected] escribió: > I agree, but like I said, I've been told that this (implicit closing > of files) is the correct style b

Re: File not closed on exception

2009-10-20 Thread [email protected]
On 20 Okt, 21:13, "Gabriel Genellina" wrote: > En Tue, 20 Oct 2009 04:47:02 -0300, [email protected]   > escribió: > > > On 20 Okt, 09:40, "Gabriel Genellina" wrote: > >> En Tue, 20 Oct 2009 03:23:49 -0300, [email protected]   > >> escribió: > >> > I agree, but like I said, I've been

Re: help to convert c++ fonction in python

2009-10-20 Thread Aahz
In article , geremy condra wrote: > >And always apply ROT13 twice for extra security. Can't you tell? I'm already doing that! -- Aahz ([email protected]) <*> http://www.pythoncraft.com/ Member of the Groucho Marx Fan Club -- http://mail.python.org/mailman/listinfo/pyth

Unicode again ... default codec ...

2009-10-20 Thread Stef Mientki
hello, As someone else already said, "every time I think : now I understand it completely, and a few weeks later ..." Form the thread "how to write a unicode string to a file ?" and my specific situation: - reading data from Excel, Delphi and other Windows programs and unicode Python - usin

Re: help to convert c++ fonction in python

2009-10-20 Thread Mel
Aahz wrote: > In article , > geremy condra wrote: >> >>And always apply ROT13 twice for extra security. > > Can't you tell? I'm already doing that! Just don't flaunt the export restrictions by using ROT52. Mel. -- http://mail.python.org/mailman/listinfo/python-list

Re: help to convert c++ fonction in python

2009-10-20 Thread geremy condra
On Tue, Oct 20, 2009 at 3:54 PM, Aahz wrote: > In article , > geremy condra   wrote: >> >>And always apply ROT13 twice for extra security. > > Can't you tell?  I'm already doing that! > -- > Aahz ([email protected])           <*>         http://www.pythoncraft.com/ Sorry, couldn't read it thro

Re: ctypes issues involving a pointer to an array of strings

2009-10-20 Thread MRAB
Nathaniel Hayes wrote: On Tue, Oct 20, 2009 at 2:08 PM, MRAB > wrote: Nathaniel Hayes wrote: On Tue, Oct 20, 2009 at 12:12 PM, MRAB mailto:[email protected]>

Re: A stupid newbie question about output...

2009-10-20 Thread Aahz
In article , J wrote: > >The tuple thing is a new concept to me... at least the vocabulary is, >I'll go look that up now and learn info on tuples. It's been ages >since I did any python programming, and even back then it was fairly >simple stuff (this was about 9 years ago)... so I'm relearning b

Re: help to convert c++ fonction in python

2009-10-20 Thread Aahz
In article , Mel wrote: >Aahz wrote: >> In article , >> geremy condra wrote: >>> >>>And always apply ROT13 twice for extra security. >> >> Can't you tell? I'm already doing that! > >Just don't flaunt the export restrictions by using ROT52. s/flaunt/flout/ HTH, HAND ;-) -- Aahz (a...@pytho

Simple audio

2009-10-20 Thread Peter Chant
What are recommendations for simple audio playback? I want to play back on linux (Slackware), which uses alsa. There seem to be many ways - but some are a couple of years old and won't compile, like pymedia, or seem not widely used and need pulseaudio (swmixer) which I have not installed. I

Re: A stupid newbie question about output...

2009-10-20 Thread J
On Tue, Oct 20, 2009 at 16:25, Aahz wrote: > In article , > J   wrote: >> >>The tuple thing is a new concept to me... at least the vocabulary is, >>I'll go look that up now and learn info on tuples. It's been ages >>since I did any python programming, and even back then it was fairly >>simple stuf

Re: help to convert c++ fonction in python

2009-10-20 Thread Gary Herron
geremy condra wrote: On Mon, Oct 19, 2009 at 2:25 AM, Tim Roberts wrote: You wrote: For the love of baby kittens, please, please, please tell me that you do not believe this securely encrypts your data. The original poster asked to have two C++ functions converted to Python.

pyserial ser.write('string') TypeError in OS X

2009-10-20 Thread Rodrigo
Maybe this is not a bug at all, but i have installed python2.5. 3.01 and 3.1.1. In python 2.5 ser. write('this is a string') works just fine. On the other hand, with 3.01 and 3.1.1 (pyserial 2.5 rc1) when i do a ser.write('this is a string') i get the following error" >>> import serial >>> ser = s

convert pyc (python 2.4) to py

2009-10-20 Thread Peng Yu
I have a .pyc file generated by python 2.4. My current python is of version 2.6. I'm wondering how to generate the corresponding .py file from it. -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest wart/bug for assertNotEqual

2009-10-20 Thread Steven D'Aprano
On Tue, 20 Oct 2009 10:20:54 -0700, Zac Burns wrote: > Using the assertNotEqual method of UnitTest (synonym for failIfEqual) > only checks if first == second, but does not include not (first != > second) > > According to the docs: > http://docs.python.org/reference/datamodel.html#specialnames The

Re: pyserial ser.write('string') TypeError in OS X

2009-10-20 Thread Diez B. Roggisch
Rodrigo schrieb: Maybe this is not a bug at all, but i have installed python2.5. 3.01 and 3.1.1. In python 2.5 ser. write('this is a string') works just fine. On the other hand, with 3.01 and 3.1.1 (pyserial 2.5 rc1) when i do a ser.write('this is a string') i get the following error" import se

Re: SimpleXMLRPCServer clobbering sys.stderr? (2.5.2)

2009-10-20 Thread Gabriel Genellina
En Mon, 19 Oct 2009 00:09:10 -0300, Joseph Turian escribió: > I was having a mysterious problem with SimpleXMLRPCServer. (I am using > Python 2.5.2) > The request handlers were sometimes failing without any error message > to the log output. Here's what I see: * If I use logging to write the

Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread Alf P. Steinbach
Hi all. I'm just learning Python from scratch, on my own. Apologies if this question is too newbie... Or perhaps answered in some FAQ (where?). Here's my original code for simple starter program, using the ActivePython implementation in Windows XP Prof, Python version is 2.6: import Tkint

Re: convert pyc (python 2.4) to py

2009-10-20 Thread Diez B. Roggisch
Peng Yu schrieb: I have a .pyc file generated by python 2.4. My current python is of version 2.6. I'm wondering how to generate the corresponding .py file from it. http://www.crazy-compilers.com/decompyle/ Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest wart/bug for assertNotEqual

2009-10-20 Thread Zac Burns
> I was with you right up to the last six words. > > Whether it's worth changing assertNotEqual to be something other than an > alias of failIfEqual is an interesting question. Currently all the > assert* and fail* variants are aliases of each other, which is easy to > learn. This would introduce a

PySide > PyQt

2009-10-20 Thread rm
Have you guys heard about PySide: http://www.pyside.org/ It is basically the same as PyQt (Qt bindings for Python), but licensed with the LGPL instead of GPL. The FAQ explains a bit more history. Looks like the end for PyQt if you ask me. -- http://mail.python.org/mailman/listinfo/python-list

PySide > PyQt

2009-10-20 Thread rm
Have you guys heard about PySide: http://www.pyside.org/ It is basically the same as PyQt (Qt bindings for Python), but licensed with the LGPL instead of GPL. The FAQ explains a bit more history. Looks like the end for PyQt if you ask me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Spam reported

2009-10-20 Thread Ned Deily
In article , Grant Edwards wrote: > On 2009-10-20, Peter Pearson wrote: > > Reported to Google's groups-abuse. > What are these postings supposed to mean? I think some people don't recognize that this forum is distributed through several channels (e.g. Usenet, python.org mailing list, gmane.o

Re: Frameworks

2009-10-20 Thread Emmanuel Surleau
> Emmanuel Surleau a écrit : > >> Django : very strong integration, excellent documentation and support, > >> huge community, really easy to get started with. And possibly a bit more > >> mature and stable... > > > > One strong point in favour of Django: it follows Python's philosophy of > > "batte

Re: pyserial ser.write('string') TypeError in OS X

2009-10-20 Thread Gabriel Genellina
En Tue, 20 Oct 2009 18:02:03 -0300, Rodrigo escribió: Maybe this is not a bug at all, but i have installed python2.5. 3.01 and 3.1.1. In python 2.5 ser. write('this is a string') works just fine. On the other hand, with 3.01 and 3.1.1 (pyserial 2.5 rc1) when i do a ser.write('this is a string

Re: Separate namespace from file hierarchy?

2009-10-20 Thread Steven D'Aprano
On Tue, 20 Oct 2009 08:51:44 -0500, Peng Yu wrote: > Suppose I have the dirname/both.py, which has the definitions of classes > A and B. I can use this module in the following code. > > # > import dirname.both > > a=dirname.both.A() > b=dirname.both.B() Have you tried this, or

Struct on on x86_64 mac os x

2009-10-20 Thread Tommy Grav
I have created a binary file that saves this struct from some C code: struct recOneData { char label[3][84]; char constName[400][6]; double timeData[3]; long int numConst; double AU; double EMRAT; long int coeffPtr[12][3]; long int DENUM;

CAD -> FEM | writing FEM meshes in abacus format || pythonOCC

2009-10-20 Thread jelle feringa
Hi, I'm wondering whether someone has experience / code / pointers on how to write FEM meshes to Abacus ( Simulia, whatever ). We're making good progress at the pythonOCC(.org) project in coupling CAD & FEM and a next step would be to plug the generates meshes into a major FEM solver such as abaq

Inconsistent raw_input behavior after Ctrl-C

2009-10-20 Thread Maxim Khitrov
Hello all, I ran into a rather strange problem when interrupting a raw_input call with Ctrl-C. This is with python 2.6.3 on Windows 7. When the call is interrupted, one of two things happen - either a KeyboardInterrupt exception is raised or raw_input raises EOFError, and KeyboardInterrupt is rais

Re: Spam reported

2009-10-20 Thread Ben Finney
Grant Edwards writes: > On 2009-10-20, Peter Pearson wrote: > > > Reported to Google's groups-abuse. > > What are these postings supposed to mean? That the posting which started the thread (which you may or may not have seen, so it's good that Peter isn't quoting the original spam) has been rep

Re: Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread Rhodri James
On Tue, 20 Oct 2009 22:42:07 +0100, Alf P. Steinbach wrote: [snip] canvas.create_oval( bbox, fill = "PeachPuff" ) [snip] It worked nicely, and I thought this code was fairly perfect until I started studying the language reference. It seems that formally correct code should apply the s

Re: unittest wart/bug for assertNotEqual

2009-10-20 Thread Steven D'Aprano
On Tue, 20 Oct 2009 14:45:49 -0700, Zac Burns wrote: > My preference would be that failIfEqual checks both != and ==. This is > practical, and would benefit almost all use cases. If "!=" isn't "not > ==" (IEEE NaNs I hear is the only known use case) numpy uses == and != as element-wise operators:

Re: PySide > PyQt

2009-10-20 Thread Robert Kern
On 2009-10-20 16:48 PM, rm wrote: Have you guys heard about PySide: http://www.pyside.org/ It is basically the same as PyQt (Qt bindings for Python), but licensed with the LGPL instead of GPL. The FAQ explains a bit more history. Looks like the end for PyQt if you ask me. Welcome to two mon

Regex

2009-10-20 Thread Someone Something
I'm trying to write a program that needs reg expressions in the following way. If the user types in "*something*" that means that the asterixes can be replaced by any string of letters. I haven't been able to find any reg expression tutorials that I can understand. Help? -- http://mail.python.org/

Re: a splitting headache

2009-10-20 Thread Mensanator
On Oct 20, 1:51 pm, David C Ullrich wrote: > On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: > > All I wanted to do is split a binary number into two lists, a list of > > blocks of consecutive ones and another list of blocks of consecutive > > zeroes. > > > But no, you can't do that. > > >>>

Re: Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread MRAB
Alf P. Steinbach wrote: Hi all. I'm just learning Python from scratch, on my own. Apologies if this question is too newbie... Or perhaps answered in some FAQ (where?). Here's my original code for simple starter program, using the ActivePython implementation in Windows XP Prof, Python version

Re: Why does passing tuple as arg WITHOUT scattering work?

2009-10-20 Thread Alf P. Steinbach
* Rhodri James: On Tue, 20 Oct 2009 22:42:07 +0100, Alf P. Steinbach wrote: [snip] canvas.create_oval( bbox, fill = "PeachPuff" ) [snip] It worked nicely, and I thought this code was fairly perfect until I started studying the language reference. It seems that formally correct code sho

Re: Checking a Number for Palindromic Behavior

2009-10-20 Thread rurpy
On 10/20/2009 03:16 PM, Steven D'Aprano wrote: > On Tue, 20 Oct 2009 10:18:55 -0700, rurpy wrote: > >> 6) Please don't apply your abstract moral standards to >> the entire rest of the world, knowing nothing about the particular >> circumstances of the poster. > > Perhaps you should apply this rul

Re: unittest wart/bug for assertNotEqual

2009-10-20 Thread Ethan Furman
Steven D'Aprano wrote: On Tue, 20 Oct 2009 14:45:49 -0700, Zac Burns wrote: My preference would be that failIfEqual checks both != and ==. This is practical, and would benefit almost all use cases. If "!=" isn't "not ==" (IEEE NaNs I hear is the only known use case) numpy uses == and != as

Re: Frameworks

2009-10-20 Thread Massimo Di Pierro
On Oct 20, 2009, at 4:59 PM, Emmanuel Surleau wrote: Compared to custom tags in, say, Mako? Having to implement a mini- parser for each single tag when you can write a stupid Python function is needless complication. I like Mako a lot and in fact web2py template took some inspiration from

Re: Anyone have python 3.1.1 installed on Solaris 10 ? (sparc or x86)

2009-10-20 Thread Antoine Pitrou
Hello, > Anyone have python 3.1.1 installed on Solaris 10 ? (sparc or x86) > > I've tried several times on sparc, I keep getting: [snip] If you don't get an answer on this list, I encourage you to file an issue on http://bugs.python.org Thank you Antoine. -- http://mail.python.org/mailman

Re: Regex

2009-10-20 Thread Chris Rebert
On Tue, Oct 20, 2009 at 3:16 PM, Someone Something wrote: > I'm trying to write a program that needs reg expressions in the following > way. If the user types in "*something*" that means that the asterixes can be > replaced by any string of letters. I haven't been able to find any reg > expression

  1   2   >