Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: > Python disappointly failed to provide a convinient cgi session > management module. Probably because there are much better options for web programming in Python ? > Not willing to use external modules, I would like to > implement a simplest Session object on my own

Re: instantiate a class with a variable

2006-03-28 Thread bruno at modulix
John wrote: > Hi, is it possible to instantiate a class with a variable. > > example > > class foo: > def method(self): > pass > > x='foo' > > Can I use variable x value to create an instance of my class? You got examples using string 'foo', now if all you need is to store or pass

Re: object references

2006-03-28 Thread bruno at modulix
DrConti wrote: > Hi Bruno, hi folks! > thank you very much for your advices. > I didn't know about the property function. > I learned also quite a lot now about "references". > Ok everything is a reference but you can't get a reference of a > reference... > > I saw a lot of variations on how to s

Re: multiple assignment

2006-03-28 Thread bruno at modulix
Anand wrote: >>>Wouldn't it be nice to say >>>id, *tokens = line.split(',') >> >> >>id, tokens_str = line.split(',', 1) > > > But then you have to split tokens_str again. > > id, tokens_str = line.split(',', 1) > tokens = tokens_str.split(',') > > this is too verbose. > head_tail = lambda seq

Re: Looking for a language/framework

2006-03-28 Thread bruno at modulix
As much as > I dislike msft, I have to admit, an ms-access app can be put together > quickly, without any steep learning curve. > > I've been looking at python web frameworks, and I'm not sure what to > think. It seems like these frameworks would allow me to do a lot of > wor

Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: > bruno at modulix 写道: > > >>Sullivan WxPyQtKinter wrote: >> >>>Python disappointly failed to provide a convinient cgi session >>>management module. >> >>Probably because there are much better options for web progra

Re: Looking for a language/framework

2006-03-29 Thread bruno at modulix
to what can run with cgi and the installed Python version. But instead of wondering, why don't you check this out with your hosting company ? And if it appears that Python support is too limited, you can also change for a more Python-friendly host... > >>Which frameworks have you l

Re: No Cookie: how to implement session?

2006-03-29 Thread bruno at modulix
> the server > will retrieve the sessionID and decide if it is in the same session. > However, since python cgi do not have a function for redirecting to a > page, I use Location: url http head How do you think redirections are implemented in frameworks that have syntactic su

Re: tips for this exercise?

2006-03-29 Thread bruno at modulix
> fiveNumbers = fiveNumbers.append(number) list.append() returns None. Guess what will be the value of fiveNumbers after this statement ? > return fiveNumbers And you exit the function at the first iteration. > Other than being sort of ugly, this also has the side effe

Re: tips for this exercise?

2006-03-29 Thread bruno at modulix
Paul Rubin wrote: (snip) > Why is everyone using shuffle? > > >>> import random > >>> random.sample(xrange(1,41), 5) > [24, 15, 9, 39, 19] Great. Didn't know that one. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTEC

Re: Python plug-in

2006-03-29 Thread bruno at modulix
toto wrote: > Hi, > > I'm trying to find some howto, tutorial in order to create a python program > that will allow plug-in programming. I've found various tutos on how to > write a plug-in for soft A or soft B but none telling me how to do it in my > own programs. Do you have any bookmarks ?? Tr

Re: Free Python IDE ?

2006-03-30 Thread bruno at modulix
Ernesto wrote: > I'm looking for a tool that I can use to "step through" python software > (debugging environment). This is not an 'IDE', it's a debugger. > Is there a good FREE one http://www.python.org/doc/2.4.2/lib/module-pdb.html Strange enough, I almost never had a use for a debugger in

Re: Try Python!

2006-03-30 Thread bruno at modulix
Michael Tobis wrote: > We had some discussion of this in the edu-sig meeting at PyCon. > > I alleged that I had read that there is no such thing as a Python > sandbox. And yet Zope 2 has some restricted environment for TTW scripts... -- bruno desthuilliers python -c "print &

Re: List conversion

