Re: Not Equal to Each Other?

2005-11-03 Thread Stephen Thorne
[1:8] I hope i have given you enough tools to do what you're trying to do. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: Frameworks for "Non-Content Oriented Web Apps"

2005-01-01 Thread Stephen Thorne
On 1 Jan 2005 20:51:06 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > But is there some sort of framework or something that is actually meant > for such web apps,application that make heavy use of forms, have very > high amount of user interaction etc. > Yeah, nevow, by those crazy twisted

Re: Decorators and static typing.

2005-01-05 Thread Stephen Thorne
t. Something standard is desired. Why don't we make it a language feature so that we don't have to waste even more lines of code and brain-cycles with obscure things like: def f(n): assert type(n) in (int, float) or subscribesToDuckType("number") using handwrit

Re: Pre/Postconditions with decorators

2005-01-06 Thread Stephen Thorne
On 6 Jan 2005 13:33:42 -0800, Rittersporn <[EMAIL PROTECTED]> wrote: > @condition("number>0 and number<2","result>=0") > def sqrt(number): > import math > return math.sqrt(number) > > @condition("list(seq) is not None","sum(seq)==result") > def my_sum(seq): > tmp=0 >

Re: Pre/Postconditions with decorators

2005-01-08 Thread Stephen Thorne
On Fri, 7 Jan 2005 20:01:50 +0200, George Sakkis <[EMAIL PROTECTED]> wrote: > > Hi George, > > it would be nice to see how you have tackled > > the task. > > Maybe we will have a checker > > module in Python one day... ;-) > > I posted my module on http://rafb.net/paste/results/voZYTG78.html and i

Re: Pre/Postconditions with decorators

2005-01-09 Thread Stephen Thorne
On 08 Jan 2005 15:50:48 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Stephen Thorne <[EMAIL PROTECTED]> writes: > > Unresolved Problems: > > 1) How do you handle duck types, i.e. a method that accepts StringIO, > > cStringIO or any other

Re: a new Perl/Python a day

2005-01-10 Thread Stephen Thorne
On Mon, 10 Jan 2005 18:38:14 GMT, gabriele renzi <[EMAIL PROTECTED]> wrote: > > You're joking, right? > > please consider that the message you all are asking are crossposted to > comp.lang.perl.misc and comp.lang.python, avoid the crossgroup flames :) Yuck. I'm on the python-list@python.org and

Re: else condition in list comprehension

2005-01-12 Thread Stephen Thorne
On 9 Jan 2005 12:20:40 -0800, Luis M. Gonzalez <[EMAIL PROTECTED]> wrote: > Hi there, > > I'd like to know if there is a way to add and else condition into a > list comprehension. I'm sure that I read somewhere an easy way to do > it, but I forgot it and now I can't find it... > > for example: >

Re: dict.updated

2005-01-12 Thread Stephen Thorne
On Wed, 12 Jan 2005 23:47:13 GMT, Rick Morrison <[EMAIL PROTECTED]> wrote: > I could live with creating a new dict, sure (although it seems wasteful). I > realize that something like this probably doesn't stand a chance of ever > making it into the std library for what might be called "philosophica

Re: Octal notation: severe deprecation

