Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
> > > Try putting "use_unicode=True" in the MySQLdb "connect" call. tried that, and also added charset="utf8" - now, I can't do any string operations, I get the error msg: descriptor 'lower' requires a 'str' object but received a 'unicode' args = ("descriptor 'lower' requires a 'str'

Re: merits of Lisp vs Python

2006-12-17 Thread xscottg
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > So don't (poke (random) value). That would be obvious to anyone > > capable of writing a device driver in C or Lisp or Oberon or > > Similarly in C programs, don't do > > *random = 0; > > Avoiding that is easier said than done. C programs s

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread fumanchu
ronrsr wrote: > code for storing to database: > > querystring = "update zingers set keywords = '%s', citation = > '%s', quotation = %s' where zid = %d" % > (keywords,citation,quotation,zid) You're missing a single quote in there around the quotation %s. Are you also replacing "\\" w

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is either 2.2 or 2.4 bests, -rsr- John Nagle wrote: > ronrsr wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is 2.2 - -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread John Nagle
ronrsr wrote: >>are you passing in the strings as Unicode strings, or as something else? >> if you're using something else, what have you done to tell the >>database what it is? >> > > > > not at all sure what I'm passing it as. > > The database default encoding is utf-8 > the database collat

Re: [IronPython] [ANN] IronPython Community Edition r5

2006-12-17 Thread M. David Peterson
SWEET! Caught this release before the news was no longer news, http://www.oreillynet.com/windows/blog/2006/12/seo_sanghyeonipce_ironpython_c_1.html Thanks, Seo! :) On 12/15/06, Sanghyeon Seo <[EMAIL PROTECTED]> wrote: This is the fifth release of IronPython Community Edition (IPCE). You can

Re: merits of Lisp vs Python

2006-12-17 Thread Ravi Teja
Jean-Paul Calderone wrote: > On 11 Dec 2006 03:01:32 -0800, Ravi Teja <[EMAIL PROTECTED]> wrote: > >Timofei Shatrov wrote: > > > > [snip] > > > >Of course, doctest is hardly the ultimate testing solution. But it does > >an admirable job for many cases where you don't need to setup elaborate > >tes

Re: merits of Lisp vs Python

2006-12-17 Thread John Thingstad
On Mon, 18 Dec 2006 05:19:49 +0100, > wrote: > [EMAIL PROTECTED] writes: >> So don't (poke (random) value). That would be obvious to anyone >> capable of writing a device driver in C or Lisp or Oberon or > > Similarly in C programs, don't do > > *random = 0; > > Avoiding that is easier sai

[no subject]

2006-12-17 Thread Divya Prakash
Hello , I would like to parse java files and detect class name's, attributes name's type's and visibility (and or list of methods). Is there any module who can parse easily a java file using jython? Regards Divya -- http://mail.python.org/mailman/listinfo/python-li

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
> > are you passing in the strings as Unicode strings, or as something else? > if you're using something else, what have you done to tell the > database what it is? > not at all sure what I'm passing it as. The database default encoding is utf-8 the database collation is utf-8 the page encod

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
structure for the DB: CREATE TABLE `zingers` ( `zid` int(9) unsigned NOT NULL auto_increment, `keywords` varchar(255) default NULL, `citation` text, `quotation` text, PRIMARY KEY (`zid`) ) ENGINE=MyISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=422 ; code for stor

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread Fredrik Lundh
ronrsr wrote: > I have an MySQL database called zingers. The structure is: > > zid - integer, key, autoincrement > keyword - varchar > citation - text > quotation - text > > the encoding and collation is utf-8 > > I am having trouble storing text, as typed in last two fields. S

dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text the encoding and collation is utf-8 I am having trouble storing text, as typed in last two fields. Special characters and punctuation

Re: trees

