Re: annoying stdin/stdout + pipes problem

2007-09-24 Thread per9000
On 23 Sep, 18:24, Damjan <[EMAIL PROTECTED]> wrote: > > I want to create a program that reads input from stdio that can prompt > > a user for input while doing so without getting into problems. > ... > > The trick (which works on Linux for sure) is to open /dev/tty and ask > question/get input on/f

Re: strange behavious of the logging module?

2007-09-24 Thread Peter Otten
Christian Meesters wrote: > Also, adding %(funcName)-8s to the formatter in basigConfig does not work > for me: instead of the functions name the level in lower case gets inserted > into the logfile. When you call logging.info(...), "info" actually is the function name. As a workaround use loggin

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Sun, 23 Sep 2007 18:32:28 -0700, Kay Schluehr wrote: > On 22 Sep., 02:14, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Kay Schluehr a crit : >> (snip) >> >> > I checked out Io once and I disliked it. I expected Io's prototype OO >> > being just a more flexible variant of class based OO b

Re: scope, modyfing outside object from inside the method

2007-09-24 Thread Peter Otten
Marcin Stępnicki wrote: > Hello. > > I thought I understand this, but apparently I don't :(. I'm missing > something very basic and fundamental here, so redirecting me to the > related documentation is welcomed as well as providing working code :). > > Trivial example which works as expected: >

Re: Google and Python