2005-01-12 Thread Stephen Thorne
On 12 Jan 2005 16:21:29 -0800, PJDM <[EMAIL PROTECTED]> wrote: > Maybe P3K will have an integer literal like "n_b" for "the integer n in > base b". I would actually like to see pychecker pick up conceptual errors like this: import datetime datetime.datetime(2005,

Re: Refactoring; arbitrary expression in lists

2005-01-12 Thread Stephen Thorne
-src'), (re.compile(r'[Mm]akefile') , 'text/x-makefile'), ] for regexp, mimetype in extensionlist: if regexp.match(filename): return mimetype if you were really concerned about efficiency, you could use something like: class SimpleMatch: def __init__(self, pattern

Re: pyserial and com port interrupts

2005-01-12 Thread Stephen Thorne
= 9600'. The OP was more interested in how to write his program so he could react to com port input in a timely manner in the face of having blocking procedures elsewhere in his code. Regards, Stephen Thorne [1] http://pyserial.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Gecko bindings for Python?

2005-01-12 Thread Stephen Thorne
there's wxMozilla, which is for embedding mozilla's rendering engine (I assume that's what you mean by 'Gecko') within wxpython/wxwidgets. Stephen. On 11 Jan 2005 07:10:57 -0800, Cordula's Web <[EMAIL PROTECTED]> wrote: > Hello, > > I'd like to use the Gecko engine in GTK+ or Qt programs writte

Re: Refactoring; arbitrary expression in lists

2005-01-12 Thread Stephen Thorne
On Thu, 13 Jan 2005 05:18:57 GMT, Bengt Richter <[EMAIL PROTECTED]> wrote: > On Thu, 13 Jan 2005 12:19:06 +1000, Stephen Thorne <[EMAIL PROTECTED]> wrote: > > >On Thu, 13 Jan 2005 01:24:29 GMT, Bengt Richter <[EMAIL PROTECTED]> wrote: > >> extensiondict

Re: newbie q

2005-01-12 Thread Stephen Thorne
> for i in [x for x in os.listdir(src) if os.path.isfile(os.path.join(src, > x)) and len(x.split('.')) > 1 and x.split('.')[-1].lower() == 'm3u']: > os.remove(os.path.join(src, i)) > > if __name__ == '__main__': > _test() import g

Re: finding/replacing a long binary pattern in a .bin file

2005-01-12 Thread Stephen Thorne
On 12 Jan 2005 22:36:54 -0800, yaipa <[EMAIL PROTECTED]> wrote: > What would be the common sense way of finding a binary pattern in a > .bin file, say some 200 bytes, and replacing it with an updated pattern > of the same length at the same offset? > > Also, the pattern can occur on any byte bound

Re: newbie q

2005-01-13 Thread Stephen Thorne
On Thu, 13 Jan 2005 17:05:39 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote: > > "Stephen Thorne" <[EMAIL PROTECTED]> ÑÐÐÐÑÐÐ/ÑÐÐÐÑÐÐÐ Ð > > ÑÐÐÐÑÑÑÐÐ: news:[EMAIL PROTECTED] > On Thu, 13 Jan 2005 15:55:10 +1000, Egor Bolonev <[EMAIL PROTE

Re: Native widgets for Python

2005-01-17 Thread Stephen Thorne
there's someone writing 'dabo', which is apparently "wxpython but more python". Stephen. On Mon, 17 Jan 2005 15:13:07 +0100, A. Klingenstein <[EMAIL PROTECTED]> wrote: > Which other GUI library for Python other than wxpython has native > widgets for MS Windows ? > I know there is MFC and GDI, bu

Re: generator expressions: performance anomaly?

2005-01-18 Thread Stephen Thorne
60*24; } Parse Error, neither is anything except + and -: class Foo { var $bar = 256 & 18; } Parse Error, and definately not variables: $baz = 12; class Foo { var $bar = $baz*2; } I compute 60*60*24 every time around the loop: foreach ($myarray as $value) { $x = 60*60*24*$value; } Thankful, Former PHP Programmer, Stephen Thorne. -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Stephen Thorne
e easily wrapped around with a simple, pythonic wrapper. It even has a .createTable() function for those times when you don't even want to log into the database. Regards, Stephen Thorne. -- http://mail.python.org/mailman/listinfo/python-list

Re: generator expressions: performance anomaly?

2005-01-18 Thread Stephen Thorne
ts_kwargs): def decorator(f) def closure(*arg, **kwargs): kwargs.update(constants_kwargs) return f(*arg, **kwargs) return closure return decorator Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: File objects? - under the hood question

2005-01-18 Thread Stephen Thorne
read any data, but at this point if the file wasn't there, the OS would have throw you an error. > (2) >>> hesjustsleeping = f.read() The entire file is read directly into a single python str. Regards, Stephen Thorne. -- http://mail.python.org/mailman/listinfo/python-list

Re: list item's position

2005-01-19 Thread Stephen Thorne
t = list(itertools.dropwhile(dropPredicate, mylist)) assert mylist == ['somecontentsxxx', 'd', 'e', 'f'] This will drop everything at the start of the list for which 'dropPredicate' returns true. This will mean that even if dropPredicate retu

Re: Print a string in binary format

2005-01-20 Thread Stephen Thorne
function that actually fulfills the requirements. This can be used in the original poster's situation to output data in (almost) readable binary format using something like the following: f = file('myfile', 'rb') while 1: bytes = f.read(8) if not bytes: break print ' '.join([bstr(ord(c)) for c in bytes]) Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: Unbinding multiple variables

2005-01-20 Thread Stephen Thorne
On 20 Jan 2005 19:24:43 -0800, Johnny Lin <[EMAIL PROTECTED]> wrote: > Hi! > > Is there a way to automate the unbinding of multiple variables? Say I > have a list of the names of all variables in the current scope via > dir(). Is there a command using del or something like that that will > itera

Re: Python with no significant whitespace

2005-01-25 Thread Stephen Thorne
On Wed, 26 Jan 2005 11:31:18 +0800, mep <[EMAIL PROTECTED]> wrote: > Hi,all > Is there anybody trying to release a modification version to current > python source code with no significant whitespace, say replacing whitespace > by {} > like C or java. I do *NOT* mean whitespace is good or bad, j

Re: python memory blow out

2005-01-26 Thread Stephen Thorne
out this limitation disappearing in python :). Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: String Fomat Conversion

