Re: Dictionaries

2006-10-19 Thread Lad
Steven, Thank you for help; Here is a code that works in a way I need A={'c':1,'d':2,'e':3,'f':2} B={'c':2,'e':1} if len(A)>=len(B): Delsi=B C = A.copy() else: Delsi=A C = B.copy() for key, value in Delsi.items(): if C.has_key(key): C[key]=

Re: a little about regex

2006-10-19 Thread Rob Wolfe
Fulvio wrote: > Great, it works perfectly. I found my errors. > I didn't use r ahead of the patterns and i was close to the 'allow' pattern > but didn't give positive result and KregexEditor reported wrong way. This > specially because of '<' inside the stream. I thing that is not a normal > reg

Re: creating many similar properties

2006-10-19 Thread Michele Simionato
Carl Banks wrote: > You sound as if you're avoiding metaclasses just for the sake of > avoiding them, which is just as bad as using them for the sake of using > them. Do you realize that you are effectively saying "avoiding a complex tool in favor of a simpler one is just as bad as avoing the simp

Re: creating many similar properties

2006-10-19 Thread Michele Simionato
James Stroud wrote: > However, I think that what you are saying about metaclasses being > brittle relates more to implementation than language. In theory, these > should be equivalent: > > (1) class Bob(object): pass > (2) Bob = type('Bob', (), {}) > > And indeed a cursory inspection of the

RELEASED Python 2.4.4, Final.

2006-10-19 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.4 (FINAL). Python 2.4.4 is a bug-fix release. While Python 2.5 is the latest version of Python, we're making this release for people who are still running Python 2.4. This is the fina

__delitem__ affecting performance

2006-10-19 Thread Karl H.
Hi, I was performing some timing tests on a class that inherits from the built-in list, and got some curious results: import timeit class MyList(list): def __init__(self): list.__init__(self) self[:] = [0,0,0] def __delitem__(self,index): print 'deleting'

UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread NoelByron
Hi! I'm struggling with the conversion of a UTF-8 string to latin-1. As far as I know the way to go is to decode the UTF-8 string to unicode and then encode it back again to latin-1? So I tried: 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'König', contains a german 'umlaut' but

Re: __delitem__ affecting performance

2006-10-19 Thread Fredrik Lundh
Karl H. wrote: > Does anybody know why defining __delitem__ is causing the code to run > slower? It is not being called, so I don't see why it would affect > performance. probably because overriding portions of the internal sequence slot API (tp_as_sequence) means that Python needs to do full

libraries options not split in setup.cfg

2006-10-19 Thread Alexandre Guimond
Hi. I just noticed that the "libraries" options under the [build_ext] section in setup.cfg doesn't seem to get expanded. In particular, in distutils.command.build_ext.py of python 2.4. (line147): if type(self.libraries) is StringType: self.libraries = [self.libraries] though l

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'm struggling with the conversion of a UTF-8 string to latin-1. As far > as I know the way to go is to decode the UTF-8 string to unicode and > then encode it back again to latin-1? > > So I tried: > > 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'Kön

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'König', > contains a german 'umlaut' > > but failed since python assumes every string to decode to be ASCII? No, Python would assume the string to be utf-8 encoded in this case: >>> 'K\xc3\xb6ni'.decode('utf

Re: characters in python

2006-10-19 Thread Gigs_
I solve it. Just have to do another encoding: http://www.python.org/dev/peps/pep-0263/ -- http://mail.python.org/mailman/listinfo/python-list

Re: characters in python

2006-10-19 Thread Gigs_
Leo Kislov wrote: > > On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: >> Stens wrote: >>> Can python handle this characters: c,c,ž,d,š? >>> If can how"I wanna to change some characters in text (in the file) to the >> characters at this address: >> >> http://rapidshare.de/files/37244252/Untit

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread NoelByron
> > > > 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'König', > > "Köni", to be precise. Äh, yes. ;o) > > contains a german 'umlaut' > > > > but failed since python assumes every string to decode to be ASCII? > > that should work, and it sure works for me: > > >>> s = 'K\xc3\xb6ni