2007-09-24 Thread Bryan Olson
Alex Martelli wrote: > Bryan Olson wrote: [...] >> How does Google use Python? As their scripting-language >> of choice. A fine choice, but just a tiny little piece. >> >> Maybe Alex will disagree with me. In my short time at >> Google, I was uber-nobody. > > YouTube (one of Google's most valuable

Re: elementtree question

2007-09-24 Thread Gabriel Genellina
En Sat, 22 Sep 2007 00:19:59 -0300, Mark T <[EMAIL PROTECTED]> escribi�: > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> En Fri, 21 Sep 2007 11:49:53 -0300, Tim Arnold <[EMAIL PROTECTED]> >> escribi�: >> >>> Hi, I'm using elementtree and elementtidy to work w

the AIM of LIFE

2007-09-24 Thread abdo911
Allow me to share with you here some information about the AIM of LIFE . What is your purpose in life? What is the rationale behind our life? Why do we live in this life? These questions frequently intrigue people who try to find accurate answers. People provide different answers to these question

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bryan Olson wrote: > The keyword "lambda" sucks. ... > > Alonzo Church's calculus used the *symbol*. The keyword was popularized by LISP, and hence adopted by most other languages to copy the concept. In my view, it's no worse than using "=" for assignment instea

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cristian wrote: > I think it would make more sense to have beginners _know_ that functions > are like all other variables ... Functions are not variables. Though they are values, and can be held in variables. In Python, every name is a variable, and can be assigne

Registration for OSDC 2007 is open

2007-09-24 Thread Richard Jones
OSDC 2007 is in Brisbane this year on 27-29 November (with a tutorial day on the 26th). $275 early bid registration closes October 14th. Just follow the instructions at the top of http://osdc.com.au/registration/ to 1. register and 2. pay. (If you are going to pay by credit card/PayPal you shou

Re: TRying to import files from my folder not pythons lib folder

2007-09-24 Thread Gabriel Genellina
En Sun, 23 Sep 2007 22:01:39 -0300, Luis M. González <[EMAIL PROTECTED]> escribi�: > This is exactly what I did, but I have a new problem now: > After seting PYTHONPATH I'm no longer able to start IDLE from the > start menu. > It seems the system cannot find the file. > But if I eliminate PYTHON

Re: elementtree question

2007-09-24 Thread Stefan Behnel
Tim Arnold wrote: > Hi, I'm using elementtree and elementtidy to work with some HTML files. For > some of these files I need to enclose the body content in a new div tag, > like this: > > >original contents... > > Give lxml.etree (or lxml.html) a try: tree = etree.parse("http://

Passing parameters at the command line (New Python User)

2007-09-24 Thread cjt22
Hi there. I just wondered whether anyone could recommend the correct way I should be passing command line parameters into my program. I am currently using the following code: def main(argv = None): file1= "directory1" file2 = "directory2" if argv is None: args = sys.argv[

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > A question: if you WERE to implement function definitions as normal > expressions, how would you go about embedding it within an expression? > > x = map(def a: > > > > , [1, 2, 3]) Perl can

Re: annoying stdin/stdout + pipes problem

2007-09-24 Thread Gabriel Genellina
En Mon, 24 Sep 2007 04:04:07 -0300, per9000 <[EMAIL PROTECTED]> escribi�: > On 23 Sep, 18:24, Damjan <[EMAIL PROTECTED]> wrote: >> > I want to create a program that reads input from stdio that can prompt >> > a user for input while doing so without getting into problems. >> ... >> >> The trick (wh

Re: Google and Python

2007-09-24 Thread Nick Craig-Wood
Paul Rubin wrote: > David <[EMAIL PROTECTED]> writes: > > Another method is for the apps to run continuously and serve on non-80 > > port (or on 80 from another host), and your main web server on port 80 > > reverse proxies to it when appropriate. > > You can also pass the open sockets around b

Re: about __str__

2007-09-24 Thread Mikael Olofsson
Bruno Desthuilliers wrote: > def __str__(self): > return "<%s:%s>" % (self.commiterID_, self.commits_) I would write that in the following way: def __str__(self): return "<%(commiterID_)s:%(commits_)s>" % self.__dict__ More explicit IMHO. And easier to maintain, especially if the string

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi there. I just wondered whether anyone could recommend the correct > way I should be passing command line parameters into my program. I am > currently using the following code: Use the module optparse. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Paul Rubin
Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > The fact that Python has difficulties is purely a demonstration of the > limitations of indentation-controlled syntax, not a criticism of the > concept itself. Not even. Haskell has indentation syntax (they call it "layout") but can have multi-lin

vim - what's a smarttab?

2007-09-24 Thread 7stud
Is smarttab one of these: 1) Expands tabs into the number of spaces set with tabstop at the start of a line, and uses a tabstop sized tab elsewhere. 2) Expands tabs into the number of spaces set with shiftwidth at the start of a line, and expands tabs into the number spaces set with tabstop elsew

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Ben Finney
[EMAIL PROTECTED] writes: > I have never used Python to pass in arguments at the command line so > any help would be much appreciated. Your 'main()' approach is good. I'd rather have the function require an 'argv' parameter, and have the default set only in the 'if __name__ == "__main__":' block,

Re: Passing parameters at the command line (New Python User)

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 01:04:58 -0700, cjt22 wrote: > for i in range(len(args)): > if args[i] == "-no": > Initialise.init(0) > Process.processCon(file2,1) > Output.print() > > if args[i] == "-not": >Initialise.init(1) >

SOAPpy Error

2007-09-24 Thread linuxprog
hi all i'm building a webservice client with soappy when i send some informations it's returns an error here is the informations that generates the error var = SOAPpy.structType() var._addItem("code", u"XysZjd") var._addItem("value", 1) when i send the var variable SOAPpy prints this

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Bruno Desthuilliers
Cristian a écrit : > On Sep 21, 5:21 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> Ok, then what about classes ? They also are objects-like-any-other, >> after all. So should we have this syntax too ? >> >> MyClass = class(ParentClass): >>__init__ = function (self, name): >> s

IPv6 in python

2007-09-24 Thread Piotr Dula (pdula)
Hello, How to make python support IPv6? I tried to do: ./configure --enable-ipv6 make make install and I didn't get any error. However, IPv6 doesn't seem to be working yet. then I tried ./configure --enable-ipv6=yes and I got a lot of parse errors (many pages similar to this below)

Re: about __str__

2007-09-24 Thread Bruno Desthuilliers
Mikael Olofsson a écrit : > Bruno Desthuilliers wrote: >> def __str__(self): >> return "<%s:%s>" % (self.commiterID_, self.commits_) > > I would write that in the following way: > > def __str__(self): >return "<%(commiterID_)s:%(commits_)s>" % self.__dict__ > > More explicit IMHO. And ea

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 11:43:59 +0200, Bruno Desthuilliers wrote: > You already can create functions without using the def statement: > > Help on class function in module __builtin__: > > class function(object) > | function(code, globals[, name[, argdefs[, closure]]]) > | > | Create a funct

Re: scope, modyfing outside object from inside the method

2007-09-24 Thread Dustan
On Sep 24, 2:13 am, Peter Otten <[EMAIL PROTECTED]> wrote: > @property > def value(self): > return self._resultset[self._row][self._col] I remember a thread where someone created a version of property that worked like this, but it's not in the standard python release, unless it is

Re: Properties and Objects...

2007-09-24 Thread Peter Otten
George V. Neville-Neil wrote: > I have been trying to switch this over to using properties, which seem > at first glance to be cleaner, but which I am having a lot of problems > with. In particular I want to add a property to an object, not a > class. You can't. The underlying mechanism (descr

python variable assignement

2007-09-24 Thread mihai
I work at an application witch has embeded python. We have an python type X. # a != b a = b # at this point both variables have the same value b = select_other() # steel the same values but both have the new value of b What might be the cause for this behavior? The type of a and b variable i

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 10:05 +, Marc 'BlackJack' Rintsch wrote: > On Mon, 24 Sep 2007 11:43:59 +0200, Bruno Desthuilliers wrote: > > > You already can create functions without using the def statement: > > > > Help on class function in module __builtin__: > > > > class function(object) > > |

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Kay Schluehr
On Sep 24, 9:09 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > Python: > > class B(object): > def __init__(self): > self.things = list() > > def add(self, thing): > self.things.append(thing) > > And Io: > > B := Object clone do( > init := method( > se

Re: python variable assignement

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 10:13 +, mihai wrote: > I work at an application witch has embeded python. > > We have an python type X. > > # a != b > > a = b # at this point both variables have the same value Not quite. At this point, 'a' and 'b' are names in the local namespace that refer to the s

RE: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Delaney, Timothy (Tim)
Carsten Haese wrote: >> Where the heck does *this* come from? Neither Python 2.5.1 nor the >> 3.0alpha has this in `__builtin__`. > > It comes from the 'new' module: > import new help(new.function) > Help on class function in module __builtin__: > ... > > Oddly enough, the help misre

Re: Properties and Objects...

2007-09-24 Thread George V. Neville-Neil
At Sun, 23 Sep 2007 19:01:04 -0300, Gabriel Genellina wrote: > > En Sat, 22 Sep 2007 15:06:38 -0300, George V. Neville-Neil > <[EMAIL PROTECTED]> escribi�: > > > I have been trying to switch this over to using properties, which seem > > at first glance to be cleaner, but which I am having a lot

Re: vim - what's a smarttab?

2007-09-24 Thread Marco
Hi "7stud", > Alternatively, what is a smarttab? in VIM type :help smarttab and you'll see the following: 'smarttab' 'sta'boolean (default off) global {not in Vi} When on, a in front of a line inserts blanks according to 'shiftwidth'. '

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Duncan Booth
Carsten Haese <[EMAIL PROTECTED]> wrote: > It comes from the 'new' module: > import new help(new.function) > Help on class function in module __builtin__: > ... > > Oddly enough, the help misrepresents which module the function is coming > from. No, I don't think it is misrepresenting

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Fri, 21 Sep 2007 22:07:55 +, Cristian wrote: > >> True, there is lambda, but that is very limited. It might be useful for >> key arguments, but not much else. > > No, lambda is useful for anything that any other function is useful for, > provided that you can w

sorting a list numbers stored as strings

2007-09-24 Thread aine_canby
hi, I have the following list - ["1", "11", "2", "22"] how do I sort it like this - ["1", "2", "11", "22"] thanks, aine -- http://mail.python.org/mailman/listinfo/python-list

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Bruno Desthuilliers
Matthew Woodcraft a écrit : > Cristian <[EMAIL PROTECTED]> wrote: >> To me, the biggest setback for new programmers is the different >> syntax Python has for creating functions. Instead of the common (and >> easy to grasp) syntax of foo = bar Python has the def foo(): syntax. > > [...] > >> in a

Re: sorting a list numbers stored as strings

2007-09-24 Thread Amit Khemka
On 9/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > hi, > > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"] > Hi, >>> l = ["1", "11", "2", "22"] >>> sorted(l, cmp = lambda x, y: cmp(int(x), int(y))) # provide your own comp

Re: sorting a list numbers stored as strings

2007-09-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > hi, > > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"] source = ["1", "11", "2", "22"] result = [t[1] for t in sorted((int(item), item) for item in source)] print result -- http://mail.python.or

Almost There - os.kill()

2007-09-24 Thread Robert Rawlins - Think Blue
Hello Guys, Finally got around to sitting down to tidy up this script this morning but I'm having a small syntax problem with os.kill() to kill a process on my system. Here is the code: def killApplication(): pid = file('/var/lock/MyApplication.lock').read().strip()

Re: Database Abstraction Layer And/Or ORM

2007-09-24 Thread Bruno Desthuilliers
BJ Dierkes a écrit : > Hello all, > > I am looking for opinions on preferred methods of Database Abstraction > Layer or Object Relation Mapper (I'm using Python 2.5). I have found a > number of options such as those listed here: > > http://wiki.python.org/moin/HigherLevelDatabaseProgramming >

Re: Writing Object Data to Disk

2007-09-24 Thread Bruno Desthuilliers
David a écrit : >> I would like to know if "Pickling" the class object is the only way of >> writing it to disk for persistent storage. Also, do we have a concept >> similar to "array of objects" in Python? The number of objects is only >> known at "run-time". > > Have a look at YAML. > > http://

rules from an xml file

2007-09-24 Thread jonny
I have a python code that manages some parameters using some variable rules that may change from day to day. I'd like that the code will self-modify according to rules parsed from a xml file: example:

Re: sorting a list numbers stored as strings

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 16:53 +0530, Amit Khemka wrote: > On 9/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > hi, > > > > I have the following list - > > > > ["1", "11", "2", "22"] > > > > how do I sort it like this - > > > > ["1", "2", "11", "22"] > > > > Hi, > > >>> l = ["1", "11", "2",

RE: Almost There - os.kill()

2007-09-24 Thread Robert Rawlins - Think Blue
Woops, Spoke too soon, just wrapped them in int() and it works a charm :-D Rob From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: 24 September 2007 12:23 To: python-list@python.org Subject: Almost There - os.kill() Hello Guys, Finall

Re: Almost There - os.kill()

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 12:23 +0100, Robert Rawlins - Think Blue wrote: > os.kill(pid, 15) > > TypeError: an integer is required > > > > Which would suggest its passing those arguments in as the wrong data > types to the kill command. What is the best way to convert these? Instead of giving

Re: rules from an xml file

2007-09-24 Thread Diez B. Roggisch
jonny wrote: > I have a python code that manages some parameters using some variable > rules that may change from day to day. I'd like that the code will > self-modify according to rules parsed from a xml file: > > example: > > > > > > > > > > > > > > > > > > >

RE: Almost There - os.kill()

2007-09-24 Thread Delaney, Timothy (Tim)
Always be careful with int() incase any of the values have a leading zero - check the documentation for int() carefully. Cheers, Tim Delaney From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: Monday, 24 September 2

RE: Almost There - os.kill()

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 12:40 +0100, Robert Rawlins - Think Blue wrote: > Woops, > > > > Spoke too soon, just wrapped them in int() and it works a charm :-D I'm glad that you figured it out for yourself. I'd like to suggest that you adjust your "give up and ask the list for help" threshold upwar

RE: Almost There - os.kill()

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 19:48 +0800, Delaney, Timothy (Tim) wrote: > Always be careful with int() incase any of the values have a leading > zero - check the documentation for int() carefully. Why would leading zeroes be a problem? >>> int("10") 10 >>> int("010") 10 >>> int("0010") 10 >>> int("00010

RE: sorting a list numbers stored as strings

2007-09-24 Thread Delaney, Timothy (Tim)
Carsten Haese wrote: > That interpreter session is a work of fiction, since sorted returns > the sorted list instead of sorting the list in place. Also, it's > better (i.e. more readable and likely faster) to use a sort key > function instead of a comparison function whenever possible. In this > c

Re: sorting a list numbers stored as strings

2007-09-24 Thread Peter Otten
aine_canby wrote: > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"] >>> items = ["1", "11", "2", "22"] >>> items.sort(key=int) >>> items ['1', '2', '11', '22'] This is more efficient than Amit's compare function and even Bruno

RE: Almost There - os.kill()

2007-09-24 Thread Delaney, Timothy (Tim)
Carsten Haese wrote: > On Mon, 2007-09-24 at 19:48 +0800, Delaney, Timothy (Tim) wrote: >> Always be careful with int() incase any of the values have a leading >> zero - check the documentation for int() carefully. > > Why would leading zeroes be a problem? > int("10") > 10 int("010")

RE: sorting a list numbers stored as strings

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 19:58 +0800, Delaney, Timothy (Tim) wrote: > I'm sure that in some version of Python it would have given a > ValueError (due to the default radix being 0) but it appears to have > changed to a default radix of 10 somewhere along the way. Not even Python 1.5.2 seems to have a

Python-URL! - weekly Python news and links (Sep 24)

2007-09-24 Thread Gabriel Genellina
QOTW: "This thread shows again that Python's best feature is comp.lang.python." - Joerg Schuster "I find it best to treasure the saints, tolerate the irritable and ignore the whiners." - RedGrittyBrick Python as a functional language: of limited usage due to stack limitations: http

Re: rules from an xml file

2007-09-24 Thread Stefan Behnel
jonny wrote: > I have a python code that manages some parameters using some variable > rules that may change from day to day. I'd like that the code will > self-modify according to rules parsed from a xml file: > > example: > > > > > > >

enabling IPv6 in python

2007-09-24 Thread Piotr Dula (pdula)
Hello, How to make python support IPv6? I have IPv6 running on my host (interfaces have ipv6 addresses assigned) I tried to do: ./configure --enable-ipv6 make make install and I didn't get any error. However, IPv6 didn't work. then I tried ./configure --enable-ipv6=yes and I go

Re: python variable assignement

2007-09-24 Thread mihai
This is the code: begin = select_point() if begin == None: return end = select_point() while end != None: record = Record(begin, end) id = add(record) begin = end end = select_point() # here (sometimes) begin has the same value (or points to the sa

Re: database persistence with mysql, sqlite

2007-09-24 Thread Gerardo Herzig
coldpizza wrote: >Hi, > >I want to run a database query and then display the first 10 records >on a web page. Then I want to be able to click the 'Next' link on the >page to show the next 10 records, and so on. > >My question is how to implement paging, i.e. the 'Next/Prev' NN >records without ree

Re: An Editor that Skips to the End of a Def

2007-09-24 Thread Neil Cerutti
On 2007-09-22, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, Bjoern > Schliessmann wrote: >> Nah. Use vim. > > Every other text editor I have ever used understands that the > current position in a file is _between_ two characters (or > before the first character,

Re: rules from an xml file

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 13:42:05 +0200, Diez B. Roggisch wrote: > jonny wrote: > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>Something is wrong! >> >> >> ... >> ... >> >> […] > […] > Just a note: the use of "par_X" as a

Re: python variable assignement

2007-09-24 Thread Carsten Haese
On Mon, 2007-09-24 at 12:12 +, mihai wrote: > [...] > id = add(record) > [...] Not that this causes your problem, but I'd still like to point out that 'id' is the name of a built-in function. Shadowing built-in names can lead to surprising behavior. > Is there a way to see if the name

Re: rules from an xml file

2007-09-24 Thread Diez B. Roggisch
Marc 'BlackJack' Rintsch wrote: > On Mon, 24 Sep 2007 13:42:05 +0200, Diez B. Roggisch wrote: > >> jonny wrote: >> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>Something is wrong! >>> >>> >>> ... >>> .

Re: An Editor that Skips to the End of a Def

2007-09-24 Thread Bruno Desthuilliers
W. Watson a écrit : (top-post corrected) > Bruno Desthuilliers wrote: >> W. Watson a écrit : >>> How about in the case of MS Win? >>> >>> Ben Finney wrote: (Please don't top-post. Instead, reply below each point to which you're responding, removing quoted text irrelevant to your resp

Re: python variable assignement

2007-09-24 Thread Duncan Booth
mihai <[EMAIL PROTECTED]> wrote: > > This is the code: > > begin = select_point() > if begin == None: > return > > end = select_point() > while end != None: > record = Record(begin, end) > id = add(record) > begin = end > end = select_point() > #

Re: SOAPpy Error

2007-09-24 Thread linuxprog
linuxprog a écrit : > hi all > > i'm building a webservice client with soappy > > when i send some informations it's returns an error > here is the informations that generates the error >var = SOAPpy.structType() >var._addItem("code", u"XysZjd") >var._addItem("value", 1) > when i send t

Converting numbers to unicode charaters

2007-09-24 Thread byte8bits
Here's how I'm doing this right now, It's a bit slow. I've just got the code working. I was wondering if there is a more efficient way of doing this... simple example from interactive Python: >>> word = '' >>> hexs = ['42', '72', '61', '64'] >>> for h in hexs: ... char = unichr(int(h, 16)) ...

Re: sorting a list numbers stored as strings

2007-09-24 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > hi, > > I have the following list - > > ["1", "11", "2", "22"] > > how do I sort it like this - > > ["1", "2", "11", "22"] > > thanks, > > aine Try: lst.sort(key = lambda s: int(s)) Assuming, of course, that "lst" is your origi

Re: strange behavious of the logging module?

2007-09-24 Thread Christian Meesters
Thanks Peter and Gabriel, I see, so I should provide the application with an additional handler for the file in order to gain maximum independence of the two handlers (console & file stream). >> Also, adding %(funcName)-8s to the formatter in basigConfig does not work >> for me: instead of the fu

Re: strange behavious of the logging module?

2007-09-24 Thread Vinay Sajip
On Sep 24, 8:03 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > It would still be a good idea to file a bug report. Not sure where the bug is. The script below, when called, prints "Information" to the console and "INFO some_func Information" to mc_rigid.log, as I would expect. (Python 2.5.1)

Re: Converting numbers to unicode charaters

2007-09-24 Thread Laurent Pointal
[EMAIL PROTECTED] a écrit : > Here's how I'm doing this right now, It's a bit slow. I've just got > the code working. I was wondering if there is a more efficient way of > doing this... simple example from interactive Python: > word = '' hexs = ['42', '72', '61', '64'] for h in hexs

Re: Converting numbers to unicode charaters

2007-09-24 Thread Paul Hankin
On Sep 24, 2:42 pm, [EMAIL PROTECTED] wrote: > Here's how I'm doing this right now, It's a bit slow. I've just got > the code working. I was wondering if there is a more efficient way of > doing this... simple example from interactive Python: > > >>> word = '' > >>> hexs = ['42', '72', '61', '64']

shutil.copy2 error

2007-09-24 Thread Horse
I've written a python script that copies a nightly Oracle backup file to another server. Every couple days, the script fails with this error message: Error copying Q:/Oradata/GISPROD/Backups/3UISN35R_1_1 to s:/gisprod/ backups/3UISN35R_1_1 [Errno 22] Invalid argument Here's the code for the fu

(pyqt) Parameters when connecting a signal to a method?

2007-09-24 Thread exhuma.twn
Some code: -- def foobar(w): print w QtCore.QObject,connect( my_line_edit, QtCore.SIGNAL("returnPressed()"), foobar ) -- How can I get this to work so "fo

problem writing setup script

2007-09-24 Thread Christian Meesters
Hi I have the following file structure MANIFEST README INSTALL -- all text setup.py src/ __init__.py foo.py for_ext.pyx and this setup-script: import sys from distutils.core import setup from distutils.extension import Extension try: from Pyrex.Distutils import build_ext except

Re: Converting numbers to unicode charaters

2007-09-24 Thread Duncan Booth
Laurent Pointal <[EMAIL PROTECTED]> wrote: > You may eventually use a more condensed expression and avoid n > concatenation of n chars using join, like this: > > >>> u''.join(unichr(int(x,16)) for x in ['42','72','61','64']) > u'Brad' Or even avoid the loop completely: >>> hexs = ['42', '72',

Re: (pyqt) Parameters when connecting a signal to a method?

2007-09-24 Thread Diez B. Roggisch
exhuma.twn wrote: > Some code: > > -- > > def foobar(w): >print w > > QtCore.QObject,connect( my_line_edit, > QtCore.SIGNAL("returnPressed()"), foobar ) > > -

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread NickC
On Sep 24, 9:16 pm, Bruno Desthuilliers wrote: > Matthew Woodcraft a écrit : > > One reason for the different syntax is that functions, unlike most > > other objects, know their own names (which can be shown in tracebacks > > and the like). > > Nope. They know *one* of their names - the one they'v

Re: Building Python with VC8 on x64 Vista

2007-09-24 Thread danfike
On Sep 22, 10:08 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > 1>py_dyn_test.obj : error LNK2001: unresolved external symbol > > _Py_NoneStruct > > Could it be that py_dyn_test.obj is a x86 (not AMD64) object > file? Run dumpbin. Hmm - I've never used dumpbin, but I think I like it. It doe

Can a base class know if a method has been overridden?

2007-09-24 Thread Ratko
Hi all, I was wondering if something like this is possible. Can a base class somehow know if a certain method has been overridden by the subclass? I appreciate any ideas. Thanks, Ratko -- http://mail.python.org/mailman/listinfo/python-list

Re: Would Anonymous Functions Help in Learning Programming/Python?

2007-09-24 Thread Bruno Desthuilliers
NickC a écrit : > On Sep 24, 9:16 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Matthew Woodcraft a écrit : >>> One reason for the different syntax is that functions, unlike most >>> other objects, know their own names (which can be shown in tracebacks >>> and the like). >> Nope. They know

Re: (pyqt) Parameters when connecting a signal to a method?

2007-09-24 Thread exhuma.twn
On Sep 24, 4:47 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: > > Some code: > > > -- > > > def foobar(w): > >print w > > > QtCore.QObject,connect( my_line_edit, > > QtCore.SIGNAL("returnPressed()"), foo

Re: strange behavious of the logging module?

2007-09-24 Thread Peter Otten
Vinay Sajip wrote: > On Sep 24, 8:03 am, Peter Otten <[EMAIL PROTECTED]> wrote: >> >> It would still be a good idea to file a bug report. > > Not sure where the bug is. The script below, when called, prints > "Information" to the console and "INFO some_func Information" to > mc_rigid.log, as

Re: Can a base class know if a method has been overridden?

2007-09-24 Thread Bruno Desthuilliers
Ratko a écrit : > Hi all, > > I was wondering if something like this is possible. Can a base class > somehow know if a certain method has been overridden by the subclass? If your use case is to make sure a given ('abstract') method has been overriden, the canonical solution is to raise NotImplem

Re: Google and Python

2007-09-24 Thread Alex Martelli
Bryan Olson <[EMAIL PROTECTED]> wrote: ... > > YouTube (one of Google's most valuable properties) is essentially > > all-Python (except for open-source infrastructure components such as > > lighttpd). Also, at Google I'm specifically "Uber Tech Lead, Production > > Systems": while I can't discu

Re: Can a base class know if a method has been overridden?

2007-09-24 Thread Michele Simionato
On Sep 24, 5:23 pm, Ratko <[EMAIL PROTECTED]> wrote: > Hi all, > > I was wondering if something like this is possible. Can a base class > somehow know if a certain method has been overridden by the subclass? > I appreciate any ideas. > Thanks, > > Ratko The first time I used Zope, I immediately h

To Andrey Khavryuchenko <[EMAIL PROTECTED]> was: Who can develop the following Python script into working application ?

2007-09-24 Thread http://members.lycos.co.uk/dariusjack/
to Andrey Khavryuchenko <[EMAIL PROTECTED]> he said: " Actually, I am a python (and django) developer, looking for a contract, owning Nokia 770 and contacted original poster with no response. -- Andrey V Khavryuchenko http://a.khavr.com/ Chytach - unflood your feeds http://www.chytach.com/ S

Re: Can a base class know if a method has been overridden?

2007-09-24 Thread Ratko
> If your use case is to make sure a given ('abstract') method has been > overriden, the canonical solution is to raise NotImplementedError in the > base class's implementation I am not really interested in forcing the subclass to implement a method. I am interested in knowing *whether* it did imp

Re: Newbie completely confused

2007-09-24 Thread Jeroen Hegeman
Thanks for the comments, > > (First, I had to add timing code to ReadClasses: the code you posted > doesn't include them, and only shows timings for ReadLines.) > > Your program uses quite a bit of memory. I guess it gets harder and > harder to allocate the required amounts of memory. Well, I gue

Re: Newbie completely confused

2007-09-24 Thread Jeroen Hegeman
> > Your code does NOT include any statements that could have produced the > above line of output -- IOW, you have not posted the code that you > actually ran. Oh my, I must have cleaned it up a bit too much, hoping that people would focus on the issue instead of the formatting of the output

Re: Can a base class know if a method has been overridden?

2007-09-24 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Sep 2007 15:48:07 +, Ratko wrote: > I have a base class EvtHandler that has methods defined to handle > certain events. You then subclass from EvtHandler and override the > methods for the events you want to receive. If a method has been > overridden, the base class will automatical

Re: Can a base class know if a method has been overridden?

2007-09-24 Thread Chris Mellon
On 9/24/07, Ratko <[EMAIL PROTECTED]> wrote: > > If your use case is to make sure a given ('abstract') method has been > > overriden, the canonical solution is to raise NotImplementedError in the > > base class's implementation > > I am not really interested in forcing the subclass to implement a >

Re: building a GUI

2007-09-24 Thread Oleg Batrashev
On Sep 23, 5:21 pm, yadin <[EMAIL PROTECTED]> wrote: > if i were up to make a GUI chich are the advantages of choosing python > over matlab or java? Haven't seen any free visual layout program for swing, swing is somewhat messy - unnecessary complex layout classes. Compile - run cycle without visu

Re: database persistence with mysql, sqlite

2007-09-24 Thread coldpizza
On Sep 24, 7:23 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>, coldpizza > wrote: > > > So far, with mysql I use 'SELECT * FROM TABLE LIMIT L1, L2' where L1 > > and L2 define the range for the 'Next' and 'Previous' commands. I > > have

Re: building a GUI

2007-09-24 Thread cyberco
Try BoaConstructor and the wxPython library, both are wonderfull. If you don't mind using Java Swing, and there are good reasons for that, go for jython. It simplifies the java swingcode so much you don't have to use a graphical GUI builder anymore :) -- http://mail.python.org/mailman/listinfo/py

CLAIM YOUR TWO FREE UNIVERSAL STUDIOS TICKETS!

2007-09-24 Thread Sword, Robyn
how do you claim your tickets? CLAIM YOUR TWO FREE UNIVERSAL STUDIOS TICKETS! CLAIM YOUR TWO FREE UNIVERSAL STUDIOS TICKETS! lisawill4u at yahoo.com Sat Nov 20 21:35:53 CET

Re: Converting numbers to unicode charaters

2007-09-24 Thread Peter Otten
Duncan Booth wrote: > Laurent Pointal <[EMAIL PROTECTED]> wrote: > >> You may eventually use a more condensed expression and avoid n >> concatenation of n chars using join, like this: >> >> >>> u''.join(unichr(int(x,16)) for x in ['42','72','61','64']) >> u'Brad' > > Or even avoid the loop com

  1   2   >