2006-03-30 Thread bruno at modulix
all looks fine, Well, I'm sorry to have to say this, but it doesn't look fine at all: >>> words = "one two three".split() >>> words ['one', 'two', 'three'] >>> len(words) 3 >>> words[4:] [] >>> import stri

Re: dynamic construction of variables / function names

2006-03-30 Thread bruno at modulix
s mostly what the proposed solutions (the one based on globals() or locals() as well as Duncan's class-based one) do - the main difference being that Python offers the hashtable for free !-) nb : I agree that the use of the global or local namespaces may not be the best thing to do - better to use

Re: does python could support sequence of short or int?

2006-03-30 Thread bruno at modulix
momobear wrote: > hi, is there a way to let python operate on sequence of int or short? > In C, we just need declare a point, I assume you mean a 'pointer'. > then I could get the point value, > just like: > short* k = buffer, //k is a point to a sequence point of short. > short i = *k++, > but

Re: regular expressions and matches

2006-03-30 Thread bruno at modulix
rking so that I could pass > the IP addresses and it would return a true or false. When it matches I > get something that looks like this. > > python ip_valid.py > IP Address : 192.158.1.1 > <_sre.SRE_Match object at 0xb7de8c80> > > As I am still attempting to learn

Re: does python could support sequence of short or int?

2006-03-30 Thread bruno at modulix
momobear wrote: > but what about buffer is not be declared in python program, it comes > from a C function. and what about I want to treat a string as a short > list? There are no "short" in Python. An integer is an integer is an integer... > buffer = foobur() // a invoke from C function, it is

Re: Non-GUI source code browser with file system tree view

2006-03-30 Thread bruno at modulix
Stefan Schwarzer wrote: > Hello, > > from time to time I want to inspect the source code of projects > on remote computers.(*) I've googled for one or two hours but > didn't find anything helpful. :-/ I'm looking for something like > IDLE's path browser - i. e. a tree view and file view > side-by-

Re: How to determine an object is "scriptable"

2006-03-30 Thread bruno at modulix
Larry Bates wrote: > abcd wrote: > >>I recently came across a problem where I saw this error: >>"TypeError: unsubscriptable object" >> >>How can I determine if an object is "scriptable" or "unscriptable"? >> > > Simplest answer is to use isinstance to see if it is a string, list, > or tuple: > >

Re: How to determine an object is "scriptable"

2006-03-30 Thread bruno at modulix
abcd wrote: > Richard Brodie wrote: > >>subscriptable: supports an indexing operator, like a list does. > > doesn't seem to be a builtin function or module... It's not. Look no further. > or is that just your > definition of subscriptable? It's a correct definition of 'subscriptable' in the c

Re: How to determine an object is "scriptable"

2006-03-30 Thread bruno at modulix
abcd wrote: > I recently came across a problem where I saw this error: > "TypeError: unsubscriptable object" > > How can I determine if an object is "scriptable" or "unscriptable"? By trying to apply the subscript operator ('[]'). If it raises a TypeError, then it's not subscriptable. But, as La

Re: How to debug python code?

2006-03-31 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > hi, >I am new to Python programming.I am not getting exactly pdb.Can > anyone tell me effective way to debug python code? (automated) unit tests + print statements + the interactive shell are usually enough. I almost never used pdb in 5+ years of Python programm

Re: Best IDE for Python?

2006-03-31 Thread bruno at modulix
Fredrik Lundh wrote: > Dennis Lee Bieber wrote: > > >>> I want to know which is the best IDE for python.Please if >>>possible mention the features of the IDE. >> >>The best IDE is the one that YOU can be most productive in. What /I/ >>find useful may not be of interest to /you/. > > > nons

Re: Best IDE for Python?

2006-03-31 Thread bruno at modulix
Duncan Booth wrote: > Fredrik Lundh wrote: > > >>as you can see, Microsoft's usability team has made some massive >>improvements (note how well it deals with the "eat flaming death" >>command): > > > I especially like the way running it messes up the prompt: > > C:\Documents and Settings\Dunca

Re: How to search HUGE XML with DOM?

2006-03-31 Thread bruno at modulix
nhance the searching speed? > Are there existing solution or algorithm? Thank you for your > suggetion... - have a look at cElementTree ? - store your XML as persistant objects in a ZODB instance, then use ZODB catalog for queries ? - index relevant data in a DB (RDBMS, Berkeley, whatever...) ?

Re: member variables in python

2006-03-31 Thread bruno at modulix
PyPK wrote: > ok I reason I was going with globals is that i use this variable in > another class something like this along with above > > testflag = 0 > > class AA: >def __init__(...): > > def methos(self,...): >global testflag >testflag = xx > > class BB: > def __ini

Re: "definitive" source on advanced python?

2006-04-03 Thread bruno at modulix
Gabriel de Dietrich wrote: > Maybe you're looking for something like this? > http://jamesthornton.com/eckel/TIPython/html/Index.htm > > Haven't read it yet, but seems to be about design patterns. Not the > "definitive" stuff, though... While TIP is an interesting book, it is more about implementa

Re: Standalone Python functions in UML?

2006-04-04 Thread bruno at modulix
Ravi Teja wrote: (snip) >>>More theoretical question is if I create classes on the fly, how UML can > > reflect that? > > "On the fly" usually means "at runtime". I guess you mean if you > "change code" will my diagram stay in sync?. Nop

Re: Standalone Python functions in UML?

2006-04-04 Thread bruno at modulix
Philippe Martin wrote: > Roman Susi wrote: > (snip) >>More theoretical question is if I create classes on the fly, how UML can >>reflect that? > > > You mean objects I think: Yes : class objects !-) Python's classes *are* objects. And you can create new class

