Freeze problem with Regular Expression

2008-06-25 Thread Kirk
-]*\s*)*)([^A-Z]*)$/; print $1; # I've python 2.5.2 on Ubuntu 8.04. any idea? Thanks! -- Kirk -- http://mail.python.org/mailman/listinfo/python-list

Re: Freeze problem with Regular Expression

2008-06-30 Thread Kirk
Perl has a different pattern matching algorithm. Thanks again to all of you! Bye! -- Kirk -- http://mail.python.org/mailman/listinfo/python-list

Re: Freeze problem with Regular Expression

2008-07-01 Thread Kirk
hanging is an *admissible* behavior? Couldn't we learn something from Perl implementation? This is my point. Bye -- Kirk -- http://mail.python.org/mailman/listinfo/python-list

Pickling and inheritance are making me hurt

2005-02-04 Thread Kirk Strauser
ems like the problem is that _saveresults is only looking inside the same namespace as Search (where it's originally defined), even if it's actually been inherited by another class in a different module. Is there a way around this? -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Python to do CDC on XML files

2016-03-23 Thread Bruce Kirk
Does anyone know of any existing projects on how to generate a change data capture on 2 very large xml files. The xml structures are the same, it is the data within the files that may differ. I need to take a XML file from yesterday and compare it to the XML file produced today and not which X

Re: Python to do CDC on XML files

2016-03-23 Thread Bruce Kirk
I agree, the challenge is the volume of the data to compare is 13. Million records. So it needs to be very fast Sent from my iPad > On Mar 23, 2016, at 4:47 PM, Bob Gailer wrote: > > > On Mar 23, 2016 4:20 PM, "Bruce Kirk" wrote: > > > > Does anyone know

Python article in Free Software Magazine

2005-12-31 Thread Kirk Strauser
lling mechanism as pass-by-reference, because that's close enough for newcomers to get the gist of it. Anyway, the article's available under an open license. If you like it, feel free to pass it around. Enjoy! -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-01 Thread Kirk Strauser
say to write for an audience with technical background. That article was meant for you, not your boss. :-) -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-04 Thread Kirk Strauser
> Makes for a nice figure, too, which Free Software Magazine needs more of. ? -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Python article in Free Software Magazine

2006-01-04 Thread Kirk Strauser
Michele Simionato wrote: > when I think Zope is the less Pythonic application I have ever seen;) You do? Why so? I'm not arguing, but that's different than my experience with it and I'm curious about how you reached that conclusion. -- Kirk Strauser -- http://mail.python.or

Finding the name of a class

2006-08-01 Thread Kirk Strauser
ed method belongs to. This seems like it should be easy, but I think I've been staring at the problem too long. -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the name of a class

2006-08-01 Thread Kirk Strauser
;> print StateProcessor.__class__.__name__ type I'm looking for something that would print 'StateProcessor' but am not having much luck. -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the name of a class

2006-08-01 Thread Kirk Strauser
Bruno Desthuilliers wrote: > Kirk Strauser wrote: >>>>> class foo(object): >>>>> pass >> >> how can I find its name, such as: >> >>>>> b = foo > I suppose you mean b = foo() ? Actually, I meant 'b = foo' in t

Re: Question on try/except

2006-08-07 Thread Kirk McDonald
t; Is there some particular use in catching an exception and immediately > re-raising it? Why catch it at all? > > /Dan > All I can think of is that it changes the traceback to point to the re-raise and not the original raise. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the keyword "is" for?

2006-08-15 Thread Kirk McDonald
certain small integers when you might not expect it to; this is done in the interests of efficiency. If you only compare the /values/ of numbers (with ==), then you will never notice this. >>> a = 1 >>> b = 1 >>> c = 100 >>> d = 100 >>> a is b True >>> c is d False -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

TypeCheck vs IsInstance in C API

2006-05-29 Thread Kirk McDonald
can take a tuple as the second argument and check the type of the first argument against every item in the tuple. I also see that TypeCheck was added in version 2.2. Why was it added? Its functionality already seems covered by IsInstance. Is it a new-style vs. old-style class thing? -Kir

API functions not working as expected

2006-06-15 Thread Kirk McDonald
when using this function. Am I missing something here? Is there, in fact, no point to these InPlace* functions? -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Turning a callback function into a generator

