Re: Cheese Shop: some history for the new-comers

2006-03-12 Thread Tim Parkin
#x27;re trying to approach it from the top down. At the moment we've trimmed down the number of top level sections and the next stage is to address the top page of each of those sections (e.g. the 'community', 'documentation','python-dev' pages). Still some w

Re: Cheese Shop: some history for the new-comers

2006-03-12 Thread Tim Parkin
Steve Holden wrote: > Tim Parkin wrote: >>Fredrik Lundh wrote: >> >>I sureley hope you can stop being facetious.. >> > > And I surely hope we can all work together for the better representation > of Python to *all* of its communities :-) > > regards &

Re: Cheese Shop: some history for the new-comers

2006-03-12 Thread Tim Hochberg
[EMAIL PROTECTED] wrote: > richard wrote: > [snip] > Should the "Python Cheeseshop" have anything in it, though? Having a > stocked cheese shop in relation to Python is just silly! Well, it shouldn't have any *cheese*, but that's probably OK for a software repository. -- http://mail.python.org

Re: generators shared among threads

2006-03-13 Thread Tim Peters
[Paul Rubin] > It looks to me like you can't have two threads in the same generator: You can't even have one thread in a generator-iterator get away with activating the generator-iterator while it's already active. That's an example in PEP 255: """ Restriction: A generator cannot be resumed w

Re: __del__ not called?

2006-03-13 Thread Tim Peters
[Duncan Booth] > No, Python doesn't run the garbage collector when it is exiting. Actually, it does. What it doesn't do is call the garbage collector twice when it exits, although it used to ;-) > What it does is to delete all the globals from each module in turn. So: Yup. The code is in funct

Re: Old Python Logo

2006-03-13 Thread Tim Parkin
> > > That website is down. You could try the archive as well: > http://web.archive.org/web/20050401015445/http://www.python.org/ or you can look at http://archive-www.python.org which will be up for the next month. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Q's: pythonD and range(1,12)

2006-03-13 Thread Tim Leslie
u need your range to start at 1? It's a common newbie error to start counting from 1 instead of zero in some places, but I won't accuse you of such an error without seeing more context :-)HTH Tim After downloading the substantial distribution .zip file, I'm intrigued to find i

Re: Cheese Shop: some history for the new-comers

2006-03-14 Thread Tim Parkin
k it works well.. I've also removed a couple of bits from the left hand nav and moved the style sheet switcher elsewhere (it probably should be in the help section). I think the left hand nav is a lot clearer if kept simple. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Cheese Shop: some history for the new-comers

2006-03-14 Thread Tim Parkin
who develop >>Python itself."Core Development"? (Used on both perl.org and tcl.tk, so >>maybe this is the best option.) >> > >"core development" is fine with me. > > > > > > forgot the link.. http://psf.pollenation.net/cgi-bin/trac.cgi/attachment/ticket/47/python-amends-2.png Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory visualization

2006-03-14 Thread Tim Peters
[EMAIL PROTECTED] > Icon is a language that share some similarities with Python: > http://www.cs.arizona.edu/icon/ > > During the execution of a Icon script there are ways to visualize the > memory: > http://www.cs.arizona.edu/icon/progvis/memmon/memmon.htm > > Related pages: > http://www.cs.arizon

Re: MS word document generator

2006-03-15 Thread Tim Churches
nerate word > documents. How about PyRTF to generate Rich Text Format documents which MS-Word will lap up? Thanks to the efforts of Simon Cusack (hi Simon). See http://cheeseshop.python.org/pypi/PyRTF/0.45 Tim C -- http://mail.python.org/mailman/listinfo/python-list

best practices for making read-only attributes of an object

2006-03-15 Thread Tim Chase
se AttributeError, attr def __setattr__(self, attr, value): if attr == 'value': self.__dict__['value'] = value else: raise AttributeError, attr Is there a better ("more pythonic") way to do this? Particularly if it plays well with sub-classing Foo.

Re: pyRTF and cells

2006-03-15 Thread Tim Churches
f to PyRTF and send Simon a copy of your modified code. Cheers, Tim C -- http://mail.python.org/mailman/listinfo/python-list

Re: Cheese Shop: some history for the new-comers

2006-03-16 Thread Tim Parkin
aybe this is the best option.) "Development Team"? >> >>+1 on Core Development. It's still ambiguous, but less >>so. And I can't think of anything better. ;) > > > Since I just said almost that independently on an earlier > thread, I guess that makes me +1 on "Core Development" (or > "Core Developers") myself. > Sold to the man in the blue hat!! It's on the server now... Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop Backwards

2006-03-16 Thread Tim Roberts
r example, to comp.lang.c and comp.lang.c++. >This example is why everyone is more excited about Ruby than Python. That statement is just not true. I've looked at Ruby, but syntactically it will never sway me from Python. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tried Ruby (or, "what Python *really* needs" or "perldoc!")

2006-03-16 Thread Tim Roberts
g out non-obvious gotchas. However, I'm sure it's a bear to administer. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Large algorithm issue -- 5x5 grid, need to fit 5 queens plus some squares

2006-03-16 Thread Tim Roberts
so that none of them threatens another". That's very different from his problem specification. It turns out there is only 1 unique (non-rotated, non-reflected) solution to the problem as he posted it. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Large algorithm issue -- 5x5 grid, need to fit 5 queens plus some squares

2006-03-17 Thread Tim Roberts
for q3 in range(q2+1,25): for q4 in range(q3+1,25): for q5 in range(q4+1,25): check( [q1+1,q2+1,q3+1,q4+1,q5+1] ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-18 Thread Tim Roberts
R when his message is visible. I'm also using Agent, and that toggles his extended characters from quoted-printable to visible for me. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting to ARGB and writing to a bitmap

2006-03-18 Thread Tim Roberts
0 ) fout.write(bmfh) # Do the BITMAPINFOHEADER. bmih = struct.pack('LLLHHLL', 40, width, height, 1, 32, 0, 0, 0, 0, 0, 0 ) fout.write(bmih) # Expand the pixels, scan by scan. for i in range(height): words = array.array('H')

Re: Initializing a list of lists

2006-03-19 Thread Tim Chase
> The above construct works if I have only few items, but if I have many, > I'd prefer to write > N =3 x =N*[[0]] x > > [[0], [0], [0]] > > If I now try extending the lists indepently, I cannot, as they all > point to the same list object > x[0].append(1) x > > [[0, 1], [0,

Re: Python 2.5 Schedule

2006-03-20 Thread Tim Peters
> For more details about the plan for Python 2.5, see: > > http://www.python.org/doc/peps/pep-0356/ Looks like links to PEPs are completely hosed at the moment. For example, the link above displays an empty directory, and http://www.python.org/doc/peps displays a directory full of empty

Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-20 Thread Tim Roberts
Roedy Green <[EMAIL PROTECTED]> wrote: >On Sun, 19 Mar 2006 02:08:11 GMT, Tim Roberts <[EMAIL PROTECTED]> wrote, >quoted or indirectly quoted someone who said : > >>Try pressing Ctrl-R when his message is visible. I'm also using Agent, and >>that toggl

Re: Passing parameters to VB

2006-03-21 Thread Tim Roberts
I can set the whole cell to bold by this: xl = win32com.client.Dispatch("Excel.Application") wb = xl.ActiveWorkbook ws = wb.Worksheets(1) r = ws.Range("A1") r.Characters.Font.Bold = True -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to recgonize an USB device in FreeBSD?

2006-03-21 Thread Tim Roberts
d you be a bit more specific? -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: New-style Python icons

2006-03-21 Thread Tim Parkin
using a proxy (one of the anonymous proxies would do the job). Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

RE: Command line arguments question (Windows XP)

2006-03-21 Thread Tim Golden
[ezd] | # u.py | import sys | print 'args',sys.argv | | in "Command Prompt" window, with 2 command lines on 2 PCs: | | # Case (1L): | C:\tmp> u.py a b c | args ['C:\\tmp\\u.py'] | | # Case (1D): | C:\tmp> u.py a b c | args ['C:\\tmp\\u.py', 'a', 'b', 'c'] Almost certainly means that the associ

Re: doctest, unittest, or if __name__='__main__'

2006-03-21 Thread Tim Peters
[EMAIL PROTECTED] <[EMAIL PROTECTED]>[ > For writing testcode, it looks like there's three ways that it's > typically done: > > (1). using the doctest module, > > (2). using the unittest module (i.e. "pyunit"), or else > > (3). just putting an "if __name__ = '__main__':" at the bottom of your > mod

Re: Spam avoidance

2006-03-21 Thread Tim Peters
[Douglas Alan] >> I've noticed that there is little to no spam in comp.lang.python >> and am wondering how this is accomplished. [Skip Montanaro] > Most mailing lists which originate on mail.python.org have SpamBayes > filtering in front of them. Worth noting that the SpamBayes project started sp

Re: C API: Testing my reference counting

2006-03-22 Thread Tim Peters
[lord trousers] >>> Is there a way I can get hold of these kinds of statistics for >>> debugging? [Martin v. Löwis] >> This is best done when Python is build in debug mode. >> sys.gettotalrefcount then gives you the number of INCREF >> calls for which no DECREF has been made; you said that >> this

Re: Server.sendmail with no "to_addrs" parameter.

2006-03-23 Thread Tim Roberts
at does not appear to have been addressed to him, but SMTP doesn't care. So, the way a BCC works is that the address goes into the envelope (in the to_addrs list), but not in the message body. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't get the real contents form page in internet as the tag "no-chche"

2006-03-23 Thread Tim Roberts
he "Refresh" header means that you are supposed to go fetch the contents of that new page immediately. Try using urllib2.open on THAT address, and you should get your content. This is one way to handle a web site reorganization and still allow older URLs to work. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's The Best Editor for python

2006-03-24 Thread Tim Chase
> Can one of you say to me what's the best editor for > editing the python programs ( for linux or windows ), and > if you can send it to me to the adresse Hmmm...it's been almost a week since this topic came up on the list. Good to see the topic is undead :) For plenty of reading, check out t

Re: detecting drives for windows and linux

2006-03-25 Thread Tim Golden
BWill wrote: > Hi, I'm writing a file browser, but I'm not sure how I could go about > detecting the drives available on windows and linux systems (preferably > using the standard modules if possible). I guess I could just try to > list root on each letter of the alphabet for windows and see if it

Re: SSH, remote login, and command output

2006-03-26 Thread Tim Parkin
d (with public/private keys). This was written to scratch a small itch but also to learn how twisted works with conch, it's ssh module. http://crontorted-project.pollenation.net/cgi-bin/trac.cgi Feel free to use, I haven't put a license on it but it would be MIT/BSD .. contact me if you want an explicit confirmation. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: SSH, remote login, and command output

2006-03-26 Thread Tim Parkin
Tim Parkin wrote: > Spire 01 wrote: > >>Greetings! >> ... >>Thanks a million! >>Spire > > > > I wrote a small tool to implement cron like functionality over ssh using > twisted (with public/private keys). This was written to scratch a small &g

Re: (not really) randon ideas

2006-03-27 Thread Tim Roberts
ng about the vulgar construct "prolly" that really irks me, even more than "sth" for "something" or "proggie" for "program". You're only saving two keystrokes over the correct word, "probably", and because it's split between the h

Re: sending emails to a list of recipients

2006-03-27 Thread Tim Roberts
? You should just be able to pass the list: s.sendmail( msg['From'], emails, msg.as_string() ) Or, if you must, msg['To'] = emails s.sendmail( msg['From'], msg['To'], msg.as_string() ) It needs to be a list or tuple of individual addresses, e-mail

Re: sending emails to a list of recipients [update]

2006-03-27 Thread Tim Roberts
o the human being at the other end, and like all e-mail headers, must be a single string. (Note that it does not actually have to have anything to do with the people who actually receive the message.) SMTP.sendmail, on the other hand, sets up the "envelope" of the message for th

Re: Nevow LivePage tutorial

2006-03-27 Thread Tim Parkin
oject.pollenation.net/cgi-bin/trac.cgi > >Jean-Paul > > And http://divmod.org/trac/wiki/DivmodNevow/FormHandling Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Nevow LivePage tutorial

2006-03-27 Thread Tim Parkin
guy got onto it) What are you trying to implement.. it may be that you don't need livepage at all.. Is it just some javascript to enhance a form field? Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Link to Daily Python-URL from www.python.org?

2006-03-28 Thread Tim Churches
there was a link to it last time I looked. Tim C -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python logo in high resolution format

2006-03-28 Thread Tim Parkin
e still isn't a 'usage' guide for the new logo but I'll get onto one soon hopefully. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: any() and all() on empty list?

2006-03-28 Thread Tim Peters
[Steve R. Hastings] > So, Python 2.5 will have new any() and all() functions. > http://www.python.org/dev/peps/pep-0356/ > > > any(seq) returns True if any value in seq evaluates true, False otherwise. > > all(seq) returns True if all values in seq evaluate true, False otherwise. > > I have a quest

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Tim Roberts
like 1/3 cannot be represented exactly in decimal. Further, the more arithmetic you do, the less precise is your result. Floating point is a very tricky world of approximation. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: web

2006-03-28 Thread Tim Roberts
> >Thanks for your time, >Daniel N. >Phone. 1.416.834.1592 >e-mail. [EMAIL PROTECTED] >url. http://2ExtremeStupids.com Mmm, yes, spamming the technical newsgroups is a GREAT way to convince the world that you are reliable, trustworthy, and knowledgable. Not. -- - Tim Rob

Re: any() and all() on empty list?

2006-03-29 Thread Tim Peters
and (17) (x)(Fx) ⊃ (∃x)(Fx), [i.e., given that some predicate F is true for all x, it follows that there exists an x for which F is true -- or, all(F) implies any(F) - tim] which are valid if the universe is not empty, fail for the empty universe as their truth depends on

Re: New Python website, new documentation ?

2006-03-30 Thread Tim Parkin
the documentation won't change but it will have a new navigation (rather than just the back, up, forward on the current latex2html output). It's probably best to get something up on a test site to look at before over-analysing it though.. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

RE: printing under MS win

2006-03-30 Thread Tim Golden
[Dean Allen Provins] | My Linux-based Python/Tkinter application runs nicely, and printing | works just fine (to a user-selected file, or an "lpr" device specified | in the Entry box). Alas, the user wants to run it under MS | Win, and of | course will want to print the canvas for posterity. |

Re: how to comment lot of lines in python

2006-03-30 Thread Tim Chase
>>Or there is something else too ?? > > You should use a decent editor that could automatically > comment/uncomment code upon your request. In Vim, you can map a key to do the following: :s/^/# to comment the highlighted lines, and :s/^# to uncomment them. To map them, you c

Re: New Python website, new documentation ?

2006-03-31 Thread Tim Parkin
inconsistency seems worse) > > John I presume so. It's not really up to me though. Someone has created some new icons based on the new logo that have received some positive feedback and that I like a lot. Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4.3 Documentation: Bad link

2006-04-02 Thread Tim Parkin
y I hadn't closed the issue in the bug tracker (it was you that reported it?). Thanks Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 licensing: stop this change

2006-04-03 Thread Tim Roberts
months, XFree86 was effectively dead and X.Org had taken over the world, with the same code base but a more traditional license. I held my breath until I read the actual document... -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython in action book

2006-04-03 Thread Tim Roberts
EVERYWHERE. The thought processes are the same -- you create UI, you handle events. You also might look at Dabo, which is a wrapper around wxPython for exactly this kind of app. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: question about nasty regex

2006-04-03 Thread Tim Chase
> What I mean is, I want to change, e.g.: > > "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434, 72 > S. Ct. 394, 397, 96 L.Ed. 475 (1952)." > > into: > > "Doremus v. Board of Education of Hawthorne, 342 U.S. 429, 434 (1952)." > > Generally, the beginning pattern would consist of:

Re: CD Burning

2006-04-05 Thread Tim Golden
Albert Leibbrandt wrote: > Hi > > Can anybody tell me which windows API or python module they are using > for writing cd's / dvd's with python? Other people have offered sound suggestions about using cdrecord etc. under Cygwin. Just to make the point, though, XP (and above, presumably) does have a

Re: "The World's Most Maintainable Programming Language"

2006-04-05 Thread Tim Parkin
o allow an operation where a 180-pound character can carry 10,000 gold pieces might actually remove the aspect of fun from the game." Isn't this data validation and if it is, should the compiler be checking this? Tim Parkin -- http://mail.python.org/mailman/listinfo/python-list

RE: Python Module for Determining CPU Freq. and Memory?

2006-04-06 Thread Tim Golden
[efrat] |I'd like to determine at runtime the computer's CPU frequency and | memory. | | (Please note: I'm interested in hardware stuff, like how much | memory the | machine has; not how much free memory is available.) I don't know if there's a cross-platform solution for this. For Window

RE: Using PythonWin32 to copy text to Windoze Clipboard for Unix-stylerandom .sig rotator?

2006-04-06 Thread Tim Golden
[EMAIL PROTECTED] | | I want to write a Python script that, when launched, will choose a | random .sig (from a list of about 30 cool ones I've devised), | and store | the .sig text in the Windows Clipboard, so I can then paste | it into any | Windows application. Very quick and untested answer.

Re: Python CGI problem: correct result, but incorrect browser response.

2006-04-06 Thread Tim Roberts
member that this will fail: print """ Set-Cookie: sessionID=LAABUQLUCZIQJTZDWTFE; Set-Cookie: username=testuser; Status:302 Location:edit.py """ because you get a blank line first, which terminates the headers. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: calculating system clock resolution

2006-04-08 Thread Tim Peters
[jUrner] >> def calc_time_res(): >> now = time.time >> start = now() >> x = start >> while start == x: >> x = now() >> print x, start # <-- >> print x - start >> >> print calc_time_res() >> 1.50203704834e-05 >> >> Something is going wrong here. >> If you look at the

Re: recognize a drive as removable media (e.g. compact flash, sd card or usb drive)

2006-04-08 Thread Tim Golden
Mike Joyce wrote: > I am trying to write a portable script that will find removable media, > such as compact flash, sd card, usb, etc. drive and then upload files > from the media. I want this to be portable so that I can write and > maintain one program for both Linux and Windows. Each platform us

Re: Python 3.0 or Python 3000?

2006-04-09 Thread Tim Peters
[John Salerno] > Is 'Python 3000' just a code name for version 3.0, or will it really be > called that when it's released? The smart money is on changing the name to Ecstasy, to leverage marketing publicity from the hallucinogenic club drug of the same name. "class" will be renamed to "rave", and

Re: can't pass command-line arguments

2006-04-10 Thread Tim Golden
BartlebyScrivener wrote: > I'm still new at this. I can't get this to work as a script. If I just > manually insert the values for sys.argv[1] and sys.argv[2] it works > fine, but I can't pass the variables from the command line. What am I > doing wrong? On windows xp, python 2.4.3 > [... snip c

RE: can't pass command-line arguments

2006-04-10 Thread Tim Golden
[BartlebyScrivener] | I had not seen the thread you linked to. I learned something, but it | still doesn't explain whatever is happening on my machine. When I run | assoc and ftype I get exactly the results you say I need to run the | scripts properly. However, this simple script (printargs.py) se

RE: python + access + odbc + linux

2006-04-10 Thread Tim Golden
[Philippe Martin] | I understand that access can be accessed through an ODBC driver under | windows (instead of Jet). | | I am wondering if the same can be done under Linux. You need to look at the mdbtools packages http://mdbtools.sourceforge.net/ which includes a Jet-ODBC driver which can be

RE: can't pass command-line arguments

2006-04-10 Thread Tim Golden
[BartlebyScrivener] | >> You missed the other option: if PATHEXT has .pyc in front | of .py then you | >> get exactly the described behaviour. | | That's it!! | | Trust me, I didn't do it. It was either ActiveState, Wing, or Komodo | Dragon, or some combination thereof. Amazing. I had a look,

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
ossibility is that there are no keys. Then the loop finishes without ever setting item or values. This would give an unbound local error. I assume that the OP would have noticed that in the traceback, but perhaps he missed it. OT, using i for the field namelike that makes my head hurt.

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
Tim Hochberg wrote: > Kent Johnson wrote: > >>David Bear wrote: >> >> >>>I'm attempting to use the cgi module with code like this: >>> >>>import cgi >>>fo = cgi.FieldStorage() >>># form field names are in t

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
Kent Johnson wrote: > Tim Hochberg wrote: > >>Kent Johnson wrote: >> >>>David Bear wrote: >>> >>> >>>>I'm attempting to use the cgi module with code like this: >>>> >>>>import cgi >>>>fo = cgi.Fiel

Re: TypeError + generator + str.join(): Bug or user error?

2006-04-10 Thread Tim Peters
[Paul Du Bois] > Using win32 python 2.4.1, I have a minimal test program: > > def generate(): > raise TypeError('blah') > yield "" > > print "\n".join((generate())) > > Executing the program gives: > > Traceback (most recent call last): > File "", line 5, in ? > TypeError: sequence expect

Re: using regex to remove $ sign

2006-04-11 Thread Tim Chase
= "00" else: raise BogusValueFromDoofusError new_input_value = "%s.%s" % (dollars, cents) With the above bogus IP-address/currency value, this would produce a valid result of "192.16" which may or may not be what you want. Caveat regextor. Feel free to monkey with the regexp to adjust for your wants. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: RegExp question

2006-04-11 Thread Tim Chase
Unless "varible number of whitespace" means "at least *some* whitespace", in which case you'd want to use (and|or|xor)\s+# Both are beautiful and precise. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory limit to dict?

2006-04-11 Thread Tim Peters
[Olivier Langlois] > ... > I have kept thinking about the original problem and I now believe that > the only solution if he wants to store 3.6GB of data in a Python script > is to recompile Python in 64 bits. I do not know if this is something > that someone has already done successfully... I did

Re: RegExp question

2006-04-11 Thread Tim Chase
> I am testing it with grep. (i.e., grep -e '(and|or|xor)\s*#' myfile) Well, you asked for the python regexp...different environments use different regexp parsing engines. Your response is akin to saying "the example snippet of python code you gave me doesn't work in my Pascal program". For g

Re: Regular expression intricacies: why do REs skip some matches?

2006-04-11 Thread Tim Chase
f.start()) or [s[f.start():f.start()+3] for f in re.finditer('(?=aba)', s)] Note that both of these know the length of the desired piece. If not, you may have to do additional processing to get them to work the way you want. Yipp

RE: Help needed on COM issue

2006-04-12 Thread Tim Golden
[Mike Howard] | Should read ... | I'm doing some conversion of vb code to python code and I have a | problem with a COM object | | Specifically in VB I can do | Set oR = oA.Action | debug.print oR.Item(1,2) | [returns say "1"] | oR.Item(1,2)="4" | debug.print oR | [returns "4"] | oR.Update | [

Re: Regular Expressions

2006-04-12 Thread Tim Chase
, "r") r = re.compile(r'"DcaVer"=dword:([0-9a-fA-F]{7})') for line in f.readlines(): m = r.match(line) if m: value = int(m.group(1), 16) print value f.close() should do the trick for you. This assumes that each string of hex digits has seven characters. Adjust accordingly. -tim -- http://mail.python.org/mailman/listinfo/python-list

quiet conversion functions

2006-04-12 Thread Tim Chase
Are there existing "quiet" conversion functions? Kin of int() and float()? My aim would be to call a function that would guarntee that the result was of the defined type, choosing sensible defaults if needed. Example problems include: int("3.14") int(None) int(__builtins__) int("hello") For

Re: CGI module: get form name

2006-04-12 Thread Tim Roberts
ate the form name in a hidden field, but there ought to >be some way to get directly at the form name but I'm just not seeing it. I >looked in the os.environ() - don't see it there. Nope, the form name is not transmitted as part of the HTTP request. It only exists for the conv

Re: Loop with float increments (frange)?

2006-04-14 Thread Tim Peters
[EMAIL PROTECTED] >> what's the standard way for a "for" loop with float increments? [Dan Sommers] > Use a while loop instead: > > f = initial_value > while f <= final_value: > process(f) > f = f + increment > > Note that there is no general guarantee that f will actually b

Re: PEP 359: The "make" Statement

2006-04-14 Thread Tim Hochberg
1') > tail('after second h1') What's the virtue of this form? Is it the indentation? If so, I suspect some relatively pretty solution could be manufactured using the 'with' syntax. Does anyone really write html 'by hand'

Re: PEP 359: The "make" Statement

2006-04-14 Thread Tim Hochberg
Steven Bethard wrote: > Steven Bethard wrote: > >>Tim Hochberg wrote: >> >>>Steven Bethard wrote: >>> >>>>Steven Bethard wrote: >>>> >>>>>Duncan Booth wrote: >>>>> >>>>>>

Re: Help for a complete newbie

2006-04-14 Thread Tim Roberts
er-for-letter like the tutorial states. Letter for letter, maybe, but not space for space. Indentation is important in Python. The "ready =", "if ready", and "else:" statements must start in column 1. The two print statements need to be indented, as they are. -

Re: PEP 359: The "make" Statement

2006-04-15 Thread Tim Hochberg
Tim Hochberg wrote: > Steven Bethard wrote: > >> Steven Bethard wrote: >> >>> Tim Hochberg wrote: >>> >>>> Steven Bethard wrote: >>>> >>>>> Steven Bethard wrote: >>>>> >>>>>> Dun

Re: Unified web API for CGI and mod_python?

2006-04-15 Thread Tim Chase
python enabled for testing purposes (my aim is to make use of at least the CGI, mod_python, and BaseHTTPRequestHandler). When I run the setup.py script (either as myself or as root) I get back [EMAIL PROTECTED] cd ~tim/WebStack-1.1.2 [EMAIL PROTECTED] python2.3 setup.py install running install error:

Re: Unified web API for CGI and mod_python?

2006-04-16 Thread Tim Chase
>>[EMAIL PROTECTED] cd ~tim/WebStack-1.1.2 >>[EMAIL PROTECTED] python2.3 setup.py install >>running install >>error: invalid Python installation: unable to open >>/usr/lib/python2.3/config/Makefile (No such file or directory) > > apt-get install python2

Re: Async Sleep?

2006-04-17 Thread Tim Head
in the cookbook seems to do the job http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178 if it doesn't do exactly what you wnat have a poke around win32 tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Using struct to read binary files

2009-11-26 Thread Tim Chase
f = open("/tmp/mbrcontent", "rb") contents = f.read() f.close() firstSectorAddress = contents[454:458] numSectors = contents[458:462]

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Tim Wintle
dia.org/wiki/Floating_point 0.1 isn't represented internally, so you haven't actually reached 10. - try comparing that "10." (as it's printed) with 10.0 i.e. print (t == 10.) you'll get False - even though they print the same Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: hex int and string

2009-11-28 Thread Tim Roberts
Marco Mariani wrote: >luca72 wrote: > >> i have checked and pyscard accept also the decimal notation, > >I'm not sure you ever understood what the problem was, or where, but I'm >happy you feel like you've solved it. +1 QOTW. Great reply. -- Ti

Re: why do I get this behavior from a while loop?

2009-11-28 Thread Tim Roberts
"S. Chris Colbert" wrote: > >What a newbie mistake for me to make. Don't feel too badly about it. Even very experienced programmers get bitten by this issue. Until someone points it out, it's certainly not obvious. -- Tim Roberts, [email protected] Providenza &a

Re: need clarification on -0

2009-11-28 Thread Tim Roberts
plement), I am particularly sensitive to this. Processors are usually architected so that you don't normally see the -0, but it leads you to think about arithmetic a bit differently. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: mysqldb cursor returning type along with result ?

2009-11-29 Thread Tim Chase
((Decimal("101.10"),), (Decimal("99.32"),), (Decimal("97.95"),), (Decimal("98.45"),), (Decimal("97.39"),), (Decimal("97.91"),), (Decimal ("98.08"),), (Decimal("97.73"),)) as such : sum(result) fails with "TypeError: unsupported operand type(s) for +: 'int' and 'tuple'" How do I either get the

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread Tim Chase
The feature is available in Python 3.x: a, b, *c = 1, 2, 3, 4, 5 a, b, c (1, 2, [3, 4, 5]) a, *b, c = 1, 2, 3, 4, 5 a, b, c (1, [2, 3, 4], 5) This is a nice feature of 3.x but I'm disappointed (especially in light of the move to make more things iterators/generators), that the first form

Re: Noobie python shell question

2009-11-29 Thread Tim Chase
tuxsun wrote: I've been working in the shell on and off all day, and need to see if a function I defined earlier is defined in the current shell I'm working in. Is there a shell command to get of list of functions I've defined? yesish...you can use dir() from the prompt to see the bound names

Re: reading from a text file

2009-11-30 Thread Tim Golden
Olof Bjarnason wrote: 2009/11/27 baboucarr sanneh : hi all i would like to create a python program that would read from a text file and returns one result at random. e.g in the text file i have these data 1.hello 2.my name 3.is 4.World Your help is highly appreciated..thnx in advance Hi bab

Re: * for generic unpacking and not just for arguments?

2009-11-30 Thread Tim Chase
a new Python construct/syntax rather than the existing py3k syntax. Or at least the removal of the "ValueError: too many values to unpack" error. That would be a lovely addition (when the new-feature-ban is lifted :) -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: reading from a text file

2009-11-30 Thread Tim Golden
inhahe wrote: i don't understand the point of using 'with' but i don't understand what 'with' does at all i've tried to understand it a few times anyway here: import random result = random.choice(open("c:\\test.txt").readlines()) Yep. That'll do the trick. The point of "with" is that, while i

Re: top-like behavior

2009-11-30 Thread Tim Chase
Is there a specific library used for displaying up to date consoles in the same way top behaves? From the last time a similar question was asked[1]: You might look at the sourcecode for "iotop"[2] which would make a good example (it's a "top"-like program written in Python, used for monitorin

<    56   57   58   59   60   61   62   63   64   65   >