Re: Standalone Python functions in UML?

2006-04-05 Thread bruno at modulix
y model > structural diagrams. Python is dynamic but only once the program starts > executing :-). Even though Python classes "can" change, they do so only > at runtime Well, you can have a lot of things happening during the import stage. Is this 'runtime' or not ?-) And y

Re: Standalone Python functions in UML?

2006-04-05 Thread bruno at modulix
Philippe Martin wrote: please don't top-post - corrected > bruno at modulix wrote: > > >>Philippe Martin wrote: >> >>>Roman Susi wrote: >>> >> >>(snip) >> >> >>>>More theoretical question is if I create class

Re: Filters like old skool Jive, Fudd, Valspeak... Text transformation in Python

2006-04-05 Thread bruno at modulix
[EMAIL PROTECTED] wrote: (snip part about filters) > Any good "generators" written in Python? I'd like to roll me one of > these as well; e.g. execute the program and it will create a few > paragraphs of text in the jargon of a discipline, subdiscipline, > subculture, etc. Anyone know what I'm ta

Re: pre-PEP: The create statement

2006-04-06 Thread bruno at modulix
Steven Bethard wrote: > The PEP below should be mostly self explanatory. I'll try to keep the > most updated versions available at: > > http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt > http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html

Re: pre-PEP: The create statement

2006-04-06 Thread bruno at modulix
Serge Orlov wrote: > bruno at modulix wrote: > >>Steven Bethard wrote: >> >>>The PEP below should be mostly self explanatory. I'll try to keep the >>>most updated versions available at: > > > [snip] > > >>Seems mostly clean. +1. &g

Re: Partially unpacking a sequence

2006-04-07 Thread bruno at modulix
ly the 2nd and 4th item > > by partially > unpacking the list. So I tried > >>>>a,b = y[2,4] Mmm, so lovely and meaningful names !-) FWIW, and since nobody seemed to mention it, list indexes are zero-based, so the second element of a list is at index 1 and the fourth at index 3.

Re: performance degradation when looping through lists

