Re: set of sets

2005-08-11 Thread Matteo Dell'Amico
Paolo Veronelli wrote: > Yes this is really strange. > > from sets import Set > class H(Set): > def __hash__(self): > return id(self) > > s=H() > f=set() #or f=Set() > > f.add(s) > f.remove(s) > > No errors. > > So we had a working implementation of sets in the library an put a > broken

Re: signals (again)

2005-08-11 Thread bill
I found a good solution to this problem in Richard Steven's _Network_Programming_. It seems like everything shows up in Steven's books! Rather than pausing, you do a blocking read on a pipe. You only write to the pipe from within the signal handler. However, this brings up the better question:

Where can be a problem?

2005-08-11 Thread Lad
I use the following ### import re Results=[] data1='' ID = re.compile(r'^.*=(\d+)&.*$',re.MULTILINE) Results=re.findall(ID,data1) print Results # to extract from data1 all numbers such as 15015,15016,15017 But the program extracts only the last number 15017. Why? Thank you

Re: Python supports LSP, does it?

2005-08-11 Thread en.karpachov
On Thu, 11 Aug 2005 15:02:08 -0400 Terry Reedy wrote: > I remember discussion of the LSP on comp.object some years ago when I > was reading it. (I presume there still are, just don't read it > anymore.). One of the problems is that biology and evolution do not > obey it. Birds (in general) c

Re: list to tuple

2005-08-11 Thread zxo102
Thanks for your help. -- http://mail.python.org/mailman/listinfo/python-list

Buglet in win32 odbc

2005-08-11 Thread Frank Millman
Hi all I am using win32 odbc to connect to SQL Server. I have just started using the 'bit' data type, which is a boolean type which can store 1 or 0. This works with win32, but it returns '1' or '0'. Obviously I can change it to an int, but it would be nicer and more correct if it returned an int

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Ray
Thanks guys! Your explanations have cleared up things significantly. My transition from C++ to Java to C# was quite painless because they were so similar, but Python is particularly challenging because the concepts are quite different. (I always have this paranoid feeling: "Am I using Python to wr

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Paul McGuire
Instance variables are typically defined in __init__(), but they can be added to an object anywhere. The only exception is when defining the magic __slots__ class variable to pre-define what the allowed instance variables can be. class A: pass a = A() a.instVar1 = "hoo-ah" a.instVar2 = "another

Re: list to tuple

2005-08-11 Thread Paddy
Try this: >>> a,b,c = list('tab'),list('era'),list('net') >>> a,b,c (['t', 'a', 'b'], ['e', 'r', 'a'], ['n', 'e', 't']) >>> tuple(((x,y,z) for x,y,z in zip(a,b,c))) (('t', 'e', 'n'), ('a', 'r', 'e'), ('b', 'a', 't')) >>> - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Ben Finney
Ray <[EMAIL PROTECTED]> wrote: > 1. Where are the access specifiers? (public, protected, private) No such thing (or, if you like, everything is "private" by default). By convention, "please don't access this name externally" is indicated by using the name '_foo' instead of 'foo'; similar to a "pr

Re: list to tuple

2005-08-11 Thread Ruslan Spivak
"zxo102" <[EMAIL PROTECTED]> writes: > Hi, >I got several dynamic lists a1, b1, c1, from a python > application such as >a1 = [1,5,3,2,5,...], the len(a1) varies. Same to b1, c1, > >With python, I would like to reorganize them into a tuple like > >t1 = ((a1[0],b1[0],c1[0]

Re: list to tuple

2005-08-11 Thread James Stroud
Try the zip funciton: py> a = [11,12,13,14] py> b = [2,3,4,5] py> c = [20,21,22,23,24,25] py> zip(a,b,c) [(11, 2, 20), (12, 3, 21), (13, 4, 22), (14, 5, 23)] On Thursday 11 August 2005 09:05 pm, zxo102 wrote: > Hi, >I got several dynamic lists a1, b1, c1, from a python > application

Using globals with classes

2005-08-11 Thread Madhusudan Singh
Hi I am relatively new to Python. I am using Qt Designer to create a UI for a measurement application that I use. Everything seems to be clear but the use of globals (defined in the module that is generated using pyuic, that contains the form class). I am using qwtplot to display a running plot

Re: MainThread blocks all others

2005-08-11 Thread Bryan Olson
Nodir Gulyamov wrote: > [...]I should show you real code [...] > Please find below real code. Sorry for amount of sources. Yeah, it's too much for me. Can you construct a minimal example that doesn't do what you think it should? -- --Bryan -- http://mail.python.org/mailman/listinfo/python-li

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Paul McGuire
Please look through this example code, and the comments. If I've misspoken, please anyone correct my errors. -- Paul class OldStyleClass: """A definition of an old style class.""" pass class NewStyleClass(object): """Note that NewStyleClass explicitly inherits from object. This

Re: How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread Steven Bethard
kyo guan wrote: > How to Adding Functionality to a Class by metaclass(not by inherit) > [snip] > > class MetaFoo(type): > def __init__(cls, name, bases, dic): > super(MetaFoo, cls).__init__(name, bases, dic) > > for n, f in inspect.ge

Re: Jargons of Info Tech industry

2005-08-11 Thread James Stroud
Xah Lee is a known troll. You are retarded to reply to his drivel. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: constructing bytestrings

2005-08-11 Thread Bryan Olson
Lenny G. wrote: > I use 's = os.read(fd, 12)' to grab 12 bytes from a file. Now, I want > to create a string, s1, which contains 16-12=4 bytes: 4,0,0,0, followed > by the contents of s. > > I know how to 's1 = "\x04\x00\x00\x00"' and how to 's3 = s1+s', but I > don't know how to construct s1

Re: Regular expression to match a #

2005-08-11 Thread Bryan Olson
John Machin wrote: [...] > Observation: factoring out the compile step makes the difference much > more apparent. > > >>> ["%.3f" % t.timeit() for t in t3, t4, t5, t6] > ['1.578', '1.175', '2.283', '1.174'] > >>> ["%.3f" % t.timeit() for t in t3, t4, t5, t6] > ['1.582', '1.179', '2.284', '

Lightweight Python distribute it in under 2MBs for Win32

2005-08-11 Thread Ramza Brown
I am sorry if I think like this, but sometimes(keyword sometimes) I like distributing my interpreters. Anyway, I found the absolute minimum libraries needed for Python to work with Win32. And, I included FLTK for the GUI toolkit. Sorry, but wxPython didn't fit my <30MB requirement. You can b

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Jeff Schwab
Ray wrote: > Devan L wrote: > >>Fausto Arinos Barbuto wrote: >> >>>Ray wrote: >>> >>> 1. Where are the access specifiers? (public, protected, private) >>> >>>AFAIK, there is not such a thing in Python. >>> >>>---Fausto >> >>Well, technically you can use _attribute to mangle it, but technic

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Steven Bethard
Ray wrote: > 1. Where are the access specifiers? (public, protected, private) There's no enforceable way of doing these. The convention is that names that begin with a single underscore are private to the class/module/function/etc. Hence why sys._getframe() is considered a hack -- it's not of

Re: Psyco & Linux

2005-08-11 Thread Fausto Arinos Barbuto
Hi Steve; Steve M wrote: >> First, I tried the usual "python setup.py install" but that did not work. > How exactly did it fail? Perhaps you can paste the error output from > this command. Sure, he is the output: linux:/home/fausto/Documents/psyco-1.4 # python setup.py install PROCES

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread kyo guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic):

Re: Pre-PEP Proposal: Codetags

2005-08-11 Thread mdelliot
Wow, thanks for all the quick responses! Martin wrote: > the PEP author is typically expected to implement the proposed > functionality (in many cases, having a draft implementation is > prerequisite to accepting it). Fuzzyman wrote: > ...you could take your proposal forward by developing a set o

How to Adding Functionality to a Class by metaclass(not by inherit)

2005-08-11 Thread Kyo Guan
How to Adding Functionality to a Class by metaclass(not by inherit) #example: import inspect class Foo(object): def f(self): pass def g(self): pass class MetaFoo(type): def __init__(cls, name, bases, dic):

constructing bytestrings

2005-08-11 Thread Lenny G.
I use 's = os.read(fd, 12)' to grab 12 bytes from a file. Now, I want to create a string, s1, which contains 16-12=4 bytes: 4,0,0,0, followed by the contents of s. I know how to 's1 = "\x04\x00\x00\x00"' and how to 's3 = s1+s', but I don't know how to construct s1 dynamically (i.e., given N, cons

Re: Jargons of Info Tech industry

2005-08-11 Thread Keith Thompson
Roedy Green <[EMAIL PROTECTED]> writes: > On 11 Aug 2005 18:23:42 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote or > quoted : [ the usual nonsense ] > > Jargon [...] [snip] Take a look at the Newsgroups: line. Then look for other articles Xah Lee has posted, and see if you can make sense of any of t

Re: Python Challenge on BBC

2005-08-11 Thread could ildg
But when I can't find a way for a long time, I'll be upset. On 8/12/05, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Magnus Lie Hetland wrote: > > Just saw this on the BBC World program Click Online: > > > > > > http://bbcworld.com/content/template_clickonline.asp?pageid=665&co_pageid=6 > > > > I m

Re: Bug in slice type

2005-08-11 Thread Bryan Olson
John Machin wrote: > Steven Bethard wrote: [...] >> BTW, a simpler example of the same phenomenon is: >> >> py> range(10)[slice(None, None, -2)] >> [9, 7, 5, 3, 1] >> py> slice(None, None, -2).indices(10) >> (9, -1, -2) >> py> range(10)[9:-1:-2] >> [] >> > > >>> rt = range(10) > >>>

list to tuple

2005-08-11 Thread zxo102
Hi, I got several dynamic lists a1, b1, c1, from a python application such as a1 = [1,5,3,2,5,...], the len(a1) varies. Same to b1, c1, With python, I would like to reorganize them into a tuple like t1 = ((a1[0],b1[0],c1[0],...),(a1[1],b1[1],c1[1],...),...) Anybody knows

any multi-pattern mathching for python

2005-08-11 Thread [EMAIL PROTECTED]
as I know , agrep can handle this , at least the newer version from http://www.tgries.de/agrep/index.html with a -f property. here is a agrep port to python http://www.bio.cam.ac.uk/~mw263/pyagrep.html, but it is some out of date, and in it's discription "matching of multiple input patterns is def

Re: Psyco & Linux

2005-08-11 Thread Steve M
> First, I tried the usual "python setup.py install" but that did not work. How exactly did it fail? Perhaps you can paste the error output from this command. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Challenge on BBC

2005-08-11 Thread Jeff Schwab
Magnus Lie Hetland wrote: > Just saw this on the BBC World program Click Online: > > http://bbcworld.com/content/template_clickonline.asp?pageid=665&co_pageid=6 > > I must say, I think this is the first time I've heard Python discussed > on TV at all... Cool :) > > (Now maybe I'll have to fini

SSL postgresql & pgdb

2005-08-11 Thread James Saker
Just curious if anyone's aware of a good recipe for setting up SSL access to postgresql for pgdb (or another appropriate db-sig 2 compliant module). Or any good recommendations/considerations e.g. m2crypto with pgdb. jamie -- http://mail.python.org/mailman/listinfo/python-list

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Ray
Devan L wrote: > Fausto Arinos Barbuto wrote: > > Ray wrote: > > > > > 1. Where are the access specifiers? (public, protected, private) > > > > AFAIK, there is not such a thing in Python. > > > > ---Fausto > > Well, technically you can use _attribute to mangle it, but technically > speaking, th

Re: NEWB: General purpose list iteration?

2005-08-11 Thread Devan L
def descend(iterable): if hasattr(iterable, '__iter__'): for element in iterable: descend(element) else: do_something(iterable) This will just do_something(object) to anything that is not an iterable. Only use it if all of your nested structures are of the same

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Ray
Fausto Arinos Barbuto wrote: > Ray wrote: > > > 1. Where are the access specifiers? (public, protected, private) > > AFAIK, there is not such a thing in Python. So everything is public? I know that you can prefix a member with underscores to make something private, but how about protected, for

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Devan L
Fausto Arinos Barbuto wrote: > Ray wrote: > > > 1. Where are the access specifiers? (public, protected, private) > > AFAIK, there is not such a thing in Python. > > ---Fausto Well, technically you can use _attribute to mangle it, but technically speaking, there are no public, protected, or pr

Re: Printing to printer

2005-08-11 Thread Kristian Zoerhoff
On 8/11/05, Steve M <[EMAIL PROTECTED]> wrote: > Kristian Zoerhoff wrote: > > > On 8/11/05, Steve M <[EMAIL PROTECTED]> wrote: > >> Hello, > >> > >>I'm having problems sending information from a python > >> script to a printer. I was wondering if someone might send me > >> in the right dir

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Fausto Arinos Barbuto
Ray wrote: > 1. Where are the access specifiers? (public, protected, private) AFAIK, there is not such a thing in Python. ---Fausto -- http://mail.python.org/mailman/listinfo/python-list

Psyco & Linux

2005-08-11 Thread Fausto Arinos Barbuto
Hi All; I have Psyco (on Windows XP) and now I want to install it on Linux, too. I FTP'd the tarball (tar.gz) from Psyco's site but can't get it compiled. First, I tried the usual "python setup.py install" but that did not work. I later found a RPM for Psyco but it wasn't suitable

Re: Jargons of Info Tech industry

2005-08-11 Thread Roedy Green
On 11 Aug 2005 18:23:42 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote or quoted : >The Jargons of >marketing came from business practice, and they can be excusable >because they are kinda a necessity or can be considered as a naturally >evolved strategy for attracting attention in a laissez-faire eco

How do these Java concepts translate to Python?

2005-08-11 Thread Ray
Hello, I've been learning Python in my sparetime. I'm a Java/C++ programmer by trade. So I've been reading about Python OO, and I have a few questions that I haven't found the answers for :) 1. Where are the access specifiers? (public, protected, private) 2. How does Python know whether a class i

NEWB: General purpose list iteration?

2005-08-11 Thread Donald Newcomb
I'm a real Python NEWB and am intrigued by some of Python's features, so I'm starting to write code to do some things to see how it works. So far I really like the lists and dictionaries since I learned to love content addressability in MATLAB. I was wondering it there's a simple routine (I think

Re: Bug in slice type

2005-08-11 Thread John Machin
Steven Bethard wrote: > Bryan Olson wrote: > >> >> class BuggerAll: >> >> def __init__(self, somelist): >> self.sequence = somelist[:] >> >> def __getitem__(self, key): >> if isinstance(key, slice): >> start, stop, step = key.indices(len(

Re: Printing literal text of an argument

2005-08-11 Thread Rex Eastbourne
Thanks. I adapted it a bit: def debug(foo): print foo, 'is:' exec('pprint.pprint(' + foo + ')') But I'm getting "NameError: name 'foo' is not defined," since foo is not defined in this scope. (The function works beautifully when I'm dealing with global variables, which is very rarely). A

Re: Printing literal text of an argument

2005-08-11 Thread Gregory Bond
Rex Eastbourne wrote: > def debug(aname, avalue): > print aname, 'is': > pprint.pprint(avalue) > use eval: def debug(s): print s, 'is' pprint.pprint(eval(s)) (it does mean the arg is a string not code..) > On a > slightly different topic, is it also possible to ma

Re: FTP over SSL (explicit encryption)

2005-08-11 Thread David Isaac
> David Isaac wrote: > > I am looking for a pure Python secure ftp solution. > > Does it exist? "Andrew MacIntyre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I recall coming across an extension package (pretty sure it wasn't pure > Python anyway, certainly not for the SSL bits)

Re: Help sorting a list by file extension

2005-08-11 Thread George Yoshida
Bengt Richter wrote: [name for dec,name in sorted((int(nm.split('.')[1]),nm) for nm in namelist)] > > ['test.1', 'test.2', 'test.3', 'test.4', 'test.10', 'test.15', 'test.20'] Giving a key argument to sorted will make it simpler:: >>> sorted(namelist, key=lambda x:int(x.rsplit('.')[-1])) --

Re: Bug in slice type

2005-08-11 Thread Bryan Olson
Steven Bethard wrote: > I suspect there's a reason that it's done this way, but I agree with you > that this seems strange. Have you filed a bug report on Sourceforge? I gather that the slice class is young, so my guess is bug. I filed the report -- my first Sourceforge bug report. > BTW, a s

Re: Printing literal text of an argument

2005-08-11 Thread Mike Meyer
[Format recovered from top posting] Jeremy Moles <[EMAIL PROTECTED]> writes: > On Thu, 2005-08-11 at 14:04 -0700, Rex Eastbourne wrote: >> Hi all, >> >> I've written the following simple macro called debug(aname, avalue) >> that prints out the name of an expression and its value: >> >> def debug

Re: Jargons of Info Tech industry

2005-08-11 Thread Jürgen Exner
Xah Lee wrote: > Jargons of Info Tech industry > > (A Love of Jargons) > > Xah Lee, 2002 Feb > > People in the computing field like to spur the use of spurious > jargons. The less educated they are, the more they like extraneous [...] Just for the records at Google et.al. in case someone stumbles

Re: command line reports

2005-08-11 Thread Peter Hansen
Darren Dale wrote: > Thanks, I didnt realize that \r is different from \n. \r has is a byte with value 13, which is the Carriage Return (CR) control character in ASCII. \n has value 10 and is the Line Feed (LF) character. CR is named after the old teletypewriter operation involving moving the

Re: thread limit in python

2005-08-11 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > disregard the C example. wasn't checking the return code of > pthread_create. the C program breaks in the same place, when creating > the 1021st thread. So that's pretty good evidence that it's an OS limit, not a Python limit. The most likely problem is that the sta

Re: Writing a small battleship game server in Python

2005-08-11 Thread Mike Meyer
Dan <[EMAIL PROTECTED]> writes: >> The server should accept connections from new players and be able to handle >> multiple games concurrently. > > Multiple threads would be the way to go for a real application. But if > you want to avoid the complexity involved in threading and > synchronization

Re: Jargons of Info Tech industry

2005-08-11 Thread Ivan Van Laningham
Hi All-- Erik Max Francis wrote: > > Xah Lee wrote: > > > Jargons of Info Tech industry > > > > (A Love of Jargons) > > > > Xah Lee, 2002 Feb > > Congratulations, this time you managed to get to your second paragraph > before your Tourette's kicked in. > You made it that far? Congratulations

keywords for optional args in extension modules

2005-08-11 Thread Sean Richards
Python 2.3.4 (#1, May 29 2004, 17:05:23) [GCC 3.3.3] on linux2 Getting some strange behaviour with keyword arguments for optional arguments in extension modules. See the simple test case below 8<-- #include "Python.h" static PyObject * ke

Re: Jargons of Info Tech industry

2005-08-11 Thread Erik Max Francis
Xah Lee wrote: > Jargons of Info Tech industry > > (A Love of Jargons) > > Xah Lee, 2002 Feb Congratulations, this time you managed to get to your second paragraph before your Tourette's kicked in. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 3

Jargons of Info Tech industry

2005-08-11 Thread Xah Lee
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like extraneous jargons, such as in the Unix & Perl community. Unlike mathematicians, where in mathematics there a

Re: Help sorting a list by file extension

2005-08-11 Thread Bengt Richter
On Fri, 12 Aug 2005 00:06:17 GMT, Peter A. Schott <[EMAIL PROTECTED]> wrote: >Trying to operate on a list of files similar to this: > >test.1 >test.2 >test.3 >test.4 >test.10 >test.15 >test.20 > >etc. > >I want to sort them in numeric order instead of string order. I'm starting >with >this code:

Re: Printing to printer

2005-08-11 Thread Steve M
Kristian Zoerhoff wrote: > On 8/11/05, Steve M <[EMAIL PROTECTED]> wrote: >> Hello, >> >>I'm having problems sending information from a python >> script to a printer. I was wondering if someone might send me >> in the right direction. I wasn't able to find much by Google > > Which platfo

Re: Printing to printer

2005-08-11 Thread Kristian Zoerhoff
On 8/11/05, Steve M <[EMAIL PROTECTED]> wrote: > Hello, > >I'm having problems sending information from a python > script to a printer. I was wondering if someone might send me > in the right direction. I wasn't able to find much by Google Which platform? Directions will vary wildly. --

pcapy help

2005-08-11 Thread billiejoex
Hi man! I found a post of yours in wich you tell that you use pcapy python module to capture packets. I need to do something similar but unfortunately I can't find too much domentation (and example codes) about this library.   Can you paste me a simple code in wich you use this module for

Re: The python license model

2005-08-11 Thread Aahz
In article <[EMAIL PROTECTED]>, Ramza Brown <[EMAIL PROTECTED]> wrote: > >Can you distribute a python system with only a couple of libraries that >you plan to use. For example, I generally avoid having a system with >hundreds of loose scripts(ie python library). So, I have considered >only ta

Printing to printer

2005-08-11 Thread Steve M
Hello, I'm having problems sending information from a python script to a printer. I was wondering if someone might send me in the right direction. I wasn't able to find much by Google TIA Steve -- http://mail.python.org/mailman/listinfo/python-list

Help sorting a list by file extension

2005-08-11 Thread Peter A.Schott
Trying to operate on a list of files similar to this: test.1 test.2 test.3 test.4 test.10 test.15 test.20 etc. I want to sort them in numeric order instead of string order. I'm starting with this code: import os for filename in [filename for filename in os.listdir(os.getcwd())]: print

Re: Why does __init__ not get called?

2005-08-11 Thread Steven Bethard
Steven Bethard wrote: > def __call__(cls, *args, **kwargs): > obj = cls.__new__() > if not isinstance(obj.__class__, cls): ^^ issubclass > return obj > obj.__class__.__init__(obj, *args, **kwargs) > return obj STeVe -- http://mail.pytho

Re: The python license model

2005-08-11 Thread Ramza Brown
Ramza Brown wrote: > Can you distribute a python system with only a couple of libraries that > you plan to use. For example, I generally avoid having a system with > hundreds of loose scripts(ie python library). So, I have considered > only taking the libraries I need. My question, is python

Re: performance of recursive generator

2005-08-11 Thread Steven Bethard
aurora wrote: > This test somehow water down the n^2 issue. The problem is in the depth > of recursion, in this case it is only log(n). It is probably more > interesting to test: > > def gen(n): > if n: > yield n > for i in gen(n-1): > yield i You should be

Can't start new thread

2005-08-11 Thread Hughes, Chad O
Title: Can't start new thread I am trying to understand what is causing python to raise this error when I create a number of threads: thread.error: can't start new thread I have been told that it is due to the default thread size (1 MB), but I have recompiled python defining an alternate

Re: command line reports

2005-08-11 Thread Darren Dale
Bengt Richter wrote: > On Thu, 11 Aug 2005 15:43:23 -0400, Darren Dale <[EMAIL PROTECTED]> wrote: > >>Peter Hansen wrote: >> >>> Darren Dale wrote: Is there a module somewhere that intelligently deals with reports to the command line? I would like to report the progress of some pretty >

The python license model

2005-08-11 Thread Ramza Brown
Can you distribute a python system with only a couple of libraries that you plan to use. For example, I generally avoid having a system with hundreds of loose scripts(ie python library). So, I have considered only taking the libraries I need. My question, is python license friendly for doing

Re: Why is this?

2005-08-11 Thread John Hazen
> [[]]*2 > > [[], []] > [[], []] == [[]]*2 > > True > > Same effect. But try the 'is' operator, to see if they are actually the > same instances of 'empty list': > > [[], []] is [[]]*2 > > True Just curious, did you actually cut and paste this from a real interactive session? (

Re: Regular expression to match a #

2005-08-11 Thread John Machin
Devan L wrote: > John Machin wrote: > >>Devan L wrote: >> >>>John Machin wrote: >>> >>> Aahz wrote: >In article <[EMAIL PROTECTED]>, >John Machin <[EMAIL PROTECTED]> wrote: > > > >>Search for r'^something' can never be better/faster than match for >>r'som

Re: Python supports LSP, does it?

2005-08-11 Thread Mike Meyer
Gregory Bond <[EMAIL PROTECTED]> writes: > phil hunt wrote: >> Let q(x) be a property provable about objects x of type T. Then >> q(y) should be true for objects y of type S where S is a subtype of T >> To me, this is nonsense. Under this definition any subtype must >> behave the same as its pa

Re: Regular expression to match a #

2005-08-11 Thread John Machin
John Machin wrote: > Devan L wrote: > >> John Machin wrote: >> >>> Aahz wrote: >>> In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: > Search for r'^something' can never be better/faster than match for > r'something', and with a dopey implementatio

Re: Regular expression to match a #

2005-08-11 Thread Devan L
John Machin wrote: > Devan L wrote: > > John Machin wrote: > > > >>Aahz wrote: > >> > >>>In article <[EMAIL PROTECTED]>, > >>>John Machin <[EMAIL PROTECTED]> wrote: > >>> > >>> > Search for r'^something' can never be better/faster than match for > r'something', and with a dopey implementa

Re: Printing literal text of an argument

2005-08-11 Thread Jeremy Moles
def debug(s): print "s" exec(s) The line thing i'm not so sure about. Er. Hmmm. On Thu, 2005-08-11 at 14:04 -0700, Rex Eastbourne wrote: > Hi all, > > I've written the following simple macro called debug(aname, avalue) > that prints out the name of an expression and its value: >

Re: Regular expression to match a #

2005-08-11 Thread John Machin
Devan L wrote: > John Machin wrote: > >>Aahz wrote: >> >>>In article <[EMAIL PROTECTED]>, >>>John Machin <[EMAIL PROTECTED]> wrote: >>> >>> Search for r'^something' can never be better/faster than match for r'something', and with a dopey implementation of search [which Python's re is

Re: Regular expression to match a #

2005-08-11 Thread Devan L
John Machin wrote: > Aahz wrote: > > In article <[EMAIL PROTECTED]>, > > John Machin <[EMAIL PROTECTED]> wrote: > > > >>Search for r'^something' can never be better/faster than match for > >>r'something', and with a dopey implementation of search [which Python's > >>re is NOT] it could be much wor

Re: len(sys.argv) in (3,4)

2005-08-11 Thread Bruno Desthuilliers
John Machin a écrit : > bruno modulix wrote: > (snip) >> >> Nope. But since you're running this on a very peculiar OS, I just can >> guess that this very peculiar OS consider all args to be one same >> string... > > > NOT SO: Your cap key got stuck ? (snip) > For *any* OS: More than one CLI

Re: PEP 328, absolute/relative import

2005-08-11 Thread Bengt Richter
On Thu, 11 Aug 2005 14:55:57 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> Will/should an __init__.py in the current directory be required, >> to control what happens (and lessen the probability of accidental >> collision from a random working directory)? > >I don't think

Re: about coding

2005-08-11 Thread John Machin
Paul Watson wrote: > cantabile wrote: > >> Hi, being a newbie in Python, I'm a bit lost with the '-*- coding : >> -*-' directive. >> >> I'm using an accented characters language. Some of them are correctly >> displayed while one doesn't. I've written : >> -*- coding: utf-8 -*- >> >> Is this wron

Re: Python Wireless Extension Module (pyiw)

2005-08-11 Thread Peter Decker
On 8/11/05, Jeremy Moles <[EMAIL PROTECTED]> wrote: > Anyway, I am just curious... we plan on using it, at any rate. It's > already made the code easier to read, faster, and more reliable. Looks pretty useful to me! -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list

Re: len(sys.argv) in (3,4)

2005-08-11 Thread John Machin
bruno modulix wrote: > Daniel Schüle wrote: > >>Hello >> >>I wrote a simple module, which is also supposed to be used as standalone >>program >>after considering how to avoid multiple if's I came up with this idea >> >>if __name__ == "__main__": >>if len(sys.argv) not in (3,4): >>prin

Re: performance of recursive generator

2005-08-11 Thread aurora
> You seem to be assuming that a yield statement and a function call are > equivalent. I'm not sure that's a valid assumption. I don't know. I was hoping the compiler can optimize away the chain of yields. > Anyway, here's some data to consider: > > test.py -

Re: need help with python syntax

2005-08-11 Thread Cyril Bazin
I think bs = BeautifulSoup.BeautifulSoup( oFile) but I don't understand what you are doing... (I never used BeautifulSoup...) Maybe It is somthing like: import itertools for incident in itertools.chain(bs('tr',  {'bgcolor' : '#ee'}), bs('tr',  {'bgcolor' : 'white'})):     do_something() Look

Re: performance of recursive generator

2005-08-11 Thread aurora
On Thu, 11 Aug 2005 01:18:11 -0700, Matt Hammond <[EMAIL PROTECTED]> wrote: > >> Is it an inherent issue in the use of recursive generator? Is there any >> compiler optimization possible? > > Hi, I could be misunderstanding it myself, but I think the short answer > to your question is that i

Re: need help with python syntax

2005-08-11 Thread Bruno Desthuilliers
yaffa a écrit : > dear python gurus, One effectively needs to have some guru-powers to answer you question... > quick question on syntax. > > i have a line of code like this > > for incident in bs('tr', {'bgcolor' : '#ee'}): > > > what i want it to do is look Where ? > for 'bgcolor' :

Re: regex help

2005-08-11 Thread Shantanoo Mahajan
John Machin wrote: > jeff sacksteder wrote: >> Regex questions seem to be rather resistant to googling. >> >> My regex currently looks like - 'FOO:.*\n\n' >> >> The chunk of text I am attempting to locate is a line beginning with >> "FOO:", followed by an unknown number of lines, terminating wit

Re: need help with python syntax

2005-08-11 Thread Bengt Richter
On 11 Aug 2005 11:56:49 -0700, "yaffa" <[EMAIL PROTECTED]> wrote: >dear python gurus, > >quick question on syntax. > >i have a line of code like this > >for incident in bs('tr', {'bgcolor' : '#ee'}): > > >what i want it to do is look for 'bgcolor' : '#ee' or 'bgcolor' : >'white' and then

Re: python2.4/site-packages

2005-08-11 Thread Lucas Raab
Michael Hoffman wrote: > Srinivasan TK wrote: > >> Now ,Is it mandatory that I build the third-party >> packages ( python2.4/site-packages) . > > > Only if you want to use them. Really, no. > >> If so is there a >> list that needs to be built and installed . > > > There is a list of them pack

Re: Python supports LSP, does it?

2005-08-11 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > On Thu, 11 Aug 2005 01:19:19 +0100 > phil hunt wrote: > > > According to Wikipedia, the Liskov substitution principle is: > > > > Let q(x) be a property provable about objects x of type T. Then > > q(y) should be true for objects y of type S where S is a subtype of T

Printing literal text of an argument

2005-08-11 Thread Rex Eastbourne
Hi all, I've written the following simple macro called debug(aname, avalue) that prints out the name of an expression and its value: def debug(aname, avalue): print aname, 'is': pprint.pprint(avalue) An example call is: debug('compose(f1,f2)', compose(f1,f2)) Writing the exact same thi

Python Wireless Extension Module (pyiw)

2005-08-11 Thread Jeremy Moles
I am mostly done with writing an extension module in C that wraps (and makes easier) interfacing with libiw (the library that powers iwconfig, iwlist, and friends on Linux). We're using this internally for a tool to manage wireless connectivity. This is a million times better than hundreds of invoc

Re: Python interpreter error: unsupported operand type(s) for |:

2005-08-11 Thread Bruno Desthuilliers
yaffa a écrit : > hey folks i get this error: Python interpreter error: unsupported > operand type(s) for |: > > when i run this line of code: > > for incident in bs('tr', {'bgcolor' : '#ee'} | {'bgcolor' : > 'white'} ): > > any idea what i'm doing wrong here? yes: trying to do a bitwis

Re: Gotchas in user-space matplotlib install?

2005-08-11 Thread John Hunter
> "Matt" == Matt Feinstein <[EMAIL PROTECTED]> writes: Matt> Hi all-- I'm planning to try to do a completely local Matt> install of matplotlib (in Fedora Core 1)-- the system Matt> administrator isn't going to stop me-- but he isn't going to Matt> cooperate either. I've got the

Re: Python interpreter error: unsupported operand type(s) for |:

2005-08-11 Thread Bruno Desthuilliers
Szabolcs Nagy a écrit : > you cannot use | with two dict (dict has no .__or__ method) > > what are you trying to do? > read the post: "need help with python syntax"... (posted one hour sooner) -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression to match a #

2005-08-11 Thread John Machin
Aahz wrote: > In article <[EMAIL PROTECTED]>, > John Machin <[EMAIL PROTECTED]> wrote: > >>Search for r'^something' can never be better/faster than match for >>r'something', and with a dopey implementation of search [which Python's >>re is NOT] it could be much worse. So please don't tell newbi

  1   2   3   >