RE: Why do this?

2006-10-05 Thread Tim Golden
[Matthew Warren] | Now, I started programming when I was 8 with BBC Basic. Hey, likewise! (Except I was 12 when it came out!) | I learned over the years to do things like the following, and I like | doing it like this because of readability, something Python seems to | focus on :- | | Print "Th

RE: Why do this?

2006-10-05 Thread Tim Golden
[Matthew Warren] | Blame outlook and AutoCaps. If number were a number I would write | | print "There are",number,"ways to skin a "+furryanimal You see now that strikes me as a bit mixed up. Why not simply use? print "a", number, "c", string | > altho' print is slated for replacement by a func

Re: weakSet

2006-10-05 Thread Tim Peters
[EMAIL PROTECTED] > Has anyone ever think about a set wich references its elements weakly ? Yes, and there are excruciating subtleties. I only implemented as much of one as ZODB needed at the time: # A simple implementation of weak sets, supplying just enough of Python's # sets.Set interface for

Re: Request for recommendations: shared database without a server

2006-10-05 Thread Tim Chase
> Access might really be the best solution. It is pretty good > for what it is supposed to do, and the quick prototyping and > UI-designing are strong arguments for it, especially if there > already is a bias towards it. > > I also _think_ that the whole "db on a shared volume" thing > works compa

Re: Question about turning off garbage collection

2006-10-05 Thread Tim Peters
[David Hirschfield] > Question from a post to pygtk list...but it probably would be better > answered here: > > I encountered a nasty problem with an external module conflicting with > my python threads recently, and right now the only fix appears to be to > turn off garbage collection while the cr

testing machine responsiveness

2006-10-06 Thread Tim Arnold
up command) I'm no expert--I bet what I'm doing could be done better. I'd appreciate any tips, caveats, etc. Thanks in advance for looking at the code. --Tim Arnold Say the host names are in a global list tmpList... # The final sorted list of cpus is called as: cpuLi

Iterating over marshal

2006-10-06 Thread Tim Lesher
al library has been around since roughly forever, is it just that no one's bothered to add iteration support to it, or am I missing something? Thanks. -- Tim Lesher [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over marshal

2006-10-06 Thread Tim Lesher
On Oct 6, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Lesher wrote: > > I'm using the marshal library to unmarshal a file containing one or > > more objects. The canonical way seems to be: > > > objs = [] > > while 1: > >

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Tim Peters
[Giovanni Bajo] > I understand your concerns, but I have to remember you that most bug reports > submitted by users go totally ignored for several years, or, better, forever. > I > do not have a correct statistic for this, Indeed you do not. > but I'm confident that at least 80% of the RFE or pa

Re: operator overloading + - / * = etc...

2006-10-07 Thread Tim Chase
>> Can these operators be overloaded? > > Yes. With the caveat of the "=" mentioned in the subject-line (being different from "==")...I haven't found any way to override assignment in the general case. There might be some oddball way to do it via property() but AFAIK, this only applies to pr

Re: operator overloading + - / * = etc...

2006-10-07 Thread Tim Chase
>> With the caveat of the "=" mentioned in the subject-line (being >> different from "==")...I haven't found any way to override >> assignment in the general case. > > Why would you want to do that? For the same reason one would use property() to create getter/setter functions for a particular v

Re: need some regular expression help

2006-10-07 Thread Tim Chase
> Why does it need to be a regex? There is a very simple and well-known > algorithm which does what you want. > > Start with i=0. Walk the string one character at a time, incrementing i > each time you see a '(', and decrementing it each time you see a ')'. At > the end of the string, the co

Re: Is there an alternative to os.walk?

2006-10-07 Thread Tim Roberts
ks for pointing me to the path module, was >interesting. Umm, may I point out that you don't NEED the "os.path.exists" call, because you are already being HANDED a list of all the filenames in that directory? You could "dirtest" with this much faster routinee: def di