2006-04-07 Thread bruno at modulix
Joachim Worringen wrote: > I need to process large lists (in my real application, this is to parse > the content of a file). Then you probably want to use generators instead of lists. The problem with large lists is that they eat a lot of memory - which can result in swapping . > I noticed that

Re: Best way to process table rows from an RDBMS

2006-04-07 Thread bruno at modulix
s to be efficient, > since I know I will be hitting the same external RDBMS from Python and > regularly processing a fixed set of tables with a certain fixed set of > attribute columns. Before ReinventingTheSquareWheel(tm), you may want to have a look at existing Python ORMs like SQLObjects or

Re: how you know you're a programming nerd

2006-04-07 Thread bruno at modulix
John Salerno wrote: > So last night I had a dream that me and two other guys needed to get a > simple task done in Java. Then s/dream/nightmare/ -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.

Re: "The World's Most Maintainable Programming Language"

2006-04-07 Thread bruno at modulix
Peter Hansen wrote: > Mirco Wahab wrote: > >> Hi Ralf >> >>> So we should rename Python into Cottonmouth to get more attention. >> >> >> No, always take some word that relates to >> something more or less 'feminine', its about >> 96% of young males who sit hours on programming >> over their belove

Re: [Newbie] Referring to a global variable inside a function

2006-04-10 Thread bruno at modulix
Ernesto García García wrote: > Hi experts, > > I've built a class for parsing a user-defined list of files and matching > lines with a user-defined list of regular expressions. It looks like this: > (snip code) > > But then, when I try to use my class using actions with "memory" it will > fail:

Re: how relevant is C today?

2006-04-10 Thread bruno at modulix
gregarican wrote: > Here are a few languages I recommend most programmers should at least > have a peek at: > (snip) > 2) Lisp - Along with FORTRAN, one of the oldest programming languages > still in use. Pure functional programming model Err... Even if Lisp is the fathe

Re: Is this object counter code pythonic

2006-04-11 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Fredrik is then this a valid "property" use case and pythonic to > get/set a common varibale across objects > > class E(object): > _i = 0 > def geti(self) : return E._i > def seti(self,val) : E._i = val > i = property(geti,seti) > > if __name__ == "_

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
fyhuang wrote: > Hello all, > > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Seems you're confusing encapsulation with data hiding. >

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
Roy Smith wrote: (snip) > That being said, you can indeed have private data in Python. Just prefix > your variable names with two underscores (i.e. __foo), and they effectively > become private. The double-leading-underscore stuff has nothing to do with "privacy". It's meant to protect from

Re: how relevant is C today?

2006-04-11 Thread bruno at modulix
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > bruno at modulix <[EMAIL PROTECTED]> wrote: > > >>gregarican wrote: >> >>>Here are a few languages I recommend most programmers should at least >>>have a peek at: >>&g

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
looping wrote: > Peter Hansen wrote: > >>Georg Brandl wrote: >> >>>class C(): >>> >>>is meant to be synonymous with >>> >>>class C: >>> >>>and therefore cannot create a new-style class. >> >>I think "looping" understands that, but is basically asking why anyone >>is bothering with a change that in

Re: unboundlocalerror with cgi module

2006-04-11 Thread bruno at modulix
if 'name:part' keys = field_storage.keys() if keys: return keys[-1].split(':', 1) else: return (None, None) import cgi fo = cgi.FieldStorage() name, part = extract_last_key(fo) I doubt this is actually what you *really* want, but this is at least what your code effe

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > bruno at modulix>Since the class statement without superclass actually > creates an old-style class, I'd expect the "class MyClass():" variant > to behave the same.< > > In Python 3.0 I really hope the > > class C: pass

Re: Why new Python 2.5 feature "class C()" return old-style class ?

2006-04-11 Thread bruno at modulix
looping wrote: > bruno at modulix wrote: > >>looping wrote: >> >>>Peter Hansen wrote: >>> >>> >>>>Georg Brandl wrote: >>>> >>>> >>>>>class C(): >>>>> >>>>>is meant

Re: how relevant is C today?

