Re: Removing None objects from a sequence

2008-12-12 Thread Tim Chase
If you want to literally remove None objects from a list(or mutable sequence) def deNone(alist): n=len(alist) i=j=0 while i < n: if alist[i] is not None: alist[j] = alist[i] j += 1 i += 1 alist[j:i] = [] blist=[None,1,None,2,None,3,None,None,4,None] deNon

Re: Why %e not in time.strftime directives?

2008-12-13 Thread Tim Chase
Any special reasons? Because it is there (at least on my Debian box)? t...@rubbish:~$ python Python 2.5.2 (r252:60911, May 28 2008, 08:35:32) [GCC 4.2.4 (Debian 4.2.4-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.str

Re: encrypt and descrypt a created file

2008-12-13 Thread Tim Chase
open(str(os.sep).join([ os.getcwd(), 'applications', request.application, 'databases', table+'.csv']),'w').write(str(db(db[table].id).select ())) How can i encrypt and descrypt the created file above?? Well, as I was recently admonished (and have come to love), the firs

Re: 1 or 1/0 doesn't raise an exception

2008-12-13 Thread Tim Chase
Is it a feature that 1 or 1/0 returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale? Yes, it's a feature: http://en.wikipedia.org/wiki/Short-circuit_evaluation When you have "True or False", you know it's true by the time you've got the first piece, so there's no need

Re: Why %e not in time.strftime directives?

2008-12-14 Thread Tim Chase
Any special reasons? Because it is there (at least on my Debian box)? But not on windows :( import time time.strftime("%e") '' Guess you'll have to take it up with the authors of strftime() at Microsoft :) The full set of format codes supported varies across platforms, because Python

Re: 1 or 1/0 doesn't raise an exception

2008-12-15 Thread Tim Rowe
Unfortunately, >>>> bool('Ruby totally pwn3s Python!') > True Using Python is not total protection against buggy programs ;-) -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Having Issues with CMD and the 'python' command

2008-12-15 Thread Tim Chase
James Mills wrote: "cmd" has _nothing_ to do with Python. well, not quite "nothing"... http://docs.python.org/lib/module-cmd.html [grins, ducks and runs] (every time I see this module it makes me want to go write a small interactive-fiction game in the style of Zork/Adventure :) -tkc

Re: alt.possessive.its.has.no.apostrophe

2008-12-15 Thread Tim Chase
Steve Holden wrote: This led to a schism between the British and the newly-independent Americans, who responded by taking the "u" out of colour, valour, and aluminium. Darn Americans and their alminim ;-) Next thing you know, they'll be putting an I in TEAM.[1] -tkc [1] http://www.quo

Re: Problem accessing a web page

2008-12-15 Thread Tim Chase
I'm able to grab the problem webpage via Python just fine, albeit with a bit of a delay. So, don't know what your exact problem is, maybe your connection? When you get the second page, are you getting the same content back that you get if you do a search in your favorite browser? Using just

Re: os.environ.get('SSH_ORIGINAL_COMMAND') returns None

2008-12-15 Thread Tim Roberts
one have done such or alike in the past and can help me >with this. >Is there anything I should do in my python file in order to get that >environment variable? The SSH_ORIGINAL_COMMAND variable is set to the command that was passed in on the ssh command line. Since you are not specifying

Re: String slices work only for first string character ?

2008-12-16 Thread Tim Chase
Can any one explain why the following string slice works only for the first character, but not for any other ? $ cat /tmp/tmp.py #!/usr/bin/env python data = 'F0023209006-0101' print data print "|"+data[0:1]+"|" print "|"+data[1:1]+"|" print "|"+data[2:1]+"|" $ python `cygpath -w /tmp/tmp.py`

Re: Transferring a file over sockets

2008-12-17 Thread Tim Golden
Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the server script is double-clicked and exec

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-17 Thread Tim Roberts
e, but if you're using ReadFile and WriteFile, it's not a problem. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Factoring Polynomials

2008-12-19 Thread Tim Rowe
to use an exception for a normal case. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: join a samba domain

2008-12-22 Thread Tim Golden
Toff wrote: hi, I 'm trying to write a script to make my computer join a samba. domeone have any idea ?? Ummm. It's not clear if you're saying that your code doesn't work, or asking for general advice, or what? I'm not in a position to have my machine join a domain or workgroup, but you seem

Re: join a samba domain

2008-12-22 Thread Tim Golden
Toff wrote: On 22 déc, 17:02, Tim Golden wrote: Toff wrote: hi, I 'm trying to write a script to make my computer join a samba. domeone have any idea ?? Ummm. It's not clear if you're saying that your code doesn't work, or asking for general advice, or what? I'm not

Re: join a samba domain

2008-12-23 Thread Tim Golden
Toff wrote: On 22 déc, 19:37, Toff wrote: On 22 déc, 18:59, Jens Henrik Leonhard Jensen wrote: Toff wrote: d = c.Win32_ComputerSystem d.JoinDomainOrWorkGroup(None, 3, "mydom", "mydompw", r"admin\\mydom") Shouldn't r"admin\\mydom" be "admin\\mydom" or r"admin\mydom". Or maybe just "

Re: multiply each element of a list by a number

2008-12-26 Thread Tim Chase
What does *not* work is 3 * [0,1,2] As you know, this gives [0,1,2,0,1,2,0,1,2] What I am hoping for is [0,3,6] I see that I can use numpy.multiply(3,range(3)) but this seems overkill to me. Can you tell I am coming to Python from Matlab? The common way to do

Re: dummy needs help with Python

2008-12-27 Thread Tim Chase
I am trying to find somebody who can give me a simple python program I can use to "program by analogy". I just want to read two CSV files and match them on several fields, manipulate some of the fields, and write a couple of output files. ... Please forgive me if this is so, and take pity on

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-27 Thread Tim Roberts
an continues to live on in the hearts and minds of today's programmers. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: math.sqrt() in new 3.0 version : solution in input()

2008-12-27 Thread Tim Roberts
relegated to the domain of beginners and tutorials. Real programs almost never use them. As a result, this change just isn't seen to be all that important. If you can figure out where this could have been written so that you would have seen it, I'm sure a documentation ch

Re: parsing csv files class

2008-12-27 Thread Tim Roberts
li,fi,re): >""" >find and replace a string inside a string, return list >find_and_replace(list,find,replace) >""" >this=[] >for l in li: >#found_index=string.find(l,fi) >this.append(l.replace(fi,re)) >return this def find_and_replace(self,li,fi,re): return [l.replace(fi,re) for l in li] I'm not sure why this is a member of the class; it doesn't use any of the members. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: need help with list/variables

