Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

2009-06-17 Thread Gabriel Rossetti
John Machin wrote: On Jun 17, 1:41 am, Gabriel Rossetti wrote: Hello everyone, I get an OperationalError with sqlite3 if I put the wrong column name, but shouldn't that be a ProgrammingError instead? I read PEP 249 and it says : [snip] and to me it sounds more like a programming

Re: strange behavior with os.system

2009-06-17 Thread kmw
That's it. I am calling my own program and not coreutils' sort, what explains the unrequested output. Many thanks. Cheers, Kay On 16 Jun., 22:16, Piet van Oostrum wrote: > > kmw (k) wrote: > >k> Hi, > >k> I wanted to write a simple script (in 5 minutes or so) which replaces > >k> the option

Re: Newbie question about method options

2009-06-17 Thread Dave Angel
python-newbie113 wrote: I am new to python and have a question about using methods. Here is the link i am looking at: http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm If i use, create_arc(bbox, options) => id what is id? and how do i find the parameter list representing

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote: > Getting a depression because of a compiler is a bit strong... > > However, yes, bytecode is similar to assembler, and in that respect > higher-level control-structures are created using (conditional) jumps. > > The same is true for other bytecode-languages, see here f

Re: Tool for browsing python code

2009-06-17 Thread Hendrik van Rooyen
Horace Blegg wrote: >I've heard from my cousin that his former high school classmate's >uncle did a research on a large statistical sample of programmers and >found that emacs users' brains are about 12% smaller than vi users' :) >I'm afraid it's the other way around, really. You see, emacs cont

Re: walking a directory with very many files

2009-06-17 Thread Mike Kazantsev
On Wed, 17 Jun 2009 17:53:33 +1200 Lawrence D'Oliveiro wrote: > > Why not use hex representation of md5/sha1-hashed id as a path, > > arranging them like /path/f/9/e/95ea4926a4 ? > > > > That way, you won't have to deal with many-files-in-path problem ... > > Why is that a problem? So you can

Re: Exotic Logics

2009-06-17 Thread Steven D'Aprano
On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > I was staring at a logic table the other day, and I asked myself, "what > if one wanted to play with exotic logics; how might one do it?" First question: what's an exotic logics? Do you mean things like three-value logic, fuzzy logic

Re: Exotic Logics

2009-06-17 Thread Steven D'Aprano
On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > I was staring at a logic table the other day, and I asked myself, "what > if one wanted to play with exotic logics; how might one do it?" This might be useful for you, and if not useful, at least it might blow your mind like it did m

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread higer
Hi,all: I'm sorry that I did not make my question clear. What I mean is that what the souce code would look like that will be compiled to such bytecodes. Regards, higer -- http://mail.python.org/mailman/listinfo/python-list

Re: Need to know if a file as only ASCII charaters

2009-06-17 Thread Wolfgang Rohdewald
On Wednesday 17 June 2009, Lie Ryan wrote: > Wolfgang Rohdewald wrote: > > On Wednesday, 17. June 2009, Steven D'Aprano wrote: > >> while text: > >> for c in text: > >> if c not in printable: return False > > > > that is one loop per character. > > unless print

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread Diez B. Roggisch
higer wrote: > Hi,all: > > I'm sorry that I did not make my question clear. What I mean is that > what the souce code would look like that will be compiled to such > bytecodes. >>> import dis >>> def foo(): ... for i in xrange(10): ... if i == 5: ...break ... if i

Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

2009-06-17 Thread John Machin
On 17/06/2009 5:15 PM, Gabriel Rossetti wrote: John Machin wrote: On Jun 17, 1:41 am, Gabriel Rossetti wrote: Hello everyone, I get an OperationalError with sqlite3 if I put the wrong column name, but shouldn't that be a ProgrammingError instead? I read PEP 249 and it says : [snip]

class or instance method

2009-06-17 Thread Paul Johnston
Hi, I would like to have a method that is both a classmethod and an instancemethod. So: class MyClass(object): @class_or_instance def myfunc(cls_or_self): pass The semantics I'd like are: When you call MyClass.myfunc, it gets passed a class When you call MyClass().myfunc, it gets passed

Re: question about a command like 'goto ' in Python's bytecode orit's just a compiler optimization?

2009-06-17 Thread pdpi
On Jun 17, 9:01 am, "Hendrik van Rooyen" wrote: >  "Diez B. Roggisch" wrote: > > > Getting a depression because of a compiler is a bit strong... > > > However, yes, bytecode is similar to assembler, and in that respect > > higher-level control-structures are created using (conditional) jumps. > >

