Creating Import Hooks

2010-02-17 Thread Sreejith K
Hi everyone, I need to implement custom import hooks for an application (http:// www.python.org/dev/peps/pep-0302/). I want to restrict an application to import certain modules (say socket module). Google app engine is using a module hook to do this (HardenedModulesHook in google/ appengine/tools/

Re: Python 3.0 usage?

2010-02-17 Thread alex23
MRAB wrote: > Python 3.0 had a relatively short run before it was superseded by Python > 3.1 due to certain issues, so, IMHO, I wouldn't worry about it unless > someone especially requests/requires it. And even then, I'd just tell them I accept patches :) -- http://mail.python.org/mailman/listin

Re: Python 3.0 usage?

2010-02-17 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philip Semanchuk wrote: > is Python 3.0 seeing use in production > anywhere, or did most of the Python world move to 3.1 as soon as it was > released? Python 3.0 has been end of lifed: http://www.python.org/download/releases/3.0.1/ Consequently no

Re: MediaWiki to RTF/Word/PDF

2010-02-17 Thread Paul Rubin
Josh English writes: > Has anyone heard of a module that parses wiki markup and transforms > it? Or am I looking at XSLT? MediaWiki markup is quite messy and unless MediaWiki has an XML export feature that I don't know about, I don't see what good XSLT can do you. (The regular MediaWiki API gener

Re: Python 3.0 usage?

2010-02-17 Thread MRAB
Philip Semanchuk wrote: Hi all, I'm the author of an extension (posix_ipc) that works under Python 2.4 - 2.6. I have a version that works under Python 2.4-2.6 and 3.1 and I would like to release it, but it doesn't work under Python 3.0. I could hack up Python 3.0-specific workarounds, but I'm

Re: Wrestling with the Py2exe Install, Win7, Py2.5

2010-02-17 Thread W. eWatson
On 2/17/2010 3:44 AM, mk wrote: W. eWatson wrote: P.S. I didn't really use PyInstaller on Windows, though -- just on Linux, where it works beautifully. Regards, mk Well,Ive made some progress with a py2exe tutorial. It starts with the short "hello world!" program. But something stumbled righ

Re: Updating Packages in 2.5 (win/numpy) and Related Matters (the latest)

2010-02-17 Thread W. eWatson
Had trouble posting this to the same thread above. Request above to provide response from numpy mail list. > On 17 February 2010 07:25, wrote: > > On Wed, Feb 17, 2010 at 12:10 AM, Wayne Watson > > wrote: >> >> Hi, I'm working on a 1800+ line program that uses tkinter. Here are the >> >> mes

Re: Updating Packages in 2.5 (win/numpy) and Related Matters (the latest)

2010-02-17 Thread W. eWatson
> On 17 February 2010 07:25, wrote: > > On Wed, Feb 17, 2010 at 12:10 AM, Wayne Watson > > wrote: >> >> Hi, I'm working on a 1800+ line program that uses tkinter. Here are the >> >> messages I started getting recently. (I finally figured out how to copy >> >> them.). The program goes merrily

Re: Updating Packages in 2.5 (win/numpy) and Related Matters (the latest)

2010-02-17 Thread W. eWatson
> On 17 February 2010 07:25, wrote: > > On Wed, Feb 17, 2010 at 12:10 AM, Wayne Watson > > wrote: >> >> Hi, I'm working on a 1800+ line program that uses tkinter. Here are the >> >> messages I started getting recently. (I finally figured out how to copy >> >> them.). The program goes merrily

Python 3.0 usage?

2010-02-17 Thread Philip Semanchuk
Hi all, I'm the author of an extension (posix_ipc) that works under Python 2.4 - 2.6. I have a version that works under Python 2.4-2.6 and 3.1 and I would like to release it, but it doesn't work under Python 3.0. I could hack up Python 3.0-specific workarounds, but I'm not sure it's worth

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Carl Banks
On Feb 17, 10:39 am, John Bokma wrote: > Jonathan Gardner writes: > > Then I looked at a stack trace from a different programming language > > with lots of anonymous functions. (I believe it was perl.) > > > I became enlightened. > > If it was Perl [1], I doubt it. Because line numbers are report

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steve Howell
On Feb 16, 4:19 pm, Jonathan Gardner wrote: > On Feb 16, 11:41 am, Andrej Mitrovic > wrote: > > > > > On Feb 16, 7:38 pm, Casey Hawthorne > > wrote: > > > > Interesting talk on Python vs. Ruby and how he would like Python to > > > have just a bit more syntactic flexibility. > > > >http://blog.ex

Re: Traversing through variable-sized lists

2010-02-17 Thread Andrej Mitrovic
On Feb 17, 11:56 pm, Dave Angel wrote: > Andrej Mitrovic wrote: > > On Feb 17, 8:24 pm, John Posner wrote: > > >> On 2/17/2010 1:10 PM, Andrej Mitrovic wrote: > > >> > > > However the values list might have an uneven number of items. I would > > like to make it as evenly distributed as possible,

Re: Wrap and intercept function calls

2010-02-17 Thread alex23
Terry Reedy wrote: > Now wrap *every* function you are interested in. Builtin functions are > no problem; methods of builtin classes cannont be wrapped without > subclassing. It's a shame it's not possible to do: type.__call__ = func_wrap(type.__call__) Or even: type.__class__ = NewTyp

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steve Howell
On Feb 17, 5:39 pm, Steven D'Aprano wrote: > On Wed, 17 Feb 2010 17:04:00 -0800, Jonathan Gardner wrote: > > (What the heck is a procedure, anyway? Is this different from a > > subroutine, a method, or a block?) > > The name is used in Pascal, which probably means it originated from > Fortran or A

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread John Bokma
Steven D'Aprano writes: > On Wed, 17 Feb 2010 12:39:30 -0600, John Bokma wrote: [..] >> If it was Perl [1], I doubt it. Because line numbers are reported, and >> if that doesn't help you, you can annotate anonymous functions with a >> nick name using >> >> local *__ANON__ = 'nice name'; > [..

Re: Wrap and intercept function calls

2010-02-17 Thread geremy condra
On Wed, Feb 17, 2010 at 11:04 AM, Dan Yamins wrote: > Really, nobody has any idea about this?   (Sorry to repost.) > > On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins wrote: >> >> Hi: >> >> I'm wondering what the best way to wrap and modify function calls is. >> Essentially what I want to achieve is

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 17:04:00 -0800, Jonathan Gardner wrote: > (What the heck is a procedure, anyway? Is this different from a > subroutine, a method, or a block?) The name is used in Pascal, which probably means it originated from Fortran or Algol. A subroutine is a generic piece of code which

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 17:13:23 -0800, Jonathan Gardner wrote: > And once you realize that every program is really a compiler, then you > have truly mastered the Zen of Programming in Any Programming Language > That Will Ever Exist. In the same way that every tool is really a screwdriver. -- Stev

Re: Which mock library do you prefer?

2010-02-17 Thread Ben Finney
Lacrima writes: > Right, isolation [of test cases] is essential. But I can't decide to > which extent I should propagate isolation. You used “propagate” in a sense I don't understand there. > For example, in "Python Testing: Beginner's Guide" by Daniel Arbuckle, > author suggests that if you do

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Rhodri James
On Thu, 18 Feb 2010 01:04:00 -, Jonathan Gardner wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: > Also, lambda's are expressions, not statements ... Is such a distinction Py

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Jonathan Gardner
On Feb 16, 3:48 pm, Imaginationworks wrote: > Hi, > > I am trying to read object information from a text file (approx. > 30,000 lines) with the following format, each line corresponds to a > line in the text file.  Currently, the whole file was read into a > string list using readlines(), then use

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 12:39:30 -0600, John Bokma wrote: > Jonathan Gardner writes: > >> Then I looked at a stack trace from a different programming language >> with lots of anonymous functions. (I believe it was perl.) >> >> I became enlightened. > > If it was Perl [1], I doubt it. Because line n

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: > In message <60b1abce-4381-46ab-91ed- > > f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: > > Also, lambda's are expressions, not statements ... > > Is such a distinction Pythonic, or not? For example, does Python distinguish > be

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: > In message > <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, > > Jonathan Gardner wrote: > > I used to think anonymous functions (AKA blocks, etc...) would be a > > nice feature for Python. > > > Then I looked at a stack trace

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 10:39 am, John Bokma wrote: > Jonathan Gardner writes: > > Then I looked at a stack trace from a different programming language > > with lots of anonymous functions. (I believe it was perl.) > > > I became enlightened. > > If it was Perl [1], I doubt it. Because line numbers are report

Re: string to list when the contents is a list

2010-02-17 Thread Ben Finney
Wes James writes: > I have been trying to create a list form a string. The string will be > a list (this is the contents will look like a list). i.e. "[]" or > "['a','b']" Pulling back to ask about the larger problem: Are you trying to create Python data structures from a serialised representa

Re: string to list when the contents is a list

2010-02-17 Thread Matt McCredie
Wes James gmail.com> writes: > > I have been trying to create a list form a string. The string will be > a list (this is the contents will look like a list). i.e. "[]" or > "['a','b']" > > The "[]" is simple since I can just check if value == "[]" then return [] > > But with "['a','b']" I ha

Re: string to list when the contents is a list

2010-02-17 Thread Steven D'Aprano
On Thu, 18 Feb 2010 00:13:05 +, Rhodri James wrote: > On Wed, 17 Feb 2010 23:48:38 -, Wes James > wrote: > >> I have been trying to create a list form a string. The string will be >> a list (this is the contents will look like a list). i.e. "[]" or >> "['a','b']" > > If your string is

Re: Which mock library do you prefer?

2010-02-17 Thread Mark Lawrence
Phlip wrote: On Feb 17, 6:26 am, Lacrima wrote: Right, isolation is essential. Please read my reply: Ben is well intentioned but completely wrong here. Mock abuse will not cure the runtime isolation problem. I believe that Ben is perfectly correct, and that you are talking at cross purp

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Thu, 18 Feb 2010 11:46:52 +1300, Lawrence D'Oliveiro wrote: > In message , cjw wrote: > >> Aren't lambda forms better described as function? > > Is this a function? > > lambda : None > > What about this? > > lambda : sys.stdout.write("hi there!\n") Of course they are; the first is

Re: string to list when the contents is a list

2010-02-17 Thread Rhodri James
On Wed, 17 Feb 2010 23:48:38 -, Wes James wrote: I have been trying to create a list form a string. The string will be a list (this is the contents will look like a list). i.e. "[]" or "['a','b']" If your string is trusted (i.e. goes nowhere near a user), just eval() it. -- Rhodri Jame

Re: Wrap and intercept function calls

2010-02-17 Thread Dan Yamins
> For CPython, alternative 1 is to create a custom interpreter to change > (wrap) the interpretation of the call-function bytecode in the ceval loop. > That is its 'call event', and I believe this would catch every explicit > f(args) call and only such calls. > > > Python has no general metasynta

Re: string to list when the contents is a list

2010-02-17 Thread Vlastimil Brom
2010/2/18 Wes James : > I have been trying to create a list form a string.  The string will be > a list (this is the contents will look like a list).  i.e. "[]" or > "['a','b']" > > The "[]" is simple since I can just check if value == "[]" then return [] > > But with "['a','b']" I have tried and g

Re: error trying to join #python on irc.freenode.net

2010-02-17 Thread Wes James
On Wed, Feb 17, 2010 at 4:53 PM, Wes James wrote: > When I try to join #python on irc.freenode.net it keeps saying: > > You need to identify with network services to join the room "#python" > on "irc.freenode.net". > > Server Details: > Cannot join channel (+r) - you need to be identified with ser

error trying to join #python on irc.freenode.net

2010-02-17 Thread Wes James
When I try to join #python on irc.freenode.net it keeps saying: You need to identify with network services to join the room "#python" on "irc.freenode.net". Server Details: Cannot join channel (+r) - you need to be identified with services What does this mean? thx, -wes -- http://mail.python.

string to list when the contents is a list

2010-02-17 Thread Wes James
I have been trying to create a list form a string. The string will be a list (this is the contents will look like a list). i.e. "[]" or "['a','b']" The "[]" is simple since I can just check if value == "[]" then return [] But with "['a','b']" I have tried and get: a="['a','b']" b=a[1:-1].spli

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Imaginationworks
On Feb 17, 1:40 pm, Paul McGuire wrote: > On Feb 16, 5:48 pm, Imaginationworks wrote: > > > Hi, > > > I am trying to read object information from a text file (approx. > > 30,000 lines) with the following format, each line corresponds to a > > line in the text file.  Currently, the whole file was

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Ben Finney
Lawrence D'Oliveiro writes: > In message , cjw wrote: > > > Aren't lambda forms better described as function? > > Is this a function? > > lambda : None > > What about this? > > lambda : sys.stdout.write("hi there!\n") They are both lambda forms in Python. As a Python expression, they eva

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Terry Reedy
On 2/17/2010 5:46 PM, Lawrence D'Oliveiro wrote: In message, cjw wrote: Aren't lambda forms better described as function? Is this a function? lambda : None What about this? lambda : sys.stdout.write("hi there!\n") To repeat: Python lambda expressions evaluate to function object

Re: Traversing through variable-sized lists

2010-02-17 Thread Dave Angel
Andrej Mitrovic wrote: On Feb 17, 8:24 pm, John Posner wrote: On 2/17/2010 1:10 PM, Andrej Mitrovic wrote: However the values list might have an uneven number of items. I would like to make it as evenly distributed as possible, e.g.: values =-2, -1, 0] frames =obj1, obj2, obj3, obj4,

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message , cjw wrote: > Aren't lambda forms better described as function? Is this a function? lambda : None What about this? lambda : sys.stdout.write("hi there!\n") -- http://mail.python.org/mailman/listinfo/python-list

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-17 Thread sjdevn...@yahoo.com
On Feb 17, 2:35 am, Steven D'Aprano wrote: > On Tue, 16 Feb 2010 21:09:27 -0800, John Nagle wrote: > >     Yes, we're now at the point where all the built-in mutable types > > have "frozen" versions.  But we don't have that for objects.  It's > > generally considered a good thing in language desig

Re: Referring to class methods in class attributes

2010-02-17 Thread Mark Lawrence
Ben Finney wrote: Bruno Desthuilliers writes: Mmmm... Let's try to explain the whole damn thing. It's really (and IMHO beautifully) simple once you get it, but I agree it's a bit peculiar when compared to most mainstream OO languages. […] Bruno, that's the first time I've understood the desc

Re: MediaWiki to RTF/Word/PDF

2010-02-17 Thread John Bokma
Josh English writes: > I have several pages exported from a private MediaWiki that I need to > convert to a PDF document, or an RTF document, or even a Word > document. > > So far, the only Python module I have found that parses MediaWiki > files is mwlib, which only runs on Unix, as far as I can

Re: Referring to class methods in class attributes

2010-02-17 Thread Ben Finney
Bruno Desthuilliers writes: > Mmmm... Let's try to explain the whole damn thing. It's really (and > IMHO beautifully) simple once you get it, but I agree it's a bit > peculiar when compared to most mainstream OO languages. […] Bruno, that's the first time I've understood the descriptor protocol,

Re: Referring to class methods in class attributes

2010-02-17 Thread Bruno Desthuilliers
John Posner a écrit : > On 2/17/2010 2:44 PM, Bruno Desthuilliers wrote: >> > Very nice writeup, Bruno -- thanks! > > >> >> >> def __call__(self, *args, **kw): >> # XXX : all sanity checks removed for readability >> if self.im_self: >> args = (self.im_func,

Re: mixins and new style classes

2010-02-17 Thread Bruno Desthuilliers
mk a écrit : class Person(object): > ... pass > ... class Friendly(object): > ... def hello(self): > ... print 'hello' > ... Person.__bases__ += (Friendly,) > Traceback (most recent call last): > File "", line 1, in > TypeError: Cannot create a consistent

Re: Referring to class methods in class attributes

2010-02-17 Thread Arnaud Delobelle
Bruno Desthuilliers writes: [...] > class Foo(object): > def bar(self): > return "baaz" > > print Foo.__dict__.keys() > print type(Foo.__dict__['bar']) > > > So, why is it that type(Foo.bar) != type(Foo.__dict__['bar']) ? The > answer is : attribute lookup rules and the descriptor pro

Re: MediaWiki to RTF/Word/PDF

2010-02-17 Thread Shashwat Anand
why not try installing cygwin. I am just guessing though but I had heard it emulates *nix decently on windows. Or a better idea is to shift to *nix ;) On Thu, Feb 18, 2010 at 2:30 AM, Josh English wrote: > I have several pages exported from a private MediaWiki that I need to > convert to a PDF do