2006-04-11 Thread bruno at modulix
gregarican wrote: > bruno wrote: > > >>Err... > > >>And ? > > > It's the snide, curt replies such as your recent ones in this thread > that reinforce the generalization that the Python community can be > rude. I'm afraid you're r

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Ben C wrote: > On 2006-04-11, Michele Simionato <[EMAIL PROTECTED]> wrote: > >>Roy Smith wrote: >> >> >>>That being said, you can indeed have private data in Python. Just prefix >>>your variable names with two underscores (i.e. __foo), and they effectively >>>become private. Yes, you can bypass

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Casey Hawthorne wrote: >>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >>or any other aspect you may be familiar with from Java or C++. The >>primary concept behind OOP is not buzzwords such as abstraction, >>encapsulation, polymorphism, etc etc, but the fact that your pro

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Gregor Horvath wrote: > Steven D'Aprano schrieb: > > >>I don't know of many other OO languages that didn't/don't have >>inheritance, > > > VB4 - VB6 > VB6 has a kind of inheritance via interface/delegation. The interface part is for subtyping, the delegation part (which has to be done manuall

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > thanks for your answer. split gives me a list of strings, Of course, why should it be otherwise ?-) More seriously : Python doesn't do much automagical conversions. Once you've got your list of strings, you have to convert'em to floats. > but i found a > way to do what i want: >

Re: converting lists to strings to lists

2006-04-12 Thread bruno at modulix
robin wrote: > yo! > > thank you everone! here's how i finally did it: > converting the string into a list: > > input = net.receiveUDPData() > input = list(eval(input[0:-2])) You'll run into trouble with this. > converting the list into a string: > > sendout = "%.6f %.6f %.6f

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
order and not all may be used. > > -m quemanager -s server -p port -k key -o object -c 20 -t [EMAIL PROTECTED] Have you looked at optparse ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
News wrote: > bruno at modulix wrote: > >>News wrote: >> >>>Hi everyone, >>> >>>My goal is to pull command switches/options from a file and then assign >>>the values to select variables which would eventually be included in a >>>class

Re: how to match n- lists for a common elements.

2006-04-13 Thread bruno at modulix
Grzegorz Ślusarek wrote: > Hi all. I my application i have situation when i have some lists and i > must get from lists common elements. Exacly i don't know how many list I > have so at the moment of creation each of one I append them to one > list. So I get list wchich co

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-13 Thread bruno at modulix
News wrote: (snip) > sometimes you can't see the forest .. trees and all that :) Yes, been here too... I wrote a CSV parser before realising there was a pretty good one in the standard lib :( (snip) > OT: I saw several references to "OP". What does this mean? Original Poster -- bruno desthuill

Re: new-style classes and len method

2006-04-13 Thread bruno at modulix
Thomas Girod wrote: > Or maybe I'm mixing up what we call a "classmethod" with what we could > call an "instance method" ? > That's what I was about to point out !-) > class Data(list): > __slots__ = ["width", "height", "label"] > > def __init__(self,width,height,label=None): > l

Re: new-style classes and len method

2006-04-13 Thread bruno at modulix
Thomas Girod wrote: > It's alright I found where my mistake came from. I was misunderstanding > the meaning of "classmethod", thinking of it as an instance method. Given that 'instance methods' being most of the time attributes of the class object, such a confusion is not so surprising !-) -- br

Re: Can't see the forest for the trees - when reading file, only processing first line

2006-04-13 Thread bruno at modulix
# so it's updated with the new args instead of # being overwritten options, args = parser.parse_args(line.split(), options=options) f.close() del f check_params() BTW, check_params() should also takes the options object as argument. Globals are evil. Definitively. Also, and if I

Re: function prototyping?

2006-04-13 Thread bruno at modulix
#-- main.py - import config def main(*args): config.dict['a']() config.dict['b']() # here we have a python trick: if __name__ == '__main__': import sys sys.exit(main(*sys.argv[1:]) # -- > I

Re: function prototyping?