2006-07-02 Thread Kirk McDonald
n the callback mechanism. The function is an existing interface, and I cannot change it. I want to somehow, in some way, provide an iteration interface to this function. Thoughts? -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: > Peter Otten wrote: > >>Kirk McDonald wrote: >> >> >>>Let's say I have a function that takes a callback function as a >>>parameter, and uses it to describe an iteration: >>> >>>def func(ca

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
Alex Martelli wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > > >>In article <[EMAIL PROTECTED]>, >> Kirk McDonald <[EMAIL PROTECTED]> wrote: >> >> >>>I want to somehow, in some way, provide an iteration interface to thi

Re: Augument assignment versus regular assignment

2006-07-07 Thread Kirk McDonald
nagy wrote: > I do the following. First create lists x,y,z. Then add an element to x > using the augumented assignment operator. This causes all the other > lists to be changed also. > But if I use the assignment x=x+[4] instead of using the augumented > assignment, the y and z lists do not change.

Re: Augument assignment versus regular assignment

2006-07-08 Thread Kirk McDonald
nagy wrote: > Thanks, Kirk. > I considered the += as only a shorthand notation for the assignment > operator. > Since for lists + is simply a concatetation, I am not sure it x=x+[2] > is creating a brand > new list. Could you refer me to any documentation on this? Yes: http://d

Re: Augument assignment versus regular assignment

2006-07-08 Thread Kirk McDonald
Frank Millman wrote: > nagy wrote: > >>Thanks, Kirk. >>I considered the += as only a shorthand notation for the assignment >>operator. >>Since for lists + is simply a concatetation, I am not sure it x=x+[2] >>is creating a brand >>new list. Could

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "mystilleef" <[EMAIL PROTECTED]> wrote: > 1). More and better mature standard libraries (Languages don't matter, > libraries do). > On Lisp Macros: > > I think they are overrated, and in general cause more harm than good. > It's the reason I find Lisp-like pr

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Now, if you want to tell me that, despite all the talk, Lisp coders don't > actually create new syntax or mini-languages all that often, that they > just use macros as functions, then the question becomes: why do you nee

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Pascal Bourguignon <[EMAIL PROTECTED]> wrote: > Kirk Sluder <[EMAIL PROTECTED]> writes: > > I've not seen a convincing explanation as to why imported macros > > from some library are so much more evil than imported functions

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 09 Dec 2006 21:55:19 +, Kirk Sluder wrote: > > Who says they do? All forms of abstraction have been criticized. Sometimes > the criticism is valid. Sometimes it warns agains

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > So it is good that English restricts the expressiveness and power of the > syntax and grammar. While we're talking English, we can both understand > each other, and in fact people who redefine words and ignore the commo

Re: merits of Lisp vs Python

2006-12-09 Thread Kirk Sluder
In some cases lisp macros are a way of saying tomato to something that would be called "tomahto" in python. One common use of macros is custom iteration constructs. In my social network analysis I wanted to do something to each and every sender-recipient pair in the header line of "mail" messag

Re: merits of Lisp vs Python

2006-12-15 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Don't be silly. Some operators are more natural as infix and others > as functions. It's just like in natural language. People have an > innate ability to make such distinctions and it's fine for a > programming lang

Re: merits of Lisp vs Python

2006-12-16 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Kirk Sluder <[EMAIL PROTECTED]> writes: > > Personally, I've always preferred use the imperative to describe > > _basic_ math rather than the passive. This would see

Re: merits of Lisp vs Python

2006-12-16 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Kirk Sluder <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Paul Rubin <http://[EMAIL PROTECTED]> wrote: > > > n! = (n/e)**n * sqrt(2*pi*n) * (1 + (1/12n)) * ... > > If computer languages were to m

Returning a value from code string

2006-01-27 Thread Kirk McDonald
t b(n=4) c(arg='foo') # EOF $ python test.py 10 7 arg = foo If I wanted to simplify the 'noreturn' example (well, if there were more lines of code this might make it simpler), I could have defined it like this: noreturn = """\ locals().update(kwargs) print 'arg = %s' % arg""" -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning a value from code string

2006-01-27 Thread Kirk McDonald
Steven D'Aprano wrote: > On Fri, 27 Jan 2006 20:33:53 -0800, Kirk McDonald wrote: > > >> Say I have a database containing chunks of Python code. I already >> have a way to easily load, edit, and save them. > > > Why? I am implementing an Everything Engine-l

Re: Returning a value from code string

2006-01-28 Thread Kirk McDonald
aise an AccessDenied exception and expect something down the line to deal with it, so I can define what the "access denied" node is in a central place, but you get the idea.) If the operation resulted in a new node being created, it might return the new node. &c. Sorry if I tend to ramble, heh. :-) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: MYSql, CGI web page search code not working