2006-12-17 Thread [EMAIL PROTECTED]
You could use ElementTree for XML. Or just use nested dictionaries. -T John Nagle wrote: > Delaney, Timothy (Tim) wrote: > > vertigo wrote: > > > > > >>Hello > >> > >>What library/functions/classes could i use to create trees ? > > SpeedTree, of course. > > http://www.speedtree.com > >

Re: Good Looking UI for a stand alone application

2006-12-17 Thread [EMAIL PROTECTED]
You could write it as a web app, with an executable which launches the server and points a browser at it. Python GUI work is a bit of a drag, really. One of the worst things about it, IMHO. -T Vincent Delporte wrote: > On Mon, 18 Dec 2006 01:23:10 +0100, Christophe Cavalaria > <[EMAIL PROTECTED

Re: merits of Lisp vs Python

2006-12-17 Thread Jean-Paul Calderone
On 11 Dec 2006 03:01:32 -0800, Ravi Teja <[EMAIL PROTECTED]> wrote: >Timofei Shatrov wrote: > > [snip] > >Of course, doctest is hardly the ultimate testing solution. But it does >an admirable job for many cases where you don't need to setup elaborate >tests. > >> It's not surprising that no one use

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > So don't (poke (random) value). That would be obvious to anyone > capable of writing a device driver in C or Lisp or Oberon or Similarly in C programs, don't do *random = 0; Avoiding that is easier said than done. C programs suffer endless bugs of that type.

Re: merits of Lisp vs Python

2006-12-17 Thread xscottg
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Even regarding interupts, I don't see a problem without a solution: > > (with-interupts-and-garbage-collection-disabled > >(poke destination (peek source)) > > It's not just GC or interrupts, it's the possibility of clobbering the > Lis

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Even regarding interupts, I don't see a problem without a solution: > (with-interupts-and-garbage-collection-disabled >(poke destination (peek source)) It's not just GC or interrupts, it's the possibility of clobbering the Lisp heap. If the peek/poke addres

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
Bill Atkins <[EMAIL PROTECTED]> writes: > Whatever do you mean? The portion of memory used for memory-mapped > registers is simply excluded from GC; everything else works as normal. Well ok, if the peek and poke functions validate the addresses. > All modern Lisps (yes, *Common* Lisps) support a

Re: merits of Lisp vs Python

2006-12-17 Thread xscottg
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > I should assume you meant Common Lisp, but there isn't really any > > reason you couldn't > > > > (poke destination (peek source)) > > That breaks the reliability of GC. I'd say you're no longer writing > in Lisp if you use something like tha

Re: merits of Lisp vs Python

2006-12-17 Thread Bill Atkins
Paul Rubin writes: > [EMAIL PROTECTED] writes: >> I should assume you meant Common Lisp, but there isn't really any >> reason you couldn't >> >> (poke destination (peek source)) > > That breaks the reliability of GC. I'd say you're no longer writing > in Lisp if y

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
Bill Atkins <[EMAIL PROTECTED]> writes: > > GC also gets rid of programs. There are programs you can write in C > > but not in Lisp, like device drivers that poke specific machine > > addresses. > > I'm sure this would be news to the people who wrote the operating > system for the Lisp machine.

Re: merits of Lisp vs Python

2006-12-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > I should assume you meant Common Lisp, but there isn't really any > reason you couldn't > > (poke destination (peek source)) That breaks the reliability of GC. I'd say you're no longer writing in Lisp if you use something like that. Writing in this "augmented Li

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

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: 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: 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 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: 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 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: 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: 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

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: 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

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

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: 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

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 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

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: 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: 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: 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: 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 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: 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 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: 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: 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 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: 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

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: 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'

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

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: 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

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: 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: 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

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: 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

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: 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: > 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 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

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: 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" %

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: 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: 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: 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: 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: 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: 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: 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: > 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: 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

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: 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.

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: 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: 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

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 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

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: 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: 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: 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: 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: 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
"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 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: 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 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: 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:

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: 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

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

  1   2   >