2005-01-26 Thread Stephen Thorne
t(x) y = float(y) Or, more concisely: for line in f.readlines(): x, y = map(float, line.split()) Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: String Fomat Conversion

2005-01-27 Thread Stephen Thorne
On Thu, 27 Jan 2005 00:02:45 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: > Stephen Thorne wrote: > > f = file('input', 'r') > > labels = f.readline() # consume the first line of the file. > > > > Easy Option: > > for line in f.readli

Re: The next Xah-lee post contest

2005-01-29 Thread Stephen Thorne
On Sat, 29 Jan 2005 19:05:55 +0530, Steve <[EMAIL PROTECTED]> wrote: > Hi All, > For sometime now, I have just been a passive lurker on this > list. Of late I saw an increase in the number of posts by Xah Lee, and > I have to admit, what he lacks in understanding of the various > programming

Re: limited python virtual machine

2005-01-29 Thread Stephen Thorne
On Sat, 29 Jan 2005 08:53:45 -0600, Skip Montanaro <[EMAIL PROTECTED]> wrote: > > >> One thing my company has done is written a ``safe_eval()`` that uses > >> a regex to disable double-underscore access. > > Alex> will the regex catch getattr(object, > Alex> 'subclasses'.join(['_'

Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Stephen Thorne
On 30 Jan 2005 16:43:26 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > I want to do the following: > > def do_load(self, arg): > sitefile = file('sitelist', 'r+', 1) > while True: > siteline = sitefile.readline() > site_rawlist = siteline.split() > sitelist[site_rawlist[0]] = site_

Re: Want to meet any of these people? They are registered for PyCon

2005-01-31 Thread Stephen Thorne
all_names)) which would not have worked correctly, it would have thrown an exception because "Aahz\n".split()[1] does not exist. I guess the second iteration would use name[1:] instead... unfortunately-not-going-to-pycon-ly y'rs. Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] string pattern matching

2005-02-01 Thread Stephen Thorne
On Tue, 1 Feb 2005 18:59:18 -0500, Dan Perl <[EMAIL PROTECTED]> wrote: > Perhaps someone will write a program to automatically follow up on every > [perl-python] posting? The follow-up could just contain a statement like > the one Daniel mentions. Obviously the program would be written in python.

Re: [perl-python] string pattern matching

2005-02-01 Thread Stephen Thorne
On Tue, 01 Feb 2005 21:19:34 -0500, Chris Smith <[EMAIL PROTECTED]> wrote: > Falls into the 'cure worse than the disease' category. > It's really just a prompt to explore the corners of Gnus, and > determine how to give X.L. the thorough ignoring he deserves. *headdesk* I'm using gmail, and I can

Re: Python's idiom for function overloads

2005-02-02 Thread Stephen Thorne
fort. http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/5b50153e3fb84862 http://tinyurl.com/4awat type(arg1) == types.IntType def multi_type(t): return multi(lambda x:type(x) == t) @multi_type(types.IntType) def foo(x): return someOperationOnInt(x) @multi_type(types.F

Re: Who uses input()? [was Re: question on "input"]

2005-07-17 Thread Stephen Thorne
put", so I > guess that would be a Py3K idea, and maybe the whole I/O concept > will be rethought then (if the "print" statement is going to go away, > anyway). I don't see as "break input() using code" -> "not until py3k" as a logical cause/ef

Re: global interpreter lock

2005-09-14 Thread Stephen Thorne
eLongRunningOperation() print somereturnvalue http://svn.twistedmatrix.com/cvs/sandbox/radix/newdefgen.py?view=markup&rev=14348 -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: "optimizing out" getattr

2005-09-14 Thread Stephen Thorne
t a significant percentage of your programs time is being spent inside this function? If you don't, then you're wasting your time doing unnecessery optimisation. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop in list.

2005-02-08 Thread Stephen Thorne
On Tue, 08 Feb 2005 23:07:09 -0500, Caleb Hattingh <[EMAIL PROTECTED]> wrote: > '>>> a = [i*2*b for i in range(3) for b in range(4)] > '>>> a > [0, 0, 0, 0, 0, 2, 4, 6, 0, 4, 8, 12] > > Might take you a while to correlate the answer with the loop, but you > should be able to see after a while that

That horrible regexp idiom

2005-02-09 Thread Stephen Thorne
ltiple regular expressions. The following is still incredibly hideous. '>>> for m in xsearch(foo_pattern, subject): '>>> pass '>>> else: '>>> for m in xsearch(bar_pattern, subject): '>>> pass '>>> else: '>>> pass Thankyou for your time. Stephen Thorne [1] Actual confusement may vary. -- http://mail.python.org/mailman/listinfo/python-list

Re: convert list of tuples into several lists

2005-02-10 Thread Stephen Thorne
On Fri, 11 Feb 2005 07:35:43 +0100, Pierre Quentel <[EMAIL PROTECTED]> wrote: > Steven Bethard a écrit : > > Cappy2112 wrote: > > > >> What does the leading * do? > > > > > > Tells Python to use the following iterable as the (remainder of the) > > argument list: > > > > Could someone explain why t

Re: "perl -p -i -e" trick in Python?

2005-02-15 Thread Stephen Thorne
On Wed, 16 Feb 2005 15:18:57 +0900, Wonjae Lee <[EMAIL PROTECTED]> wrote: > I read the comment of > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277753. > (Title : Find and replace string in all files in a directory) > > "perl -p -i -e 's/change this/..to this/g'" trick looks handy. > D

Re: Attaching to a Python Interpreter a la Tcl

2005-02-23 Thread Stephen Thorne
On 23 Feb 2005 02:37:48 -0800, DE <[EMAIL PROTECTED]> wrote: > Hello, > > Some long time ago, I used to use Tcl/Tk. I had an tcl embedded into my > app. > > The coolest thing was however, I was able to attach to the interpreter > (built in to my app) via a tcl shell in which I could type in regul

Re: Question - What is a faster alternative to recursion?

2005-03-02 Thread Stephen Thorne
On Wed, 02 Mar 2005 00:58:58 -0600, actuary77 <[EMAIL PROTECTED]> wrote: > Yes, iteration is 100 times faster than recursion. > > The problem I have is: > > # need to call this function 50 times with seed of 10 > (afunc(afunc(afunc(... afunc(10)) > > required_iterations_ 50 > funct

Re: Distributing applications

2005-03-02 Thread Stephen Thorne
On Wed, 2 Mar 2005 13:07:25 -0600, Jaime Wyant <[EMAIL PROTECTED]> wrote: > However, if you have an idea on updating py2exe bundled apps, I'm all ears... I'm working on a little project that requires remote updating. What I basically came up with is two nested applications. program/program.exe r

Re: "Static" python program

2005-03-05 Thread Stephen Thorne
On Fri, 04 Mar 2005 12:10:00 +0100, Daniel Frickemeier <[EMAIL PROTECTED]> wrote: > I´m developing a small python-program wiht the mysql-python-module. > The program should run on a server without any mysql-installation. > Is there any posibility to "kompile" a python with static libaries? Sure, h

Re: function with a state

2005-03-06 Thread Stephen Thorne
out just using the function object directly? def myFun(): myFun.x += 1 return myFun.x myFun.x = 0 for test in range(10): assert myFun()+1 == myFun() assert myFun()*2+3 == myFun()+myFun() assert range(myFun(), myFun()+9) == [myFun() for x in range(10)] assert range(myFun()+2, myFun()+

Re: py2exe error: 2.4.2.4: No such file or directory

2005-03-07 Thread Stephen Thorne
On Mon, 07 Mar 2005 16:20:30 -0600, Larry Bates <[EMAIL PROTECTED]> wrote: > I had occasion to look back at a project I did over a year ago > and needed to make one small change. I use py2exe to package > it for distribution via Inno Setup. After making my change > I tried to run my setup script

Re: FW: list reduction

2005-03-10 Thread Stephen Thorne
t; > > > > Apologies if this is a bad question. > > > > > > > > Thanks > > -- > James Stroud, Ph.D. > UCLA-DOE Institute for Genomics and Proteomics > Box 951570 > Los Angeles, CA 90095 > -- > http://mail.python.org/mailman/listinfo/python-list > -- Stephen Thorne Development Engineer, NetBoxBlue.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PyAsm

2005-03-10 Thread Stephen Thorne
On 10 Mar 2005 12:35:36 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey Roger, > > I didn't realize that Stefan replied to the list and sent a private > email reply. There seemed to be a lag in google groups today. I > basically told him that I might be crazy enough to write an assembl

Re: modifiable config files in compiled code?

2005-03-10 Thread Stephen Thorne
sys.path.append(os.path.split(sys.path[0])) import config 3) Put in your setup.py setug( .... data=[('.', ['config.py'])]# Package config.py seperately. ) Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: injecting "set" into 2.3's builtins?

2005-03-10 Thread Stephen Thorne
y incompatibilities between the 2.3 and 2.4 versions of > set objects, but my use of them has been pretty straightforward. I have: try: set except NameError: from sets import Set as set in my code in a few places. Its not any worse than: try: True,False except NameError:

Re: Convert python to exe

2005-03-13 Thread Stephen Thorne
On 13 Mar 2005 14:31:53 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi > > I have a python script under linux, I wonder if I can be converted to > an executable or not? Yes, you can use cx_Freeze. Regards, Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: Web framework

2005-03-15 Thread Stephen Thorne
On Sun, 13 Mar 2005 13:21:27 -0800, Venkat B <[EMAIL PROTECTED]> wrote: > > I'd say Nevow! For apache setup, you might be interested in my wsgi [1] > > implementation. > > Hi Sridhar, > > Are you aware of Nevow's "integrability" with the webservers (CGIHTTPServer > in particular) that come packag

Re: Html or Pdf to Rtf (Linux) with Python

2004-12-16 Thread Stephen Thorne
browser (load this url, print this page, etc). I've been investigating doing the same feat using JS/XUL/etc in mozilla. It probably is possible. There's lots of documentation about the XPCOM api available from http://xulplanet.com/ As for converting to RTF, someone has already pointed

Re: Html or Pdf to Rtf (Linux) with Python

2004-12-17 Thread Stephen Thorne
On Fri, 17 Dec 2004 07:55:10 + (UTC), Axel Straschil <[EMAIL PROTECTED]> wrote: > Hello! > > > I've been able to successfully get konqueror to generate a pdf from a > > html file via dcop. It's something along the lines of: > > For that stuff, I'm using htmloc (http://www.htmldoc.org/). I fo

Re: Is this a good use for lambda

2004-12-17 Thread Stephen Thorne
On Fri, 17 Dec 2004 15:58:09 -0800, Charlie Taylor <[EMAIL PROTECTED]> wrote: > > I find that I use lambda functions mainly for callbacks to things like > integration or root finding routines as follows. > > flow = integrate(lambda x: 2.0*pi * d(x)* v(x) * sin(a(x)),xBeg, xEnd) > > root = findRo

Re: newbie question

2004-12-20 Thread Stephen Thorne
On Mon, 20 Dec 2004 18:06:36 -0600, Doug Holton <[EMAIL PROTECTED]> wrote: > To actually answer your question, no, there is no standard for enums in > python. There are custom hacks for it that you can search for. > > This is a good sugestion for Python 3.0, a.k.a. Python 3000: > http://www.pytho

Re: editing XML via DOM

2004-12-20 Thread Stephen Thorne
ample of that - but I do recommend it if you have a situation where you need to parse crappy xml. A quick google comes up with: http://www.acooke.org/andrew/writing/python-xml.html which shows how to use xml.dom.ext.reader.Sax.FromXmlFile and then doing some stuff with createElement, appendChil

Re: word to digit module

2004-12-21 Thread Stephen Thorne
: items = s.replace(',', '').split() numbers = [translation.get(item.strip(), -1) for item in items if item.strip()] if -1 in numbers: raise ValueError("Invalid string '%s'" % (s,)) if 1000 in numbers: idx = numbers.index(1000) hundreds = numbers[:idx] numbers = numbers[idx+1:] + [1000*x for x in hundreds] if 100 in numbers: idx = numbers.index(100) hundreds = numbers[:idx] numbers = numbers[idx+1:] + [100*x for x in hundreds] return sum(numbers) Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: word to digit module

2004-12-22 Thread Stephen Thorne
On Wed, 22 Dec 2004 11:41:26 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > Stephen Thorne wrote: > > .def toNumber2(s): > > . items = s.replace(',', '').split() > > . numbers = [translation.get(

Re: PHP vs. Python

2004-12-22 Thread Stephen Thorne
re-write any sections of code that are too slow in C, in pyrex, optimise them with psyco, or just plain fix your efficiency problems. Profiling in php isn't as easy as import profile profile.run("main()") Regards, Stephen Thorne. [1] I have written php commerically for over 3 yea

Re: regular expression: perl ==> python

2004-12-22 Thread Stephen Thorne
convert('abc') except: pass else: assert None,"Should Raise on invalid input" Of course, I wrote the tests first. I used your regexp's but I was confused as to why you were always using .group(1), but decided to leave it. I would pro

Lambda going out of fashion

2004-12-22 Thread Stephen Thorne
Hi guys, I'm a little worried about the expected disappearance of lambda in python3000. I've had my brain badly broken by functional programming in the past, and I would hate to see things suddenly become harder than they need to be. An example of what I mean is a quick script I wrote for doing c

Re: Lambda going out of fashion

2004-12-23 Thread Stephen Thorne
a single expression myself (if it's more complex than "lambda x:baz(x.foo(y))", I would prefer to write a named function). ultimate-ly yr's. Stephen Thorne. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-23 Thread Stephen Thorne
ully the frustration you must experience when you see map(lambda x:f(x). I think it is important to voice concern, and I recieved not a few 'me-too's in reply to this thread. But at the end of the day, I'm not against removing lambda in py3k. slightly-less-concerned-ly yr's Stephen Thorne. -- http://mail.python.org/mailman/listinfo/python-list

Re: list Integer indexing dies??

2004-12-23 Thread Stephen Thorne
ould > > >>>035[0] > 3 # my own opinion. TypeError: unsubscriptable object > > cough up the same as 29[0]. > > >>>29[0] > 2 #again my own opinion TypeError: unsubscriptable object Just-in-my-own-opinion-ly y'rs Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: Optional Static Typing

2004-12-24 Thread Stephen Thorne
On 24 Dec 2004 21:35:24 -0800, Luis M. Gonzalez <[EMAIL PROTECTED]> wrote: > I don't understand why this discussion on optional static typing came > up right at this moment. Because Guido made some notes on it. http://www.artima.com/weblogs/viewpost.jsp?thread=85551 merry christmas. Stephen. --

Re: C pointers/Python

2005-03-21 Thread Stephen Thorne
data = 'somedata' if code == CODE1: return data In C, you pass a memory location to copy the result into. In Python, we return the result as an object. As for pointers, we don't need them. -- Stephen Thorne Development Engineer, NetBoxBlue.com -- http://mail.python.org/mailman/listinfo/python-list

Re: C pointers/Python

2005-03-21 Thread Stephen Thorne
gt; example, you could use a list here.) > def testit( buffer ): >for i in range( len ): > buffer[A+i]=data[B+i] > for some constants A,B That's unpythonic. The correct solution is to return the result. Anything else is trying to squeeze a C idiom into python for no gain.

Re: C pointers/Python

2005-03-22 Thread Stephen Thorne
e that would love to show you the pythonic way of achieving your goal. -- Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list

Re: (noob alert) why doesn't this work?

2005-03-22 Thread Stephen Thorne
int out, there's a bug here. If any flac file is missing any one of these tags, but a previous one does have the tag, (i.e. 'Genre'), then the previous tag will be used, because you don't reset the variables each time around the loop. -- Stephen Thorne Development Engineer, NetBoxBlue.com -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison puzzle? bug?

2005-03-22 Thread Stephen Thorne
going on? > print"item[0] > lvl = %d > %d = " %(item[0], lvl), bool(item[0] == lvl) you have an == there, it should be a > also, consider using %r instead of %d in your print statements. -- Stephen Thorne Development Engineer, NetBoxBlue.com -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-23 Thread Stephen Thorne
ot; % x) @f.close() (The @ marks are to preserve the indentation on usenet, I believe google strips them). I hope that helps you. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for a 10-14 years old?

2005-03-23 Thread Stephen Thorne
> small problems? http://www.livewires.org.uk/ run use python to teach programming at their camp. They have their course material on their website under a Free license. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython: accessing wxFrame methods in __del__ fails

2005-03-23 Thread Stephen Thorne
iated. Don't use __del__, use EVT_CLOSE i.e. self.Bind(wx.EVT_CLOSE, self.OnClose) and def OnClose(self, evt): x, y = self.GetPositionTuple() -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird...

2005-04-11 Thread Stephen Thorne
On Apr 11, 2005 7:57 AM, Joshua Ginsberg <[EMAIL PROTECTED]> wrote: > >>> {'a':1,'b':'2','c':[3,4]}.keys() > ['a', 'c', 'b'] > > How come? :-) Dicts are not ordered. See note (3) on this page :

Re: expect-like package

2005-12-20 Thread Stephen Thorne
return success > "^HTTP/1\.0 4\d\d.*" then return warning > else return error Have a look at these: http://www.idyll.org/~t/www-tools/twill.html http://pbp.berlios.de/ http://www.openqa.org/selenium/ -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: vim configuration for python

2005-05-25 Thread Stephen Thorne
characters. A tab character in your file will be rendered as 8 wide. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: scripting browsers from Python

2005-06-01 Thread Stephen Thorne
snetial an assertion, so if anything fails it fails spectacularly with debug messages and non-zero exit codes. You can also load python code up so you can do arbitary stuff. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread Stephen Thorne
uct.unpack('!hi', '\xf0\xf0\xf0\xf0\xff\xfe') (-3856, -252641282) help(struct) for more information -- Regards, Stephen Thorne Development Engineer NetBox Blue - 1300 737 060 Scanned by the NetBox from NetBox Blue (http://netboxblue.com/) -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing None objects from a sequence

2008-12-14 Thread Stephen Thorne
way? There's a little hack that will remove all elements from a list that are 'False' when considered as a boolean. So None, [], '', False, etc. filter(None, myseq) an example: >>> l = ['1', 2, 0, None, '5'] >>> filter(None, l

Re: How do I manually uninstall setuptools (installed by egg)?

2008-12-14 Thread Stephen Thorne
dist_deb.py here: http://bazaar.launchpad.net/~jerub/packaging/trunk/annotate/11?file_id=bdist_deb.py-20080507003948-5c5mn3f68meq60hs-1 -- Regards, Stephen Thorne Development Engineer NetBox Blue - 1300 737 060 Scanned by the NetBox from NetBox Blue (http://netboxblue.com/) Can you afford to b

Re: no sign() function ?

2008-12-22 Thread Stephen Thorne
u don't want a float response:: def sign(x): return cmp(x, 0) -- Regards, Stephen Thorne Development Engineer NetBox Blue - 1300 737 060 -- http://mail.python.org/mailman/listinfo/python-list

Re: python admin abuse complaint

2010-02-03 Thread Stephen Thorne
PM) eggy_: OhnoesRaptor: getting sockets (and event loops > etc) right is quite tricky > (12:12:21 PM) OhnoesRaptor: I know how to do sockets right eggy, just > wondering whats up with thepythonverison :D > (12:12:24 PM) mode (+o dash) by ChanServ > (12:12:30 PM) You have been kicked by d

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
On Feb 5, 8:26 am, Xah Lee wrote: > I appreciate that you taking this more seriously than normal > newsgroups postings. In fact, for this complaint, the response you > made is all i asked for. > > I am taking this as seriously as all the articles you have posted to usenet. Stephen. -- http://m

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
On Feb 5, 9:02 am, Steve Holden wrote: > > • The list of ban'd person's names, the reason for banning, and the > > name of admin who ban'd them, should be public. (irc already provides > > means for this that allows admins to annotate in the ban list.) In > > particular, if you are going to ban so