2006-01-28 Thread Kirk McDonald
Fred wrote: > No matter what I type in the form text box (or even if I leave it > blank) I get all the records. Try this: #!/usr/local/bin/python print "Content-Type: text/html\n" import MySQLdb import cgi db=MySQLdb.connect(host = 'localhost', db = 'phone') cursor=db.cursor() cursor.execute("Se

Re: MYSql, CGI web page search code not working

2006-01-28 Thread Kirk McDonald
Fred wrote: > Yeah, I already tried that (except you have a , after name. > > Your code produces the same error: > > NameError: name 'name' is not defined > > I know I am close!! Just missing some small thing... > Oh, duh. I forgot something: #!/usr/local/bin/python print "Content-Type: text

Re: Returning a value from code string

2006-01-28 Thread Kirk McDonald
Max wrote: > Kirk McDonald wrote: > >> Another kind of node (I'm still deciding >> whether to call them Codenodes or Opcodes or maybe Pynodes) is a chunk >> of code that can be asked to run itself, and which can be edited, on >> the fly, from within the we

Re: MYSql, CGI web page search code not working

2006-01-28 Thread Kirk McDonald
ot;Select * from phone where name like %%s% order by > name", > (form['name'].value,)) > > But it blows up... > This should work: cursor.execute("Select * from phone where name like %s order by name", ('%'+form['name'].value+'%',)) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: MYSql, CGI web page search code not working

2006-01-28 Thread Kirk McDonald
Dennis Lee Bieber wrote: > On Sat, 28 Jan 2006 10:14:44 -0800, Kirk McDonald <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > >>The comma is intentional: the MySQLdb wants the argument(s) as a tuple. > > > The DB-API wants

Re: String Manipulation Help!

2006-01-28 Thread Kirk McDonald
s[i] == '\n': nl.append(i) return tuple(nl) Your example returns: (0, 64, 65, 80, 81) This probably isn't as fast as a regex, but at least it works. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Decoupling the version of the file from the name of the module.

2006-01-28 Thread Kirk McDonald
up your old versions to other filenames or something. Or, if you really want to do this right, you could install Subversion. :-) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Decoupling the version of the file from the name of the module.

2006-01-28 Thread Kirk McDonald
new version, then rename the current circle.py as circle-1.1.py, and lather, rinse, repeat. However, I'd still look into a version control system like Subversion. It can do all of this for you. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning a value from code string

2006-01-29 Thread Kirk McDonald
back to the database-stored PSP document in which the form was found (if the form wants it to), letting the PSP document deal with it. That should be adequate. In short, I learned something about exec and namespaces that I'm not actually going to use. Hooray! -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
g/doc/2.4.2/tut/node5.html#SECTION00514 -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
t; You're thinking too hard. Say you want to read in all the lines from the file object f and just print them out one at a time: lines = f.getlines() for line in lines: print line Simple. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
; > When I debug it the error I get is the following: >AttributeError: 'file' object has no attribute 'getlines' > D'oh! That's because the method is readlines(). Stupid brain: log = open('C:\log_0.txt') lines = log.readlines() for li

URL Character Decoding

2006-01-29 Thread Kirk McDonald
ely used to them. This is clearer to me, at least.) I guess what I'm asking is: Is there a library function (in Python or mod_python) that knows how to do this? Or, failing that, is there a different regex I could use to get rid of the substitution function? -Kirk McDonald -- http://mail.pyth

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Kirk McDonald wrote: > If you have a link such as, e.g.: > > Main menu! > > The space will be translated to the character code '%20' when you later > retrieve the GET data. Not knowing if there was a library function that > would convert these back to their actu

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Kirk McDonald wrote: > Actually, I just noticed this doesn't really work at all. The URL > character codes are in hex, so not only does the regex not match what it > should, but sub_func fails miserably. See why I wanted a library function? > > -Kirk McDonald Not to keep ta

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Paul McGuire wrote: > "Kirk McDonald" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>If you have a link such as, e.g.: >> >>Main menu! >> >>The space will be translated to the character code '%20' when you later &

Introspection with classes