Re: Python wrapper for C++ core

2006-10-19 Thread Holly
Thanks everyone for the responses - I think I have a better understanding now. I can handle all the messy I/O in Python and use C for the number crunching. I especially like the idea of using python to output the results to excel. OK time to learn Python i think - any tips on best place to start

Re: Install from source on a x86_64 machine

2006-10-19 Thread Paul Boddie
Christopher Taylor wrote: > > Being relatively new to linux I'm a little confused about what options > I need to use to build python from source. The README should provide sufficient information, although if you want to install Python into /usr rather than /usr/local (as I believe is the default),

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread NoelByron
Duncan Booth wrote: > [EMAIL PROTECTED] wrote: > > > 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'König', > > contains a german 'umlaut' > > > > but failed since python assumes every string to decode to be ASCII? > > No, Python would assume the string to be utf-8 encoded in this cas

Re: Flexible Collating (feedback please)

2006-10-19 Thread Leo Kislov
Ron Adam wrote: > locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect (unexpectedly to the application) time.strftime() and C

Re: Book about database application development?

2006-10-19 Thread Paul Boddie
Dennis Lee Bieber wrote: > On 18 Oct 2006 02:20:15 -0700, "Paul Boddie" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > Aren't we going round in circles here? There presumably are grid > > Possibly -- it was the fairly recent lamentation about Delphi that > made me think

Re: More Noob Questions

2006-10-19 Thread Ravi Teja
> 1) I'm also learning to program flash movies while I learn to do > python. How can one implement flash movies into their python code? Depending on what "implementing flash movies into Python code" means. Python and Flash can be complementary. You can develop the UI in Flash and have it talk to

Re: Python wrapper for C++ core

2006-10-19 Thread Roman Yakovenko
On 19 Oct 2006 03:10:55 -0700, Holly <[EMAIL PROTECTED]> wrote: > > Thanks everyone for the responses - I think I have a better > understanding now. I can handle all the messy I/O in Python and use C > for the number crunching. I especially like the idea of using python to > output the results to e

Type discrepancy using struct.unpack

2006-10-19 Thread Pieter Rautenbach
Hallo, I have a 64 bit server with CentOS 4.3 installed, running Python. [EMAIL PROTECTED] pymsnt-0.11.2]$ uname -a Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT 2006 x86_64 x86_64 x86_64 GNU/Linux Consider the following two snippets, issuing a struct.unpack(...) using P

Python Memory Leak Detector

2006-10-19 Thread Stephen Kellett
Announcing Software Tools for Python We are pleased to inform you that we have completed the port and beta test of our Memory Analysis software tool to support Python. The software tools run on the Windows NT/2000/XP (and above) platforms. Python Memory Validator (a memory leak detection tool)

Re: Type discrepancy using struct.unpack

2006-10-19 Thread Leo Kislov
Pieter Rautenbach wrote: > Hallo, > > I have a 64 bit server with CentOS 4.3 installed, running Python. > > [EMAIL PROTECTED] pymsnt-0.11.2]$ uname -a > Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT > 2006 x86_64 x86_64 x86_64 GNU/Linux > > Consider the following two snipp

Re: How to use python in TestMaker

2006-10-19 Thread kelin,[EMAIL PROTECTED]
Paddy wrote: > kelin,[EMAIL PROTECTED] wrote: > > Hello, > > > > Now I 'm learning python to do testing jobs, and want to use it in > > TestMaker. > > The problem is: I don't know how to use python in TestMaker. > > Just write python program in it or call .py files in it? > > I am really new about

Re: How to use python in TestMaker

2006-10-19 Thread kelin,[EMAIL PROTECTED]
I don't know that TestMaker is written in Python before. So maybe it's my mistake. Then have you ever done testing jobs with Python? I know that many people do testing jobs with it. I just can't find a good tool to do Unit Test with Python. Could you please tell me any? Thanks a lot! Gabriel Ge