2006-04-13 Thread bruno at modulix
Burton Samograd wrote: > bruno at modulix <[EMAIL PROTECTED]> writes: (snip) >>*But* is it necessary to have the main() in the same file that defines >>a_fun and b_fun ? It's quite common (and not only in Python) to use a >>distinct file for the main(). So you

Re: function prototyping?

2006-04-13 Thread bruno at modulix
like way; > prototype the function, initalize the array using the prototypes, have > the functions defined somewhere else and then let the linker work it > all out for me. I was hoping that python had some sort of lazy > evaluation scheme for this type of behaviour so that you could defer

Re: nested functions

2006-04-14 Thread bruno at modulix
Szabolcs Berecz wrote: > On 14 Apr 2006 04:37:54 -0700, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > >>def a(): >> def b(): >>print "b" >> def c(): >>print "c" >> >>how can i call c() ?? > > > Function c() is not meant to be called from outside function a(). > That's what a nested

urllib2 and proxies support ?

2006-01-04 Thread tomazi75-nospam(at)gmail.com
Hello all, I've a problem using urllib2 with a proxy which need authentication. I've tested the 'simple way' : -- code -- import urllib # example values for the post my_url = 'http://www.python.org' proxy_info = { 'host' : 'netcache.monentreprise.com', 'port' : 3128,

Re: Ban Xah Lee

2009-03-07 Thread Dirk Bruere at NeoPax
t on fighting, the reason they cited to ban me was spreading propaganda. For some account of this incident, see bottom of: Why Can't You Be Normal?. The fighting and discussion can be seen on my talk page, at: User talk:P0lyglut. The writing where i defended my edit, that got removed from my

Re: Ban Xah Lee

2009-03-07 Thread Dirk Bruere at NeoPax
Dirk Bruere at NeoPax wrote: Xah Lee wrote: Of interest: • Why Can't You Be Normal? http://xahlee.org/Netiquette_dir/why_cant_you_be_normal.html • Ban Xah Lee http://xahlee.org/Netiquette_dir/ban_Xah_Lee.html I consider this post relevant because i've been perennially gossipe

Re: Ban Xah Lee

2009-03-09 Thread Dirk Bruere at NeoPax
Larry Gates wrote: On Sun, 08 Mar 2009 04:09:52 +, Dirk Bruere at NeoPax wrote: Dirk Bruere at NeoPax wrote: Well, don't worry - nobody is going to ban you from Usenet (except possibly the Chinese govt). OTOH, nobody here much cares. So, rant on - it's what Usenet is for. ☄

Re: Ban Xah Lee

2009-03-09 Thread Dirk Bruere at NeoPax
Kenneth Tilton wrote: Dirk Bruere at NeoPax wrote: Larry Gates wrote: On Sun, 08 Mar 2009 04:09:52 +, Dirk Bruere at NeoPax wrote: Dirk Bruere at NeoPax wrote: Well, don't worry - nobody is going to ban you from Usenet (except possibly the Chinese govt). OTOH, nobody here much

Re: "pickle" vs. f.write()

2005-02-01 Thread mmiller at tx3 dot com
On 1/26/05 at 1:48 pm, Terry Reedy wrote: > For basic builtin objects, repr(ob) generally produces a string that when > eval()ed will recreate the object. IE > eval(repr(ob) == ob # sometimes I've found extending this property to your own classes often fairly easy to implement (an

'isa' keyword

2005-09-01 Thread talin at acm dot org
if name in dependencies: ...which is much more readable and intuitive. At the same time, however, I recognize that there is a logical difference between membership in a container, and membership in a category. For example, although a bear is a member of the class of mammals, it doesn't make as much to

Re: 'isa' keyword

2005-09-02 Thread talin at acm dot org
sinstance( event, Note ): # draw note elif isinstance( event, Aftertouch ): # draw ...etc You could also invert the logic (which is somewhat clumsier): class Note: def repaint( context ): if isinstance( context, PianoRollEditor ): ... etc... Now, I realize that some fol

Replacement for lambda - 'def' as an expression?

2005-09-06 Thread talin at acm dot org
I've been reading about how "lambda" is going away in Python 3000 (or at least, that's the stated intent), and while I agree for the most part with the reasoning, at the same time I'd be sad to see the notion of "anonymous functions" go - partly because I use the