2006-01-31 Thread Kirk McDonald
f the User class wanted its own attributes (say, a password), they would just get added to the end. This is my third stab at the problem (the first was mentioned above, the second was basically the same as this but dbInfo was an instance variable instead of a class variable which, uh, w

Re: OO conventions

2006-02-01 Thread Kirk McDonald
e() image.close() And, in addition, there would be an image.open() method. In the above, __init__ just calls it on its own when the filename is specified. (Though, of course, I'm not at all familiar with the PIL module; there might be more stuff going on behind the scenes with the way they do it.) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi - secure sessions

2006-02-01 Thread Kirk McDonald
_python supports sessions: http://www.modpython.org/live/current/doc-html/pyapi-sess.html I've been playing with them recently, and they seem to work. :-) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi - secure sessions

2006-02-01 Thread Kirk McDonald
on has a built-in Cookie module: http://www.python.org/doc/2.4.2/lib/module-Cookie.html It may simplify matters. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: nDimensional sparse histogram in python.

2006-02-01 Thread Kirk McDonald
le code: sortedList = [(v, k) for k, v in self.histo.items()] sortedList.sort() Should do it... -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: nDimensional sparse histogram in python.

2006-02-01 Thread Kirk McDonald
sto = {} def update(self, point): self.histo[point] = self.histo.get(point, 0) + 1 def get(self, point): return self.histo.get(point, 0) dict.get's default return value is your friend. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: nDimensional sparse histogram in python.

2006-02-01 Thread Kirk McDonald
is actually unordered; a C++ std::map this ain't. To sort its elements, you need to build a list of the items and sort that, e.g.: items = [(v, k) for k, v in self.histo.items()] items.sort() This will give you a list of (value, key) tuples sorted by value. -Kirk McDonald -- http://mai

Re: Automatic class attribute

2006-02-03 Thread Kirk McDonald
them ? > Thanks a lot, > Franck By an astounding coincidence, I was just working on a similar problem. Metaclasses can do this, no problem: class M(type): def __init__(cls, name, bases, dict): cls.observers = [] def showObservers(cls): print cls.observers

Re: Global variables, Classes, inheritance

2006-02-03 Thread Kirk McDonald
able. > class Foo: > def __init(self): > i = 12345 > ... > (You forgot the trailing __, but whatever. :-) This binds the name 'i' to the local namespace of the __init__ function. It is just like any other local variable in a function. Namespaces in Python are really great. It is worth reading up on globals() and locals() if you don't get them yet. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: python's library support

2006-02-03 Thread Kirk McDonald
software_hardware/numarray The standard library can do quite a lot, and if it fails you, there's more than likely a third-party library available. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: UnboundMethodType and MethodType

2006-02-07 Thread Kirk McDonald
>>> b.bar > >>> type(b.bar) >>> id(B.bar) -1211888788 >>> id(b.bar) -1211888788 It's the same function, whether it's bound or not. Thus, it should always have the same type. It's simply called in different ways. You can just as easily say: >>> B.bar(b) As: >>> b.bar() -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: UnboundMethodType and MethodType

2006-02-08 Thread Kirk McDonald
is is tricky stuff, nobody should expect to understand > it thoroughly without both study and testing. > > --Scott David Daniels > [EMAIL PROTECTED] You know what? That makes perfect sense. Thank you. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: calculating on matrix indices

2006-02-17 Thread Kirk McDonald
the line where you assign t to: t = arange(0, 20, .1, 'f') I'm not sure why it doesn't figure that own on its own (since it obviously does hold floats), but this does cause it to work. -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: embedding python in HTML

2006-02-17 Thread Kirk McDonald
John Salerno wrote: > bruno at modulix wrote: > >> You've got to understand that Python is *not* a 'ServerPage' language >> (-> php, asp, jsp etc) in itself. Your server can now run python, fine, >> but *how* ? CGI ? FastCGI ? mod_python ? other ? (hint: it's probably >> just plain old CGI...) >

Re: 2-dimensional data structures

2006-02-18 Thread Kirk McDonald
mproved, such as using the // floor division operator rather than /, not using global variables, and so on. What can I say? It was a straight conversion from C++. I hardly knew what "Pythonic" meant.) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Python & cgi on win98--tinyweb problems, etc

2007-06-28 Thread Kirk Bailey
file name, restart the server. I used tinyweb in supporting the development of windows wiki, and in all that crazy alpha stage flakiness, it NOT ONCE blew out. It is BULLETPROOF. But it is it's own strange beast, and has it's own peculiarities. -- Salute! -Kirk Bailey

Auto-parallelizing with decorators?

2007-07-06 Thread Kirk Strauser
ts. However, if you take care to make your functions loosely coupled and not dependent on execution order, you could get a nice speedup every single time you give Python permission to schedule your repeated function calls. -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Auto-parallelizing with decorators?

2007-07-06 Thread Kirk Strauser
f Windows has os.fork(), having never looked for it). I know something like this wouldn't be the easiest thing to implement, but honestly, having such beautiful constructs as map() and list comprehensions available is just begging for an application like this. -- Kirk Strauser -- http://mail.python.o