Re: More Noob Questions

2006-10-19 Thread Roberto Bonvallet
Omar wrote: > more to come! Please, use a more meaningful subject next time, like "Integration of Python and Flash" or "Where can I find vido tutorials". That way it will be easier to people that knows about the subject to find your message and answer you. And please think of us, non-native Engl

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Michael Ströder
[EMAIL PROTECTED] wrote: > > print 'K\xc3\xb6ni'.decode('utf-8') > > and this line raised a UnicodeDecode exception. Works for me. Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode object. With print this is implicitly converted to string. The char set used depends on your console Chec

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
Leo Kislov wrote: > Ron Adam wrote: > >> locale.setlocale(locale.LC_ALL, '') # use current locale settings > > It's not current locale settings, it's user's locale settings. > Application can actually use something else and you will overwrite > that. You can also affect (unexpectedly to the appl

Re: Install from source on a x86_64 machine

2006-10-19 Thread Christopher Taylor
> The README should provide sufficient information, although if you want > to install Python into /usr rather than /usr/local (as I believe is the > default), you need to run configure as follows: > > ./configure --prefix=/usr > Yeah, I saw that in the readme. > > In fact, it's /usr/bin/python, /

Re: passing values to a program

2006-10-19 Thread [EMAIL PROTECTED]
If it is as simple as using the sys and dot befour the argv then I have it made.. The example I was trying to get that from came from the first edition programming python (I think they were using version 1.3). thanks for the help I will give that a try. https://sourceforge.net/project/stats/?gro

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread NoelByron
Michael Ströder wrote: > [EMAIL PROTECTED] wrote: > > > > print 'K\xc3\xb6ni'.decode('utf-8') > > > > and this line raised a UnicodeDecode exception. > > Works for me. > > Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode object. With > print this is implicitly converted to string. The char

Can I use decorators to manipulate return type or create methods?

2006-10-19 Thread WakeBdr
I'm writing a class that will query a database for some data and return the result to the caller. I need to be able to return the result of the query in several different ways: list, xml, dictionary, etc. I was wondering if I can use decorators to accomplish this. For instance, I have the follow

Re: What happened to RuleDispatch

2006-10-19 Thread exhuma.twn
On Oct 18, 10:41 pm, "Adam Jones" <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: > > Hi all, > > > yesterday I wanted to install TurboGears, which depends on > >RuleDispatch. However, I failed to download it. First I got the error > > "Bad Gateway" from the server, today it's simply a "Not Found"

Re: What happened to RuleDispatch

2006-10-19 Thread exhuma.twn
On Oct 19, 3:44 pm, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > On Oct 18, 10:41 pm, "Adam Jones" <[EMAIL PROTECTED]> wrote: > > > > > exhuma.twn wrote: > > > Hi all, > > > > yesterday I wanted to install TurboGears, which depends on > > >RuleDispatch. However, I failed to download it. First I got

Python with MPI enable C-module

2006-10-19 Thread [EMAIL PROTECTED]
Hello All, A software project that I am working on currently has a C++ library that runs on a Beowulf cluster for parallel computation. The library code uses MPI for its implementation. We are currently developing python wrappers for the library. Our current design uses one Python process as a fro

wxPython help wxSashWindow

2006-10-19 Thread MatthewWarren
Hi, I'm wondering if anyone can tell me here, or point to a specific tutorial ( I have searched for 1/2hour, but can find only reference style docs or not-quite-what-im-after help) on how to build a wxSashWindow in wxPython. I'm just starting out with wxPython, and the first thing i need to do is

Re: Install from source on a x86_64 machine

2006-10-19 Thread Paul Boddie
Christopher Taylor wrote: > > ok, so where does that leave me. I'm not even sure which files > *should* be put in /lib64 vs lib. I'd imagine that anything which is a .so file (plus the modules which depend on it, I suppose) should be put in the appropriate library directory. Thus, 32-bit librarie

Re: Type discrepancy using struct.unpack

