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 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: It's ...

2009-06-25 Thread Kirk Strauser
o need to seek to the beginning, and files are closed when they are garbage collected (although I can't make myself not close output files after years of doing so), and map() is largely deprecated in favor of list comprehensions and generator functions. -- 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: 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: (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: (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: 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: 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: 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-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: 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
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: 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

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: 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: 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: 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: 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: 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: 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: 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: More regex help

2008-09-24 Thread Kirk Strauser
27;/foo') 'http://www.example.com/foo' >>> urllib.basejoin('http://www.example.com/path/to/deep/page', 'http://slashdot.org/foo') 'http://slashdot.org/foo' -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Suggestions for creating a PDF table

2008-07-28 Thread Kirk Strauser
d *almost* perfect, except that it doesn't support colspans. As I hope I demonstrated in the example, most of our reports depend on that ability. So, again, any thoughts on a PDF generator that can generate tables with the same kind of flexibility as HTML? -- Kirk Strauser -- http://mail.python.org/mailman/listinfo/python-list

Re: How do web templates separate content and logic?

2008-07-01 Thread Kirk Strauser
the function and all of the HTML print statements to the bottom. And then you realize you've written your very own page template, and that it's ugly, and that you should've used something different from the very beginning. That's why you don't embed HTML in Python, at lea

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

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

Django or TurboGears for a new project

2008-06-27 Thread Kirk Strauser
s any to find subject matter experts. Thanks, -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: newb question on strings

2008-06-27 Thread Kirk Strauser
ut of curiosity, what kind of processing? The only time I've really had to mess with escaping quotes involved SQL. There is *no* reason why you'd ever directly generate SQL strings yourself today unless you're writing a database connector. -- Kirk Strauser The Day Companies --

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: question relateding to parsing dbf files.

2008-06-18 Thread Kirk Strauser
http://honeypot.net/project/xbasetopg . If that's too complicated, I've written a replacement in straight C but I haven't published it yet. I use these programs to sync our legacy FoxPro database to our new PostgreSQL servers on an hourly basis. Syncing 4GB of data ta

Re: dict order

2008-06-18 Thread Kirk Strauser
ict_two that's not in dict_one. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Over Python Lists

2008-06-17 Thread Kirk Strauser
item is a list: compare(item, function) def check(list): if list starts with [1, 2] and length of the list > 2: return True else: return False -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Good cross-host IPC?

2008-06-16 Thread Kirk Strauser
of the same problem space, but not all of our code is easily bent to its will. Is there another, more common way of doing this stuff? Popularity isn't the most important thing in the world, but I like the warm fuzzies of knowing that thousands of others are testing and using the same project as we are. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: accumulator generators

2008-05-30 Thread Kirk Strauser
them. So your bar is taking s, adding i to it, then assigning the value back to the local variable named s. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling instance methods from a decorator

2008-05-30 Thread Kirk Strauser
At 2008-05-30T17:40:17Z, "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Of course you can get the self - just use the first paramter, because it > *is* self. Self is just a parameter - nothing special. If I blame it on being a long week, can I keep my geek card? --

Calling instance methods from a decorator

2008-05-30 Thread Kirk Strauser
;__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name'] There's no nice im_self to bounce off of or anything. I seem to be going about this all wrong. What's a good approach to get the desired effect? -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list

Subclassing list the right way?

2008-04-25 Thread Kirk Strauser
;>> class Foo(list): ... def __getitem__(self, index): ... return 5 ... >>> a = Foo([1, 2, 3, 4, 5]) >>> print a [1, 2, 3, 4, 5] >>> print a[2:4] [3, 4] >>> print a[3] 5 I first expected that to instead behave like: >>> print a [5, 5, 5, 5, 5

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

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

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

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

Re: (Modular-)Application Framework / Rich-Client-Platform in Python

2007-05-18 Thread Kirk Job Sluder
uot;foo" text. You might customize other "view" objects to display documentation, compilation, and debugging information. (The fact that Eclipse and emacs are both rather lean programs is obsucred by the sheer quantity of plug-ins that have become a part of the standard installation

Re: Trying to choose between python and java

2007-05-15 Thread Kirk Job Sluder
x27;ve found it useful to use a mix of pure java and jython, although I'm still working through some gotchas in regards to compiling jython code that's acessible from java. > -- > Kind Regards, > Anthony Irwin > > http://www.irwinresources.com > http://www.makeh

Re: Basic question

2007-05-12 Thread Kirk Job Sluder
w ArrayList; //Java 1.5 addition I think. for(int x=0,x > Am I missing something? > > []'s > Cesar > -- Kirk Job Sluder -- http://mail.python.org/mailman/listinfo/python-list

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: SQLite problems

2007-04-12 Thread Kirk Job Sluder
ny ideas? miss-match of versions between the fink and the Apple-supplied sqlite3? > > Regards, > -Justin > -- Kirk Job Sluder -- http://mail.python.org/mailman/listinfo/python-list

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: 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: 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: "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: 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: 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: 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-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 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: 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

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-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-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-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 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]>, 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: > 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]>, "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: 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

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: 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: 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

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: 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: 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-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: 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: 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

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

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

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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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

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: 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 &

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
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

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: 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

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

  1   2   >