Re: module wide metaclass for new style classes

2006-12-17 Thread Peter Otten
Daniel Nogradi wrote: > I used to have the following code to collect all (old style) class > names defined in the current module to a list called reg: > > > def meta( reg ): > def _meta( name, bases, dictionary ): > reg.append( name ) > return _meta > > reg = [ ] > __metaclass__

Re: textwrap.dedent replaces tabs?

2006-12-17 Thread Peter Otten
Tom Plunket wrote: > I guess I could manually replace all tabs with eight > spaces (as opposed to 'correct' tab stops), and then replace them when > done, but it's probably just as easy to write a non-destructive dedent. You mean, as easy as >>> "\talpha\tbeta\t".expandtabs() 'alpha be

Re: OT : Bug/Issue tracking systems

2006-12-17 Thread Paddy
[EMAIL PROTECTED] wrote: > Hi, > > (Off-topic) > > I am looking to put an open-source bug/issue tracking system in place > for our current project (eventually expanded for all projects), and > would appreciate any experiences/comments/suggestions. > > Note the project is encompasses embedded hardw

Re: merits of Lisp vs Python

2006-12-17 Thread Kaz Kylheku
Paul Rubin wrote: > Raffael Cavallaro <[EMAIL PROTECTED]'espam-s'il-vous-plait-mac.com> writes: > > For example, a common lisp with optional static typing on demand would > > be strictly more expressive than common lisp. But, take say, haskell; > > haskell's static typing is not optional (you can w

Re: Metaclass uses?

2006-12-17 Thread Paddy
Nathan Harmston wrote: > Also is there anymore interesting OO stuff that Python has apart from Java. Duck Typing: http://www.thescripts.com/forum/thread22721.html; http://mindview.net/WebLog/log-0025, Python does not have checked exceptions: http://www.mindview.net/Etc/Discussions/CheckedException

Re: Good Looking UI for a stand alone application

2006-12-17 Thread Luc Heinrich
The Night Blogger <[EMAIL PROTECTED]> wrote: > Can someone recommend me a good API for writing a sexy looking (Rich UI like WinForms) shrink wrap application No, because such a thing doesn't exist. > My requirement is that the application needs to look as good on Windows as > on the Apple Mac C

Re: OT : Bug/Issue tracking systems

2006-12-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, moogyd wrote: > The requirements I have come up with > > […] > > - Ideally via text files, a bit of perl/tcl/python OK. I'd rather > avoid SQL You should drop that requirement. The tracker will be used concurrently and this is handled very efficiently and reliable by a

Re: Smarter way to do this? Unicode + stdin, stdout

2006-12-17 Thread Martin v. Löwis
BenjaMinster schrieb: > I want to read and write unicode on stdin and stdout. I can't seem to > find any way to force sys.stdin.encoding and sys.stdout.encoding to be > utf-8, so I've got the following workaround: What operating system are you using? Why do you want to do this? Python attempts to

Re: module wide metaclass for new style classes

2006-12-17 Thread Daniel Nogradi
> > I used to have the following code to collect all (old style) class > > names defined in the current module to a list called reg: > > > > > > def meta( reg ): > > def _meta( name, bases, dictionary ): > > reg.append( name ) > > return _meta > > > > reg = [ ] > > __metaclass__ = m

Control-C alternative in Windows

2006-12-17 Thread Vlad Dogaru
Hello, I've written a simple, standalone wiki server in Python. It runs a BaseHTTPServer's serve_forever() method until a KeyboardInterrupt is caught, at which point it writes changes to a file and exits. This works as expected in Linux. However, in Windows I cannot stop the script with Control-C.

Re: Good Looking UI for a stand alone application

2006-12-17 Thread Christophe Cavalaria
Sandra-24 wrote: > On 12/16/06, The Night Blogger <[EMAIL PROTECTED]> wrote: >> Can someone recommend me a good API for writing a sexy looking (Rich UI >> like WinForms) shrink wrap application > >> My requirement is that the application needs to look as good on Windows >> as on the Apple Mac >