MediaWiki to RTF/Word/PDF

2010-02-17 Thread Josh English
I have several pages exported from a private MediaWiki that I need to convert to a PDF document, or an RTF document, or even a Word document. So far, the only Python module I have found that parses MediaWiki files is mwlib, which only runs on Unix, as far as I can tell. I'm working on Windows here

Re: Over(joy)riding

2010-02-17 Thread Bruno Desthuilliers
mk a écrit : > Bruno Desthuilliers wrote: >> mk a écrit : >>> P.S. Method resolution order in Python makes me want to kill small >>> kittens. >> >> mro is only a "problem" when using MI. > > Oh sure! And I have the impression that multiple inheritance is not used > all that often. What (some) Pyth

Re: Referring to class methods in class attributes

2010-02-17 Thread John Posner
On 2/17/2010 2:44 PM, Bruno Desthuilliers wrote: Mmmm... Let's try to explain the whole damn thing. It's really (and IMHO beautifully) simple once you get it, but I agree it's a bit peculiar when compared to most mainstream OO languages. Very nice writeup, Bruno -- thanks! class method(ob

Re: Wrap and intercept function calls

2010-02-17 Thread Terry Reedy
On 2/17/2010 11:04 AM, Dan Yamins wrote: Really, nobody has any idea about this? (Sorry to repost.) On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins mailto:dyam...@gmail.com>> wrote: Hi: I'm wondering what the best way to wrap and modify function calls is.Essentially what I want