Re: Python license question

2006-10-08 Thread Tim Peters
[Martitza] |> Hi. I work for a small company (actually in process of forming) > interested in embedding or extending python as part of our commercial > non-open-source product. We have legal counsel, but are interested in > the spirit as well as the letter of the law. Not much seems to have > be

Re: Python license question

2006-10-08 Thread Tim Peters
[Martitza] > Mr. Peters: Na, my father's dead -- you can call me Uncle Timmy ;-) > Thank you for so kindly taking the time to resolve my misunderstandings > and to elaborate on the intent of the PSF. > > In particular, thank you for explaining in plain language how the > licenses stack. I'm sure

RE: file system iteration

2006-10-09 Thread Tim Golden
[Georg Brandl] | rick wrote: | > In Windows, the file system is disjointed and there is now | real 'root' | > At least none that I can see. It looks more like this: | > | > | | | | | | | | > |_|_|_|_|_|_| | > A B C D E F G | > | > How do you guys handle this when working with scripts that | n

RE: file system iteration

2006-10-09 Thread Tim Golden
[Rick] | Searching for a file by name. Scanning for viruses. Etc. | There are lots | of legitimate reason to walk all paths from a central | starting point, no??? Well, to get you started, I think this is the kind of thing you'll want. Uses ctypes, which is built-in to Python 2.5 so presumably

Re: Python component model

2006-10-10 Thread Tim Chase
> There's no doubt that Python's excellent introspection mechanism allows > an outside RAD-like tool to inspect the workings of any Python object. > But that does not make it a component model in my original use of the > term on this thread. A RAD tool needs to know what properties and events >

Re: Is a list static when it's a class member?

2006-10-10 Thread Tim Chase
> class A: > name = "" > data = [] > def __init__(self, name): > self.name = name > def append(self, info): > self.data.append(info) > def enum(self): > for x in self.data: > print "\t%s" % x > How do i get: > A: > one > two >

RE: How to find a file or a device is currently used by which processor which program ?

2006-10-11 Thread Tim Golden
[EMAIL PROTECTED] | When I want to uninstall my usb disk on windows, the | operating systems | sometimes tells me the device is being used by other program. But I | can't find which program is using it. Can I do this using python ? This is really one of those questions that could better be rep

Re: Regular expression worries

2006-10-11 Thread Tim Chase
> for l in > open('/root/Desktop/project/chatlog_20060819_110043.xml.txt'): > > l=l.replace("Document", "DOC") > fh.close() > > But it does not replace Document with Doc in the txt file In addition to closing the file handle for the loop *within* the loop, you're changing "l" (s

Re: hundreds of seconds?

2006-10-11 Thread Tim Peters
[EMAIL PROTECTED] > ... > G5-fiwihex:~ eur$ python > Python 2.3.5 (#1, Mar 20 2005, 20:38:20) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import time > >>> time.time() > 1160580871.258379 > >>> > > M

Re: strings in the global section

2006-10-12 Thread Tim Chase
Phoe6 wrote: > I write a script: > #!/usr/bin/python > astring = "This is a String" > > def fun1(): > astring = "I modify it in fun1" > def fun2(): > astring = "I modify it in fun2" > def main(): > print astring > fun1() > print astring > fun2() >

Re: prefix search on a large file

2006-10-12 Thread Tim Chase
> def leaders(sorted_list): > held = None > for phrase in held: Ummm...that for phrase in None: doesn't do a whole lot other than give a traceback. :*) I suspect you mean for phrase in sorted_list: no? -tkc -- http://mail.python.org/mailman/listinfo/

Re: strings in the global section

2006-10-12 Thread Tim Chase
>> Works, but something different ? > > Excuse me, what do you mean? Sounded like the OP wanted a behavior similar to "auto-globals" that has been a long-cursed aspect of PHP. That, without specifying it, local-variables should be global if their name exists in the global namespace. Python s

Re: Starting out.

2006-10-12 Thread Tim Chase
> (OT: Try to type 'proficient' with one hand on a US keyboard. :-)) A number of nice words like that: authenticity proficiency entitlement enchantment protozoans proficient antisocial tutorials tormentor shanghais shamrocks rhapsodic protozoan pantheism handiwork flamencos fishbowls firmament en