2008-12-30 Thread Tim Chase
I have a list and would like to parse the list appending each list item to the end of a variable on a new line. for instance mylist = ['something\n', 'another something\n', 'something again\n'] then parse mylist to make it appear in my variable in this format: myvar = """ something another som

Re: parsing csv files class

2008-12-30 Thread Tim Roberts
b fallback" I will post it here shortly to >python-list. One common method is like this: try: import pycurl except ImportError: pycurl = None import urllib -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy-to-use Python GUI

2008-12-30 Thread Tim Roberts
> >--- > >This is pretty darned easy for me understand and modify either by hand or with >the GUI builder. Well, allow me to point out that the equivalent code in wxPython would not be very much longer than this. It's just spelled differently. Sure, you have a bit of a learning

Re: What is site-packages?

2008-12-30 Thread Tim Roberts
t's where third-party libraries are typically installed to. >> >> Follow the path of the Iguana...http://rebertia.com > >You mean like MoinMoin, Django or Pylons for example? It means any package that should be available to Python programs that is not part of the standard Pytho

Re: Cheetah

2008-12-30 Thread Tim Roberts
re and a semicolon after. Again, show us a complete, runnable example and we can check it out. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2008-12-30 Thread Tim Roberts
and Y are...", and regardless of the substitution of X and Y, the plurality of the subject agrees with the verb. The Morning Star and the Evening Star are bright tonight. Ignoring the fact that we can't see both at the same time, why is the meaning of that unclear? -- Tim Roberts, t..

Re: multiprocessing vs thread performance

2008-12-30 Thread Tim Roberts
mple, thread creation on Windows is not all that expensive. >You should use a pool of threads or processes. Even so, this is good advise. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: change only the nth occurrence of a pattern in a string

2008-12-31 Thread Tim Chase
I would like to change only the nth occurence of a pattern in a string. The problem with "replace" method of strings, and "re.sub" is that we can only define the number of occurrences to change from the first one. v="coucou" v.replace("o","i",2) 'ciuciu' import re re.sub( "o", "i", v,2) 'c

Re: Why not Ruby?

2008-12-31 Thread Tim Greer
Giampaolo Rodola' wrote: > This is not a Ruby group. > I recommend you to go waste your time there. That poster has a frequent habit of cross posting to multiple, irrelevant news groups. There's no rhyme or reason to it. It's best to just filter the guy's posts. --

Re: How to find the beginning of last line of a big text file ?

2009-01-01 Thread Tim Chase
Sebastian Bassi wrote: On Thu, Jan 1, 2009 at 2:19 PM, Barak, Ron wrote: I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file into memory (as I s

Re: Why not Ruby?

2009-01-01 Thread Tim Greer
Richard Riley wrote: > > Tim Greer writes: > >> Giampaolo Rodola' wrote: >> >>> This is not a Ruby group. >>> I recommend you to go waste your time there. >> >> That poster has a frequent habit of cross posting to multiple, >> ir

Re: Why not Ruby?

2009-01-01 Thread Tim Greer
et troll. By all means, be his fan, but don't encourage his cross posting trolling as a means to provoke interesting, intelligent debating (because he's not and it's absolutely not his intention). Believe what you want, though, and I'll believe what I know. -- Tim Greer, CEO/

Re: why cannot assign to function call

2009-01-01 Thread Tim Roberts
listener can get confused. I'm inclined to disagree, but in contexts where it is important, I always try to say "a and b are bound to the same object". -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not Ruby?

2009-01-01 Thread Tim Greer
Richard Riley wrote: > Tim Greer writes: > >> Richard Riley wrote: >> >>> >>> Tim Greer writes: >>> >>>> Giampaolo Rodola' wrote: >>>> >>>>> This is not a Ruby group. >>>>> I recommend

Re: Videocapture in python

2009-01-01 Thread Tim Roberts
ctShow filter graph. The graph builder has the ability to deliver events asynchronously, like when the device goes away, but it would not be trivial to incorporate that into the module as written. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not Ruby?

2009-01-02 Thread Tim Greer
Don Geddis wrote: > Richard Riley wrote on Thu, 01 Jan 2009: >> Tim Greer writes: >>> That poster has a frequent habit of cross posting to multiple, >>> irrelevant >>> news groups. There's no rhyme or reason to it. >> >> No rhym

Re: win32gui

2009-01-03 Thread Tim Roberts
7;s the first step. Then, you need to figure out what kind of window it is. If it is a standard edit box, you can use the EM_GETLINE functions. If it's a rich text edit box, you can use the rich text messages. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: f.seek() unwanted output

2009-01-05 Thread Tim Chase
I'm having trouble with a script that is printing the output of f.seek () [snip] I have a file in memory. when i try f.seek(0) #or any other value in f.tell() it gives me 0 as output: the following script illustrates my 'problem' for a in range(10): f.seek(a) 0 1 2 3 4 5 6 7 8 9

Re: Why not Ruby?

2009-01-05 Thread Tim Rowe
gle thing I liked (and I certainly didn't find it "elegant", as the original poster described it). What do you see in it that you think would be good in Python? Remember, put in too many shortcuts and you'll end up with code that's as unmaintainable as Perl! -- Tim Rowe

Re: parse/slice/...

2009-01-07 Thread Tim Arnold
for i in range(step,len(tlist), step): yield tlist[j:i] j = i if j < len(tlist): yield tlist[j:] --Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: figuring week of the day....

2009-01-08 Thread Tim Chase
tekion wrote: Is there a module where you could figure week of the day, like where it starts and end. I need to do this for a whole year. Thanks. sounds like you want the standard library's "calendar" module, particularly the monthcalendar() which gets you pretty close. For a lazy version ju

Re: Printed Documentation

2009-01-08 Thread Tim Arnold
into Volumes, which I'd rather not have > to do. > > Has anyone tried this before? Is the documentation already available > in print? > > Thanks, > > drfloob just a datapoint, but I used lulu.com to print the latex sources (525 pages) hardbound for a cost of $25 US. --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list

drive a desktop app from python?

2009-01-08 Thread Tim Arnold
browser, but I have thousands of files I need it to analyze every night. Is there any lib or recipe(s) for doing something like this via python? thanks, --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list

Re: figuring week of the day....

2009-01-09 Thread Tim Chase
Tim Chase wrote: tekion wrote: Is there a module where you could figure week of the day, like where it starts and end. I need to do this for a whole year. Thanks. the monthcalendar() call returns the whole month's calendar which may be more what you want for the big-picture. And i

Re: When Python should not be used?

2008-10-06 Thread Tim Rowe
language can be wrapped in a Python library, of course, as is the case with regexp support). Logic languages still seem to have the edge over imperative in some AI and theorem proving applications (although I suppose one /could/ implement Prolog in Python, if Prolog is what you need it's probably be

Re: Array of dict or lists or ....?

2008-10-06 Thread Tim Chase
I can't figure out how to set up a Python data structure to read in data that looks something like this (albeit somewhat simplified and contrived): States Counties Schools Classes Max Allowed Students Current enrolled Students Nebraska, Wabash, Newville,

Re: Array of dict or lists or ....?

2008-10-06 Thread Tim Chase
__repr__ = __str__ I don't know if that's a good practice. I've seen it in a couple places, and it's pretty explicit what it's doing. try: data.setdefault( state, {}).setdefault( county, {}).setdefault( cls, Attendence(max_students)).accrue(enrolle

Re: Python 2.6, GUI not working on vista?

2008-10-06 Thread Tim Roberts
d. That depends entirely on your audience. For developers, UAC is provably detrimental to productivity. I have no hesitation recommending its disablement in that case. As a driver developer, I use Device Manager a LOT. It didn't take me long to pull the plug. Now, if you have an office

Re: automatically insert text in ms-word properties

2008-10-07 Thread Tim Rowe
he difficulty isn't with the language, it's with lack of documentation on Office Automation access to document properties. If Gita can find that, Python should be at least as good for the job as VB (and I think I'm being unduly kind to VB in putting it like that!) -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: print command don't work (subscripted) word[2:4]

2008-10-07 Thread Tim Chase
[EMAIL PROTECTED] wrote: Why is this not working ? bla = 'hondenriem' print bla[0:4] # correct ! (= hond) print bla[3:2] # nothing ! (= en) print bla[6:3] # nothing ! (= riem) Why don't bla[3:2] and bla[6:3] won't work ? I use this version: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [

Re: Problem while reading an outlook in box using python.

2008-10-08 Thread Tim Golden
[EMAIL PROTECTED] wrote: Hello, I was getting an error in Cocreate instance while trying to access "Outlook" using python script. The python script looks like: from win32com.client import Dispatch session = Dispatch("MAPI.session") session.Logon('OUTLOOK') # MAPI profile name inbox =

Re: Problem while reading an outlook in box using python.

2008-10-08 Thread Tim Golden
[EMAIL PROTECTED] wrote: May I know how to check whether my Outlook is installed with CDO components? There is no entry in my Registry Database with the name MAPI.Session. Well, that pretty much *is* the check. Get hold of your Office install disk and do a reinstall and look out for suboption

Re: Python/Django hosting on "normal" hosting plans

2008-10-08 Thread Tim Chase
My questions are: - can most everyday vanilla linux web hosts run a django site ? - can most everyday vanilla linux web hosts run python web scripts? Depends on your definition of "most everyday vanilla linux web hosts". :) The bottom-of-the-barrel hosts will often (but not always) off

Re: Quality control in open source development

2008-10-08 Thread Tim Chase
I think it's pretty self-evident that it's not a huge problem, don't you? Do you see lots of low quality python forks cluttering up the internet? hardly any...the best python fork I found: http://www.woopit.com/albums/Australian-snakes/GreenPythonSnake.jpg though they look more like tweezers t

Re: split a list based on a predicate

2008-10-08 Thread Tim Chase
Is there a functional way to do this? I have an array [0,1,2,3,0,1,2,2,3] and I want the first chunk of non-decreasing values from this array (eg: In this case I want [0,1,2,3]) Sounds like a use for a generator wrapper: def monotonic(iterator): i = iter(iterator) prev = i.next()

Re: first of not None

2008-10-09 Thread Tim Chase
element in iterable: if element: return element raise NoElementFound lst = [any, beny] if condition: lst.append(riki) print first(lst).name This first() is about the functionality of the SQL Coalesce() function. Hope this helps, -tim -- http://mail.python.org/mailman/listi

Re: Upgrading from 2.5 to 2.6

2008-10-12 Thread Tim Roberts
have to download new versions of them. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Append a new value to dict

2008-10-13 Thread Tim Chase
In Python, this is the best code I could come up with for adding a new key, value to a dict mytable.setdefault( k, [] ).append( v ) Naturally, right after writing my post I found that there is an easier way: table[ k ] = v Just to be clear...these do two VERY different things: >>> v1=42

Re: strip module bug

2008-10-13 Thread Tim Chase
I'm using versions 2.5.2 and 2.5.1 of python and have encountered a potential bug. Not sure if I'm misunderstanding the usage of the strip function but here's my example. var = "detail.xml" print var.strip(".xml") ### expect to see 'detail', but get 'detai' var = "overview.xml" print var.stri

Re: strip module bug

2008-10-14 Thread Tim Roberts
"Poppy" <[EMAIL PROTECTED]> wrote: > >Thanks Steven and Tim, I understand the strip module a lot more today. It's NOT a module. It is a method of string objects. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: read zipfile sequentially?

2008-10-15 Thread Tim Chase
I have a large ASCII data set that is zipped to a reasonable size. Can I access the data without decompressing the whole file first? I would like to run through the data to produce a much smaller extract and some summary statistics, but without unzipping it (if that is even possible). Yes, if yo

Re: IDE Question

2008-10-16 Thread Tim Cook
on FOSS apps, you can get a free license. I chose to pay for a copy after having a FOSS copy because they are so good at support. I do not think you can beat the features. --Tim -- http://mail.python.org/mailman/listinfo/python-list

baffling memory usage

2008-10-16 Thread Tim Redfern
he startup script. Why would python use twice as much memory when launched from a startup script? Could it be related to the use of the os.system() function? Thanks in advance, Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting windows error while making a backup

2008-10-17 Thread Tim Golden
[EMAIL PROTECTED] wrote: Hi, I've this backup script that having some problems. Please some one suggest what is that I'm missing in it. This backup script deletes the previous backups and then create a new backup by simply renaming the original folder to backup folder and creates a new folder.

Re: xor: how come so slow?

2008-10-18 Thread Tim Roberts
this effect. His net takeaway is that most of the things people do to increase randomness actually have exactly the opposite effect. ----- [1] Knuth, Donald. The Art of Computer Programming, Volume 2, Seminumerical Algorithms. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Idenfity numbers in variables

2008-10-20 Thread Tim Chase
sn't have", print "a digit in it" The regexp can be tightened up if you want to ensure that it has a letter in front of it, or a number of other tests but that should be a decent start. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Tim Golden
Eric Wertman wrote: I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of reco

Re: Abnormal Interpreter Shutdown

2008-10-20 Thread Tim Golden
k3xji wrote: Hi all, Is there anyway to detect abnormal interpreter shutdown like (closing from task manager, power shutdown of the PC..etc)? "Task Manager" suggests you're using Windows, on which basis you've got a few options open to you, but fundamentally if someone pulls the plug on the PC

Re: How is the logical processing being done for strings like 'Dog' and 'Cat'

2008-10-20 Thread Tim Roberts
logical operators. The exact definition of "x and y" is "if x has a false value, return x, otherwise return y". If both sides are booleans, this does exactly what you expect. Similarly, "x or y" is actually done as "if x has a true value, return x, otherwise re

Re: indentation

2008-10-21 Thread Tim Rowe
2008/10/21 Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>: > Ever noticed that computer freaks often start counting at 0? ;-) We grow to be like our pets -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: However, pyODBC doesn't support return variables(parameters) in stored procedures (at least with MS SQL). pymssql is the only db api for python that I've found that can reliably do this. I've tried adodbapi, pyodbc and one or two others (can't think of the names now... :-/).

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: [... re output params in pymssql / pyodbc ...] Oh, trust me - I've tried a *LOT*. I aggree, submitting a feature request is a good idea. I think I'll do that. :) Looks like someone already has: http://sourceforge.net/tracker/index.php?func=detail&aid=1985956&group_id=162557

Re: Exclude Directories from os.walk

2008-10-21 Thread Tim Golden
D wrote: Hello, How can one exclude a directory (and all its subdirectories) when running os.walk()? Just remove it from the dirnames yielded: import os for dirpath, dirnames, filenames in os.walk ("c:/temp"): print dirpath if "archive" in dirnames: dirnames.remove ("archive") TJG -

Re: Need some advice

2008-10-21 Thread Tim Chase
I am planing to develop a desktop application which would have some usage, but also it should be able to comunicate to a web server which hosts a php web application. So I wanted to ask if someone has some expirience with connecting PHP webapplications with Python desktop applications. Could someo

Re: Ordering python sets

2008-10-22 Thread Tim Chase
I think that using Python sets would be the best choice, but I also need integers to be ordered inside the set and I've just found out that, instead, Python sets are unordered collections. Sets (both in Python, and their mathematical definition) are unordered. However, some simple testing in m

Re: What are the syntax for &&, ||

2008-10-22 Thread Tim Chase
if condition1 && condition2: # and doThis elif condition3 || condition4: # or doThat In most of language have &&, || How do I do in Python? Heh, you answered your own question in your comments: if condition1 and condition2: doThis() elif cond3 or cond4: doThat() -

Re: windows / unix path

2008-10-23 Thread Tim Roberts
t going >to interpret '/' as an option. Well, you actually said the same thing as Dennis here, in a slightly different way. The executive summary here is that the Windows APIs all accept either forward or backward slashes just fine. The trouble happens when you start using command l

Re: Dummy explanation to win32com needed

2008-10-23 Thread Tim Golden
korean_dave wrote: Hi. I need a dummy's explanation to utilizing the win32com component to access Microsoft Excel. So far, I have this code. import win32com.client xl = win32com.client.Dispatch("Excel.Application") xl.Visible = 1 workbook = xl.Workbooks.Open("C:\test.xls") We

Re: dictionary

2008-10-24 Thread Tim Chase
["%s="%s" % (k,v) for k,v in d.items()] File "", line 1 ["%s="%s" % (k,v) for k,v in d.items()] ^ SyntaxError: EOL while scanning single-quoted string You have three quotation marks... you want "%s=%s" not "%s="%s" -tkc -- http://mail.

Re: from package import * without overwriting similarly named functions?

2008-10-24 Thread Tim Chase
I have multiple packages that have many of the same function names. Is it possible to do from package1 import * from package2 import * without overwriting similarly named objects from package1 with material in package2? How about a way to do this that at least gives a warning? Yeah, just use

lxml removing tag, keeping text order

2008-10-24 Thread Tim Arnold
it's wrong, but not how to make it right. It returns: first text emphasized text ladida last text Maybe I should send the outside element (via tostring) to a regexp for removing the child and return that string? Regexp? Getting desperate, hey. Any pointers much appreciated, --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list

Re: arange randomly words in a list

2008-10-25 Thread Tim Chase
I have a list that looks like: name = name1 name2 name3 name4 and I would like to be able to arrange randomly this list, like: name = name 2 name 1 name3 name4 name = name4 name2 name1 name3 I have tried with random.shuffle, but still no good result May I get an example? I'm not sure

Re: Urllib vs. FireFox

2008-10-26 Thread Tim Roberts
Lie Ryan <[EMAIL PROTECTED]> wrote: > >Cookies? Yes, please. I'll take two. Chocolate chip. With milk. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: capturing ESC, page up/down in Python

2008-10-26 Thread Tim Roberts
kbhit and getch functions that can do this. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Linq to Python

2008-10-27 Thread Tim Rowe
t with a dictionary. - Extension methods: Python already has. - Lambda expressions: Python already has. - Auto-Implemented properties: No, but that's just syntactic sugar to make declarations more compact. So all of the language elements that are needed for LINQ are already in Python; a libra

Re: lxml removing tag, keeping text order

2008-10-27 Thread Tim Arnold
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold schrieb: >> Hi, >> Using lxml to clean up auto-generated xml to validate against a dtd; I >> need >> to remove an element tag but keep the text in order. F

Re: How to get high precision timer in python?

2008-10-28 Thread Tim Roberts
on Linux, and time.clock() is more precise on Windows. So, use time.clock(). -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Regex Question

2008-10-29 Thread Tim Chase
I need a regex expression which returns the start to the x=ANIMAL for only the x=Dog fragments so all my entries should be start ... (something here) ... x=Dog . So I am really interested in fragments 1 and 3 only. My idea (primitive) ^start.*?x=Dog doesn't work because clearly it would return r

Re: how to use logging module to log an object like print()

2008-10-31 Thread Tim Roberts
age is not needed. This is exactly why logger supports this somewhat unusual feature. Now, one can certainly imagine circumstances where the parameter evaluation is expensive, so Vinay's bypass is still useful in some circumstances. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe

2008-10-31 Thread Tim Roberts
pywinauto and extra). If you have explicit imports, py2exe can figure those out. You should be able to see that in the "dist" directory. However, wxPython needs some extra modules and DLLs that py2exe is not able to figure out. I believe the wxPython web site talks about this.

Re: open a new terminal window from another terminal window in linux/unix system

2008-10-31 Thread Tim Golden
gaurav kashyap wrote: I am using Microsoft Windows XP.Using putty.exe,I connected to LINUX server and a terminal window gets opened.Here i logeed in as root. What i want to do is open another terminal window from already opened terminal window. Can this be achieved.If yes,please provide a teste

Re: Windows DOS box redirection

2008-10-31 Thread Tim Golden
Bill McClain wrote: On 2008-10-31, Glenn Linderman <[EMAIL PROTECTED]> wrote: The problem with stdin/stdout is on Windows 2000 (and maybe the earlier NT?). But not on XP or AFAIK Vista. It only occurs when a program is executed indirectly using the file associations instead of directly via

Re: Windows DOS box redirection

2008-10-31 Thread Tim Golden
Bill McClain wrote: On 2008-10-31, Stef Mientki <[EMAIL PROTECTED]> wrote: Well I don't know any Windows users that still use DOS-boxes ;-) cheers, What do they do when they want to run a cross-platform command-line script with parameters and redirection? I think it's a slight dig at the no

Re: split() and string.whitespace

2008-10-31 Thread Tim Chase
I am unable to figure out why the first two statements work as I expect them to and the next two do not. Namely, the first two spit the sentence into its component words, while the latter two return the whole sentence entact. import string from string import whitespace mytext = "The quick brown f

Simplifying anonymous inner classes?

2008-11-01 Thread Tim Chase
I've got code similar to the following class Action: def __init__(self, ...): pass def __call__(self, ...): pass def get_help(self, ...): pass class Backend: class _Load(Action): def __init__(self, ...): pass # override1 def __call__(self, ...): pass # override1 d

Re: Simplifying anonymous inner classes?

2008-11-01 Thread Tim Chase
defined to be instantiated once in exactly the location they were defined. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordering python sets

2008-11-01 Thread Tim Rowe
hon list type to be named list instead of > array, despite it supports more or less all the functions you expect > from an abstract list type. They're not different data structures from the client point of view. "More or less" all the functions wouldn't be enough. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Responding to web request with python

2008-11-01 Thread Tim Roberts
arated by a blank line. Perhaps you should try to use a debug proxy to intercept the exact text of the response, just to make sure you're sending what you think you are sending. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

<    47   48   49   50   51   52   53   54   55   56   >