2006-10-19 Thread Pieter Rautenbach
Leo Kislov wrote: > Pieter Rautenbach wrote: > > Hallo, > > > > I have a 64 bit server with CentOS 4.3 installed, running Python. > > > > [EMAIL PROTECTED] pymsnt-0.11.2]$ uname -a > > Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT > > 2006 x86_64 x86_64 x86_64 GNU/Linux >

Re: Install from source on a x86_64 machine

2006-10-19 Thread Christopher Taylor
> Generally, the install process should respect the prefix (ie. /usr in > your case, /usr/local in the default case) and then choose the > appropriate library directories below that (ie. /usr/lib, /usr/lib64 in > your case), but I can't find anything obvious in the README about > specifying archite

A suggestion/request for IDEs

2006-10-19 Thread John Salerno
I apologize for the slightly off-topic nature, but I thought I'd just throw this out there for anyone working on text editors or IDEs with auto-completion. I think it should be a feature, when an item is selected for auto-completion in a drop-down box, that pressing the spacebar (in addition t

Re: Classes and Functions - General Questions

2006-10-19 Thread John Salerno
John Salerno wrote: > Setash wrote: > >> And have class2 inherit class1 without any import statements, or need >> it be imported first? >> Or need class1 and class2 be both declared in the same .py file if >> there is inheritance? > > If the classes are in the same module, you don't need to do an

Re: wxPython help wxSashWindow