Re: Replacement for lambda - 'def' as an expression?

2005-09-06 Thread talin at acm dot org
ython, but rather by giving solver-like capabilities to a Python programmer. Needless to say, this involves a number of interesting hacks, and part of the motivation for my suggestion(s) is reducing the hack factor. So, at the risk of being visited by Social Services for my abuse of Python Operators, h

Fun with decorators and unification dispatch

2005-09-10 Thread talin at acm dot org
Been playing around a bit more with developing my python inference engine, and I thought it might be of general interest (plus, I am finding the criticism useful). My original goal was to brush up on my math skills. Now, I've long felt that the best way to learn a language *thoroughly* is to write

Re: Fun with decorators and unification dispatch

2005-09-10 Thread talin at acm dot org
name ] generic.name = name generic.last_defined = f generic.add_arity( pattern, f ) return generic return inner There's a couple of kludges here: 1) The Generic doesn't know its own name until you define at least one specialization for it. Otherwise, you

Re: Matching Strings

2007-02-09 Thread rshepard-at-appl-ecosys . com
On 2007-02-10, [EMAIL PROTECTED] wrote: > if item == selName: Slicing doesn't seem to do anything -- if I've done it correctly. I changed the above to read, if item[2:-2] == selName: but the output's the same. Rich -- http://mail.python.org/mailman/listinfo/python-list

Re: Matching Strings

2007-02-09 Thread rshepard-at-appl-ecosys . com
On 2007-02-10, James Stroud <[EMAIL PROTECTED]> wrote: > Assuming item is "(u'ground water',)" > > import re > item = re.compile(r"\(u'([^']*)',\)").search(item).group(1) James, I solved the problem when some experimentation reminded me that 'item' is a list index and not a string variable. by

Fwd: Re: Logging question

2009-12-16 Thread Vinay Sajip at Red Dove
Original Message Subject:Re: Logging question Date: Tue, 15 Dec 2009 18:28:54 + From: Vinay Sajip at Red Dove To: Yaroslav Molochko On 15/12/2009 14:29, Yaroslav Molochko wrote: > Hello Vinay Sajip, > > my name is Yaroslav, I'm tryi

Re: Question to logging

2009-12-16 Thread Vinay Sajip at Red Dove
On 16/12/2009 12:49, stefan.messerl...@postfinance.ch wrote: > I have the following error and no clue, how to solve that. Up to python > version 2.5 the following script worked without an error, but since python > 2.6. I get the following error: > > #!/usr/bin/env python > # -*- coding: ISO-8859-

debugging xmlrpc servers

2005-01-22 Thread alan dot ezust at gmail dot com
lling each other's methods all the time. I am running into some bugs which I am unable to debug. I am using http://rpdb.digitalpeers.com/Download.htm As per the instructions, I called rpdb.set_trace() right before calling server.serve_forever(). Then I ran the server, and ran the client. At

Re: debugging xmlrpc servers

2005-01-23 Thread alan dot ezust at gmail dot com
Understandable - i had difficulties understanding my problem too! I don't really understand why I got that error message before - I believe it was due to the fact that some other exception was being raised inside results(). Anyway, the solution was to call rpdb.set_trace() inside the actual metho

Python Guru needed in San Jose!

2007-01-02 Thread Brent Rogers -X (breroger - Spherion at Cisco)
Start the New Year off with a new Python job! Cisco Systems (San Jose, CA) Posted 16-Nov-2006 Technical Leader I (759661) Description We are looking for a Software Development Engineer who will work in development of a new Cisco product. Architect and develop high per