Re: File read-write mode: problem appending after reading

2006-10-13 Thread Tim Peters
[Frederic Rentsch] >Working with read and write operations on a file I stumbled on a > complication when writes fail following a read to the end. > > >>> f = file ('T:/z', 'r+b') > >>> f.write ('abcdefg') > >>> f.tell () > 30L > >>> f.seek (0) > >>> f.read () > 'abcdefg' > >>> f.flush ()

Re: Line algorithim for python and numeric

2006-10-13 Thread Tim Chase
>> I'm wondering if anyone knows of a way to extract data from a numeric >> array along a line. I have a gridded dataset which I would like to be >> able to choose two points and extract a 1-d array of the data values >> along the line between the two points. Any ideas? > > Are these all 45 degr

Re: Starting out.

2006-10-13 Thread Tim Chase
> Maybe you should say "amongst the longest" > > pepperwort > perpetuity > perruquier > pirouetter > proprietor > repertoire > typewriter > > But even that would be wrong. > > rupturewort > >> hey, look, it's Friday proprietory proterotype rupturewort according to my web2 list of words. Hey,

Re: Reverse string-formatting (maybe?)

2006-10-14 Thread Tim Chase
template = 'I am %s, and he %s last %s.' values = ('coding', "coded', 'week') formatted = template % values formatted > 'I am coding, and he coded last week.' deformat(formatted, template) > ('coding', 'coded', 'week') > > expanded (for better visual): deformat('I am

Re: Reverse string-formatting (maybe?)

2006-10-14 Thread Tim Chase
template = 'I am %s, and he %s last %s.' values = ('coding', "coded', 'week') formatted = template % values formatted > 'I am coding, and he coded last week.' deformat(formatted, template) > ('coding', 'coded', 'week') > > expanded (for better visual): deformat('I am

Re: File read-write mode: problem appending after reading

2006-10-14 Thread Tim Peters
[Frederic Rentsch] > Thanks a lot for your input. I seemed to notice that everything > works fine without setting the cursor as long as it stops before the end > of the file. Is that also a coincidence that may not work? "if you want to read following a write, or write following a read, on

Re: Reverse string-formatting (maybe?)

2006-10-15 Thread Tim Chase
> My template outside of the '%s' characters contains only commas and > spaces, and within, neither commas nor spaces. Given that information, > is there any reason it might not work properly? Given this new (key) information along with the assumption that you're doing straight string replacement

Re: Reverse string-formatting (maybe?)

2006-10-15 Thread Tim Chase
>>> >>> template = '%s, %s, %s' >>> >>> values = ('Tom', 'Dick', 'Harry') >>> >>> formatted = template % values >>> >>> import re >>> >>> unformat_string = template.replace('%s', '([^, ]+)') >>> >>> unformatter = re.compile(unformat_string) >>> >>> extracted_values = unformatter.search(forma

Re: set operations on dictionaries?

2006-10-16 Thread Tim Chase
> I understand this point but this is just an argument for > saying that it should throw an exception when the values don't > match. It is not an argument for not doing the logical thing > when they do. In fact in many situations it can be reasonably > expected that the values will be the same. If

Re: Need a strange sort method...

2006-10-16 Thread Tim Chase
> for example: > a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order > > def cmp(i,j): #to be defined in this thread. Well, if you're willing to give up doing it in a cmp() method, you can do it as such: >>> a.sort() >>> chunk_size = 3 >>> [a[i::chunk_size] for i in range(chunk_si

Re: Need a strange sort method...

2006-10-16 Thread Tim Chase
>>> that's trivial to do with slicing, of course. what makes you think you >>> need to do this by calling the "sort" method ? >>> >>> >> You are of course correct.. There might be a way to do this with >> slicing >> and i % 3 > > Slicing will work only with a sorted list. But modulus arithmeti

Re: Cannot import a module from a variable

2006-10-17 Thread Tim Williams
On 16/10/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Jia Lu wrote: > > Hi all: > > > > I try to do things below: > import sys > for i in sys.modules.keys(): > > import i > > Traceback (most recent call last): > > File "", line 2, in > > import i > > ImportError: No m

Re: Tertiary Operation

2006-10-17 Thread Tim Chase
> x = None > result = (x is None and "" or str(x)) > > print result, type(result) > > --- > OUTPUT > --- > None > > > y = 5 > result = (y is 5 and "it's five" or "it's not five") > > print result > > - > OUTPUT > - > it's five > > ...what's wr

Re: making a valid file name...

2006-10-17 Thread Tim Chase
> Sometimes the user inputs characters that aren't valid > characters for a file or directory name. Here are the > characters that I consider to be valid characters... > > valid = > ':./,^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ' Just a caveat, as colons and slashes can gi

Re: loop iterators?

2006-10-17 Thread Tim Chase
> l = ['a','b','c'] > for e in l: >print l, i >i = i + 1 > > Is there a way to get rid of the i processing in this script? > Sorry I'm still trying to learn python tricks here... for i, e in enumerate(l): print l, i -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: making a valid file name...

2006-10-17 Thread Tim Chase
>> If you're doing it on a time-critical basis, it might help to >> make "valid" a set, which should have O(1) membership testing, >> rather than using the "in" test with a string. I don't know >> how well the find() method of a string performs in relationship >> to "in" testing of a set. Test an

Re: Python Web Site?

2006-10-17 Thread Tim Chase
> Is there a problem with the Python and wxPython web sites? > I cannot seem to get them up Sounds like someone needs some pyagra... (grins, ducks, and runs) the-red-or-blue-pill'ly yers, -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries

2006-10-18 Thread Tim Chase
> How can I add two dictionaries into one? > E.g. > a={'a:1} > b={'b':2} > > I need > > the result {'a':1,'b':2}. >>> a.update(b) >>> a {'a':1,'b':2} -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries

2006-10-18 Thread Tim Chase
> However It does not work as I would need. > Let's suppose I have > > a={'c':1,'d':2} > b={'c':2} > but > a.update(b) > will make > {'c': 2, 'd': 2} > > and I would need > {'c': 3, 'd': 2} Ah...a previously omitted detail. There are likely a multitude of ways to do it. However, the one th

[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

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

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 Tim Chase
> Is this why the applicants I see that are fresh out of college > with their shiny new computer science degrees can't seem to > code their way out of a wet paper bag? Well, there you go! Apparently, your wet paper bag has no "detect a palendrome" exit. While you're installing such an egress t

Re: Calling a definition

2006-10-19 Thread Tim Chase
> I have a piece of code that I need some help with. It is > supposed (in my mind at least) take two arguments, a start > path and a file extension. Then when called it should return > each of the file paths that are found matching the criteria. > It is only returning the first file that it finds.

Re: list comprehension (searching for onliners)

2006-10-20 Thread Tim Chase
> result = [{'service_id' : 1, 'value': 10}, > {'service_id': 2, 'value': 5}, > {'service_id': 1, 'value': 15}, > {'service_id': 2, 'value': 15}, > ] > > and so on...what i need to do is some list comprehension that returns me > somethi

Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Tim Roberts
hat will install all of them. This also makes it trivially easy to install my environment on a different computer. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: print dos format file into unix format

2006-10-21 Thread Tim Roberts
line, Are you running this on Unix or on DOS? On Unix, you can do: for line in open(options.filename).readlines(): print line.rstrip() Perhaps quicker is: sys.stdout.write( open(options.filename).read().replace('\r\n','\n') ) -- Tim Roberts, [EMAIL PROTECTED] Pro

RE: File and directory permissions in windows

2006-10-23 Thread Tim Golden
[ismael] | I have some problems to get the the permissions on windows. I | use a simple code that run perfectly in UNIX but give me wrong | information on Windows. I found this code searching by google: [... snip ...] | is there a solution for this?, another library or code? | Anything that i

RE: File and directory permissions in windows

2006-10-23 Thread Tim Golden
[ismael] | My objective is check if some directories exist and if the | user that execute the perl script has access to some files | and directories. If one of this checkpoints failed the | execution will be aborted. If all of then finish ok | the execution will continue. It's simply this. I th

Re: mean ans std dev of an array?

2006-10-23 Thread Tim Chase
> import array > a = array.array('f', [1,2,3]) > print a.mean() > print a.std_dev() > > Is there a way to calculate the mean and standard deviation on array > data? > > Do I need to import it into a Numeric Array to do this? No, you don't have to...though there are likely some stats modules flo

Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-23 Thread Tim Roberts
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Sun, 22 Oct 2006 01:55:53 GMT, Tim Roberts <[EMAIL PROTECTED]> declaimed >the following in comp.lang.python: > >> Having learned that lesson the hard way, I now keep a directory with zips >> and tarballs for all of

Re: The format of filename

2006-10-24 Thread Tim Chase
>> As an example, I'm aware (through osmosis?) that I can use '/' as >> a directory separator in filenames on both Unix and Dos. But >> where is this documented? > > in the documentation for your operating system. Python doesn't do > anything with the filenames. Windows seems to be (occasionall

Re: strange problem

2006-10-24 Thread Tim Chase
> This file has 1,000,000+ lines in it, yet when I print the counter 'cin' > at EOF I get around 10,000 less lines. Any ideas? > > lineIn = > csv.reader(file("rits_feed\\rits_feed_US.csv",'rb'),delimiter='|') > for emp in lineIn: > cin=cin+1 > print cin What happens if yo

Re: question about True values

2006-10-25 Thread Tim Chase
> I'm a little confused. Why doesn't s evaluate to True in the first part, > but it does in the second? Is the first statement something different? > > >>> s = 'hello' > >>> s == True > False > >>> if s: > print 'hi' The "if s" does an implicit (yeah, I know, "explicit is better than

Re: question about True values

2006-10-25 Thread Tim Chase
> So I suppose > > if (10 > 5) > > would be the same as > > if (10 > 5) == True > > because (10 > 5) does evaluate to "True". Yes...and similarly, if ((10 > 5) == True) == True for the same reason...as does if (((10 > 5) == True) == True) == True as does... :*) -tkc -- http://mail.pyt

Re: Any way of adding methods/accessors to built-in classes?

2006-10-25 Thread Tim Chase
> the builtins, but not being able to do things like > '[1,2,3]'.length drives me a little nuts. You mean like '[1,2,3]'.__len__() That gets you the length of the string, which is what one would expect, calling the __len__() method on a string. The same works for an array:

Re: Dealing with multiple sets

2006-10-25 Thread Tim Peters
[John Henry] > If I have a bunch of sets: > > a = set((1, 2, 3)) > b = set((2, 3)) > c = set((1, 3)) > > > What's the cleanest way to say: > > 1) Give me a list of the items that are in all of the sets? (3 in the > above example) list(a & b & c) > 2) Give me a list of the items that are not

Re: using mmap on large (> 2 Gig) files

2006-10-25 Thread Tim Roberts
t wouldn't be rocket science to extend Python's mmap to allow that. >There are in any case room for improving Python's mmap object. Here we agree. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get each pixel value from a picture file!

2006-10-25 Thread Tim Roberts
t is rather unlikely that your low-order bit changes will survive the compression process. There is lots and lots of research on this subject. It's called "steganography" and "digital watermarking". Google is your friend. -- Tim Roberts, [EMAIL PROTECTED] Providenza &

Re: The format of filename

2006-10-25 Thread Tim Roberts
ward slashes or back, and have done so clear back to Windows 3.0. However, the Windows command shells do not. That's what you're seeing here. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: The format of filename

2006-10-26 Thread Tim Chase
>> Some experimentation shows that Python does seem to provide >> *some* translation. Windows lets me use '/' as a path separator, >> but not as the name of the root of a partition name. But perhaps >> this a peculiarity of the commands themselves, and not of Windows >> path names in particular. >>

Re: [OT] Win32 and forward/backslashes (was "The format of filename")

2006-10-26 Thread Tim Chase
Tim Roberts wrote: >> C:\temp\foo\bar>cd .. >> C:\temp\foo>cd .. >> C:\temp>cd /foo/bar > > This one does not work for me, but as long as the initial slash is back, > the rest can be foreward: > > C:\tmp>cd /foo/bar > The system cannot f

Re: Search & Replace

2006-10-26 Thread Tim Chase
> Below is my attempt at it, but this code appends > a copy of the text file within itself 4 times. > Can someone help me out. [snip] > file = open("text.txt", "w") > file.write(text.replace("Left_RefAddr", "FromLeft")) > file.write(text.replace("Left_NonRefAddr", "ToLeft")) > file.write(text.repla

Re: What's the best IDE?

2006-10-27 Thread Tim Chase
>> What's your favorite IDE? > > emacs > >> What do you like about it? > > It does just about everything. It can edit just about every kind of > code I use, read my mail, connection to irc ... everything. Well, > except order pizza, but I think it might be possible to make that > happen as well.

Re: Mass-Renaming folders win32

2006-10-28 Thread Tim Chase
> I've a folder structure like this : > > "Folder A" > |--> "1" > |--> "2" > ---> "3" > > "Folder B" > |--> "4" > ---> "5" > > And I want to obtain a structure like this : > > "Folder A - 1" > "Folder A - 2" > "Folder A - 3" > "Folder B - 4" > "Folder B - 5" > > Can someone help me ? I am pyth

Re: ZODB: single database, multiple connections

2006-10-30 Thread Tim Peters
[Petra Chong] > I am using Python 2.3 and ZODB (without the rest of Zope) with the > following pattern: > > * One process which writes stuff to a ZODB instance (call it test.db) > * Another process which reads stuff from the above ZODB instance > test.db > > What I find is that when the first proce

Re: scared about refrences...

2006-10-31 Thread Tim Chase
> I don't know how to make this structure immutable... Pickle > it? Seems very inefficient to me... Well, classes can be made mostly immutable by intercepting the attempts to write to it...something like class Foo(object): def __setattr__( self, name, val ): raise TypeError("I'm

Re: Why can't you assign to a list in a loop without enumerate?

2006-10-31 Thread Tim Chase
> In the following code snippet, I attempt to assign 10 to every index in > the list a and fail because when I try to assign number to 10, number > is a deep copy of the ith index (is this statement correct?). Sorta...just like with function parameters, there are mutables and immutables. a

Re: Make all files extension lower by a given directory name

2006-11-01 Thread Tim Chase
>>> fullname = name[:len(name) - 1] + ext.lower() >> are you sure you want to strip off the last character in the actual >> filename? should "FOO.BAR" really be turned into "FO.bar" ? >> name[:len(name) - 1] can be written name[:-1], btw. >>> os.rename(os.path.join(path, f

Re: Style for modules with lots of constants

2006-11-01 Thread Tim Chase
>> The reason I used instances instead of just the Constants >> class was so that I could define a little more descriptive >> context for the constants, > > Sorry I don't know what you mean here, could I have an example It helps in the recognition if you have separation between something like

Re: Computing FFT with Python NumPy 1.0

2006-11-01 Thread Tim Leslie
On 1 Nov 2006 16:04:59 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I recently installed Python 2.5 on Windows and also installed numpy > 1.0. I'd like to compute an FFT on an array of numbers but I can't > seem to access the FFT function. I'm fairly new to Python (obviously) > and I can

Re: Make all files extension lower by a given directory name

2006-11-02 Thread Tim Chase
>> can you post an example of a filename that misbehaves on >> your machine? >> >> > > To Fredrik Lundh and Tim Chase: > > My task was read all tga file names and generate a config xml > file, then pass this xml file to a utility, but this utillity >

Re: string formatter for tuple

2006-11-02 Thread Tim Chase
> a = (1,2,3) > print "a = %s" %a > > But when I run this, I get: > > TypeError: not all arguments converted during string formatting > > Now I realize why this happens, a is actually 3 elements when the print > statement is only expecting to print one value. I tried > > print "a = %s" %(a) >

Re: Converting a .dbf file to a CSV file

2006-11-02 Thread Tim Chase
> Is there a module/method in python to convert a file from .DBF format to > .CSV format? Well, at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 there's a recipe for reading DBF files...iterating over the returned data from the function declared there, it should be pretty eas

Re: urllib2: HTTP Version not supported

2006-11-02 Thread Tim Roberts
; >How do I force urllib2 to use HTTP v1.1? Are you passing httplib.HTTPConnection as the connection handler? If you use httplib.HTTP instead, it should create a 1.0 request. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: is mod_python borked?

2006-11-02 Thread Tim Roberts
OT the only way of using Python to create a web site. CGI by itself is quite practical, unless you are anticipating 100s of hits per minute. Even if it isn't, something like CherryPy used through a proxy gives you the benefit of a long-running process with the convenience of Apache. -- Ti

Re: ANN: SE 2.3. Available now

2006-11-05 Thread Tim Chase
> nah, if you've spent more than five minutes on c.l.python lately, you'd > noticed that it's the Solution to Everything (up there with pyparsing, I > think). SE would be the Solution to Everything. pyparsing Provides Your Perfect Alternative where Regexp Syntax Is No Good. The "re" module is

Re: Is there a commas-in-between idiom?

2006-11-05 Thread Tim Peters
]Ernesto García García] > it's very common that I have a list and I want to print it with commas > in between. How do I do this in an easy manner, whithout having the > annoying comma in the end? > > > > list = [1,2,3,4,5,6] > > # the easy way > for element in list: >print element, ',', > > pr

Re: sqlite query not working

2006-11-07 Thread Tim Chase
>> Have you tried adding a self.connection.commit() to the >> code? I don't know whether sqlite is transactional, but if >> it is then the changes will disappear without a commit. > > Wow, that worked! Now, I know I've done some DB work before > (very similar to this) and never used commit(), so I

Re: Awesome Python Information

2006-11-07 Thread Tim Roberts
ngled newsreader". I was evaluating it in 1999 as an alternative to Agent, and it was not new even then. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem getting a file pathname with tkFileDialog

2006-11-08 Thread Tim Daneliuk
o documentation on the file class used with > tkFileDialog. Does someone have a solution for that? > > Thank you > > Christian > How about: print file.name -- ---- Tim Daneliuk [EMAIL PROTECTED] PGP Ke

Re: Problem getting a file pathname with tkFileDialog

2006-11-08 Thread Tim Daneliuk
encoding = loc[1] --- Change the "if 0:" to "if 1:" and see if that doesn't fix the problem. -- Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: help using smtplib to work ..

2006-11-08 Thread Tim Williams
On 8 Nov 2006 15:31:27 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > > > > > > > Under outgoing mail smtp server, use smtp.gmail.com. Since it requires SMTP > > authorization, use your Gmail account as username (e.g. [EMAIL PROTECTED]) > > and > > your Gmail password as password. You can turn TSL

Re: Python to tell what is the IP of my PC .

2006-11-08 Thread Tim Williams
On 8 Nov 2006 15:35:31 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > How can I use python to get the real IP address of my DSL router (when > my PC is part of the local home LAN) ? The router will the PC's default gateway IP address, if you are on a windows platform, you can view it by typing IPC

Re: Python to tell what is the IP of my PC .

2006-11-08 Thread Tim Williams
On 09/11/06, Nicolas G <[EMAIL PROTECTED]> wrote: > > > On 11/9/06, Tim Williams <[EMAIL PROTECTED]> wrote: > > On 8 Nov 2006 15:35:31 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > > > How can I use python to get the real IP address of my DSL router (when

Re: help using smtplib to work ..

2006-11-08 Thread Tim Williams
On 09/11/06, Nicolas G <[EMAIL PROTECTED]> wrote: > > > > > > Usually when sending/relaying without authentication, the From is > > irrelevant, only the To is taken into account. Maybe, GMAIL do > > something different because they have to put the mail in the sender's > > mailbox as well as the r

Re: Problem getting a file pathname with tkFileDialog

2006-11-08 Thread Tim Daneliuk
x27;s my filepath, what is not ASCII in there? è > > Just checked and it's 138 in ascii... Anyway, thanks a lot > > Christian > > > Tim Daneliuk wrote: >> Sefyroth wrote: >>> Thanks, >>> >>> but I get this error when I try this. >

Re: help using smtplib to work ..

2006-11-09 Thread Tim Williams
On 8 Nov 2006 19:45:00 -0800, Jordan <[EMAIL PROTECTED]> wrote: > For some reason, > smtp for gmail seems to require that you call server.ehlo() a second > time, after having called server.starttls(), otherwise, the server > won't accept authorization. Thanks. Not just GMAIL, all (RFC Complian

Re: Sorted list - how to change it

2006-11-09 Thread Tim Chase
>> I have a sorted list for example [1,2,3,4,5] and I would like to change >> it in a random way >> e.g [2,5,3,1,4] or [3,4,1,5,2] or in any other way except being >> ordered. >> What is the best/easiest >> way how to do it? > > use random.shuffel: > import random x = [1,2,3,4,5]

Re: extract text from a string

2006-11-09 Thread Tim Williams
On 9 Nov 2006 07:45:25 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I have a string containing: "+abc_cde.fgh_jkl\n" and what I need to > become is "abc_cde.fgh_jkl". Could anybody be so kind and write me a > code of how to extract this text from that string? > for that particular str

Re: Vim/Python Help

2006-11-09 Thread Tim Chase
> I am just getting into python and am trying to learn how to use the > python.vim script. I really like the fact that it autoindents for me while > inserting defs etc, but how do I move my cursor to back to outer block (say > at the end of a def) to continue with writing next def while still i

Re: Py3K idea: why not drop the colon?

2006-11-09 Thread Tim Chase
>>> Anyway, the FAQ answer seems to be a weak argument to me. >> I agree. I was expecting something more technical to justify >> the colon, not just that it looks better. > > I think it is outstanding that the colon's justification is > asthetic rather than technical (though I too had expected to

Re: how is python not the same as java?

2006-11-09 Thread Tim Chase
> Java is horrible, Oython is not. Oython...the new scripting language from down under...just a wee bit south of the island of Java... g'day-mate'ly yers... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting externally-facing IP address?

2006-11-10 Thread Tim Williams
On 10/11/06, Michael B. Trausch <[EMAIL PROTECTED]> wrote: Every programming example that I have seen thus far shows simple server code and how to bind to a socket--however, every example binds to the localhost address.  What I am wondering is this:  Is there a clean way to get the netw

<    28   29   30   31   32   33   34   35   36   37   >