Re: Traversing through variable-sized lists

2010-02-17 Thread Andrej Mitrovic
On Feb 17, 8:24 pm, John Posner wrote: > On 2/17/2010 1:10 PM, Andrej Mitrovic wrote: > > > > > Hi, > > > I couldn't figure out a better description for the Subject line, but > > anyway, I have the following: > > > _num_frames = 32 > > _frames = range(0, _num_frames) # This is a list of actual obj

Re: Referring to class methods in class attributes

2010-02-17 Thread Bruno Desthuilliers
mk a écrit : > Stephen Hansen wrote: > >> You don't have to (and can't) refer to the class within the body. >> Class statements are sort of... odd. They are code which is directly >> executed, and the results are then passed into a >> metaclass/type/whatever and a class object is created. While wi

Re: How to build a list of all modules in standard library?

2010-02-17 Thread Terry Reedy
On 2/17/2010 9:57 AM, pyt...@bdurham.com wrote: We're building a py2exe executable that may need to do some dynamic module imports. I'm looking for suggestions on how we can mechanically generate a list of standard library modules/packages to make sure our build has the full set of Python 2.6.4 l

Re: Is automatic reload of a module available in Python?

2010-02-17 Thread Terry Reedy
On 2/17/2010 9:27 AM, R (Chandra) Chandrasekhar wrote: Dear Folks, I am currently developing a python program, let us call it "generic.py", and I am testing out the functions therein by testing them out interactively in the python interpreter by invoking python and doing import generic Once I