Message ("Your message dated Mon, 26 Dec 2005 10:15:57...")

2005-12-25 Thread L-Soft list server at (12) TBS, Inc. (1.8d)
Your message dated Mon, 26 Dec 2005 10:15:57 +0545 with subject "Re: Mail Authentification" has been submitted to the moderator of the ASIABREAKINGNEWS list. -- http://mail.python.org/mailman/listinfo/python-list

Decorator behavior

2011-07-22 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I am just trying to wrap my head around decorators in Python, and I'm confused about some behavior I'm seeing. Run the code below (slightly adapted from a Bruce Eckel article), and I get the following output: inside myDecorator.__init__() inside aFunction() Finished decorating aFunction() inside

Query regarding python 2.7.11 release

2016-04-14 Thread Gaurav Rastogi -X (garastog - ARICENT TECHNOLOGIES MAURIITIUS LIMITED at Cisco)
Hi, We are currently using Python 2.6.7 in our product. We have received below vulnerabilities from field: CVE-2014-7185 Integer overflow in bufferobject.c in Python before 2.7.8 allows context-dependent attackers to obtain sensitive information from process memory via a large size and offset i

accessing parts of large files with File.seek()

2007-08-08 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a problem with the File object's seek() method. Specifically, I cannot use it to seek to a location in a binary file that is greater than 2^31 (2147483648). This seems unnecessarily limiting, as it is common these days to have files larger than 2 GB. Is there some LargeFile object out

Re: accessing parts of large files with File.seek()

2007-08-08 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 8, 7:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Aug 8, 11:46 am, "mhearne808[insert-at-sign-here]gmail[insert-dot- > > > > here]com" <[EMAIL PROTECTED]> wrote: > > I'm having a problem with the File object'

fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386 i386 Python 2.5.1 (built from source) OK, the weirdness: First o

Re: fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 30, 4:19 pm, "mhearne808[insert-at-sign-here]gmail[insert-dot- here]com" <[EMAIL PROTECTED]> wrote: > I'm having a number of problems with the fcntl module. First off, my > system info: > > Mac OS X > Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Ke

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
rocess. > > > According to my Python Cookbook: > > "Exclusive lock: This denies all _other_ processes both read and write > > access to the file." > > This is only for mandatory locking; POSIX flock is advisory locking, > which states: "Only one process m

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
gt; f = open('foo', 'w+') > try: >fcntl.flock(f.fileno(),fcntl.LOCK_EX |fcntl.LOCK_NB) > except IOError, e: > if e.args[0] == 35: > sys.exit(1) > else: > raise > f.seek(0, 2) # seek to end > # do your thing with the file > f.fl

Don't understand module search path...

2007-10-04 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I think I don't understand how the module search path works... Let's say I have a folders called 'test'. Underneath it, I create two more folders called 'foo' and 'bar'. In 'foo', I create an empty '__init__.py' file, indicating that this folder is a package 'foo'. I then create a simple python

PYTHONPATH on OS X

2007-10-10 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is a capture of what I did. Note that my newfolder appears nowhere on the list of directories in sys.path. H

Re: PYTHONPATH on OS X

2007-10-11 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Oct 10, 4:59 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Oct 11, 8:00 am, "mhearne808[insert-at-sign-here]gmail[insert-dot- > > > > here]com" <[EMAIL PROTECTED]> wrote: > > I'm missing something major here. I'm trying to add a

Creating installer with external extension modules

2007-11-09 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm creating a piece of software which will be used by in-house users. My code will all be written in pure Python; however, it depends heavily on a number of third-party Python modules, many of which have C/C++ dependencies (numpy, scipy, etc.) Installing these packages on my machine involved a m

Getting file timestamp from url

2007-11-16 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
Is is possible to get the timestamp of a file on a web server if it has a URL? For example, let's say that I want to know when the following file was created: http://www.w3schools.com/xml/note.xml I can get an HTTPMessage object using urllib2, like this:

<    1   2   3   4   5   6   7   >