Core dump revisited

2006-12-17 Thread Sheldon
Hi, I have a python script that uses a C extention. I keep getting a recurring problem that causes a core dump a few lines after the C extention return data back tp python. I tried using pbd and gdb but I have not succeeded in understanding what went wrong and where. I post the python script here

Re: How to test if two strings point to the same file or directory?

2006-12-17 Thread Tim Golden
Sandra-24 wrote: > Comparing file system paths as strings is very brittle. Is there a > better way to test if two paths point to the same file or directory > (and that will work across platforms?) I suspect that the "and that will work across platforms" parenthesis is in effect a killer. However,

Re: OT : Bug/Issue tracking systems

2006-12-17 Thread moogyd
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, moogyd wrote: > > > The requirements I have come up with > > > > [...] > > > > - Ideally via text files, a bit of perl/tcl/python OK. I'd rather > > avoid SQL > > You should drop that requirement. The tracker will be used concurrently >

Re: skip last line in loops

2006-12-17 Thread stdazi
lines = open('blah').readlines() for i in range(0, len(lines)-1) : print lines[i] [EMAIL PROTECTED] wrote: > hi, > how can i skip printing the last line using loops (for /while) > > eg > > for line in open("file): > print line. > > I want to skip printing last line of the file.thanks --

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread Diez B. Roggisch
> > Most values tend to work, but only because the SQL string representation > happens to be the same as the Python representation. That may not apply to > some float values, bool, perhaps others. I had hoped the tools would have > solved those problems so I don't have to. In typed languages (J

Re: Shed Skin 0.0.15

2006-12-17 Thread Mark Dufour
Thanks to those that sent in bug reports. This is really, really useful. I already released 0.0.16, with the following improvements: -added frozenset -time.sleep now works on WIN32 -constant-string expressions and __doc__ attributes are made into nice C++ comments -added --nowrap optimization opt

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread Fredrik Lundh
dyork wrote: > Most values tend to work, but only because the SQL string representation > happens to be the same as the Python representation. That may not apply to > some float values, bool, perhaps others. I had hoped the tools would have > solved those problems so I don't have to. In typed l

Re: merits of Lisp vs Python

2006-12-17 Thread jayessay
Paul Rubin writes: > "Kaz Kylheku" <[EMAIL PROTECTED]> writes: > > > Lisp just seems hopelessly old-fashioned to me these days. A > > > modernized version would be cool, but I think the more serious > > > Lisp-like language designers have moved on to newer ideas. > > >

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread Hertha Steck
Am Sat, 16 Dec 2006 16:31:18 -0500 schrieb Carsten Haese: > > This may come as a shock to you, but MySQL is not the only database > engine on the planet. Your recommendation may apply to MySQL, but it is > not true for all databases in general. I can name at least two examples > (Informix and Ora

Re: Control-C alternative in Windows

2006-12-17 Thread Kleine Aap
Vlad Dogaru wrote: > I've written a simple, standalone wiki server in Python. It runs a > BaseHTTPServer's serve_forever() method until a KeyboardInterrupt is > caught, at which point it writes changes to a file and exits. This > works as expected in Linux. However, in Windows I cannot stop the >

Re: merits of Lisp vs Python

2006-12-17 Thread Jon Harrop
Raffael Cavallaro wrote: > On 2006-12-16 13:58:37 -0500, Jon Harrop <[EMAIL PROTECTED]> said: >> Why do you think that uniform syntax is necessary to provide new >> paradigms when it is equivalent to infix syntax? > > Because it doesn't require one to write a parser for each new syntax > for each

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"fumanchu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Here's the web adaptation layer I use: > http://projects.amor.org/misc/browser/alamode.py > Have a look at the coerce_in and coerce_out functions. Thanks! Plenty of useful ideas there. My web framework already does all the

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Python is a typed language, too, and "this thing" works just fine, > provided that you are using a reasonable DB-API implementation, and > provided that you're actually binding objects as parameters instead of > just st

Re: How to test if two strings point to the same file or directory?

2006-12-17 Thread Tim Chase
> The current setup will not "silently fail when run on win32". How could > it? It doesn't exist; it can't be run. Ah...didn't know which it did (or didn't do) as I don't have a win32 box at hand on which to test it. In chasing the matter further, the OP mentioned that their particular problem

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This may come as a shock to you, but MySQL is not the only database > engine on the planet. Your recommendation may apply to MySQL, but it is > not true for all databases in general. I can name at least two examples > (I

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you actually look at what the various DB-API adapters produce > when sending to the database engine, floats, bools, etc. are all sent as > string representations; about the only source for problems would be > in

Changing variable to integer

2006-12-17 Thread vertigo
Hello I receive such error: File "p4.py", line 24, in PrintWordCountFloat print "%s %f" % (word,words[word]) TypeError: list indices must be integers i call PrintWordCountFloat with hash table, keys are words(string) and values float. This part of the code: def PrintWordCountFloat(words)

Re: Changing variable to integer

2006-12-17 Thread Dustan
vertigo wrote: > Hello > > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the code:

Re: Changing variable to integer

2006-12-17 Thread Diez B. Roggisch
vertigo schrieb: > > Hello > > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the

Re: Is there a way to push data into Ical from Python ?

2006-12-17 Thread dwhall
You could save your calendar_ to a .ics file which is in the VCal_ file format; but that requires the extra step of manually saving your calendar to a file or accessing the files that iCal creates behind the scenes in ~/Library/Application Support/iCal/Sources/ which is unclear and potentially haza

Re: Changing variable to integer

2006-12-17 Thread Peter Otten
vertigo wrote: > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers > > i call PrintWordCountFloat with hash table, keys are words(string) and > values float. > This part of the code: > > def

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Actually, MySQLdb isn't released for Python 2.5 yet, so for > anything with a database, you need an older version of Python. It's not really a problem so far. >If you really want to change the conversions for TIMES

Re: Changing variable to integer

2006-12-17 Thread Fredrik Lundh
vertigo wrote: > I receive such error: > File "p4.py", line 24, in PrintWordCountFloat > print "%s %f" % (word,words[word]) > TypeError: list indices must be integers please post the *entire* traceback message. see: http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-progra

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if you think that Python isn't typed, you've completely missed how things > work. your problem is that you're removing every trace of the type > information by casting everything to strings, not that Python itself (n

Re: Serial port failure

2006-12-17 Thread Nick Craig-Wood
Rob <[EMAIL PROTECTED]> wrote: > Craig, > > In the embedded firmware, the each box re-transmits after it finishes > reading the packet. This is a very rudimentary system, and uses no > flow control. The topology is that each embedded box has a master and > a slave port. The master is used

Re: Changing variable to integer

2006-12-17 Thread vertigo
> Perhaps you meant something more along the lines of this: > def PrintWordCountFloat(words): > number = 0 > for index, word in enumerate(words): > print "%s %f" % (index, word) > number = number + 1 > print "Total words: %d" %(number) PrintW

Re: textwrap.dedent replaces tabs?

2006-12-17 Thread Frederic Rentsch
Tom Plunket wrote: > CakeProphet wrote: > > >> Hmmm... a quick fix might be to temporarily replace all tab characters >> with another, relatively unused control character. >> >> MyString = MyString.replace("\t", chr(1)) >> MyString = textwrap.dedent(MyString) >> MyString = MyString.replace(chr(1

Re: tuple.index()

2006-12-17 Thread Roy Smith
greg <[EMAIL PROTECTED]> wrote: > A Python tuple is like a C struct, and a Python list is like a C array. A Python list is more like C++/STL vector than an array, but that's probably picking nits. The real problem is that while the *intent* of the Python tuple is to act like a C/C++ struct (aga

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread Diez B. Roggisch
> > The advantage of static typing in this context is that the variable still > holds the type even if the value happens to be null. Any value that has been > exposed to user input comes back as a string and has to be validated and > converted to the correct data type. Static typing provides a

Class and instance question

2006-12-17 Thread rzed
I'm confused (not for the first time). I create these classes: class T(object): def __new__(self): self.a = 1 class X(T): def __init__(self): self.a = 4 class Y: def __init__(self): self.a = 4 class Z(object): def __init__(self): self.a = 4 ..

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread fumanchu
dyork wrote: > "Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > If you actually look at what the various DB-API adapters produce > > when sending to the database engine, floats, bools, etc. are all sent as > > string representations; about the only source for

Re: Changing variable to integer

2006-12-17 Thread Juho Schultz
vertigo wrote: > > Perhaps you meant something more along the lines of this: > > > def PrintWordCountFloat(words): > > number = 0 > > for index, word in enumerate(words): > > print "%s %f" % (index, word) > > number = number + 1 > > print "Total words: %d" %

Re: Wrapping classes with pure virtual functions

2006-12-17 Thread Chris Lambacher
On Thu, Dec 14, 2006 at 01:57:10PM -0800, [EMAIL PROTECTED] wrote: > Hi, > I'm having problems wrapping a hierarchy of classes, actually having > problems wrapping the base class. I don't need to use the WrapClass > mechanism since I don't want to override classes in Python. My code > boils down to

Re: Class and instance question

2006-12-17 Thread Marco Wahl
rzed <[EMAIL PROTECTED]> writes: To simplify take > class T(object): > def __new__(self): > self.a = 1 and t = T() and then you get >>> print t.a > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'NoneType' object has no attribute 'a' While T.a is 1.

Why there isn't a sort method for array ?

2006-12-17 Thread [EMAIL PROTECTED]
Hi, It seems that an array acts like an list very much, except it doesn't have a method sort. Regards, -- http://mail.python.org/mailman/listinfo/python-list

Re: OT : Bug/Issue tracking systems

2006-12-17 Thread Phil Schmidt
Steven, I have worked with Trac a bit, only to demo it in my company. We ended up not going with it (for reasons not related to Trac), but I found it easy to set up and configure. I seems to be a very nice tool. I especially like the wiki integration, as it makes it really easy to link tickets wit

Re: merits of Lisp vs Python

2006-12-17 Thread Raffael Cavallaro
On 2006-12-17 07:54:28 -0500, Jon Harrop <[EMAIL PROTECTED]> said: > What if eager impurity isn't the "very nature" of the problem but, rather, > is the very nature of Tilton's chosen solution? That's the whole point which you keep missing - that a programming language is expressive precisely to

Re: converting mysql db into sqlite3.

2006-12-17 Thread skip
gordy> You could probably use the mysqldump command with the proper gordy> options to export the contents of your mysql database to an ASCII gordy> text file that contains the SQL insert statements. Not sure where the original post is. All I see is this reply. In case the OP is lis

Re: merits of Lisp vs Python

2006-12-17 Thread Raffael Cavallaro
On 2006-12-17 07:54:28 -0500, Jon Harrop <[EMAIL PROTECTED]> said: > After all, > Haskell and OCaml are more popular that any given Lisp variant with similar > features (e.g. pattern matching), AFAIK. What doublespeak! haskell and ocaml are more popular than any lisp library that tries to imita

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread John Machin
dyork wrote: > "Carsten Haese" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > This may come as a shock to you, but MySQL is not the only database > > engine on the planet. Your recommendation may apply to MySQL, but it is > > not true for all databases in general. I can name at

Re: Wrapping classes with pure virtual functions

2006-12-17 Thread [EMAIL PROTECTED]
Chris Lambacher wrote: > On Thu, Dec 14, 2006 at 01:57:10PM -0800, [EMAIL PROTECTED] wrote: > > Hi, > > I'm having problems wrapping a hierarchy of classes, actually having > > problems wrapping the base class. I don't need to use the WrapClass > > mechanism since I don't want to override classes

Re: Class and instance question

2006-12-17 Thread Colin J. Williams
rzed wrote: > I'm confused (not for the first time). > > I create these classes: > > class T(object): > def __new__(self): > self.a = 1 > > class X(T): > def __init__(self): > self.a = 4 > > class Y: > def __init__(self): > self.a = 4 > > class Z(object): >

Re: No latin9 in Python?

2006-12-17 Thread Christoph Zwerschke
Martin v. Löwis schrieb: > Christoph Zwerschke schrieb: >> Shall I proceed writing such a patch? Shall I also add latin0 and l0 >> which are other inofficial aliases? > > Sure, go ahead. I see no need for the latin0/l0 aliases, though: they > predate the formal adoption of iso-8859-15, and should

Re: How to test if two strings point to the same file or directory?

2006-12-17 Thread Sandra-24
It looks like you can get a fairly good apporximation for samefile on win32. Currently I'm using the algorithm suggested by Tim Chase as it is "good enough" for my needs. But if one wanted to add samefile to the ntpath module, here's the algorithm I would suggest: If the passed files do not exist

Re: tuple.index()

2006-12-17 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, greg <[EMAIL PROTECTED]> writes: |> |> > A collection is inhomogeneous if, for some attribute that is needed |> > for at least one action on at least one element of the collection, |> > the attribute is not shared by all elements of the collection. |>

Re: Changing variable to integer

2006-12-17 Thread vertigo
On Sun, 17 Dec 2006 17:00:46 +0100, Juho Schultz <[EMAIL PROTECTED]> wrote: > vertigo wrote: >> > Perhaps you meant something more along the lines of this: >> > >> def PrintWordCountFloat(words): >> >number = 0 >> >for index, word in enumerate(words): >> >print "%s %f" %

length of multidimensional table

2006-12-17 Thread vertigo
Hello i have: x = zeros([3,4],Float) how can i check how many rows and columns x have ? (what is the X and Y size of that table) ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: length of multidimensional table

2006-12-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, vertigo wrote: > i have: > x = zeros([3,4],Float) > > how can i check how many rows and columns x have ? > (what is the X and Y size of that table) ? Try `x.getshape()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-17 Thread Jon Harrop
Raffael Cavallaro wrote: > On 2006-12-17 07:54:28 -0500, Jon Harrop <[EMAIL PROTECTED]> said: >> What if eager impurity isn't the "very nature" of the problem but, >> rather, is the very nature of Tilton's chosen solution? > > That's the whole point which you keep missing - that a programming > la

Re: length of multidimensional table

2006-12-17 Thread Wojciech Muła
vertigo wrote: > i have: > x = zeros([3,4],Float) > > how can i check how many rows and columns x have ? > (what is the X and Y size of that table) ? Data member x.shape (tuple) contains dimensions of array. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-17 Thread Jon Harrop
Raffael Cavallaro wrote: > haskell and ocaml are more popular than any lisp library that tries to > imitate Haskell and ocaml. Implementing pattern matching does not mean imitating Haskell or OCaml. > This only speaks to the relative > unpopularity of imitating these features of haskell and oca

Re: Wrapping classes with pure virtual functions

2006-12-17 Thread Carl Banks
[EMAIL PROTECTED] wrote: > Chris Lambacher wrote: > > On Thu, Dec 14, 2006 at 01:57:10PM -0800, [EMAIL PROTECTED] wrote: > > > Hi, > > > I'm having problems wrapping a hierarchy of classes, actually having > > > problems wrapping the base class. I don't need to use the WrapClass > > > mechanism sin

first and last index as in matlab

2006-12-17 Thread Evan
In matlab I can do the following: >> ind = [3,5,7,2,4,7,8,24] ind = 3 5 7 2 4 7 824 >> ind(1) ans = 3 >> ind(end) ans =24 >> ind([1 end]) ans = 324 but I can't get the last line in python: In [690]: ind = [3,5,7,2,4,7,8,24] In [691]: ind

Re: merits of Lisp vs Python

2006-12-17 Thread Raffael Cavallaro
On 2006-12-17 12:49:46 -0500, Jon Harrop <[EMAIL PROTECTED]> said: > For example, when faced with a problem best solved using pattern matching > in Lisp, most Lisp programmers would reinvent an ad-hoc, informally > specified and bug-ridden pattern matcher of their own. No, I think most of us woul

Re: Wrapping classes with pure virtual functions

2006-12-17 Thread Roman Yakovenko
On 14 Dec 2006 13:57:10 -0800, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: Hi, I'm having problems wrapping a hierarchy of classes, actually having problems wrapping the base class. I don't need to use the WrapClass mechanism since I don't want to override classes in Python. My code boils down

Re: first and last index as in matlab

2006-12-17 Thread Rob Williscroft
Evan wrote in news:[EMAIL PROTECTED] in comp.lang.python: > In matlab I can do the following: > >>> ind = [3,5,7,2,4,7,8,24] > ind = 3 5 7 2 4 7 824 >>> ind(1) ans = 3 >>> ind(end) ans =24 >>> ind([1 end]) ans = 324 > > but I can't get

Re: merits of Lisp vs Python

2006-12-17 Thread Raffael Cavallaro
On 2006-12-17 12:52:34 -0500, Jon Harrop <[EMAIL PROTECTED]> said: > Implementing pattern matching does not mean imitating Haskell or OCaml. We were explicitly comparing lisp with haskell and ocaml. Adding features built into haskell and ocaml but not present in ANSI common lisp would therefore

url filtering

2006-12-17 Thread vertigo
Hello I want to do some text analysis based on html documents grabbed from internet. Is there any library which could allow me easily getting text from html documents (cutting javascript, html tags and other not nececary data) ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: url filtering

2006-12-17 Thread Dennis Benzinger
Am Sun, 17 Dec 2006 20:14:32 +0100 schrieb vertigo <[EMAIL PROTECTED]>: > Hello > > I want to do some text analysis based on html documents grabbed from > internet. > Is there any library which could allow me easily getting text from > html documents > (cutting javascript, html tags and other n

Re: first and last index as in matlab

2006-12-17 Thread Paul McGuire
"Evan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In matlab I can do the following: > >>> ind = [3,5,7,2,4,7,8,24] > ind = 3 5 7 2 4 7 824 >>> ind(1) ans = 3 >>> ind(end) ans =24 >>> ind([1 end]) ans = 324 > > but I can'

trees

2006-12-17 Thread vertigo
Hello What library/functions/classes could i use to create trees ? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: trees

2006-12-17 Thread Fredrik Lundh
vertigo wrote: > What library/functions/classes could i use to create trees ? what kind of trees? using lists, tuples, or a class with child pointers is so extremely simple so it has to be something else you're after... -- http://mail.python.org/mailman/listinfo/python-list

RE: trees

2006-12-17 Thread Delaney, Timothy (Tim)
vertigo wrote: > Hello > > What library/functions/classes could i use to create trees ? I would suggest either a horticultural or religious class. I'm sure that any library will contain functional texts on both. Or you could just read the following: http://www.catb.org/~esr/faqs/smart-questions

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Tim Roberts
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: >> > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH > >>This will tell you that "x.exe" is executable, even if "x.exe" contains >> nothing but zeros. > >Isn't the same with any other r

Re: trees

2006-12-17 Thread John Nagle
Delaney, Timothy (Tim) wrote: > vertigo wrote: > > >>Hello >> >>What library/functions/classes could i use to create trees ? SpeedTree, of course. http://www.speedtree.com They have great downloadable demos. John Nagle -- http://mail.py

Re: first and last index as in matlab

2006-12-17 Thread Beliavsky
Evan wrote: > In matlab I can do the following: > > >> ind = [3,5,7,2,4,7,8,24] > ind = 3 5 7 2 4 7 824 > >> ind(1) ans = 3 > >> ind(end) ans =24 > >> ind([1 end]) ans = 324 > > but I can't get the last line in python: > > In [690]: ind =

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Roger Upole
Gabriel Genellina wrote: > On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: >> > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH > >>This will tell you that "x.exe" is executable, even if "x.exe" contains >> nothing but zeros. > > Isn't the same with any other recipe, portable or n

Re: first and last index as in matlab

2006-12-17 Thread Robert Kern
Beliavsky wrote: > Evan wrote: >> In matlab I can do the following: >> ind = [3,5,7,2,4,7,8,24] >> ind = 3 5 7 2 4 7 824 ind(1) ans = 3 ind(end) ans =24 ind([1 end]) ans = 324 >> but I can't get the last line in python:

Re: Why there isn't a sort method for array ?

2006-12-17 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >It seems that an array acts like an list very much, except it doesn't >have a method sort. What do you mean by "array"? There is no such beast in the Python language. Do you mean the library module "array"? -- Tim Roberts, [EMAIL PROTECTED] Pro

Re: first and last index as in matlab

2006-12-17 Thread sturlamolden
It's quite straight forward, actually. What you need to know is that -1 is the index of the last element in a sequence, and that slicing excludes the 'end' value in 'start:end'. So if you type arr[0:N], you get the subsequence [arr[0], arr[1], arr[2], ..., arr[N-1]] When comparing with Matlab, P

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Tim Daneliuk
Roger Upole wrote: > Gabriel Genellina wrote: >> On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH >>> This will tell you that "x.exe" is executable, even if "x.exe" contains >>> nothing but zeros. >> Isn't the same with any other

Re: merits of Lisp vs Python

2006-12-17 Thread Slawomir Nowaczyk
On Sat, 16 Dec 2006 14:05:06 -0500 Kirk Sluder <[EMAIL PROTECTED]> wrote: #> And there is something that is missing here in arguing about computer #> language notations in relationship to human language readability, or #> correspondence to spoken language. I'm not writing code for another #> human

Re: Why there isn't a sort method for array ?

2006-12-17 Thread John Machin
Tim Roberts wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > >It seems that an array acts like an list very much, except it doesn't > >have a method sort. > > What do you mean by "array"? There is no such beast in the Python > language. Do you mean the library module "array"? > Ind

Re: Good Looking UI for a stand alone application

2006-12-17 Thread Vincent Delporte
On Sun, 17 Dec 2006 09:37:04 +0100, [EMAIL PROTECTED] (Luc Heinrich) wrote: >Crossplatform toolkits/frameworks suck. All of them. No exception. If >you want your app to look *AND* feel great on all platform, abstract the >core of your application and embed it in platform native GUI code. +1. Appli

import

2006-12-17 Thread Gert Cuykens
I would like to lauch a server from outside the side package directory how do i specify a path with import #/home/gert/Desktop/www/db/py/start-server.py import cherrypy class HelloWorld: def index(self): return #external htm file Hello world! index.exposed = True if __name__ == '__main__':

Re: Good Looking UI for a stand alone application

2006-12-17 Thread Christophe Cavalaria
Vincent Delporte wrote: > On Sun, 17 Dec 2006 09:37:04 +0100, [EMAIL PROTECTED] (Luc Heinrich) > wrote: >>Crossplatform toolkits/frameworks suck. All of them. No exception. If >>you want your app to look *AND* feel great on all platform, abstract the >>core of your application and embed it in plat

New os.path.exists() behavior - bug or feature?

2006-12-17 Thread klappnase
Hi all, yesterday I installed Python-2.5 and python-2.4.4 on my windows2k box. When trying to use os.path.exists() to detect which drives are present on the system I noticed that these behave differently: Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "copyrigh

Re: tuple.index()

2006-12-17 Thread greg
Roy Smith wrote: > The struct does lookup by name, the tuple is inherently index based. I was trying to help people understand the distinction we're talking about by showing an example of the same distinction in another language where it's much clearer. There are a great many ways in which C str

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Roger Upole
Tim Daneliuk wrote: > Roger Upole wrote: >> Gabriel Genellina wrote: >>> On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH This will tell you that "x.exe" is executable, even if "x.exe" contains nothing but zeros. >>> Is

writing serial port data to the gzip file

2006-12-17 Thread Petr Jakes
I am trying to save data it is comming from the serial port continually for some period. (expect reading from serial port is 100% not a problem) Following is an example of the code I am trying to write. It works, but it produce an empty gz file (0kB size) even I am sure I am getting data from the s

Re: Is there a way to push data into Ical from Python ?

2006-12-17 Thread [EMAIL PROTECTED]
You might find this useful: http://doughellmann.blogspot.com/2006/12/mailbox2ics.html The Night Blogger wrote: > Is there a way to pull & push data into (Apple Mac OS X Calendar) Ical from > Python ? -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-17 Thread Roy Smith
In article <[EMAIL PROTECTED]>, greg <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > > The struct does lookup by name, the tuple is inherently index based. > > I was trying to help people understand the distinction > we're talking about by showing an example of the same > distinction in anoth

Re: merits of Lisp vs Python

2006-12-17 Thread Jon Harrop
Kaz Kylheku wrote: > The removal for the need for manual object lifetime computation does > not cause a whole class of useful programs to be rejected. Sometimes you must be able to guarantee that a resource has been disposed before you can continue. That is why we have finalisers in OCaml and disp

Re: writing serial port data to the gzip file

2006-12-17 Thread Leo Kislov
Petr Jakes wrote: > I am trying to save data it is comming from the serial port continually > for some period. > (expect reading from serial port is 100% not a problem) > Following is an example of the code I am trying to write. It works, but > it produce an empty gz file (0kB size) even I am sure

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
"Kaz Kylheku" <[EMAIL PROTECTED]> writes: > > Incorrect, I believe. The above is like saying Lisp's lack of > > optional manual storage allocation and machine pointers makes Lisp > > less powerful. > > That is true. By itself, that feature makes Lisp less poweful for > real-world software dev, wh

Re: Class and instance question

2006-12-17 Thread Scott David Daniels
Colin J. Williams wrote: > rzed wrote: >> class T(object): >> def __new__(self): >> self.a = 1 >> ... >> t = T() >> >> and I want to examine the 'a' attributes. >> > print T.a >> 1 > print t.a >> Traceback (most recent call last): >> File "", line 1, in >> AttributeError: 'No

Re: merits of Lisp vs Python

2006-12-17 Thread xscottg
Paul Rubin wrote: > > [...] There are programs you can write in C > but not in Lisp, like device drivers that poke specific machine > addresses. > I should assume you meant Common Lisp, but there isn't really any reason you couldn't (poke destination (peek source)) in some version of Lisp

Re: merits of Lisp vs Python

2006-12-17 Thread Bill Atkins
Paul Rubin writes: >> In fact, all previously correct programs continue to work as before, >> and in addition, some hitherto incorrect programs become correct. >> That's an increase in power: new programs are possible without losing >> the old ones. > > There's more to p

Re: Good Looking UI for a stand alone application

2006-12-17 Thread Vincent Delporte
On Mon, 18 Dec 2006 01:23:10 +0100, Christophe Cavalaria <[EMAIL PROTECTED]> wrote: >They use QT. Back to read the first part of your post. It doesn't make much difference: - QT is big, so even small apps carry a lot of baggage - by not using the native widgets, you're dependent on that layer to

  1   2   >