GAEUnit testing

2009-06-17 Thread Mike
Hello I'm using GAEUnit to develop an app for google appengine and am having a little trouble. I'm trying to make a test as follows: I have a file (say model.py) which contains Model.db model classes and some methods for accessing them. The methods are not part of the class. In my test I can cal

Re: class or instance method

2009-06-17 Thread Bruno Desthuilliers
Paul Johnston a écrit : Hi, I would like to have a method that is both a classmethod and an instancemethod. So: class MyClass(object): @class_or_instance def myfunc(cls_or_self): pass The semantics I'd like are: When you call MyClass.myfunc, it gets passed a class When you call MyClass

Re: Question about None

2009-06-17 Thread Bruno Desthuilliers
John Yeung a écrit : On Jun 13, 2:29 am, Steven D'Aprano wrote: Paul LaFollette wrote: 3) (this is purely philosophical but I am curious) Would it not be more intuitive if isinstance(None, ) returned true? Good grief no!!! None is an object. It has a type, NoneType. It's *not* a string, or a

Re: walking a directory with very many files

2009-06-17 Thread Lawrence D'Oliveiro
In message <20090617142431.2b25f...@malediction>, Mike Kazantsev wrote: > On Wed, 17 Jun 2009 17:53:33 +1200 > Lawrence D'Oliveiro wrote: > >> > Why not use hex representation of md5/sha1-hashed id as a path, >> > arranging them like /path/f/9/e/95ea4926a4 ? >> > >> > That way, you won't have t

Re: TypeError: int argument required

