Re: scoping problem with list comprehension // learning Python

2009-05-21 Thread Diez B. Roggisch
Adrian Dragulescu schrieb: I just started to learn python (first posting to the list). I have a list of dates as strings that I want to convert to a list of datetime objects. Here is my debugging session from inside a method. (Pdb) formatIndex '%Y-%m-%d' (Pdb) [datetime.strptime(i, formatI

Re: Extending C++ class in python

2009-05-24 Thread Diez B. Roggisch
nazia schrieb: Hi all, I'm a newbie in Python and need help. Can anyone help me by explaining the steps of extending a C++ class in Python with a simple example? I'm not interested to use SWIG like tools. Thanks for your time. If your are not interested in using the tools provided for this task

Re: formating query with empty parameter

2009-05-25 Thread Diez B. Roggisch
__insert(self, data): > query = """ > BEGIN; > INSERT INTO table > (a, b, c, d, e, f, g) > VALUES > (%s, %s, %s, %s, %s, %s, %s); > COMMIT; >

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
enzo michelangeli schrieb: Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Paul Rudin wrote: > "Diez B. Roggisch" writes: > >> enzo michelangeli schrieb: >>> Let's suppose I want to create a list of n functions of a single >>> argument, returning the sum between argument and index in the list, so >>> that e.g.: &g

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Arnaud Delobelle wrote: > "Diez B. Roggisch" writes: > >> You need to capture n into the closure of the lambda: >> >> f = [lambda x, n=n: x+j for j in xrange(n)] > > You mean [lambda x, j=j: x+j for j in xrange(n)] Ah, sorry, parentheses-problem. D

Re: What is the difference between init and enter?

2009-05-26 Thread Diez B. Roggisch
John wrote: > I'm okay with init, but it seems to me that enter is redundant since it > appears that anything you want to execute in enter can be done in init. About what are you talking? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: DB-API execute params, am I missing something?

2009-05-26 Thread Diez B. Roggisch
Gabriel Rossetti wrote: > Hello everyone, I am trying to use dbapi with mysql and I get this error: > > Traceback (most recent call last): > File "", line 1, in > File "", line 2, in getUnitParams > File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 151, > in execute > q

Re: DB-API execute params, am I missing something?

2009-05-27 Thread Diez B. Roggisch
Lawrence D'Oliveiro wrote: > In message , Dennis > Lee Bieber wrote: > >> Notice that db.literal() call? That's part of the mechanism used to >> escape and quote parameters -- it only returns strings that are safe for >> insertion into the SQL statement. > > Does it deal with "like"-wildcards?

Re: AOPython Question

2009-05-29 Thread Diez B. Roggisch
Roastie schrieb: I installed the AOPython module: % easy_install aopython That left an aopython-1.0.3-py2.6.egg at C:\mystuff\python\python_2.6.2\Lib\site-packages. I entered the interpreter: import aopython All is well. But I was uncomfortable, since I was used to seeing directories

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-02 Thread Diez B. Roggisch
Joseph Garvin schrieb: So I was curious whether it's possible to use the ctypes module with C++ and if so how difficult it is. I figure in principal it's possible if ctypes knows about each compiler's name mangling scheme. So I searched for "ctypes c++" on Google. The third link will be "Using c

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Diez B. Roggisch
A. Cavallo schrieb: Mmmm, not really a conspiracy but it is not that trivial In wrapping c++ you might find useful the commands nm with c++filt although they work under linux there is the same pair for every platform (under windows I remember there is objdump): they should only you need to

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread Diez B. Roggisch
Esmail wrote: > Hi all, > > I am trying to visualize a number of small objects moving over > a 2D surface during run-time. I was wondering what would the easiest > way to accomplish this using Python? Ideally I am looking for a shallow > learning curve and efficient implementation :-) > > These

Re: private pypi repository

2009-06-03 Thread Diez B. Roggisch
Aljosa Mohorovic wrote: > i'm looking for a effective way to setup private pypi repository, i've > found: > - PloneSoftwareCenter > - http://code.google.com/p/pypione/ > - http://pypi.python.org/pypi/haufe.eggserver > > what are you using? what would you recommend? We use eggbasket [1], in an ac

Re: frameword vs application server?

2008-05-12 Thread Diez B. Roggisch
walterbyrd schrieb: Can somebody help me understand the difference? Not just where Python is concerned, but in general? As I understand it, an application server is supposed to be a great help in developing apps, because most of the business logic is already there. It seems to me that, usually w

Re: Removing option from optparse

2008-05-12 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hello, I'm trying to figure out if the following is a bug or if I'm using the remove_option in the wrong way. #!/usr/bin/env python import optparse parser = optparse.OptionParser() parser.add_option("--test", help="This is a test option") parser.remove_option('--test'

Re: buffering choking sys.stdin.readlines() ?

2008-05-12 Thread Diez B. Roggisch
cshirky schrieb: Newbie question: I'm trying to turn a large XML file (~7G compressed) into a YAML file, and my program seems to be buffering the input. IOtest.py is just import sys for line in sys.stdin.readlines(): print line but when I run $ gzcat bigXMLfile.gz | IOtest.py but it

Re: downloading a link with javascript in it..

2008-05-12 Thread Diez B. Roggisch
Jetus schrieb: I am able to download this page (enclosed code), but I then want to download a pdf file that I can view in a regular browser by clicking on the "view" link. I don't know how to automate this next part of my script. It seems like it uses Javascript. The line in the page source says

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
Dave Parker wrote: > On May 12, 7:20 pm, [EMAIL PROTECTED] wrote: >>Yes, I am trying to visualize something. > > If it is related to making furniture comfortable for humans, have you > considered painting the furniture with thermochromic paint ( > http://en.wikipedia.org/wiki/Thermochromism )? I

Re: array in class

2008-05-13 Thread Diez B. Roggisch
alefajnie wrote: > class A: >this_is_original_variable_only_for_one_inctance = 0 > >def __init__(self, v): >self.this_is_original_variable_only_for_one_inctance = v > > > class B: > this_is_common_for_all_instances = []

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
Dave Parker wrote: >> Don't let yourself be irritated by castironpi > > I'm not the sort to get irritated by anyone. There is value in all > interaction. Flaming Thunder is itself the averaging of interactions > with many computer languages and conversations with many people, so as > to create

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
> Also, several users have rewritten their Python programs in Flaming > Thunder, and found that Flaming Thunder was 5 to 10 times faster > (Flaming Thunder compiles to native executables). So again, since > many people value their time at more than $0, I think that many people > will find that Fla

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
> True. But in Python, you don't see statically-linked pure-syscall CGI > scripts being cross-compiled under Windows for ftp'ing up to a Linux > server. And you don't see the speed of pure assembly language > libraries. And I'll be willing to bet that Flaming Thunder will have > OO features simi

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
> This shows how much you don't know about customers, and their needs. A > customer gives a s**t about 5-10 times faster sites. They care if it is > *fast enough*, but beyond that they don't bother. But what *always* > bothers them is development time & flexibility. Because that directly > affects

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
> then I think the comparison moves beyond a matter of taste into the > realm of measurable ease-of-use. Oh, would you please additionally comment on the ease of use of FT in the domain of string-manipulation, regular expressions, collection datatypes? I'm keen to know which 5-10 times faster FT

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
Dave Parker schrieb: Who has conducted the research that supports that statement? And since when is ^ the better operator for "to the power of" that **? Because latex uses it? I need to see the elementary school students who use that... All of the calculators and textbooks that elementary schoo

Re: Python and Flaming Thunder

2008-05-13 Thread Diez B. Roggisch
Dave Parker schrieb: Just to support this statement: PHP runs an order of magnitude slower than python. Yet a great deal (if not the majority) of dynamic sites out there run under PHP. All of these are unhappy customers? The websites owners might not be unhappy, but lots of customers complain a

Re: built in list generator?

2008-05-13 Thread Diez B. Roggisch
globalrev schrieb: if i want a list with all numbers between x and y is there a way to do this with an inbult function. i mean i can always construct a function to do this but is there soemthing like: nbrs = list(range(50,100, 2)) range *does* that. use xrange if all you want is to iterate.

Re: Why can't I import this?

2008-05-13 Thread Diez B. Roggisch
John Henry schrieb: Hi list, I can't understand this. The following import statement works fine: from PythonCard.templates.dialogs import runOptionsDialog but this one fails: from PythonCard.tools.codeEditor.codeEditor import CodeEditor I've checked and rechecked to make sure that t

Re: Why can't I import this?

2008-05-13 Thread Diez B. Roggisch
Thumper's dad always told him: If you don't have anything nice/useful/ garbage to say, then don't say noth'ng at all. You mean it's not useful to tell you - to give more information on *what* acutally goes wrong? - in the meantime, to look harder for your mistake, because it's unlikely to

Re: Python and Flaming Thunder

2008-05-14 Thread Diez B. Roggisch
>>> That's also a myth. For example, if C is easy to maintain, why is >>> Flaming Thunder the only single-asset 8-by-8 shotgun cross compiler in >>> the world? There should be lots of single-asset 8-by-8 shotgun cross >>> compilers written in C, if C is easier to maintain. >>Not only is it the wo

Re: Class Methods Vs Any Other Callable

2008-05-14 Thread Diez B. Roggisch
> An instance method works on the instance > A Static method is basically a function nested within a class object > A class method is overkill? If anything, a static method is overkill. See it this way: *if* you for some reason put a method into an enclosing context - isn't it worth having a refer

Re: Rename field in Access DB

2008-05-14 Thread Diez B. Roggisch
Iain King wrote: > I'm manipulating an MS Access db via ADODB with win32com.client. I > want to rename a field within a table, but I don't know how to. I > assume there is a line of SQL which will do it, but nothing I've tried > (from searching) has worked. > Basic code: > > import win32com.cli

Re: Class Methods Vs Any Other Callable

2008-05-14 Thread Diez B. Roggisch
> When I learned about static methods, I learned they're a way to > tightly couple some functionality with a class without tying the > functionality to any of the instances. I see them as nothing more than > a design decision. To me they make some sense. Which you can say exactly about classmethod

Re: Using file objects with elementtree

2008-05-14 Thread Diez B. Roggisch
dj schrieb: Hello, Rather then holding my XML document in memory before writing it to disk, I want to create a file object that elementtree will write each element to has it is created. Does any one know how to do that ? Here is my code so, far: fd = open("page.xml", "w") tree.write( fd, encod

Re: List behaviour

2008-05-15 Thread Diez B. Roggisch
Gabriel wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > tasks = [[]]*6 tasks > [[], [], [], [], [], []] tasks[0].append(1) tasks > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting to end up with was something like: > 

Re: TPCServer and xdrlib

2008-05-16 Thread Diez B. Roggisch
Did you consider gzipping your XML (or YAML) packets ? Would the transfer time be acceptable in this case ? That would add even more to the overhead of transcoding the transportlayer. Switching from XMLRPC to a json-based protocol reduced in a project of mine reduced the overhead 10-20fold -

Re: writing python extensions in assembly

2008-05-16 Thread Diez B. Roggisch
inhahe schrieb: Can anyone give me pointers/instructions/a template for writing a Python extension in assembly (or better, HLA)? You could write a C-extension and embed assembly. See the docs for how to write one. If you know how to implement a C-callingconvention-based shared library in asse

Re: TPCServer and xdrlib

2008-05-16 Thread Diez B. Roggisch
Henrique Dante de Almeida schrieb: On May 16, 9:26 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Did you consider gzipping your XML (or YAML) packets ? Would the transfer time be acceptable in this case ? That would add even more to the overhead of transcoding th

Re: writing python extensions in assembly

2008-05-16 Thread Diez B. Roggisch
inhahe schrieb: Well the problem is that I'm actually not an assembler guru, so I don't know how to implement a dll in asm or use a c calling convention, although I'm sure those instructions are available on the web. I was just afraid of trying to learn that AND making python-specific extensio

Re: writing python extensions in assembly

2008-05-16 Thread Diez B. Roggisch
inhahe schrieb: I like to learn what I need, but I have done assembly before, I wrote a terminal program in assembly for example, with ansi and avatar support. I'm just not fluent in much other than the language itself, per se. Perhaps C would be as fast as my asm would, but C would not allow

Re: writing python extensions in assembly

2008-05-18 Thread Diez B. Roggisch
Also, from the gcc manpage, apparently 387 is the default when compiling for 32 bit architectures, and using sse instructions is default on x86-64 architectures, but you can use -march=(some architecture with simd instructions), -msse, -msse2, -msse3, or -mfpmath=(one of 387, sse, or sse,387) to g

Re: waiting on an event blocks all signals

2008-05-18 Thread Diez B. Roggisch
alan schrieb: This ignores CTRL-C on every platform I've tested: python -c "import threading; threading.Event().wait()" ^C^C^C^C It looks to me like all signals are masked before entering wait(). Can someone familiar with the internals explain and/or justify this behavior? Thanks, They aren't

Re: Get all the instances of one class

2008-05-18 Thread Diez B. Roggisch
with gc.get_referrers() py> import gc py> class A(object): pass ... py> a,b,c = A(),A(),A() py> A py> for item in gc.get_referrers(A): print type(item) ... We need to filter that list, keeping only A's instances: py> [item for item in gc.get_referrers(A)

Re: Showing the method's class in expection's traceback

2008-05-18 Thread Diez B. Roggisch
Agustin Villena schrieb: Hi! is there anyway to show the class of a method in an exception's traceback? For example, the next code class Some(object): def foo(self,x): raise Exception(x) obj = Some() obj.foo("some arg") produces the next traceback Traceback (most recent call las

Re: "Disabling" raw string to print newlines

2008-05-19 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > *** > import urllib2 > import re > import string > import sys > > url = "http://www.macgyver.com/"; > request = urllib2.Request(url) > opener = urllib2.build_opener() > html = opener.open(request).read() > > match = re.compile("(.+)", re.DOTALL)

Re: Showing the method's class in expection's traceback

2008-05-19 Thread Diez B. Roggisch
> > That by itself is not enough, the method could be inherited; one should > walk the base classes in the MRO to find the right one. And deal with > classmethods and staticmethods. And decorators that don't preserve meta > information... Hmmm, I think it isn't so trivial as it seems. You might e

Re: Using Python for programming algorithms

2008-05-19 Thread Diez B. Roggisch
Roel Schroeven wrote: > Bruno Desthuilliers schreef: >> 1/ being interpreted or compiled (for whatever definition of these >> terms) is not a property of a language, but a property of an >> implementation of a language. >> >> 2/ actually, all known Python implementations compile to byte-code. >>

Re: printing class __dict__

2008-05-19 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > hi, > i am a newbie. so bear wth me > i wrote a program like this > -- > class H(object): > def __init__( self): > self.data =10 > def e ( self ): > pass > def f ( self ): > pass > > class H1(H): > x2 = 11 > def __init__(self): > self.x = 10 >

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
John Salerno wrote: > I posted this code last night in response to another thread, and after I > posted it I got to wondering if I had misused the list comprehension. > Here's the two examples: > > Example 1: > > def compress(s): > new = [] > > for c in s: >

Re: What is wrong with my Python threading?

2008-05-20 Thread Diez B. Roggisch
Chuckk Hubbard wrote: > #!/usr/bin/python > > #why doesn't this run both threads simultaneously? > #Thanks for any help. > #Chuckk Because you should call thread.start(). Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > John Salerno: >> What does everyone think about this? > > The Example 2 builds a list, that is then thrown away. It's just a > waste of memory (and time). No, it doesn't. It uses append because it refers to itself in the if-expression. So the append(c) is needed - and

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
Hrvoje Niksic wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >> [EMAIL PROTECTED] wrote: >> >>> John Salerno: >>>> What does everyone think about this? >>> >>> The Example 2 builds a list, that is then thro

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
Thomas Bellman wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >> [EMAIL PROTECTED] wrote: > >>> The Example 2 builds a list, that is then thrown away. It's just a >>> waste of memory (and time). > >> No, it doesn't

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
> That being said, I use that idiom myself. But I don't see anything wrong > with using a list-comp as loop-abbreviation. because that is it's actual > purpose. And also it is common in non-functional languages that l-values > aren't always assigned, if the aren't needed. It's the consequence of >

Re: Processing in Python

2008-05-20 Thread Diez B. Roggisch
Salvatore DI DI0 schrieb: Hello, The Processing Graphics language has been implemented in Javascript. No, it hasn't. Processing is written in Java. Does anybody tried to make this in Python ? There are similar projects, yet maybe not to the same level of integration. However, pygame + PyO

Re: Processing in Python

2008-05-20 Thread Diez B. Roggisch
Istvan Albert schrieb: On May 20, 6:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Salvatore DI DI0 schrieb: Hello, The Processing Graphics language has been implemented in Javascript. No, it hasn't. Processing is written in Java. He meant it has been re-impl

Re: scalable xml

2008-05-21 Thread Diez B. Roggisch
hyperboreean wrote: > Hi, I am writing the application server for a three-tier architecture > and sending the client's response in xml. My question is: is there a way > to build the xml dom in a more scalable way and faster way than just > creating every textNode and element for it? I have tons of

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > I have an if-elif chain in which I'd like to match a string against > several regular expressions. Also I'd like to use the match groups > within the respective elif... block. The C-like idiom that I would > like to use is this: > > if (match = my_re1.match(

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
(no offense) than the original idea which > would have worked if Python's assignment statement would double as > expression, as in C. Well, it's a design-decision - and I'm pretty ok with it being a bit verbose here - as it prevents a *great* deal of programming errors that would other

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 21, 3:12 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> On May 21, 1:47 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >> >> > Although that solution is pretty, it is not the canonical solution >> > because it doesn't cover the important case of "if" bodies

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> >> And wastes time. regular expressions can become expensive to match - >> doing it twice might be hurtful. >> >> Diez > > match = (my_re1.match(line) or my_re2.match(line)) or > my_re3.match(line) How do you know *which* of the three has matched then? Diez -- http:/

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 21, 4:09 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> >> >> And wastes time. regular expressions can become expensive to match - >> >> doing it twice might be hurtful. >

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Diez B. Roggisch
Mark Dickinson schrieb: On SuSE 10.2/Xeon there seems to be a rounding bug for floating-point addition: [EMAIL PROTECTED]:~> python Python 2.5 (r25:51908, May 25 2007, 16:14:04) [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more inf

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Diez B. Roggisch
Dave Parker schrieb: On May 21, 2:44 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: My understand is no, not if you're using IEEE floating point. Yes, that would explain it. I assumed that Python automatically switched from hardware floating point to multi-precision floating point so that the u

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-21 Thread Diez B. Roggisch
Dave Parker schrieb: On May 21, 3:19 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: The fact is, sometimes it's better to get it fast and be good enough, where you can use whatever methods you want to deal with rounding error accumulation. I agree. I also think that the precision/speed tradeoff s

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-22 Thread Diez B. Roggisch
Dave Parker wrote: > On May 21, 7:01 pm, Carl Banks <[EMAIL PROTECTED]> wrote: >> The crucial thing is not to slow down the calculations with useless >> bells and whistles. > > Are you running your simulations on a system that does or does not > support the "useless bell and whistle" of correct r

Re: Bug in floating-point addition: is anyone else seeing this?

2008-05-22 Thread Diez B. Roggisch
> > This person who started this thread posted the calculations showing > that Python was doing the wrong thing, and filed a bug report on it. > > If someone pointed out a similar problem in Flaming Thunder, I would > agree that Flaming Thunder was doing the wrong thing. > > I would fix the prob

Re: merging the global namespaces of two modules

2008-05-22 Thread Diez B. Roggisch
Fabrizio Pollastri wrote: > Jeff wrote: >> Can you be more specific? modA and modB don't import from each other >> but both need to access objects in the global namespace of what >> module? The controlling application? > >> Or do you mean that, for >> example, modA needs to access some function

Re: Loading contents behind the scenes

2008-05-22 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 22, 8:51 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> On 2008-05-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > Hi, I wanted to know how cautious it is to do something like: >> >> > f = file("filename", "rb") >> > f.read() >> >> > for a possibly huge

Re: pyserial and file open conflict?

2008-05-23 Thread Diez B. Roggisch
Do you have to much time? Maybe you have enough time to read this: http://www.catb.org/~esr/faqs/smart-questions.html Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its ability of kernel coding. So I am wondering if python can

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
Andrew Lee schrieb: Diez B. Roggisch wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a versatile language that can accomplish tasks for many different purposes. However, AFAIK, little is known about its abil

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
OP: "I am wondering if python can do some kernel coding that used to be the private garden of C/C++." "kernel coding" is pretty clear I'd say - coding a or in the kernel. Not coding that runs on an OS that happens to have a kernel. The answer is yes. IPC and py-pf are examples. If you don'

Re: can python do some kernel stuff?

2008-05-23 Thread Diez B. Roggisch
Jimmy schrieb: On May 23, 11:14 pm, Jimmy <[EMAIL PROTECTED]> wrote: On May 23, 5:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Jimmy schrieb: On May 23, 3:05 pm, Andrew Lee <[EMAIL PROTECTED]> wrote: Jimmy wrote: Hi to all python now has grown to a

Re: Popen: NameError: name 'PIPE' is not defined

2008-05-24 Thread Diez B. Roggisch
Mathieu Prevot schrieb: Hi I import subprocess and use Popen, but PIPE is not defined. I used 2.5.1, 2.5.2, Python 2.6a3+ (trunk:63576, May 24 2008, 12:13:40), it's always the same. What am I missing ? Without showing code, it's hard to know. A guess is: if you use import subprocess then us

Re: need some help in serving static files inside a wsgi apps

2008-05-24 Thread Diez B. Roggisch
Tool69 schrieb: Hi, Until now, I was running my own static site with Python, but I'm in need of dynamism. After reading some cgi tutorials, I saw Joe Gregorio's old article "Why so many Python web frameworks?" about wsgi apps [http:// bitworking.org/news/Why_so_many_Python_web_frameworks] and h

Re: need some help in serving static files inside a wsgi apps

2008-05-24 Thread Diez B. Roggisch
kib schrieb: Diez B. Roggisch a écrit : Tool69 schrieb: Hi, Until now, I was running my own static site with Python, but I'm in need of dynamism. After reading some cgi tutorials, I saw Joe Gregorio's old article "Why so many Python web frameworks?" about wsgi apps [ht

Re: Python, Daemons and D-Bus

2008-05-25 Thread Diez B. Roggisch
PurpleServerMonkey schrieb: On May 25, 5:46 am, Sebastian 'lunar' Wiesner <[EMAIL PROTECTED]> wrote: [ PurpleServerMonkey <[EMAIL PROTECTED]> ] Would you use D-Bus or a more traditional IPC method such as sockets? Although D-Bus is relatively new it looks interesting, just not sure it would wo

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
Roy Smith schrieb: In article <[EMAIL PROTECTED]>, Fuzzyman <[EMAIL PROTECTED]> wrote: Also, like others, I have had wonderful experiences of trying to track down test failures that depend on the order that tests run in. Having interdependencies between tests is a recipe for madness... I ag

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Diez B. Roggisch
Sebastian 'lunar' Wiesner schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [ Diez B. Roggisch <[EMAIL PROTECTED]> ] I finally managed to work with static files with a little hack, but it's ugly because I'm reading each static file per request. How else should t

Re: need some help in serving static files inside a wsgi apps

2008-05-25 Thread Diez B. Roggisch
Matthew Woodcraft schrieb: Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Sebastian 'lunar' Wiesner schrieb: I guess, Apache does some kind of memory caching for files, which are often requested and small enough to fit into the system memory. May be, that's what the OP is r

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
Here's an example of why *running* tests in order can make sense. You could have a bunch of tests of increasing complexity. The first bunch of tests all run in a few seconds and test some basic functionality. From experience, you also know that these are the tests that are most likely to f

Re: unittest: Calling tests in liner number order

2008-05-25 Thread Diez B. Roggisch
In fact, from a protocol point of view, some of the types really do depend on each other. We send counted strings, for example, so we can't send a string until we know how to send an int (for the string length). If the first test that fails is the string test, I know right off that the problem

Re: Flash Decoder

2008-05-28 Thread Diez B. Roggisch
Ankit wrote: > Hi everyone,i wanted to build a flash decoder using python can > somebody tell me which library to use and what steps should i follow > to make a flash(video) decoder?By a decoder i mean that i need to > display all the pixel values of each frame.Waiting for your replies. Check out

Re: Error handling in Python

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Dear Members of the group, > If I open a url by urlopen in the urllib, the file is either opening a > file or if no url is there it would give error. The error is generated > can be handled by IOError handling schemes. > But if there are thousands or millions of URLs and

pydb remote debugging/cmd.Cmd over socket?

2008-05-28 Thread Diez B. Roggisch
Hi, I'm fiddling around with pydb. Installation and usage are fine. What I especially like is the fact that you can attach a signal such that you drop into debugging mode on demand. But this is of limited use to me in situations where a server is written in python. According to the source, pydb's

Re: BadStatusLine error

2008-05-28 Thread Diez B. Roggisch
Jim wrote: > Hi > > I get a BadStatusLine error (indicated below). Can anyone help with > how to > catch error in code before abort? http://docs.python.org/tut/node10.html Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Struct usages in Python

2008-05-28 Thread Diez B. Roggisch
Alex Gusarov schrieb: class Event(object): Always subclass object, unless you have a very compelling reason not to, or you are subclassing something else. I've thought that if I write class Event: pass , it'll be subclass of object too, I was wrong? Yes. That is the somewhat unfortu

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with another lump of code). The sample script is: # Sample script, simply creat

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
Kind of like how this year's program won't work on next year's Python? For somebody who has admitted to have only very rudimentary knowledge of python that's a pretty bold statement, don't you think? Except Flaming Thunder is faster. ;) Faster in execution speed for a very limited domain

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On May 28, 8:52 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: On May 28, 8:26 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: Hi, I'm trying to work out some stra

Re: Threads and import

2008-05-28 Thread Diez B. Roggisch
Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. import TestThread # from TestThread.py If I use python 2.5, this doesn't happen - instead, the module ist just run. If I use py

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
Dave Parker schrieb: On May 28, 3:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Kind of like how this year's program won't work on next year's Python? For somebody who has admitted to have only very rudimentary knowledge of python that's a pr

Re: Python and Flaming Thunder

2008-05-28 Thread Diez B. Roggisch
To be fair, the graphics look cool and the "single-asset 8-by-8 shotgun cross compiler, written entirely in assembly language" sounds impressive from an implementation point of view, in the sense that building Deep Blue with nothing but NAND gates would; utterly impressive and pointless at the s

Re: pydb remote debugging/cmd.Cmd over socket?

2008-05-29 Thread Diez B. Roggisch
As part of the 2006 Google Summer of Code project Matt Flemming started working on remote debugging in pydb. Alas it wasn't completed and I let the code fall through the cracks. Matt claimed it worked to some degree but I could never get it to work for me. Most definitely the code has atrophied

cmd.Cmd bug or at least docu-bug

2008-05-29 Thread Diez B. Roggisch
Hi, I'm fiddling around with module cmd. I tried to pass my own streams as replacements for stdin and stdout. However, stdin wasn't working. After a look into the sourcecode I discovered that there is an class-variable called use_rawinput that prevents using the passed stdin. I then read the do

Re: php vs python

2008-05-29 Thread Diez B. Roggisch
> A good OO programmer could easily write good functional code. You are aware that functional programming is *not* procedural or imperative programming? http://en.wikipedia.org/wiki/Functional_programming OO is *heavily* depending on state and state modification. I've seen OO programmers weep o

Re: Strange thing with types

2008-05-29 Thread Diez B. Roggisch
ng.join() and fed > to time.strptime(). > > Here's some code: > timeinput = re.split('[\s:-]', rawtime) > print timeinput #trace statement > print year #trace statement > t = timeinput.insert(2, year) > print t #trace statement > t1 = string.join(t, '

<    27   28   29   30   31   32   33   34   35   36   >