Re: Python version of perl's "if (-T ..)" and "if (-B ...)"?

2010-02-17 Thread Hrvoje Niksic
Tim Chase writes: > if portion is None: > content = iter(f) iter(f) will iterate over lines in the file, which doesn't fit with the rest of the algorithm. Creating an iterator that iterates over fixed-size file chunks (in this case of length 1) is where the two-argument form of iter c

Re: Over(joy)riding

2010-02-17 Thread Terry Reedy
On 2/17/2010 8:53 AM, mk wrote: Found in Dive into Python: """Guido, the original author of Python, explains method overriding this way: "Derived classes may override methods of their base classes. Because methods have no special privileges when calling other methods of the same object, a method

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Terry Reedy
On 2/17/2010 1:51 PM, cjw wrote: On 17-Feb-10 05:48 AM, Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction P

Re: plugin / intra process communication system

2010-02-17 Thread Diez B. Roggisch
IMHO the ones using interfaces usually immediatly implement them for some cases - so you actually get the interface for you authentication framework, and also implement an OpenID plugin for it. And this forms one package. Then you can add new packages that implement other things. So if I want to

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Paul McGuire
On Feb 16, 5:48 pm, Imaginationworks wrote: > Hi, > > I am trying to read object information from a text file (approx. > 30,000 lines) with the following format, each line corresponds to a > line in the text file.  Currently, the whole file was read into a > string list using readlines(), then use

Re: Traversing through variable-sized lists

2010-02-17 Thread Peter Otten
Andrej Mitrovic wrote: > Hi, > > I couldn't figure out a better description for the Subject line, but > anyway, I have the following: > > _num_frames = 32 > _frames = range(0, _num_frames) # This is a list of actual objects, > I'm just pseudocoding here. > _values = [0, 1, 2, 3, 4] > > I want t

Re: Traversing through variable-sized lists

2010-02-17 Thread John Posner
On 2/17/2010 1:10 PM, Andrej Mitrovic wrote: Hi, I couldn't figure out a better description for the Subject line, but anyway, I have the following: _num_frames = 32 _frames = range(0, _num_frames) # This is a list of actual objects, I'm just pseudocoding here. _values = [0, 1, 2, 3, 4] I want

Re: Traversing through variable-sized lists

2010-02-17 Thread Wolfram Hinderer
On 17 Feb., 19:10, Andrej Mitrovic wrote: > Hi, > > I couldn't figure out a better description for the Subject line, but > anyway, I have the following: > > _num_frames = 32 > _frames = range(0, _num_frames) # This is a list of actual objects, > I'm just pseudocoding here. > _values = [0, 1, 2, 3,

Re: Traversing through variable-sized lists

2010-02-17 Thread Peter Pearson
On Wed, 17 Feb 2010 10:10:37 -0800 (PST), Andrej Mitrovic wrote: [snip] > _num_frames = 32 > _frames = range(0, _num_frames) # This is a list of actual objects, > I'm just pseudocoding here. > _values = [0, 1, 2, 3, 4] > > I want to call a function of _frames for each frame with a _values > argumen

Re: Traversing through variable-sized lists

2010-02-17 Thread Matt McCredie
> I've tried the following workaround, but it often gives me inaccurate > results (due to integer division), so I had to add a safety check: > > num_frames = 32 > values = [0, 1, 2, 3, 4] > offset_step = num_frames / len(values) > for index in xrange(0, num_frames): > offset = index /

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread cjw
On 17-Feb-10 05:48 AM, Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction Pythonic, or not? Python is (by d

Re: Referring to class methods in class attributes

2010-02-17 Thread Jean-Michel Pichavant
mk wrote: Stephen Hansen wrote: You don't have to (and can't) refer to the class within the body. Class statements are sort of... odd. They are code which is directly executed, and the results are then passed into a metaclass/type/whatever and a class object is created. While within the clas

Re: Referring to class methods in class attributes

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 10:38 AM, mk wrote: > Thanks, that worked. But in order to make it work I had to get rid of > 'self' in print_internal_date signature, bc all other functions in tagdata > have only a single argument: > Right, I should have caught that. You can make print_internal_date a

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread John Bokma
Jonathan Gardner writes: > Then I looked at a stack trace from a different programming language > with lots of anonymous functions. (I believe it was perl.) > > I became enlightened. If it was Perl [1], I doubt it. Because line numbers are reported, and if that doesn't help you, you can annotate

Re: Timer

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 10:14 AM, Victor Subervi wrote: > Obviously, the removeCSS isn't going to work in that last line. What can I > put there to remove the splash page after 5 seconds? > Even though you're generating this with python, it doesn't have anything to do with Python. You'll have to

Re: Referring to class methods in class attributes

2010-02-17 Thread mk
Stephen Hansen wrote: You don't have to (and can't) refer to the class within the body. Class statements are sort of... odd. They are code which is directly executed, and the results are then passed into a metaclass/type/whatever and a class object is created. While within the class body, the

Re: Timer

2010-02-17 Thread Dotan Cohen
> What can I > put there to remove the splash page after 5 seconds? > Javascript. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il Please CC me if you want to be sure that I read your message. I do not read all list mail. -- http://mail.python.org/mailman/listinfo/python-list

Re: Timer

2010-02-17 Thread Gabriel
On Wed, Feb 17, 2010 at 3:14 PM, Victor Subervi wrote: > Hi; > I have the following css: > > .splash { position:absolute; left:0px; top:0px; z-index:2 } > .page { position:absolute; left:0px; top:0px; z-index:1 } > .text {  font-family: Arial, Helvetica, sans-serif; font-size: 16px; > text-decora

Timer

2010-02-17 Thread Victor Subervi
Hi; I have the following css: .splash { position:absolute; left:0px; top:0px; z-index:2 } .page { position:absolute; left:0px; top:0px; z-index:1 } .text { font-family: Arial, Helvetica, sans-serif; font-size: 16px; text-decoration: none; text-align: justify} and the following python: if ne

Traversing through variable-sized lists

2010-02-17 Thread Andrej Mitrovic
Hi, I couldn't figure out a better description for the Subject line, but anyway, I have the following: _num_frames = 32 _frames = range(0, _num_frames) # This is a list of actual objects, I'm just pseudocoding here. _values = [0, 1, 2, 3, 4] I want to call a function of _frames for each frame wi

mixins and new style classes

2010-02-17 Thread mk
>>> class Person(object): ... pass ... >>> class Friendly(object): ... def hello(self): ... print 'hello' ... >>> >>> Person.__bases__ += (Friendly,) Traceback (most recent call last): File "", line 1, in TypeError: Cannot create a consistent method resolution order (MRO) fo

Re: Referring to class methods in class attributes

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 9:38 AM, mk wrote: > It works. But if I'd like to def print_internal_date in PYFileInfo body > like so: > > class PYFileInfo(FileInfo): >'python file properties' > >def print_internal_date(self, filename): >f = open(filename + 'c', "rb") >data = f.r

Referring to class methods in class attributes

2010-02-17 Thread mk
Hello everyone, OK so I have this: def print_internal_date(filename): f = open(filename + 'c', "rb") data = f.read(8) mtime = struct.unpack("It works. But if I'd like to def print_internal_date in PYFileInfo body like so: class PYFileInfo(FileInfo): 'python file properties'

Re: Over(joy)riding

2010-02-17 Thread mk
Kurt Smith wrote: In case you're not familiar with it, MI allows you to have mixins & traits. They work very well if the mixin superclasses don't have any clashes with the other superclasses, so each mixin adds its own unique set of methods to the derived class. Then you don't have to worry ab

Re: The future of "frozen" types as the number of CPU cores increases

2010-02-17 Thread John Nagle
Daniel Stutzbach wrote: On Tue, Feb 16, 2010 at 3:15 PM, John Nagle wrote: One possible implementation would be to have unfrozen objects managed by reference counting and locking as in CPython. Frozen objects would live in a different memory space and be garbage collected by a concurrent garb

Re: Which mock library do you prefer?

2010-02-17 Thread Phlip
Lacrima wrote: > I run my tests all the time (they almost replaced debugger in my IDE). > But there are times, when I can't just run tests after 1-3 lines of > code. ... > Maybe it's not proper TDD You are still being too literal. The "1-3 lines of code" guideline is a guideline, not a rule. It m

Re: Recommendations for cloud based file storage service with Python API?

2010-02-17 Thread Robert Kern
On 2010-02-17 09:10 AM, pyt...@bdurham.com wrote: I'm looking for recommendations on a cloud based file storage service with a Python API. Would appreciate hearing feedback from anyone using Python to interface to Amazon S3, RackSpace Cloud Files, Microsoft Azure, Rsync.net, or other hosted file

Re: Wrap and intercept function calls

2010-02-17 Thread Dan Yamins
Really, nobody has any idea about this? (Sorry to repost.) On Tue, Feb 16, 2010 at 7:29 PM, Dan Yamins wrote: > Hi: > > I'm wondering what the best way to wrap and modify function calls is. > Essentially what I want to achieve is to have a function like this: > > def Wrap(frame,event,arg): >

Re: Over(joy)riding

2010-02-17 Thread Kurt Smith
On Wed, Feb 17, 2010 at 9:08 AM, mk wrote: > Bruno Desthuilliers wrote: >> >> mk a écrit : >>> >>> P.S. Method resolution order in Python makes me want to kill small >>> kittens. >> >> mro is only a "problem" when using MI. > > Oh sure! And I have the impression that multiple inheritance is not us

Re: Is automatic reload of a module available in Python?

2010-02-17 Thread Jean-Michel Pichavant
R (Chandra) Chandrasekhar wrote: Dear Folks, I am currently developing a python program, let us call it "generic.py", and I am testing out the functions therein by testing them out interactively in the python interpreter by invoking python and doing import generic Once I hit an error, I ne

Recommendations for cloud based file storage service with Python API?

2010-02-17 Thread python
I'm looking for recommendations on a cloud based file storage service with a Python API. Would appreciate hearing feedback from anyone using Python to interface to Amazon S3, RackSpace Cloud Files, Microsoft Azure, Rsync.net, or other hosted file storage service. What services do you recommend or

Re: Over(joy)riding

2010-02-17 Thread mk
Bruno Desthuilliers wrote: mk a écrit : P.S. Method resolution order in Python makes me want to kill small kittens. mro is only a "problem" when using MI. Oh sure! And I have the impression that multiple inheritance is not used all that often. What (some) Python code I've read in open sourc

How to build a list of all modules in standard library?

2010-02-17 Thread python
We're building a py2exe executable that may need to do some dynamic module imports. I'm looking for suggestions on how we can mechanically generate a list of standard library modules/packages to make sure our build has the full set of Python 2.6.4 libraries. We're planning on creating a module ca

Re: Is automatic reload of a module available in Python?

2010-02-17 Thread Arnaud Delobelle
"R (Chandra) Chandrasekhar" writes: > Dear Folks, > > I am currently developing a python program, let us call it > "generic.py", and I am testing out the functions therein by testing > them out interactively in the python interpreter by invoking python > and doing > > import generic > > Once I hi

Re: Over(joy)riding

2010-02-17 Thread Bruno Desthuilliers
mk a écrit : P.S. Method resolution order in Python makes me want to kill small kittens. mro is only a "problem" when using MI. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Imaginationworks
On Feb 16, 7:14 pm, Gary Herron wrote: > Imaginationworks wrote: > > Hi, > > > I am trying to read object information from a text file (approx. > > 30,000 lines) with the following format, each line corresponds to a > > line in the text file.  Currently, the whole file was read into a > > string l

Re: Over(joy)riding

2010-02-17 Thread mk
Arnaud Delobelle wrote: Is what I concocted in e.calling_overriden() == what Guido said on base class sometimes calling overriden method instead of its own original method? Yes! For a change I achieved resounding success with Python. :-) P.S. Method resolution order in Python makes me want t

Is automatic reload of a module available in Python?

2010-02-17 Thread R (Chandra) Chandrasekhar
Dear Folks, I am currently developing a python program, let us call it "generic.py", and I am testing out the functions therein by testing them out interactively in the python interpreter by invoking python and doing import generic Once I hit an error, I need to revise my file and reload the

Re: Which mock library do you prefer?

2010-02-17 Thread Lacrima
On Feb 16, 10:30 pm, Ben Finney wrote: > Lacrima writes: > > And I have already refused to write totally isolated tests, because it > > looks like a great waste of time. > > It only looks like that until you chase your tail in a long, fruitless > debugging session because (you later realise) the

Re: Over(joy)riding

2010-02-17 Thread Arnaud Delobelle
mk writes: > Found in Dive into Python: > > """Guido, the original author of Python, explains method overriding > this way: "Derived classes may override methods of their base > classes. Because methods have no special privileges when calling other > methods of the same object, a method of a base

Re: listing existing windows services with python

2010-02-17 Thread Tim Golden
On 16/02/2010 13:51, Alf P. Steinbach wrote: It doesn't seem to provide ordinary Windows "service"s, but it's a bit unclear since e.g. the URL above says [... snip ...] Well the useful info in there appears to come from: http://msdn.microsoft.com/en-us/library/aa392783%28VS.85%29.aspx Look

Re: Shipping Executables

2010-02-17 Thread rodmc
> > Hi Rod, > > The user's ability to hack into the code is usually considered one of > > the strengths of Python & open source software in general. Since most > > Python software that's distributed  is open source, you're doing > > something different than most. It'd help if you explain how you w

  1   2   >