2009-06-17 Thread Lawrence D'Oliveiro
In message , Lie Ryan wrote: > out.write ( > ''' > function JSString(Str) > { > var Result = '\"' > for (var i = 0; i < Str.length; ++i) > { > var ThisCh = Str.charAt(i) > if (ThisCh == '\\') > { > ThisCh = '' > } > else

Re: Exceptions and Object Destruction (was: Problem with apsw and garbage collection)

2009-06-17 Thread Lawrence D'Oliveiro
In message <7x7hzbv14a@ruckus.brouhaha.com>, wrote: > Lawrence D'Oliveiro writes: > >> > Reference counting is an implementation detail used by CPython but not >> > [implementations built on runtimes designed for corporate-herd-oriented >> > languages, like] IronPython or Jython. >> >> I re

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Charles Yeomans
On Jun 17, 2009, at 2:04 AM, Paul Rubin wrote: Jaime Fernandez del Rio writes: I am pretty sure that a continuous sequence of curves that converges to a continuous curve, will do so uniformly. I think a typical example of a curve that's continuous but not uniformly continuous is f(t) = s

Regarding Python is scripting language or not

2009-06-17 Thread abhishek goswami
Hi, I have very basic question about Python that do we consider pyhton as script language. I searched in google but it becomes more confusion for me. After some analysis I came to know that Python support oops . Can anyone Guide me that Python is Oject oriented programming language or Script la

Re: Exceptions and Object Destruction (was: Problem with apsw and garbage collection)

2009-06-17 Thread Charles Yeomans
On Jun 17, 2009, at 2:13 AM, Paul Rubin wrote: Lawrence D'Oliveiro writes: Reference counting is an implementation detail used by CPython but not [implementations built on runtimes designed for corporate-herd- oriented languages, like] IronPython or Jython. I rest my case. You're reall

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 7:04 am, Paul Rubin wrote: > I think a typical example of a curve that's continuous but not > uniformly continuous is > >    f(t) = sin(1/t), defined when t > 0 > > It is continuous at every t>0 but wiggles violently as you get closer > to t=0.  You wouldn'

Re: Perl's @foo[3,7,1,-1] ?

2009-06-17 Thread Jean-Michel Pichavant
On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: What's np.arange? import numpy as np -- Pierre "delroth" Bourdon Étudiant à l'EPITA / Student at EPITA Perfect example of why renaming namespaces should be done only when absolutely required, that is, almost never. Jean-Michel

Re: class or instance method

2009-06-17 Thread Xavier Ho
I'm quite curious as to why you would like it, because: >>> MyClass (returns the MyClass class representation) >>> MyClass() (returns a instance of the MyClass class) So, are you just looking for a method that does exactly the above? Best regards, Ching-Yun "Xavier" Ho, Technical Artist Contac

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Jaime Fernandez del Rio
On Wed, Jun 17, 2009 at 1:52 PM, Mark Dickinson wrote: > Maybe James is thinking of the standard theorem > that says that if a sequence of continuous functions > on an interval converges uniformly then its limit > is continuous? Jaime was simply plain wrong... The example that always comes to mind

Re: question about a command like 'goto ' in Python's bytecode or it's just a compiler optimization?

2009-06-17 Thread John Machin
On Jun 17, 1:40 pm, higer wrote: > My Python version is 2.5.2; When I reading the bytecode of some pyc > file, I always found that there are many jump command from different > position,but to the same position. You can see this situation in > following code(this bytecode is just from one .pyc file

Re: Regarding Python is scripting language or not

2009-06-17 Thread Jean-Michel Pichavant
abhishek goswami wrote: Hi, I have very basic question about Python that do we consider pyhton as script language. I searched in google but it becomes more confusion for me. After some analysis I came to know that Python support oops . Can anyone Guide me that Python is Oject oriented program

Re: Regarding Python is scripting language or not

2009-06-17 Thread Jochen Schulz
abhishek goswami: > > Can anyone Guide me that Python is Oject oriented programming language > or Script language In my opinion, Python is both. But an "objective" answer would require you to define what you means by these terms. If, by "object-oriented" you mean "everything has to be put into c

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 1:26 pm, Jaime Fernandez del Rio wrote: > On Wed, Jun 17, 2009 at 1:52 PM, Mark Dickinson wrote: > > Maybe James is thinking of the standard theorem > > that says that if a sequence of continuous functions > > on an interval converges uniformly then its limit > > is continuous? s/James

Re: question about a command like 'goto ' in Python's bytecode or it's just a compiler optimization?

2009-06-17 Thread higer
On Jun 17, 8:29 pm, John Machin wrote: > On Jun 17, 1:40 pm, higer wrote: > > > My Python version is 2.5.2; When I reading the bytecode of some pyc > > file, I always found that there are many jump command from different > > position,but to the same position. You can see this situation in > > fol

Re: walking a directory with very many files

2009-06-17 Thread Scott David Daniels
Mike Kazantsev wrote: On Wed, 17 Jun 2009 14:52:28 +1200 Lawrence D'Oliveiro wrote: In message <234b19ac-7baf-4356-9fe5-37d00146d...@z9g2000yqi.googlegroups.com>, thebjorn wrote: Not proud of this, but...: [django] www4:~/datakortet/media$ ls bfpbilder|wc -l 174197 all .jpg files between

Re: class or instance method

2009-06-17 Thread Hrvoje Niksic
Paul Johnston writes: > I would like to have a method that is both a classmethod and an > instancemethod. So: > > class MyClass(object): > @class_or_instance > def myfunc(cls_or_self): > pass > > The semantics I'd like are: > When you call MyClass.myfunc, it gets passed a class > When you

Re: Perl's @foo[3,7,1,-1] ?

2009-06-17 Thread Scott David Daniels
Jean-Michel Pichavant wrote: On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: What's np.arange? import numpy as np Perfect example of why renaming namespaces should be done only when absolutely required, that is, almost never. Jean-Michel Actually, "np." is quite commonly used in t

Re: Regarding Python is scripting language or not

2009-06-17 Thread Martin P. Hellwig
Jochen Schulz wrote: abhishek goswami: Can anyone Guide me that Python is Oject oriented programming language or Script language In my opinion, Python is both. But an "objective" answer would require you to define what you means by these terms. If, by "object-oriented" you mean "everything ha

Re: Newbie question about method options

2009-06-17 Thread Scott David Daniels
Dave Angel wrote: python-newbie113 wrote: I am new to python and have a question about using methods. Here is the link i am looking at: http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm If i use, create_arc(bbox, options) => id what is id? and how do i find the parameter

Re: UDP queue size

2009-06-17 Thread Scott David Daniels
找尋自己的一片天 wrote: > I got a problem about UDP. > > How do I get the UDP buffer size? > > When the server had some delay in handling incoming UDP, it will lost > some package. I wonder it's because the system buffer size, is there any > ways to find the exactly size of the buffer? U

Newbie queue question

2009-06-17 Thread Jure Erznožnik
Hi, I'm pretty new to Python (2.6) and I've run into a problem I just can't seem to solve. I'm using dbfpy to access DBF tables as part of a little test project. I've programmed two separate functions, one that reads the DBF in main thread and the other which reads the DBF asynchronously in a separ

Re: first full alpha release of PyLab_Works v0.3

2009-06-17 Thread edexter
On Jun 17, 12:29 am, "Martin P. Hellwig" wrote: > edexter wrote: > > On Jun 16, 12:27 pm, Stef Mientki wrote: > >> hello, > > >> I am pleased to announce the first full alpha release of PyLab_Works, v0.3. > > >> PyLab_Works is a modular Visual Development Environment, based on > >> data-flow prog

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 2:18 pm, pdpi wrote: > On Jun 17, 1:26 pm, Jaime Fernandez del Rio > wrote: > > > P.S. The snowflake curve, on the other hand, is uniformly continuous, right? > > The definition of uniform continuity is that, for any epsilon > 0, > there is a delta > 0 such that, for any x and y, if x-

Re: Tool for browsing python code

2009-06-17 Thread Paul Boddie
On 16 Jun, 14:48, Lucas P Melo wrote: > Is there any tool for browsing python code? (I'm having a hard time > trying to figure this out) > Anything like cscope with vim would be great. Are you limiting your inquiry to text editors or IDEs, or are Web- based solutions also interesting? Often, conv

Re: Tool for browsing python code

2009-06-17 Thread Kurt Smith
On Tue, Jun 16, 2009 at 7:48 AM, Lucas P Melo wrote: > Is there any tool for browsing python code? (I'm having a hard time trying > to figure this out) > Anything like cscope with vim would be great. Check out pycscope: http://pypi.python.org/pypi/pycscope/0.3 I use it myself, and it works fine.

Re: ANN: pyTenjin 0.8.0 - much faster template engine than Django

2009-06-17 Thread Igor Katson
kwatch wrote: I have released pyTenjin 0.8.0 Thanks for your project. I have used it a little, and there is a question to you. import tenjin from tenjin.helpers import * shared_cache = tenjin.GaeMemcacheCacheStorage() engine = tenjin.Engine(cache=shared_cache) 1. Why should I import tenjin

Re: persistent composites

2009-06-17 Thread Aaron Brady
On Jun 16, 10:09 am, Mike Kazantsev wrote: > On Tue, 16 Jun 2009 06:57:13 -0700 (PDT) > > Aaron Brady wrote: > > Making the charitable interpretation that this was the extent of c-l- > > py's support and enthusiasm for my idea, I will now go into mourning. > > Death occurred at oh-eight-hundred.

Re: Question about None

2009-06-17 Thread Aaron Brady
On Jun 17, 5:47 am, Bruno Desthuilliers wrote: > John Yeung a écrit : > > But mathematically speaking, it's intuitive that "nothing" would match > > any type. > > IOW, what's the OP is after is not the None type, but some yet > unexisting "Anything" type !-) The behaviors of the 'anything' object

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 3:46 pm, Paul Rubin wrote: > Mark Dickinson writes: > > It looks as though you're treating (a portion of?) the Koch curve as > > the graph of a function f from R -> R and claiming that f is > > uniformly continuous.  But the Koch curve isn't such a graph (

Re: UDP queue size

2009-06-17 Thread Nick Craig-Wood
§ä´m¦Û¤vª�...@¤ù¤Ñ wrote: > I got a problem about UDP. > > How do I get the UDP buffer size? > > When the server had some delay in handling incoming UDP, it will lost > some package. I wonder it's because the system buffer size, is there any > ways to find the exactly size of t

Re: walking a directory with very many files

2009-06-17 Thread Mike Kazantsev
On Wed, 17 Jun 2009 23:04:37 +1200 Lawrence D'Oliveiro wrote: > In message <20090617142431.2b25f...@malediction>, Mike Kazantsev wrote: > > > On Wed, 17 Jun 2009 17:53:33 +1200 > > Lawrence D'Oliveiro wrote: > > > >> > Why not use hex representation of md5/sha1-hashed id as a path, > >> > arra

Re: Measuring Fractal Dimension ?

2009-06-17 Thread pdpi
On Jun 17, 4:18 pm, Mark Dickinson wrote: > On Jun 17, 3:46 pm, Paul Rubin wrote: > > > Mark Dickinson writes: > > > It looks as though you're treating (a portion of?) the Koch curve as > > > the graph of a function f from R -> R and claiming that f is > > > uniform

Re: UDP queue size

2009-06-17 Thread Martin P. Hellwig
Scott David Daniels wrote: > 找尋自己的一片天 wrote: >> I got a problem about UDP. >> >> How do I get the UDP buffer size? >> >> When the server had some delay in handling incoming UDP, it will lost >> some package. I wonder it's because the system buffer size, is there any >> ways to find

Re: Executing a python script while it is running

2009-06-17 Thread bobicanprogram
On Jun 17, 1:42 am, Zach Hobesh wrote: > On Tue, Jun 16, 2009 at 6:37 PM, Chris Rebert wrote: > > On Tue, Jun 16, 2009 at 6:21 PM, wrote: > >> Hey Dave, > > >> Thanks for the helpful responses. > > >>> Option 2 is what you get by default. Naturally it depends on what the > >>> application is us

exit() or sys.exit()

2009-06-17 Thread Brendan
What is the difference on exit() and sys.exit() when called in the main body of a script? From the command line they seem to have the same effect. Aside: Just used a python dictionary in which the keys were compiled regular expressions. Provided a very elegant solution. Have to love it. -- http:/

Re: exit() or sys.exit()

2009-06-17 Thread Tim Chase
Brendan wrote: What is the difference on exit() and sys.exit() when called in the main body of a script? From the command line they seem to have the same effect. In Python <=2.4 you had to use sys.exit() because __builtins__.exit() griped: tch...@asgix:~$ python2.4 Python 2.4.4 (#2, Apr

Re: Executing a python script while it is running

2009-06-17 Thread Aaron Brady
On Jun 16, 3:48 pm, Zach Hobesh wrote: > > A lot more information would be useful.  What version of Python, and what > > operating system environment?  Exactly what would you like to happen when > > the batch file is invoked a second time? > > I'm running Python 2.6.2 on Windows.  I'm passing file

Re: Exotic Logics

2009-06-17 Thread Lie Ryan
Steven D'Aprano wrote: > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > >> I was staring at a logic table the other day, and I asked myself, "what >> if one wanted to play with exotic logics; how might one do it?" > > > This might be useful for you, and if not useful, at least it

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 1:44 am, Steven D'Aprano wrote: > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > I was staring at a logic table the other day, and I asked myself, "what > > if one wanted to play with exotic logics; how might one do it?" > > This might be useful for you, and if not usef

Re: ODE, GUI, plotter in Python

2009-06-17 Thread Rob Clewley
There was just an announcement on this list and the scipy list for PyLab_Works, which sounds exactly like what you're looking for. I would not recommend starting over with a new simulator at this point. -Rob On Tue, Jun 16, 2009 at 12:00 PM, Ala wrote: > Hello everyone. > > I am starting on implem

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 1:28 am, Steven D'Aprano wrote: > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > I was staring at a logic table the other day, and I asked myself, "what > > if one wanted to play with exotic logics; how might one do it?" > > First question: what's an exotic logics? > >

Re: Exotic Logics

2009-06-17 Thread pdpi
On Jun 17, 5:37 pm, Lie Ryan wrote: > Steven D'Aprano wrote: > > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > >> I was staring at a logic table the other day, and I asked myself, "what > >> if one wanted to play with exotic logics; how might one do it?" > > > This might be usefu

Re: exit() or sys.exit()

2009-06-17 Thread Brendan
On Jun 17, 1:33 pm, Tim Chase wrote: > Brendan wrote: > > What is the difference on exit() and sys.exit() when called in the > > main body of a script? From the command line they seem to have the > > same effect. > > In Python <=2.4 you had to use sys.exit() because > __builtins__.exit() griped: >

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:04 am, Aaron Brady wrote: snip > You (OP) may be interested in the definitions of the fuzzy operators: > > and( x, y ) := min( x, y ) > or( x, y ) := max( x, y ) > not( x ) := 1 (one)- x > nand( x, y ) := not( and( x, y ) ) = 1- min( x, y ) > > Defining 'xor' as '( x or y ) and ( not

Re: Exotic Logics

2009-06-17 Thread Mensanator
On Jun 17, 11:59 am, Aaron Brady wrote: > On Jun 17, 1:44 am, Steven D'Aprano > > > > wrote: > > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > > I was staring at a logic table the other day, and I asked myself, "what > > > if one wanted to play with exotic logics; how might one

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:05 am, pdpi wrote: > On Jun 17, 5:37 pm, Lie Ryan wrote: > > > > > Steven D'Aprano wrote: > > > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > > >> I was staring at a logic table the other day, and I asked myself, "what > > >> if one wanted to play with exotic logic

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:23 am, Mensanator wrote: > On Jun 17, 11:59 am, Aaron Brady wrote: > > > > > On Jun 17, 1:44 am, Steven D'Aprano > > > wrote: > > > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > > > I was staring at a logic table the other day, and I asked myself, "what > > > > if

Pythonic way to overwrite a file

2009-06-17 Thread Cameron Pulsford
Hey all, hopefully a simple question. I'm writing a simple python tool that opens a file, and does something like for line in file.readlines(): temp.write(line.doStuff()) However, I want to provide the option do this "in place", as in have the destination file be the same as the source file.

Create 3D Surface / Contour (with vpython?)

2009-06-17 Thread Philip Gröger
Hi! How can I create a 3D surface (or something like the picture on the FAQ page http://www.vpython.org/contents/FAQ.html ) with python [or vpython]. Didnt find anything in the Documentation under "graph" Basically like a contourf diagram in 3D ( http://www.techsoft.de/german/documents/images/3D_co

Re: Pythonic way to overwrite a file

2009-06-17 Thread Ben Charrow
Cameron Pulsford wrote: > Hey all, hopefully a simple question. > > I'm writing a simple python tool that opens a file, and does something like > > for line in file.readlines(): > temp.write(line.doStuff()) > > However, I want to provide the option do this "in place", as in have the > desti

Re: Pythonic way to overwrite a file

2009-06-17 Thread Jean-Michel Pichavant
Cameron Pulsford wrote: Hey all, hopefully a simple question. I'm writing a simple python tool that opens a file, and does something like for line in file.readlines(): temp.write(line.doStuff()) However, I want to provide the option do this "in place", as in have the destination file be

Re: Pythonic way to overwrite a file

2009-06-17 Thread Cameron Pulsford
Essentially it just cleans up a source file of erroneous spaces and tabs and can also convert tabs to spaces so loading the whole file into memory is possibly an option. I am making this utility for personal use, and that would definitely be fine, but if it turned out well I'd open source it and th

Re: Observer implementations

2009-06-17 Thread Mike C. Fletcher
Tobias Weber wrote: > In article , > "Mike C. Fletcher" wrote: > > >> See PyDispatcher for code to do this. >> > > That was the original problem. Got it now: if used inside the class > definition dispatcher.connect will raise "cannot create weak reference > to 'classmethod' object". Out

Re: Regarding Python is scripting language or not

2009-06-17 Thread Ken Seehart
abhishek goswami wrote: Hi, I have very basic question about Python that do we consider pyhton as script language. I searched in google but it becomes more confusion for me. After some analysis I came to know that Python support oops . Can anyone Guide me that Python is Oject oriented program

Re: Regarding Python is scripting language or not

2009-06-17 Thread Terry Reedy
Jochen Schulz wrote: abhishek goswami: Can anyone Guide me that Python is Oject oriented programming language or Script language In my opinion, Python is both. But an "objective" answer would require you to define what you means by these terms. If, by "object-oriented" you mean "everything ha

Re: Exotic Logics

2009-06-17 Thread William Clifford
On Jun 17, 1:28 am, Steven D'Aprano wrote: > On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > > I was staring at a logic table the other day, and I asked myself, "what > > if one wanted to play with exotic logics; how might one do it?" > > First question: what's an exotic logics? > >

Re: strptime issue in multi-threaded application

2009-06-17 Thread Joe Holloway
Christian wrote: > > Joe Holloway schrieb: > > ImportError: Failed to import _strptime because the import lockis > > [sic] held by another thread. > > The error message is my fault. The cause of the mistake is obvious: No worries. The error message is clear even with the minor typo, I just wanted

Re: A simpler logging configuration file format?

2009-06-17 Thread Vinay Sajip
On Jun 5, 9:07 pm, geoff.ba...@gmail.com wrote: > Hi all, Some discussion about this has already taken place on the issue tracker: http://bugs.python.org/issue6136 and I thought I would summarise my comments there on this thread, for people who have no need to look at that issue. > At the momen

Re: Exotic Logics

2009-06-17 Thread Terry Reedy
William Clifford wrote: same (or different) results. I've read one can do all of the 16 binary operations with clever uses of NAND or NOR. The book Laws of Form, by Spencer-Brown' is based on that observation, with nand/nor expanded to n-ary 'bag' functions (like sum() is). I recommend it, e

Re: Regarding Python is scripting language or not

2009-06-17 Thread Christian Heimes
Terry Reedy wrote: > If you mean 'be an instance of a class', which I think is the most > natural reading, then Python *is* object-oriented and, if I understand > what I have read correctly (so that ints are just (unboxed) ints and not > members of an int class), Java *is not*! A friend of mine ca

Re: Create 3D Surface / Contour (with vpython?)

2009-06-17 Thread Gökhan SEVER
On Wed, Jun 17, 2009 at 12:58 PM, Philip Gröger < philip.groe...@googlemail.com> wrote: > Hi! > How can I create a 3D surface (or something like the picture on the FAQ > page http://www.vpython.org/contents/FAQ.html ) with python [or vpython]. > Didnt find anything in the Documentation under "grap

SHM and Touchpad

2009-06-17 Thread Sparky
Hello! I am writing an application that requires access to the state of a synaptics touch pad on a laptop running Ubuntu Linux (for the number of fingers, pressure, x location, y location, etc). A different program using C++ accesses the information through SHM and I was hoping to do the same with

Re: Perl's @foo[3,7,1,-1] ?

2009-06-17 Thread J. Cliff Dyer
On Wed, 2009-06-17 at 14:13 +0200, Jean-Michel Pichavant wrote: > On Wed, Jun 17, 2009 at 04:14, Steven D'Aprano wrote: > >> What's np.arange? > >> > > > > import numpy as np > > > > -- > > Pierre "delroth" Bourdon > > Étudiant à l'EPITA / Student at EPITA > > > > Perfect example of why r

Re: SHM and Touchpad

2009-06-17 Thread Philip Semanchuk
On Jun 17, 2009, at 3:56 PM, Sparky wrote: Hello! I am writing an application that requires access to the state of a synaptics touch pad on a laptop running Ubuntu Linux (for the number of fingers, pressure, x location, y location, etc). A different program using C++ accesses the information th

Re: first full alpha release of PyLab_Works v0.3

2009-06-17 Thread Martin P. Hellwig
edexter wrote: it says I am missing msvcp71.dll installing Microsoft Visual C++ 2005 Redistributable Package did not help.. I had simular problems with alot of installers I had saved (from installing on xp) but when I grabbed newer installers they all worked, could be the manifast I was

logging.fileConfig limitations?

2009-06-17 Thread Mani Ghasemlou
Hi all, I have an application that writes out its logs in a subfolder of the user's local data directory. Let's say our user's name is "ßéäöÜ2". On my Windows XP machine, this logging path turns out to be: C:\Documents and Settings\ßéäöÜ2\Local Settings\Application Data\MyApp\MyApp.log My appli

Re: SHM and Touchpad

2009-06-17 Thread Sparky
On Jun 17, 2:09 pm, Philip Semanchuk wrote: > On Jun 17, 2009, at 3:56 PM, Sparky wrote: > > > Hello! I am writing an application that requires access to the state > > of a synaptics touch pad on a laptop running Ubuntu Linux (for the > > number of fingers, pressure, x location, y location, etc).

etree, lxml unexpected behaviour

2009-06-17 Thread Emanuele D'Arrigo
Hi everybody, I just tried the following: >>> import xml.etree.ElementTree as etree >>> e = etree.fromstring('>> xmlns:ans="anotherNamespace">>> ans:anotherAttr="2"/>') >>> e.getchildren()[0].attrib {'anAttr': '1', '{anotherNamespace}anotherAttr': '2'} Notice the lack of namespace before the attr

Reading and setting file permissions programmatically

2009-06-17 Thread Cameron Pulsford
Sorry to flood the list but my google fu isn't up to par today I guess. Basically, is it possible to read the permissions on one file and then set the permissions of another file to the ones we just read? os.dup2 seemed like it would work but I might not be using it correctly. I know there is os.c

Re: Regarding Python is scripting language or not

2009-06-17 Thread Lie Ryan
Jean-Michel Pichavant wrote: > abhishek goswami wrote: >> Hi, >> I have very basic question about Python that do we consider pyhton as >> script language. >> I searched in google but it becomes more confusion for me. After some >> analysis I came to know that Python support oops . >> >> Can anyone

Re: etree, lxml unexpected behaviour

2009-06-17 Thread Stefan Behnel
Emanuele D'Arrigo wrote: > Hi everybody, I just tried the following: > import xml.etree.ElementTree as etree e = etree.fromstring('>>> xmlns:ans="anotherNamespace" ans:anotherAttr="2"/>') e.getchildren()[0].attrib > {'anAttr': '1', '{anotherNamespace}anotherAttr': '2'} > > Noti

Re: Reading and setting file permissions programmatically

2009-06-17 Thread MRAB
Cameron Pulsford wrote: Sorry to flood the list but my google fu isn't up to par today I guess. Basically, is it possible to read the permissions on one file and then set the permissions of another file to the ones we just read? os.dup2 seemed like it would work but I might not be using it cor

RE: Good books in computer science?

2009-06-17 Thread Phil Runciman
Because it reminds me of when things went badly wrong. IBM360, Von Neumann architecture, no hardware stacks ... IMHO Burroughs and ICL had better approaches to OS design back then but had less resources to develop their ideas. However, mainly this period marked a transition from the excitement

Re: Exotic Logics

2009-06-17 Thread Lie Ryan
pdpi wrote: > On Jun 17, 5:37 pm, Lie Ryan wrote: >> Steven D'Aprano wrote: >>> On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: I was staring at a logic table the other day, and I asked myself, "what if one wanted to play with exotic logics; how might one do it?" >>> This mig

Re: exit() or sys.exit()

2009-06-17 Thread Sebastian Wiesner
> What is the difference on exit() and sys.exit() when called in the > main body of a script? From the command line they seem to have the > same effect. As of Python 2.5 there is no difference, however documentation [1] says about exit() and quit(): > They are useful for the interactive interp

Re: Exotic Logics

2009-06-17 Thread Luis Alberto Zarrabeitia Gomez
Quoting Lie Ryan : > pdpi wrote: > > On Jun 17, 5:37 pm, Lie Ryan wrote: > >> Steven D'Aprano wrote: > >>> On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: > I was staring at a logic table the other day, and I asked myself, "what > if one wanted to play with exotic logics; h

Re: Perl's @foo[3,7,1,-1] ?

2009-06-17 Thread Alan G Isaac
On 6/17/2009 4:03 PM J. Cliff Dyer apparently wrote: > example code > should always include relevant imports. Agreed. It was a cut and paste failure. Apologies. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

generator expression works in shell, NameError in script

2009-06-17 Thread ssc
Hello, I am trying to generate this list of tuples: [(0, ''), (1, 'Dr'), (2, 'Miss'), (3, 'Mr'), (4, 'Mrs'), (5, 'Ms')] My code works fine in the Python shell: >>> titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms',] >>> title_choices = [(0, '')] + list((titles.index(t)+1, t) for t in titles) >>> title_c

Re: generator expression works in shell, NameError in script

2009-06-17 Thread Emile van Sebille
On 6/17/2009 3:19 PM ssc said... Hello, I am trying to generate this list of tuples: [(0, ''), (1, 'Dr'), (2, 'Miss'), (3, 'Mr'), (4, 'Mrs'), (5, 'Ms')] My code works fine in the Python shell: titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms',] title_choices = [(0, '')] + list((titles.index(t)+1, t)

Re: walking a directory with very many files

2009-06-17 Thread Lawrence D'Oliveiro
In message <20090617214535.10866...@coercion>, Mike Kazantsev wrote: > On Wed, 17 Jun 2009 23:04:37 +1200 > Lawrence D'Oliveiro wrote: > >> In message <20090617142431.2b25f...@malediction>, Mike Kazantsev wrote: >> >>> On Wed, 17 Jun 2009 17:53:33 +1200 >>> Lawrence D'Oliveiro wrote: >>>

Re: generator expression works in shell, NameError in script

2009-06-17 Thread Chris Rebert
On Wed, Jun 17, 2009 at 3:19 PM, ssc wrote: > Hello, > > I am trying to generate this list of tuples: > [(0, ''), (1, 'Dr'), (2, 'Miss'), (3, 'Mr'), (4, 'Mrs'), (5, 'Ms')] > > My code works fine in the Python shell: > titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms',] title_choices = [(0, '')] +

Re: generator expression works in shell, NameError in script

2009-06-17 Thread Jason Tackaberry
On Wed, 2009-06-17 at 15:38 -0700, Chris Rebert wrote: > See what Emile said, but here's a nicer way to code it, IMHO: > > titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms'] > title_choices = zip(range(len(titles)+1), ['']+titles) > > zip() to the rescue! How about: enumerate([''] + titles) -- htt

  1   2   >