2006-10-19 Thread John Salerno
MatthewWarren wrote: > I'm just starting out with wxPython Hi there. Sorry I can't help you because SashWindow isn't something I've worked with yet, but I just wanted to let you know that there is also a dedicated wxPython newsgroup (not that the people here aren't geniuses!) :) gmane.comp.pyt

Re: Flexible Collating (feedback please)

2006-10-19 Thread Ron Adam
[EMAIL PROTECTED] wrote: > Ron Adam: > > Insted of: > > def __init__(self, flags=[]): > self.flags = flags > self.numrex = re.compile(r'([\d\.]*|\D*)', re.LOCALE) > self.txtable = [] > if HYPHEN_AS_SPACE in flags: > self.txtable.append(('-',

Re: wxPython help wxSashWindow

2006-10-19 Thread MatthewWarren
John Salerno wrote: > MatthewWarren wrote: > > > I'm just starting out with wxPython > > Hi there. Sorry I can't help you because SashWindow isn't something I've > worked with yet, but I just wanted to let you know that there is also a > dedicated wxPython newsgroup (not that the people here aren'

Re: Determining if a file is locked in Windows

2006-10-19 Thread elake
Larry Bates wrote: > elake wrote: > > I found this thread about a pst file in Windows being locked and I am > > having the same issue. > > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locked+files%27&rnum=1 > > > >

Bad Magic Number with only .py deployed

2006-10-19 Thread KronicDeth
I have a package of python modules deployed on an NFS mount on my network that I use for sysadmin tools. Since some of the machines use different versions of python I've only put the .py files in the mounted share. However, I'm getting ImportError: Bad Magic Number when I try to load any of the

Re: Classes and Functions - General Questions

2006-10-19 Thread Sybren Stuvel
Setash enlightened us with: >> class1.py: >> >> class Class1(object): >> pass >> >> class2.py: >> import class1 This line imports class1.py and places its contents under the name "class1". > classes.py: > > class Class1 > pass > > class Class2(Class1) > pass That's co

Re: Ok. This IS homework ...

2006-10-19 Thread Magnus Lycka
Frederic Rentsch wrote: > Once upon a time programmers did things like this: > > BEGIN > | > -->|<- > | | | > | catch input| >

Re: Flexable Collating (feedback please)

2006-10-19 Thread Ron Adam
Gabriel Genellina wrote: > At Wednesday 18/10/2006 21:36, Ron Adam wrote: >> Maybe changing the CAPS_FIRST to REVERSE_CAPS_ORDER would do? > > At least it's a more accurate name. > There is an indirect way: test locale.strcoll("A","a") and see how they > get sorted. Then define options CAPS_FIRST

wxPython and PIL

2006-10-19 Thread Odalrick
I'm making a simple program to crop and scale images, essentially make thumbnails from a user defined subset of the image. I'm planning to use Python Image Library to crop and resize the images, mostly to make the resized smaller images look good. How do I display a PIL image with wxPython? --

Re: Determining if a file is locked in Windows

2006-10-19 Thread MatthewWarren
elake wrote: > Larry Bates wrote: > > elake wrote: > > > I found this thread about a pst file in Windows being locked and I am > > > having the same issue. > > > > > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locke

Re: A suggestion/request for IDEs

2006-10-19 Thread [EMAIL PROTECTED]
John Salerno wrote: > I apologize for the slightly off-topic nature, but I thought I'd just > throw this out there for anyone working on text editors or IDEs with > auto-completion. > > I think it should be a feature, when an item is selected for > auto-completion in a drop-down box, that pressing

Re: Can I use decorators to manipulate return type or create methods?

2006-10-19 Thread Chris Mellon
On 19 Oct 2006 06:43:49 -0700, WakeBdr <[EMAIL PROTECTED]> wrote: > I'm writing a class that will query a database for some data and return > the result to the caller. I need to be able to return the result of > the query in several different ways: list, xml, dictionary, etc. I was > wondering if

Re: What happened to RuleDispatch

2006-10-19 Thread Adam Jones
exhuma.twn wrote: > On Oct 19, 3:44 pm, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > > On Oct 18, 10:41 pm, "Adam Jones" <[EMAIL PROTECTED]> wrote: > > > > > > > > > exhuma.twn wrote: > > > > Hi all, > > > > > > yesterday I wanted to install TurboGears, which depends on > > > >RuleDispatch. However,

[OT] Re: A suggestion/request for IDEs

2006-10-19 Thread Tim Chase
John Salerno wrote: > I apologize for the slightly off-topic nature, but I thought I'd just > throw this out there for anyone working on text editors or IDEs with > auto-completion. Well, Vim7's autocompletion already allows this. Earlier versions of vim also allowed similar behavior, but (AFAIK

Dictionaries again - where do I make a mistake?

2006-10-19 Thread Lad
I use the following code to sort dictionary. Olddict={'r':4,'c':1,'d':2,'e':3,'f':2} Newdict={} i = [(val, key) for (key, val) in Olddict.items()] i.sort() # by val i.reverse() # Get largest first. for (val, key) in i: print key,val Newdict[key]=val print Olddict print Newdict

Re: Dictionaries again - where do I make a mistake?

2006-10-19 Thread Dustin J. Mitchell
Lad wrote: > Sorting seems to be OK,. > the command > print key,val > prints the proper values > but I can not create Newdict to be sorted properly. > > Where do I make a mistake? > Thank you for help. Dictionaries are unordered -- the order in which items come out is unspecified. It's based on

Re: Dictionaries again - where do I make a mistake?

2006-10-19 Thread Tim Chase
> but I can not create Newdict to be sorted properly. > > Where do I make a mistake? By assuming that dictionaries *can* be sorted. For more reading: http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52306 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 They're intrinsical

Komodo

2006-10-19 Thread SpreadTooThin
Why is it that (On MAC OS X) in Komodo 3.5 Professional, if I try to find something in my script, I am unable to change the text it is searching for? -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to RuleDispatch

2006-10-19 Thread exhuma.twn
On Oct 19, 5:32 pm, "Adam Jones" <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: > > On Oct 19, 3:44 pm, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > > > On Oct 18, 10:41 pm, "Adam Jones" <[EMAIL PROTECTED]> wrote: > > > > > exhuma.twn wrote: > > > > > Hi all, > > > > > > yesterday I wanted to instal

Re: Can I use decorators to manipulate return type or create methods?

2006-10-19 Thread Diez B. Roggisch
WakeBdr schrieb: > I'm writing a class that will query a database for some data and return > the result to the caller. I need to be able to return the result of > the query in several different ways: list, xml, dictionary, etc. I was > wondering if I can use decorators to accomplish this. > > Fo

invert or reverse a string... warning this is a rant

2006-10-19 Thread rick
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x[::-1] Ruby: x = 'a_string' # Reverse the string print x.reverse The Ruby approach makes sense to me as a human being. The Python approach is not easy for me (as a human being) to rem

httplib problems -- bug, or am I missing something?

2006-10-19 Thread Dustin J. Mitchell
I'm building an interface to Amazon's S3, using httplib. It uses a single object for multiple transactions. What's happening is this: HTTP > PUT /unitest-temp-1161039691 HTTP/1.1 HTTP > Date: Mon, 16 Oct 2006 23:01:32 GMT HTTP > Authorization: AWS <>:KiTWRuq/6aay0bI2J5DkE2TAWD0= HTTP > (end head

Re: wxPython help wxSashWindow

2006-10-19 Thread John Salerno
MatthewWarren wrote: > Thanks, is that a newsgroup I can view through google groups? I tried > seraching for it but google says no.. I'm not sure, but I don't think so. The way I have to do it is use Thunderbird (or equivalent) and subscribe first to the "Gmane" account, then to the specific ne

pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe)

2006-10-19 Thread kogrover
ISSUE: COM Excel Sort works with Early Binding, but not Late Binding, but py2exe only does Late Binding I have code similar to this (type from notes, so there may be a typo...) import win32com.client xl = win32com.client.Dispatch("Excel.Application") xl.Visible = False xl.ScreenUpdating = False w

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Michael Ströder <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> >> print 'K\xc3\xb6ni'.decode('utf-8') >> >> and this line raised a UnicodeDecode exception. > > Works for me. > > Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode > object. With print this is implici

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread John Salerno
rick wrote: > Why can't Python have a reverse() function/method like Ruby? I'm not steeped enough in daily programming to argue that it isn't necessary, but my question is why do you need to reverse strings? Is it something that happens often enough to warrant a method for it? -- http://mail.py

Re: Book about database application development?

2006-10-19 Thread Magnus Lycka
Wolfgang Keller wrote: > does anyone know of a good book that about development of database > applications? Scott Ambler's "Agile Database Techniques" Regardless of whether you'll actually use a full MVC framework or not, I suggest that you write model classes that are fully decoupled from the U

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Paul Rubin
rick <[EMAIL PROTECTED]> writes: > Why can't Python have a reverse() function/method like Ruby? > > Python: > x = 'a_string' > # Reverse the string > print x[::-1] > > The Ruby approach makes sense to me as a human being. The Python > approach is not easy for me (as a human being) to remember. Ca

Calling functions

2006-10-19 Thread Tommy Grav
I have a small program that goes something like thisdef funcA() : passdef funcB() : passdef funcC() : passdef determine(f): t = f() return tWhat I would like to do is be able to n = determine(funcA)m = determine(funcB)But I can't really figure out how to do this (I think it is possible :) CheersTom

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Fredrik Lundh
rick wrote: > The Ruby approach makes sense to me as a human being. do the humans on your planet spend a lot of time reversing strings? it's definitely not a very common thing to do over here. anyway, if you do this a lot, why not define a helper function? def reverse(s): return

Re: Calling functions

2006-10-19 Thread Dustin J. Mitchell
Tommy Grav wrote: > I have a small program that goes something like this > > def funcA() : pass > def funcB() : pass > def funcC() : pass > > def determine(f): > t = f() > return t > > What I would like to do is be able to > > n = determine(funcA) > m = determine(funcB) > > But I can't really

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Neil Cerutti wrote: >> Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode >> object. With print this is implicitly converted to string. The >> char set used depends on your console > > No, the setting of the console encoding (sys.stdout.encoding) is > ignored. Nope

RE: invert or reverse a string... warning this is a rant

2006-10-19 Thread Demel, Jeff
John Salerno wrote: >'m not steeped enough in daily programming to argue that it >sn't necessary, but my question is why do you need to >reverse strings? Is it something that happens often enough >to warrant a method for it? I've been programming professionally for over 10 years, and have never

Re: Calling functions

2006-10-19 Thread Fredrik Lundh
Tommy Grav wrote: > I have a small program that goes something like this > > def funcA() : pass > def funcB() : pass > def funcC() : pass > > def determine(f): > t = f() > return t > > What I would like to do is be able to > > n = determine(funcA) > m = determine(funcB) > > But I can

Re: wxPython and PIL

2006-10-19 Thread Laszlo Nagy
Odalrick wrote: > I'm making a simple program to crop and scale images, essentially make > thumbnails from a user defined subset of the image. > > I'm planning to use Python Image Library to crop and resize the images, > mostly to make the resized smaller images look good. > > How do I display a PI

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: > >>> Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode >>> object. With print this is implicitly converted to string. The >>> char set used depends on your console >> >> No, th

advice for web-based image annotation

2006-10-19 Thread Brian Blais
Hello, I want to set up a system where I can have my family members write comments about a number of pictures, as part of a family tree project. Essentially, I want them to be able to log into a website (I already have the webspace, and the server runs python, but not mod_python), see image

RE: invert or reverse a string... warning this is a rant

2006-10-19 Thread Demel, Jeff
John Salerno wrote: >'m not steeped enough in daily programming to argue that it sn't >necessary, but my question is why do you need to reverse strings? Is it >something that happens often enough to warrant a method for it? I've been programming professionally for over 10 years, and have never o

Re: Calling functions

2006-10-19 Thread Tommy Grav
That does work yes :) I just noticed that the script had another little error in it, making me believe that the function call was crooking.Cheers   TommyOn Oct 19, 2006, at 12:30 PM, Dustin J. Mitchell wrote:Tommy Grav wrote: I have a small program that goes something like thisdef funcA() : passdef

Re: UTF-8 to unicode or latin-1 (and yes, I read the FAQ)

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Neil Cerutti wrote: >>> Note that 'K\xc3\xb6ni'.decode('utf-8') returns a Unicode >>> object. With print this is implicitly converted to string. The >>> char set used depends on your console >> >> No, the

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Brad
John Salerno wrote: > rick wrote: >> Why can't Python have a reverse() function/method like Ruby? > > I'm not steeped enough in daily programming to argue that it isn't > necessary, but my question is why do you need to reverse strings? Is it > something that happens often enough to warrant a me

Re: Determining if a file is locked in Windows

2006-10-19 Thread elake
MatthewWarren wrote: > elake wrote: > > Larry Bates wrote: > > > elake wrote: > > > > I found this thread about a pst file in Windows being locked and I am > > > > having the same issue. > > > > > > > > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed009

Re: wxPython help wxSashWindow

2006-10-19 Thread Max Erickson
"MatthewWarren" <[EMAIL PROTECTED]> wrote: > > Thanks, is that a newsgroup I can view through google groups? I > tried seraching for it but google says no.. > > And I'll give that list a subscribe. > > I have found a wxPython google group, but only 11 members and a > handfull of posts in a year

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Neil Cerutti
On 2006-10-19, Brad <[EMAIL PROTECTED]> wrote: > I'm home for lunch so my email addy is different. > > No, it doesn't happen very often, but when I need to reverse > something (usually a list or a string). I can never remember > right of the top of my head how to do so in Python. I always > have to

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Brad
Fredrik Lundh wrote: > rick wrote: > >> The Ruby approach makes sense to me as a human being. > > do the humans on your planet spend a lot of time reversing strings? it's > definitely not a very common thing to do over here. On our planet, we're all dyslexic. We tend to do things 'backwards' so

Re: Can I use decorators to manipulate return type or create methods?

2006-10-19 Thread Peter Otten
WakeBdr wrote: > I'm writing a class that will query a database for some data and return > the result to the caller. I need to be able to return the result of > the query in several different ways: list, xml, dictionary, etc. I was > wondering if I can use decorators to accomplish this. > > For

Re: Komodo

2006-10-19 Thread Mark Elston
* SpreadTooThin wrote (on 10/19/2006 8:47 AM): > Why is it that (On MAC OS X) in Komodo 3.5 Professional, if I try to > find something in my script, > I am unable to change the text it is searching for? > Perhaps Emacs might work better ... :) Mark -- http://mail.python.org/mailman/listinfo/pyt

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Paul McGuire
"Demel, Jeff" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] John Salerno wrote: P.S. How about a string.shuffle() method that splits the string in half into two new strings str1 and str2, and then recompiles the string by alternating one character from each str1 and str2 as it goes

Re: Converting existing module/objects to threads

2006-10-19 Thread Gabriel Genellina
At Thursday 19/10/2006 00:01, [EMAIL PROTECTED] wrote: > Consider using the asyncore module instead of threads. I think that is a good point and I am considering using asyncore/asynchat... i'm a little confused as to how i can make this model work. There is no server communication without con

Re: Komodo

2006-10-19 Thread hg
Mark Elston wrote: > * SpreadTooThin wrote (on 10/19/2006 8:47 AM): >> Why is it that (On MAC OS X) in Komodo 3.5 Professional, if I try to >> find something in my script, >> I am unable to change the text it is searching for? >> > > Perhaps Emacs might work better ... :) > > Mark Can you sugges