Re: Auto-parallelizing with decorators?

2007-07-06 Thread Kirk Strauser
In article <[EMAIL PROTECTED]>, Kirk Strauser <[EMAIL PROTECTED]> wrote: > I was thinking about how a lot of Lisp proponents claim that Lisp is > inherently parallelizable because its functions don't have (or are not > supposed to have) side effects, and therefore th

Recommended validating XML parser?

2007-05-07 Thread Kirk Strauser
3000 """, dtd=file('/etc/weightfile.dtd')) >>> print foo.weight 3000 ...or some variant on that theme. -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not play well with others

2007-02-03 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > I do think the core should have more stuff than it does, so that its > functionality can be on a par with competing language distros like > J2SE and PHP. Both of those distros include database connectvity > modules an

Re: Python does not play well with others

2007-02-03 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Where would you stop? At the boundaries of your particular application > > interests? > > If the Pythonistas are serious > about such a claim, competitive analysis says they should be wi

Re: Python does not play well with others

2007-02-03 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "Paul Boddie" <[EMAIL PROTECTED]> wrote: > Quite. I imagine that most GNU/Linux distributions (and various BSDs) > provide at least some version of MySQLdb as a package. Bingo, I've rarely installed python from python.org, or other libraries from sourceforge, etc.

Re: Python does not play well with others

2007-02-04 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "Paul Boddie" <[EMAIL PROTECTED]> wrote: > Would it benefit the Python community more if Python shipped with > MySQL support out of the box? Is it likely that a user suddenly finds > him/herself needing to connect to a MySQL database? The other problem is that it

Re: Definitions of editor and IDE?

2007-02-04 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "Paddy" <[EMAIL PROTECTED]> wrote: > On Feb 4, 9:01 am, Necmettin Begiter <[EMAIL PROTECTED]> > wrote: > > Can't give definitions, but here is the difference: if you use an editor, > > you > > will have to run your script or program from outside the editor; if you

Re: "Subscribing" to topics?

2007-02-04 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "Mizipzor" <[EMAIL PROTECTED]> wrote: > On Feb 4, 9:55 pm, Toby A Inkster <[EMAIL PROTECTED]> > wrote: > > You discovered wrong -- Google does not provide a free newsserver. They no > > doubt *have* several newsservers, but don't provide direct access to them > > e

Re: Best Free and Open Source Python IDE

2007-02-10 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Stef Mientki <[EMAIL PROTECTED]> wrote: > Which brings me to some other questions on waste: > - isn't it a pitty so many people are involved in writing another editor / > IDE ? I don't know about that. Most of the new editor development appears to involve one o

Re: Regex Speed

2007-02-21 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, "John Machin" <[EMAIL PROTECTED]> wrote: > Getting back to the "It would be nice ..." bit: yes, it would be nice > to have even more smarts in re, but who's going to do it? It's not a > "rainy Sunday afternoon" job :-) Well, just as an idea, there is a portable C

Re: RegExp performance?

2007-02-25 Thread Kirk Sluder
In article <[EMAIL PROTECTED]>, Christian Sonne <[EMAIL PROTECTED]> wrote: > Thanks to all of you for your replies - they have been most helpful, and > my program is now running at a reasonable pace... > > > I ended up using r"\b\d{9}[0-9X]\b" which seems to do the trick - if it > turns out t

Re: setting file permissions on a web server

2006-04-30 Thread Kirk McDonald
scendants don't have permissions any more than DOS does. (Except with respect to Windows network file-sharing.) (Heh, I checked just before posting this and someone beat me to it. Here's my post anyway.) :-) -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread Kirk Strauser
worry about losing leading or trailing spaces if those are important to you. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Do more imported objects affect performance

2008-12-11 Thread Kirk Strauser
tire module but want to call a function that many times, you can do something like: import timeit Timer = timeit.Timer for _ in xrange(100): Timer -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread Kirk Strauser
'.rstrip('\r\n') > ' ab c ' I didn't say it couldn't be done. I just like the Perl version better. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-11 Thread Kirk Strauser
At 2008-12-11T19:49:23Z, Steve Holden writes: > ... and it's so hard to write > > item = item[:-1] It's easy - and broken. Bad things happen if you're using something other than '\n' for EOL. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: if var1 == var2:

2008-12-12 Thread Kirk Strauser
peol method because I seem to end up writing the inline version of "chomp" every time I iterate across a file. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing None objects from a sequence

2008-12-12 Thread Kirk Strauser
erence exactly? "foo is not None" is actually surprising to me, since "not None" is True. "0 is True" is False, but "0 is not None" is True. Why is that? -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Kirk Strauser
> return 0.0 How 'bout: def get_rate(balance): for threshold, rate in ((10, .0173), (5, .0149), (25000, .0124), (1, .0085), (0, .006)): if balance

Re: (Very Newbie) Problems defining a variable

2008-12-12 Thread Kirk Strauser
> consider reversing the order Actually, I just wanted to point out a simplified version of the exact same algorithm. Given enough RAM and if the speed was indeed critical, you could turn that into a tuple of interest rates and jump straight to rate[balance] in O(1). -- Kirk Straus

Re: tricky nested list unpacking problem

2008-12-15 Thread Kirk Strauser
use it to call unpack([1,2,3,5,[7,8,9]]) and unpack([1,2,3,6,[7,8,9]]), compile the results, and return them. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: tricky nested list unpacking problem

2008-12-15 Thread Kirk Strauser
> [1, 2, 3, 5, 6, 10, 11, 7, 9, 1, 2, 3, 4, 5] >>>> '-'.join(str(num) for num in flattened) > '1-2-3-5-6-10-11-7-9-1-2-3-4-5' He doesn't want to flatten them directly. He's using [1,2,3] sort of like a regular expression, so that 1,[2,3],4 means "1,2,4

Re: Append a new value to dict

2008-10-13 Thread Kirk Strauser
= 'dict' because it seems to more clearly indicate what I'm doing, and has fewer opportunities for types. Still, there is a performance penalty. Running "my way" 10,000,000 times took 8.7s, and "your way" only took 4.7s. If you're doing this in an i

Re: Suggestion for the PythonDevelopment for next version

2008-10-13 Thread Kirk Strauser
uct to overwrite it? What if I never use enumerate as it is and don't want to pay for the extra overhead of modify every object I'll ever get from an iterator? Thanks, but no. One of the things I love about Python is its lack of magic. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: RegExp: "wontmatch"-function

2008-10-13 Thread Kirk Strauser
At 2008-10-13T16:40:07Z, [EMAIL PROTECTED] writes: def nomatch(value): return not(value == '' or pattern.match(value)) -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about scope

2008-10-28 Thread Kirk Strauser
alize initialize.initialize() def main(): if myGlobals.remote_device_enabled: process_device() -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Python barcode decoding

2008-10-28 Thread Kirk Strauser
erated, or scanned in from other material? If they're nice and crisp, I wrote a simple and pretty quick decoder at http://pypi.python.org/pypi/Daycos/1.0 . Look in the Daycos.Imageproc.Barcode module. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Python/Numeric users be aware!

2008-10-29 Thread Kirk Strauser
At 2008-10-29T17:53:43Z, Benyang <[EMAIL PROTECTED]> writes: > It is totally screwed up on 64-bit linux machines: > [1 1 1 1 1 1 1 1 1 1] And on 64-bit FreeBSD machines. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing with interspersed element

2008-11-06 Thread Kirk Strauser
e [or screen] as > you go through the original string. Right? How about: def alternator(lst, sep): for index, item in enumerate(lst): if index: yield sep yield item for item in alternator(list_of_objects, 10): print item, -- Kirk Strauser The Day Compani

Re: Weird behavior with lexical scope

2008-11-06 Thread Kirk Strauser
At 2008-11-06T16:57:39Z, mrstevegross <[EMAIL PROTECTED]> writes: > class Outer: > class Inner: > def __init__(self): > pass > def __init__ (self): > a = Inner() > Outer() Try instead: class Outer: def __init__(self): a = self.Inner()

Re: Python and Its Libraries--Who's on First?

2008-11-18 Thread Kirk Strauser
At 2008-11-17T11:44:00Z, "W. eWatson" <[EMAIL PROTECTED]> writes: > See the post by Chris R. In general, it is incumbent on the asker to provide additional information as needed, rather than being the job of the would-be answerer to go searching for it. -- Ki

  1   2   >