Re: advice for web-based image annotation

2006-10-19 Thread Max Erickson
Brian Blais <[EMAIL PROTECTED]> wrote: > Hello, > > I want to set up a system where I can have my family members > write comments about a number of pictures, as part of a family > tree project. Essentially, I want them to be able to log into a > website (I already have the webspace, and the serv

Re: Komodo

2006-10-19 Thread Todd Whiteman
SpreadTooThin wrote: > Why is it that (On MAC OS X) in Komodo 3.5 Professional, if I try to > find something in my script, > I am unable to change the text it is searching for? > > I am not sure, especially given the limited amount of context, you will likely get a better response by posting a

Re: A suggestion/request for IDEs

2006-10-19 Thread Stephen Eilert
Tim Chase wrote: > John Salerno wrote: > > I apologize for the slightly off-topic nature, but I thought I'd just > > throw this out there for anyone working on text editors or IDEs with > > auto-completion. > > Well, Vim7's autocompletion already allows this. Earlier > versions of vim also allowed

Compile for 64bit RHEL

2006-10-19 Thread Christopher Taylor
Has anyone been able to get python 2.4 to compile properly for x86_64 RHEL? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting existing module/objects to threads

2006-10-19 Thread Jean-Paul Calderone
On Thu, 19 Oct 2006 14:09:11 -0300, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >At Thursday 19/10/2006 00:01, [EMAIL PROTECTED] wrote: >> > Consider using the asyncore module instead of threads. >> >>I think that is a good point and I am considering using >>asyncore/asynchat... i'm a little conf

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Tim Chase
> P.S. How about a string.shuffle() method that splits the string in half > into two new strings str1 and str2, and then recompiles the string by > alternating one character from each str1 and str2 as it goes? Like > shuffling cards. ;) Well, for a true shuffling of a string, there's a random.

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread Fredrik Lundh
Dennis Lee Bieber wrote: > ONE usage... The old intro-to-programming Palindrome detector > becomes a very simple assignment given an easy means of reversing a > string (vs the "expected" loop comparing from the ends in to the center) you mean like >>> s = "a man a plan a canal panama" >>

RE: invert or reverse a string... warning this is a rant

2006-10-19 Thread Demel, Jeff
[EMAIL PROTECTED] wrote: >ONE usage... The old intro-to-programming Palindrome detector >becomes a very simple assignment given an easy means of >reversing a string (vs the "expected" loop comparing from >the ends in to the center) Ok, let me re-phrase: ...[snip]... I've been programming profe

  1   2   3   >