Re: need some advice on x y plot

2005-10-20 Thread nephish
how ?
i have tried to use unix timestamps, and i have also tried with
DateTime objects
do i need to use a scale that isn't linear (default in most) ?
how do i putt this off ?

thanks btw.
sk

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modules and Namespaces

2005-10-20 Thread Larry Bates
One way is to pass the RS object when you instantiate
an instance of srfBase, something like:

 class srfBase:
 '''Base class inherited by the srf* classes, binding general Rhino
 surface functionality to a particular
 surface generation method'''
 def __init__(self, RS):
 self.id   = 'self.id srfBase'
 self.RS=RS
 return
 def isBrep(self):
 return self.RS.IsBrep(self.id)
 def isPointInSurface(self, coord):
 return self.RS.IsPointInSurface(self.id, coord)

This is how most of wxWindows seems to do things.

-Larry Bates

Jelle Feringa / EZCT Architecture & Design Research wrote:
> ##I'm sorry to stir up such a well discussed topic yet again, but namespaces
> are a point of confusion to me...
> 
> I took the effort of organizing my Python code (scripting a cad program
> calles Rhino) in well defined classes, which would be a terrific thing if I
> didn't got stuck in namespace issues.
> 
> I have a module that launches the application I'm scripting via win32com;
> rhino.load
> 
> from rhino import load
> RS = load.RS
> 
> So the application, with all its methods are now available through the RS
> (RhinoScript) object
> 
> from rhino import SRF # is where things get stuck
> 
> The RS object is the application scripted via COM, where all its method
> reside.
> In my module, SRF, I'm not importing anything, though it refers to the RS
> object all the time.
> Such as:
> 
> class srfBase:
> '''Base class inherited by the srf* classes, binding general Rhino
> surface functionality to a particular
> surface generation method'''
> def __init__(self):
> self.id   = 'self.id srfBase'
> pass
> def isBrep(self):
> return RS.IsBrep(self.id)
> def isPointInSurface(self, coord):
> return RS.IsPointInSurface(self.id, coord)
> 
> 
> How do I make the RS object available to the imported SRF module, such that
> my module code and program code both refer to RS as the application object
> being scripted?
> 
> Cheers,
> 
> Jelle.
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: best way to replace first word in string?

2005-10-20 Thread Larry Bates
There is a "gotcha" on this:

How do you define "word"? (e.g. can the
first word be followed by space, comma, period,
or other punctuation or is it always a space).

If it is always a space then this will be pretty
"efficient".

string="aa to become"
firstword, restwords=s.split(' ',1)
newstring="/%s/ %s" % (firstword, restwords)

I'm sure the regular expression gurus here can come
up with something if it can be followed by other than
a space.

-Larry Bates


[EMAIL PROTECTED] wrote:
> I am looking for the best and efficient way to replace the first word
> in a str, like this:
> "aa to become" -> "/aa/ to become"
> I know I can use spilt and than join them
> but I can also use regular expressions
> and I sure there is a lot ways, but I need realy efficient one
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modules and Namespaces

2005-10-20 Thread Steve Holden
Jelle Feringa / EZCT Architecture & Design Research wrote:
> ##I'm sorry to stir up such a well discussed topic yet again, but namespaces
> are a point of confusion to me...
> 
> I took the effort of organizing my Python code (scripting a cad program
> calles Rhino) in well defined classes, which would be a terrific thing if I
> didn't got stuck in namespace issues.
> 
> I have a module that launches the application I'm scripting via win32com;
> rhino.load
> 
> from rhino import load
> RS = load.RS
> 
> So the application, with all its methods are now available through the RS
> (RhinoScript) object
> 
> from rhino import SRF # is where things get stuck
> 
> The RS object is the application scripted via COM, where all its method
> reside.
> In my module, SRF, I'm not importing anything, though it refers to the RS
> object all the time.
> Such as:
> 
> class srfBase:
> '''Base class inherited by the srf* classes, binding general Rhino
> surface functionality to a particular
> surface generation method'''
> def __init__(self):
> self.id   = 'self.id srfBase'
> pass
> def isBrep(self):
> return RS.IsBrep(self.id)
> def isPointInSurface(self, coord):
> return RS.IsPointInSurface(self.id, coord)
> 
> 
> How do I make the RS object available to the imported SRF module, such that
> my module code and program code both refer to RS as the application object
> being scripted?
> 
One relatively simple way (though not a perfect solution) is to provide 
a function in the SRF module that allows the caller to provide a 
reference to the RS object, which is then stored as a module global. 
Similar to this:

# Somewhere in SRF's code

RS = None   # This RS is global to the SRF module

def RSreg(rs):
 global RS  # Ensures it isn't treated as function-local
 RS = rs

Then all you have to do is

from rhino import load
RS = load.RS

from rhino import SRF
SRF.RSreg(RS)

and everything inside SRF can refer to RS as a module global quite 
happily. Note that this falls over horribly if you ever want to handle 
several RS objects at the same time. In that case you might be better 
explicitly passing RS references into each function that uses them.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


sort problem

2005-10-20 Thread Michele Petrazzo
I have a list of lists (a grid table) that can have about 15000 - 2
"rows" and 10 "cols", so:

1 [ [ 'aaa', 'vv', 'cc', 23, ... ],
2   [ 'aav', 'vv', 'cc', 45, ... ],
...
15000   [ 'sad', 'ad', 'es', 123, ... ], ]

I need to sort this list, but I need to specify two things: the "column"
and its type (string or int), so for example in this list, I want to
sort the fourth column that has int values. The type because that I want
that 1, 2, 12 will be sort in this order, not 1, 12, 2 like strings.

I have already tried to modify some code found on aspn, but the results
are always too slow for me, about 30-40 sec.
Can someone has some code or some point where can I start for speedup my
code?

Thanks,
Michele
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need some advice on x y plot

2005-10-20 Thread Grant Edwards
On 2005-10-20, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> [...] I need to make an x y chart for some data that comes in
> from sensors at different times durring the day. i need it to
> show the value in the y and the time in the x .  no problem so
> far. But what i cannot get to happen is to scale x (time of
> the plot) with respect to time.

Gnuplot does that just fine.  Just give it two columns of data, the
first being the x value (time) and the second being the y value.

All of the other plotting packages handle this as well.

-- 
Grant Edwards   grante Yow!  I hope I
  at   bought the right
   visi.comrelish... z...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing a dll from Python

2005-10-20 Thread mku
I used ctypes. It works really fine with DLLs.
have a lool at http://starship.python.net/crew/theller/ctypes
Martin

-- 
http://mail.python.org/mailman/listinfo/python-list


How to retrieve the filename of a module

2005-10-20 Thread mku
Hi,

there´s a function inside a module. How can these function retrieve
the path+name   of his module ? (The path is most important).
That should also work if the module is part of a package.

Thanks in advance

Martin

-- 
http://mail.python.org/mailman/listinfo/python-list


Ruby on Rails Agile role

2005-10-20 Thread [EMAIL PROTECTED]
I am looking for 2 Software Engineers with a Java / Python / Ruby
background to work for a rapidly growing start-up using Ruby on Rails
in an Agile environment.


The role is paying between £40 - £45k and is based in central London.



Please send your details to grant @ connectionsrecruit.co.uk or call
01189897601

-- 
http://mail.python.org/mailman/listinfo/python-list


Searching for txt file and importing to ms access

2005-10-20 Thread Mark Line
Hello!



I'm a python n00b!



I've been writing in c++ for a few years so programming's not new to me, 
just python that I don't know the syntax!



What I'm trying to do is get an email from an pop3 account, and then search 
the email for some CVS data and import that information into MS Access.



I'm managed to get some code to download a message from the email account 
and save it to a text file, does any one have a link to some sample code to 
search though a file until a string of characters is matched?  Or could 
point me to some functions that may help me with this?



I've also managed to connect to my access database, and just print out a 
field in a table, but I cant find anywhere on the web that will help me to 
import data?  Any help would be great?!



By the way I'm running on windows, and have installed the windows add on's.



Thanks in advance

Mark



email code



import sys, poplib


f = open('c:\\myfile.txt', 'w')

mailserver = 'pop3.abilitec.com'
mailuser   = '[EMAIL PROTECTED]'
mailpasswd = '***'



print 'Connecting...'
server = poplib.POP3(mailserver)
server.user(mailuser)  # connect, login to mail server
server.pass_(mailpasswd)   # pass is a reserved word

try:
print server.getwelcome()  # print returned greeting message
msgCount, msgBytes = server.stat()
print 'There are', msgCount, 'mail messages in', msgBytes, 'bytes'
print server.list()
print '-'*80

for i in range(msgCount):
hdr, message, octets = server.retr(i+1)# octets is byte count
for line in message:
 # retrieve, print all 
mail
f.write(line)
f.write('\n')
print '-'*80   # mail box locked till 
quit
if i < msgCount - 1:
   raw_input('[Press Enter key]')
finally:   # make sure we unlock 
mbox
server.quit()  # else locked till 
timeout
print 'Bye.'

f.close()





access



import sys, win32com.client

print 'start'

connection = win32com.client.Dispatch(r'ADODB.Connection')
DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA 
SOURCE=c:\\booking.mdb;/root/blackcomb'
connection.Open(DSN)
recordset = win32com.client.Dispatch(r'ADODB.Recordset')
recordset.Open('SELECT * FROM tblBooking', connection, 1, 3)
fields_dict = {}
for x in range(recordset.Fields.Count):
fields_dict[x] = recordset.Fields.Item(x).Name
print fields_dict[x], recordset.Fields.Item(x).Value

print 'end'







-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some more odd behaviour from the Regexp library

2005-10-20 Thread David Veerasingam
Thanks for all your replies.

I guess I've always used .*? as sort of an idiom for a non-greedy
match, but I guess it only works if I specify the end point (which I
didn't in the above case).

e.g. re.search(r'exit: (.*?)$', a)

Thanks for pointing that out! 

David

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> >> Using // for 'in' looks really weird, too. It's too bad you can't
> >> overload Python's 'in' operator. (Can you? It seems to be hard-coded
> >> to iterate through an iterable and look for the value, rather than
> >> calling a private method like some other builtins do.)
> >>
> >
> > // was a bit of a stretch.  I'd initially thought it for the "where"
> > clause, becuase it's lower precedence than ** (I think), and really
> > late at night // kind of looks like a W.  I decided against it because
> > it looks to close to a comment in some other languages.
> >
> > Python "in" clause doesn't seem exploitable in any way--probably a
> > good
> > thing.  I did add a "in_" method (name is arguable), which does the
> > same thing, also a not_in.
>
> What about modifying the overloaded == to produce 'in' if the right-
> hand side is a list? Then you can more easily generate statements
> dynamically:
>
> def makeCond(name):
>  return someOtherCond & (model.table.name == name)
>
> makeCond("foo")
> makeCond(["foo", "bar"])
>
> And it doesn't require two different functions.
>
> As long as there is no case where you might actually want to test if
> a column value equals a list, it should work. Is there? Some DBs
> support an Array type, but in general that might be better handled
> with an Array class, anyway.

This is a great idea, and should be the default behaviour for lists.
It does present a problem if the right hand expression is a SELECT
object, though.  Both of these are valid syntax:

id = (select max(id) from table)
id in (select id from table)

Also, SQLite allows for  column in table_name syntax.  I've never seen
that before, but I wanted to support that, there'd be no way of knowing
in vs. ==.

On this line of thought, what about the += operator?  That might be
more intuative than //.  I could even use -= for not in.

Runar

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread beza1e1
Uh, no good style to comment myself, sorry. I just found why i could't
see your blog entry. Since i read your message through groups.google.de
i just clicked on the link. Your Google Highlight plugin seems to be
confused about that:

Warning: Unknown modifier '/' in
/var/www/html/wp/wp-content/plugins/google-hilite.php on line 107

Warning: Unknown modifier 'w' in
/var/www/html/wp/wp-content/plugins/google-hilite.php on line 105

Not everybody who comes from google has a search query in his referer ;)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread beza1e1
I just see a database error on your blog, perhaps you should have used
Python instead of PHP? Ok, kidding ;)

Since i can't see your comparison, i have to guess. PHP wins? Would not
surprise me, because PHP+MySQL is the easiest hosting to get.
Wordpress, Textpattern, ... are also much more polished.

btw my blog runs on Python! :D
http://beza1e1.tuxen.de

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __getattr__, __setattr__

2005-10-20 Thread Steve Holden
Thomas Heller wrote:
> Just wondering about this behaviour, why is it this way?
> 
> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> 
object.__setattr__
> 
> 
> 
object.__getattr__
> 
> Traceback (most recent call last):
>   File "", line 1, in ?
> AttributeError: type object 'object' has no attribute '__getattr__'
> 
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> object.__getattribute__


Ring any bells?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> The big operator question will be: how will "and" and "or" be
> implemented? This is always a sticking point because of Python's
> short-circuiting behaviors regarding them (the resultant bytecode will
> include a JUMP).

I'm using the Boolean | and & operators for logical groups, eg (a | b |
(b & c)).  This might seem ugly to pureists, but solves all of the
short-circuit issues.  It does require the user to use excessive
parentheses, becuase | evaluates before ==.  Another option is to use
functions-- AND(EQ(a, 1), OR(IN(B,(1,2,3 -- But I find this hard to
read.  But mixing the two is sometimes clean:  EQ(a,1) & LT(b,2).  But
having too many ways of doing things doesn't seem very pythonic.

>
> An alternative is to stuff the representation into a string, which can
> then be parsed however one likes.
>
> For Dejavu (http://projects.amor.org/dejavu), I didn't do either
> one--instead I used lambdas to express the where clause, so that:
>
> f = logic.Expression(lambda x: ('Rick' in x.Name) or
>  (x.Birthdate == datetime.date(1970, 1, 1)))
> units = sandbox.recall(Person, f)
>
> might produce, in the bowels of the ORM:
>
> "SELECT * FROM [Person] WHERE [Person].[Name] Like '%Rick%' or
> [Person].[Birthdate] = #1/1/1970#"
>
> Note that the tablename is provided in a separate step. The translation
> is based on the codewalk.py and logic.py modules, which are in the
> public domain if you want to use any part of them. See
> http://projects.amor.org/dejavu/svn/trunk/

This is a very elegant solution, so much so that I almost didn't go
down the path of sqlstring.  Having support for lambda expressions is
still an option, though I wanted to try object operator
overloading/methods first--too see if I could avoid the Bytecode issue.

>
> >2. How to best add further sql function support? Adding magic
> > callable objects to columns came to mind, but this has it's own set
> > of issues. I'm leaning towards a magic object in the sqlstring
> > module. For example:
> >
> >   sqlstring.F.substring(0, 4, person.first_name)
> >
> >   would result in: substring(0, 4, person.first_name). the F object
> > could be put in the local scope for short-hand.
>
> This is a hard problem, since your sqlstring module doesn't control the
> result sets, and so can't provide fallback mechanisms if a given
> database does not support a given function (or operator, or minute
> detail of how a function or operator works; for example, LIKE is
> case-insensitive in MS SQL Server but case-sensitive in PostgreSQL). If
> you're going to use subclasses to handle "database-specific overwrites"
> (below), then you'll probably want to stick such functions in that base
> class (and override them in subclasses), as well.
Good point.  These things should be able to be "intercepted" in the
database specific modules, so the library has a documented way
functions should be used (ANSI if applicable), but database specific
overwrites allow us to deal with issues or hacks (to emulate a
function) in databases.


> See the Adapter and SQLDecompiler classes in
> http://projects.amor.org/dejavu/svn/trunk/storage/db.py (and the
> store*.py modules) for some examples of using subclassing to produce
> database-specific syntax. There, it's one Adapter class per supported
> DB-type; you might consider keeping the Expression objects themselves
> free from SQL, and transform the Expressions to SQL in a separate
> class, which you could then subclass.
Thanks.  Your approach here had already inspired me, I'll take a look
at it again.  Pulling the SQL out of the Expression objects is double
sided, but might be a way to cleanly support db syntax nuances.  I'll
keep you posted.

Runar

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-20 Thread Steve Holden
Rocco Moretti wrote:
> James Stroud wrote:
> 
> 
>>I propose that any time anyone suggests switching to Windows, the reasons for 
>>such should be explicitly described, and not left to interpretation.
> 
> 
> I propose that any time anyone suggests switching to Linux ...
> I propose that any time anyone suggests switching to Mac ...
> I propose that any time anyone suggests switching to Ruby ...
> I propose that any time anyone suggests switching to Firefox ...
> I propose that any time anyone suggests switching to Waxed Dental Floss ...
> 
> People should not feel *required* to justify their decisions to c.l.py, 
> especially if they are not trying to evangelize that choice. (FWIW, even 
> from the original post it's very apparent that he's dissuading people 
> from joining him.)
> 
> It is true that giving the reasons for a choice will help responders put 
> some perspective on it, and perhaps prompt a few alternatives, but 
> c.l.py is not your mother, and shouldn't require you to justify the 
> validity of your lifestyle to it.

Man, you mean I can use any dental floss I like?!?!?!?!!?

regards
  Steve

who quite agrees with the sentiments expressed above
(it's an extension of the "consenting adults" philosophy).
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


need some advice on x y plot

2005-10-20 Thread nephish
Hey there,
i have tried about every graphing package for python i can get to work
on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get
matplot to work)
so far, they all are working ok. I need to make an x y chart for some
data that comes in from sensors at different times durring the day. i
need it to show the value in the y and the time in the x .  no problem
so far. But what i cannot get to happen is to scale x (time of the
plot) with respect to time. in other words, i get a chart with the
times evenly spaced out along the x axis, with their respective values.
i need the chart to show gaps when there are gaps in the data. i need
it to be able to scale by time. if i have 3 values that come in within
a few minutes, i need them to be displayed close together, as compared
to another value that may come in, say, an hour later. Does this make
sence ?
one of you guys know a charting app that will do this ? or is there
some other way i could do it?

looking for suggestions,
sk

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: possible bug in cherrypy.lib.autoreload

2005-10-20 Thread infidel
Ok, so it turns out that the problem the cherrypy.lib.autoreload module
is having, is that kid imports elementtree and on my machine the
elementtree modules are inside a zip file (.egg).  So the "path" to the
elementtree __init__.py file is not a valid OS path because everything
after the .egg file is inside the file.

Is there a quick way of determining that a module was imported from a
zip file, or that a module's __file__ attribute is a valid path as far
as Python is concerned, even though it doesn't exist to the OS?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: __getattr__, __setattr__

2005-10-20 Thread [EMAIL PROTECTED]
for new style classes  __getattribute__ is defined, see eg.
http://www.python.org/2.2.3/descrintro.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread Casey Hawthorne
What languages do you know already?

What computer science concepts do you know?

What computer programming concepts do you know?


Have you heard of Scheme?


Ruby is a bit Perl like -- so if you like Perl, chances are you might
like Ruby.

Python is more like Java.

I have heard, but have not been able to verify that if a program is
about
10,000 lines in C++
it is about
5,000 lines in Java
and it is about
3,000 lines in Python (Ruby to?)



Roy Smith <[EMAIL PROTECTED]> wrote:

>In article <[EMAIL PROTECTED]>,
> "Amol Vaidya" <[EMAIL PROTECTED]> wrote:
>
>> Hi. I am interested in learning a new programming language, and have been 
>> debating whether to learn Ruby or Python. How do these compare and contrast 
>> with one another, and what advantages does one language provide over the 
>> other? I would like to consider as many opinions as I can on this matter 
>> before I start studying either language in depth. Any help/comments are 
>> greatly appreciated. Thanks in advance for your help. 
>
>Of all the common scripting languages, Ruby has the highest vowel to 
>consonant ratio.
--
Regards,
Casey
-- 
http://mail.python.org/mailman/listinfo/python-list


Popularity of blogging tools used by python programmers

2005-10-20 Thread Stewart Midwinter
I've made a comparison of the relative popularity of blogging tools
used by python programmers.  I was surprised by the number of python
developers not using python for their blogs; isn't that like GM
employees driving Toyota cars?

See my post at:

http://midtoad.homelinux.org/wp/?p=117

S
-- 
http://mail.python.org/mailman/listinfo/python-list


Modules and Namespaces

2005-10-20 Thread Jelle Feringa / EZCT Architecture & Design Research
##I'm sorry to stir up such a well discussed topic yet again, but namespaces
are a point of confusion to me...

I took the effort of organizing my Python code (scripting a cad program
calles Rhino) in well defined classes, which would be a terrific thing if I
didn't got stuck in namespace issues.

I have a module that launches the application I'm scripting via win32com;
rhino.load

from rhino import load
RS = load.RS

So the application, with all its methods are now available through the RS
(RhinoScript) object

from rhino import SRF # is where things get stuck

The RS object is the application scripted via COM, where all its method
reside.
In my module, SRF, I'm not importing anything, though it refers to the RS
object all the time.
Such as:

class srfBase:
'''Base class inherited by the srf* classes, binding general Rhino
surface functionality to a particular
surface generation method'''
def __init__(self):
self.id   = 'self.id srfBase'
pass
def isBrep(self):
return RS.IsBrep(self.id)
def isPointInSurface(self, coord):
return RS.IsPointInSurface(self.id, coord)


How do I make the RS object available to the imported SRF module, such that
my module code and program code both refer to RS as the application object
being scripted?

Cheers,

Jelle.


-- 
http://mail.python.org/mailman/listinfo/python-list


best way to replace first word in string?

2005-10-20 Thread [EMAIL PROTECTED]
I am looking for the best and efficient way to replace the first word
in a str, like this:
"aa to become" -> "/aa/ to become"
I know I can use spilt and than join them
but I can also use regular expressions
and I sure there is a lot ways, but I need realy efficient one

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-20 Thread Rocco Moretti
James Stroud wrote:

> I propose that any time anyone suggests switching to Windows, the reasons for 
> such should be explicitly described, and not left to interpretation.

I propose that any time anyone suggests switching to Linux ...
I propose that any time anyone suggests switching to Mac ...
I propose that any time anyone suggests switching to Ruby ...
I propose that any time anyone suggests switching to Firefox ...
I propose that any time anyone suggests switching to Waxed Dental Floss ...

People should not feel *required* to justify their decisions to c.l.py, 
especially if they are not trying to evangelize that choice. (FWIW, even 
from the original post it's very apparent that he's dissuading people 
from joining him.)

It is true that giving the reasons for a choice will help responders put 
some perspective on it, and perhaps prompt a few alternatives, but 
c.l.py is not your mother, and shouldn't require you to justify the 
validity of your lifestyle to it.
-- 
http://mail.python.org/mailman/listinfo/python-list


__getattr__, __setattr__

2005-10-20 Thread Thomas Heller
Just wondering about this behaviour, why is it this way?

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> object.__setattr__

>>> object.__getattr__
Traceback (most recent call last):
  File "", line 1, in ?
AttributeError: type object 'object' has no attribute '__getattr__'
>>>


Thanks,

Thomas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Jason Stitt
On Oct 19, 2005, at 11:55 PM, [EMAIL PROTECTED] wrote:

>
> Jason Stitt wrote:
>
>>
>> Using // for 'in' looks really weird, too. It's too bad you can't
>> overload Python's 'in' operator. (Can you? It seems to be hard-coded
>> to iterate through an iterable and look for the value, rather than
>> calling a private method like some other builtins do.)
>>
>
> // was a bit of a stretch.  I'd initially thought it for the "where"
> clause, becuase it's lower precedence than ** (I think), and really
> late at night // kind of looks like a W.  I decided against it because
> it looks to close to a comment in some other languages.
>
> Python "in" clause doesn't seem exploitable in any way--probably a  
> good
> thing.  I did add a "in_" method (name is arguable), which does the
> same thing, also a not_in.

What about modifying the overloaded == to produce 'in' if the right- 
hand side is a list? Then you can more easily generate statements  
dynamically:

def makeCond(name):
 return someOtherCond & (model.table.name == name)

makeCond("foo")
makeCond(["foo", "bar"])

And it doesn't require two different functions.

As long as there is no case where you might actually want to test if  
a column value equals a list, it should work. Is there? Some DBs  
support an Array type, but in general that might be better handled  
with an Array class, anyway.

- Jason, fingers crossed that all this black magic doesn't affect  
one's chances in the afterlife ;)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: destroy your self????

2005-10-20 Thread Ron Adam
James wrote:
> Doesn't work for classes because self has no global reference.

True.  To make it work one would need to track instances and names and 
do comparisons... and so on.  So it's not worth it.  ;-)

Cheers,
Ron
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UI toolkits for Python

2005-10-20 Thread Ed Jensen
Kenneth McDonald <[EMAIL PROTECTED]> wrote:
> I'd have to agree with this. Unfortunately, the only way to use Swing  
> (in a
> reasonable manner) from Python is to use Jython, and Jython has other
> shortcomings that make me not want to use it.

What shortcomings?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abstract Methods & Abstract Class

2005-10-20 Thread sébastien
or 

[...]
def method(self):
assert not "must be overrided"

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread Grant Edwards
On 2005-10-20, Christian <[EMAIL PROTECTED]> wrote:

> How do I export an environment variable in a .py script?

http://www.python.org/doc/current/lib/os-procinfo.html#l2h-1548

-- 
Grant Edwards   grante Yow!  My BIOLOGICAL ALARM
  at   CLOCK just went off... It
   visi.comhas noiseless DOZE FUNCTION
   and full kitchen!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread Grant Edwards
On 2005-10-20, the_crazy88 <[EMAIL PROTECTED]> wrote:

> os.system("export PYTHONPATH = %s" %("your_pythonpath"))

No, that won't work.  

That will set the environment variable in the shell spawned by
the os.system command.  That shell will then immediately exit,
leaving the caller's environment unchanged.

-- 
Grant Edwards   grante Yow!  Are you mentally here
  at   at Pizza Hut??
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing a dll from Python

2005-10-20 Thread Larry Bates
If you want you can also take a look at something I wrote a while
ago (before ctypes was really well known).  It has worked for me
with .DLLS form Castelle and Expervision that both have extensive
APIs.  It is located here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847

Larry Bates

dcrespo wrote:
> Hi to all,
> 
> Can someone give me lights on how can I deal with dlls from python?
> 
> My main purpose is to get access to a Unitech PT600 Bar Code system. I
> have the dll that works fine through Visual Basic. But I'm migrating to
> Python, so I need a way to use the same dll, or a C library.
> 
> I tried to access a dll created by myself on Visual Basic. The dll just
> have one function. It works perfect when using it on a VB project just
> including it in the references configuration. But I can't access it
> from python. I tried the ctypes module.
> 
> Thank you
> 
> Daniel
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sequence and/or pattern matching

2005-10-20 Thread Mike Meyer
"Séb" <[EMAIL PROTECTED]> writes:

> Hi everybody,
>
> Thanks for the time taken to answer my question. Unfortunatly, it seems
> that there's a little confusion about what I want to do.
>
> In fact, I don't want to search for a particular path between
> computers. What I really want is to detect sequences of connection that
> are repeated along the log. Is it clearer, if not, I will put another
> exmample ;-)

You're right - I was confused. That's why I asked about the timing
issue. But I also indicated that I might be way off base with that.

Everyone may be confused as well - we thought you were looking for
*any* series of connections that started at one computer and ended at
a second computer. That problem is the well-understood problem of
finding a path through a graph, where "path" is used in a
graph-theoretic sense and not a network sense.

>From what you say above, it looks like you're looking for a specfic
sequence of connections in your connetions record. That's a much
easier problem. Roughly, you'd do:

def matches(desired, history):
"""Determines if history contains the desired path.
desired = # List of connections we're looking for.
history = # List of connections that were actually made."""

for con in desired:
try:
while not con.matches(history[hp]):
hp += 1
except IndexError:
return False
   return True


 http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread Eric Brunel
On 20 Oct 2005 01:58:44 -0700, the_crazy88 <[EMAIL PROTECTED]> wrote:

> Just use
> os.system("export PYTHONPATH = %s" %("your_pythonpath"))

... except it won't work: os.system will execute the command in a new process, 
so the environment variable change will only be visible in *this* process. 
Since you don't do anything else, the environment variable change will never be 
seen by anyone.

As for the OP's question, the short answer is "you can't": the Python 
interpreter will always be executed in a different process than the calling 
shell, and environment variable changes *never* impact the calling process on 
Unix.

The closest thing you can do is that:

-myScript.py--
print 'export MY_VARIABLE=value'
--

-myScript.sh--
python myScript.py > /tmp/chgvars.sh
. /tmp/chgvars.sh
--

This is quite ugly: you write the shell commands changing the environment 
variables to a file, then "source" this file in the calling shell. But this is 
probably the best way to do what you want.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in 
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting 2bit hex representation to integer ?

2005-10-20 Thread Larry Bates
No you can't convert using str().  Binary data is
stored in a Python string object, but it isn't really
a string.  It is rather just a bunch of bits packed
into a string variable.  struct.unpack() will unpack
those bits into any number of different types of
variables and is what you need.

Example:

import struct
s='\x64'
values=struct.unpack('b',s)
print "values=",values

value=(100,)

Note: struct.unpack returns a tuple of values.  Just get
values[0] to get the first one.

Larry

Madhusudan Singh wrote:
> Larry Bates wrote:
> 
> 
>>Can you give us an example.  I don't know what two bit
>>hex means (takes at least 4 bits to make a hex digit).
> 
> 
> Like 64(base 16)=100.
> I am referring to 64 in the above.
> 
> 
>>Now I'm going to try to guess:
>>
>>If the data is binary then all you need to do is to
>>use the struct.unpack module to convert to integer.
> 
> 
> Doesn't unpack presume that the input is a string ? If so, is it safe to
> convert binary data to string using str() ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New Website

2005-10-20 Thread Diez B. Roggisch
I get a 404 - as Linux and MacOs-User, I'm pretty ignorant of
Viruses/Malware. So, I'm not sure but I think it's possible that this
site is spreading such malicious content.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Jason Stitt
On Oct 20, 2005, at 2:19 AM, Steve Holden wrote:

> Jason Stitt wrote:

>> Using // for 'in' looks really weird, too. It's too bad you can't
>> overload Python's 'in' operator. (Can you? It seems to be hard-coded
>> to iterate through an iterable and look for the value, rather than
>> calling a private method like some other builtins do.)
>>
 class inplus(object):

> ...   def __contains__(self, thing):
> ... print "Do I have a", thing, "?"
> ... return True
> ...

I stand corrected. Python.org was intermittently down  
yesterday so I was trying to play around with the  
interactive interpreter and missed it.

For future reference:
http://www.python.org/doc/ref/specialnames.html

However 'in' seems to coerce the return value of __contains__ to True  
or False, even if you return an object reference.

- Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to extract a part of html file

2005-10-20 Thread Mike Meyer
Ben Finney <[EMAIL PROTECTED]> writes:

> Joe <[EMAIL PROTECTED]> wrote:
>> I'm trying to extract part of html code from a tag to a tag
> For tag soup, use BeautifulSoup:
> http://www.crummy.com/software/BeautifulSoup/>

Except he's trying to extract an apparently random part of the
file. BeautifulSoup is a wonderful thing for dealing with X/HTML
documents as structured documents, which is how you want to deal with
them most of the time.

In this case, an re works nicely:

>>> import re
>>> s = '  and ends with TD> >> src="http://whatever/some.gif";> '
>>> r = re.match('(.*)TD> >> src="http://whatever/some.gif";> ', s)
>>> r.group(1)
'  and ends with '
>>> 

String.find also works really well:

>>> start = s.find('') + len('>> class="boldyellow">')
>>> stop = s.find('TD> http://whatever/some.gif";> 
>>> ', start)
>>> s[start:stop]
'  and ends with '
>>> 

Not a lot to choose between them.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread Steven D'Aprano
On Thu, 20 Oct 2005 13:17:14 +, axel wrote:

> Employees have *no* obligations towards the shareholders of a company.
> They are not employed or paid by the shareholders, they are employed
> by the company itself which is a separate legal entity.
> 
> It is a different matter for the board of directors of a company.

The board of directors are also employees of the company. That's why the
company can fire them.


-- 
Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extention Woes

2005-10-20 Thread Tuvas
Never mind, problem solved. The other problem I was having was I forgot
to put the .so at the end of a file, so it didn't change anything.
Thanks for all of the help!

-- 
http://mail.python.org/mailman/listinfo/python-list


KeyboardInterrupt vs extension written in C

2005-10-20 Thread Tamas Nepusz
Hi everyone,

I have tried to do some googling before asking my question here, but I
haven't found any suitable answer. I am developing a Python API for a
graph library written in pure C. The library is doing an awful lot of
math computations, and some of them can take a pretty long time
(depending on the size of the input). If I invoke such calculation from
Python using my own extension, the interpreter locks until the
calculation is complete (I mean, it is not responding to Ctrl-C or
SIGINT).

My question is: is there any way to allow the user to use Ctrl-C to
generate a KeyboardInterrupt and cancel such large computations? I'm
assuming that although pressing Ctrl-C may generate a KeyboardInterrupt
in Python, it is not propagated to the user level until the call into
the graph library returns. I tried to add Py_BEGIN_ALLOW_THREADS before
the call to the underlying C library and Py_END_ALLOW_THREADS after
returning from it, but I had no luck.

Thanks in advance for your answers,
--
Tamas <[EMAIL PROTECTED]>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing a dll from Python

2005-10-20 Thread Richie Hindle

[Daniel]
> I tried the ctypes module.

ctypes is the right way to do it.  You need to post your code and whatever
errors you received.  Here's an example of using ctypes to call a DLL:

>>> from ctypes import *
>>> windll.user32.MessageBoxA(None, "Hello world", "ctypes", 0);

You use "windll" for stdcall functions (eg. the Windows API) and "cdll" for
cdecl functions.  I don't know which one VB defaults to.  If you get it
wrong, ctypes will give you an error talking about using the "wrong calling
convention".

-- 
Richie Hindle
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Accessing a dll from Python

2005-10-20 Thread dcrespo
Hi to all,

Can someone give me lights on how can I deal with dlls from python?

My main purpose is to get access to a Unitech PT600 Bar Code system. I
have the dll that works fine through Visual Basic. But I'm migrating to
Python, so I need a way to use the same dll, or a C library.

I tried to access a dll created by myself on Visual Basic. The dll just
have one function. It works perfect when using it on a VB project just
including it in the references configuration. But I can't access it
from python. I tried the ctypes module.

Thank you

Daniel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread axel
In comp.lang.perl.misc Roedy Green <[EMAIL PROTECTED]> wrote:
> On Wed, 19 Oct 2005 03:15:03 -0700, "David Schwartz"
> <[EMAIL PROTECTED]> wrote or quoted :
 
>>Did I say their obligation was to secure their shareholders as much 
>>profit as possible? I said their obligation was to their shareholders.
 
> You are literally saying people work for a company have an obligation
> to the shareholders. That is too obvious to be bothered with
> announcing. The employees take the shareholder's money, so obviously
> they have an obligation to produce something in return.  When I read
> your words, I think you really mean this is the prime or sole
> obligation of an employee.  I disagree with that. There are many
> loyalties that compete.

Employees have *no* obligations towards the shareholders of a company.
They are not employed or paid by the shareholders, they are employed
by the company itself which is a separate legal entity.

It is a different matter for the board of directors of a company.

Axel
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>,
bruno modulix  <[EMAIL PROTECTED]> wrote:
>Bryan wrote:
>> Amol Vaidya wrote:
>> 
>>> Hi. I am interested in learning a new programming language, and have
>>> been debating whether to learn Ruby or Python. 
>(snip)
>> 
>> why don't you do what i did?  download ruby and spend a day or two
>> reading "programming ruby" from www.ruby-lang.org/en.  the download
>> python and spend a day or two reading the python tuturial from
>> www.python.org.
>
>Or better: DiveIntoPython
.
.
.
You've already been told all the essentials:  that they're similar,
that specific Web pages usefully contrast them, that *Dive into Python*
and so on are worth reading, ...  I want to emphasize particularly the
wisdom of trying the two for yourself, to see how each fits your own 
tastes.  This is practical advice; it truly is possible to have a 
meaningful experience with Python and/or Ruby over the course of a day.
These languages are FAR more "light-weight" than, for example, C++, 
which typically requires weeks or months of practice before one truly
"gets it".  While you won't know everything about, say, Ruby, in the
first four hours, you *will* be able to write programs independently,
and you'll have a "feel" for how the language works as a whole.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Ben Sizer

Steve Holden wrote:

> Do note, though, that if you aren't using some means (threading,
> forking, etc) of handling the connections asynchronously then your
> server will normally only queue a very limited number of connections
> (usually 5 at most).

The example given by the original poster seemed to be a client (using
connect_ex) rather than a server, so I think this would only be an
issue if the code was connecting to the same host repeatedly in quick
succession.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread Christian
Thanks Jeff and the crazy 88.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread jepler
In Unix, you generally can't affect the environment of your parent program (in
a broad sense, which includes environment variables, current working directory,
opened files, effective user ID, etc).

You have two basic choices to achieve an effect like this.  First, you can
start a subshell with the desired environment, something like (untested)
os.environ['VARIABLE'] = 'value'
os.system(os.environ['shell'])
(commands like 'su' work in this way)

Second, you can produce shell commands that have the effect of changing a
shell's environment when they are executed.  Something like:
print "VARIABLE=value"
To use this, the user must write something like
eval `myscript.py`
instead of just
myscript.py
this can typically be encapsulated in a shell alias or function.
(commands like 'resize' (which sets the shell's idea of a terminal's size) work
this way)

Finally, you might be able to use an OS-specific interface like linux' ptrace
to change the actual contents of a calling process's memory.  I didn't
immediately find an example of this, but on Linux it would consist of using
PTRACE_PEEKDATA and PTRACE_POKEDATA to locate the environment in another
process and modify it.  The ptrace interface is not available from any standard
Python module, and isn't portable anyway. (though my manpage actually says
'CONFORMING TO SVr4, ..., X/OPEN, BSD 4.3' so maybe ptrace is more portable
than I believed)

Jeff


pgpGRSQal48ZE.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Writing an immutable object in python

2005-10-20 Thread Magnus Lycka
Mapisto wrote:
> Ok, I've understood my mistake.
> 
> Now, my list contains a shared entry of an empty object. When an entry
> is needed to be changed, I check if the entry is the shared empty
> object; in that case I create a new unique instance. If the entry is
> already a unique instance, I use it, so the empty object isn't touched.

It's probably less confusing if you make a list
of None, instead of a list of references to an
instance object you don't use anyway.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing an immutable object in python

2005-10-20 Thread Magnus Lycka
Mapisto wrote:
> Ok, I've understood my mistake.
> 
> Now, my list contains a shared entry of an empty object. When an entry
> is needed to be changed, I check if the entry is the shared empty
> object; in that case I create a new unique instance. If the entry is
> already a unique instance, I use it, so the empty object isn't touched.

If you know that you'll use all list entries, you
might as well do it right from the start. Instead
of:

l = [C()] * n

you can do:

l = [C() for i in range(n)]

-- 
http://mail.python.org/mailman/listinfo/python-list


New Website

2005-10-20 Thread sina sodagar
Hi
This website can help you to find any links about computer you want:
http://lxlinks.ati-net.net/
Enjoy

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Steve Holden
Antoon Pardon wrote:
> Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>:
> 
>>Antoon Pardon wrote:
>>
>>>I was wondering how people would feel if the cmp function and
>>>the __cmp__ method would be a bit more generalised.
>>>
>>>The problem now is that the cmp protocol has no way to
>>>indicate two objects are incomparable, they are not
>>>equal but neither is one less or greater than the other.
>>>
>>>So I thought that either cmp could return None in this
>>>case or throw a specific exception. People writing a
>>>__cmp__ method could do the same.
>>>
>>
>>The current behaviour is, of course, by design: """The operators <, >, 
>>==, >=, <=, and != compare the values of two objects. The objects need 
>>not have the same type. If both are numbers, they are converted to a 
>>common type. Otherwise, objects of different types always compare 
>>unequal, and are ordered consistently but arbitrarily."""
>>
>>Personally I'm still not convinced that your requirement reflects a 
>>substantial use case (but then I'm getting used to that ;-). Just 
>>because an ordering is partial that doesn't mean that two instances of a 
>>class shouldn't be compared.
> 
> 
> I'm not suggesting that they shouldn't be compared.
> 
Sorry, I thought that was the meaning of "The problem now is that the 
cmp protocol has no way to indicate two objects are incomparable".
> 
>>What would you have Python do when the programmer tries to perform an 
>>invalid comparison (i.e. what are the exact semantics imposed when 
>>__cmp__() returns None/raises an exception)?
> 
> 
> My appologies, I should have been more complete.
> 
> What I want is a way to say that all of the following are False:
> 
>   a < b, a <= b, a == b, a > b, a >= b
> 
> and that only the following is True:
> 
>   a != b
> 
> 
> So if a coder writes one of the comparisons and as a result python
> calls the __cmp__ method on one of the terms which would return
> either None or raise an exceptions I would like it to reflect
> the above behaviour.
> 
Ergo: use rich comparisons.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread Peter T. Breuer
In comp.os.linux.misc David Schwartz <[EMAIL PROTECTED]> wrote:

> "Peter T. Breuer" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]

>> Not if they abuse a monopoly position in doing so, which is where we
>> started.

> In other words, what they did was wrong because it was them who did it. 

No, do not twist words. What they did was wrong, no matter what their
name was. If somebody else had done that it would alsobe wrong.

> It is fine if anyone else does, just not fine if Microsoft does it.

Nope.

> And what is it they have a monopoly in again? Operating systems?

O/ses on PC platforms, as determined by the courts. Thanks to their
initial agreement with IBM, and subsequent nasty tactics.

> Can you cite any rational reason whatsoever for defining the market so 
> ridiculously narrowly? Of course not.

I define whatever you are talking about the way it is, unlike you, who
seem to define whatever it is the way you like. So go 'way 'n be
happy.  The world has spoken.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: make: circular dependency for Modules/signalmodule.o

2005-10-20 Thread James Buchanan
Neal  Norwitz wrote: 
> I've never heard of this problem.  The Makefile is generated by
> configure so this is possibly a configure issue.  In my (generated)
> Makefile, signalmodule.o is listed in MODOBJS, but not in SIGNAL_OBJS.
> Maybe your signalmodule.o is listed in both?
> 
> Search through the Makefile for signalmodule and see what you can
> find.
> 
> Mine has two long lines for the rules which cause signalmodule.c to be
> compiled.
> 
> Modules/signalmodule.o: $(srcdir)/Modules/signalmodule.c; $(CC)
> $(PY_CFLAGS) -c $(srcdir)/Modules/signalmodule.c -o
> Modules/signalmodule.o
> 
> Modules/signalmodule$(SO):  Modules/signalmodule.o; $(LDSHARED)
> Modules/signalmodule.o -o Modules/signalmodule$(SO)

Hi Neal,

Thanks very much for your tip.  I've been studying makefiles to find out
exactly what all this means.  It may be because the Minix make program
is less capable than gmake.  gmake and other make programs can
obviously handle this.  Configure might have run incorrectly or both
rules are one and the same on Minix, because there is no LDSHARED or
signalmodule$(SO).  Maybe...

Still working on it, but this has narrowed it down for me, so thanks
heaps. :)

James

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Toby Dickenson
On Thursday 20 October 2005 11:53, Steve Holden wrote:

> Personally I'm still not convinced that your requirement reflects a 
> substantial use case (but then I'm getting used to that ;-). Just 
> because an ordering is partial that doesn't mean that two instances of a 
> class shouldn't be compared.

C++ has a cmp template function which can be implemented to define a total 
ordering for one type. This can be reliably used by implementations of 
ordered tree containers (for example) so that this container template class 
can only be instantiated for holding types that provide this comparison 
template function.

One disadvantage is that these template container classes can only hold one 
type.

ZODB's BTrees work in a similar way but use the regular python comparison 
function, and the lack of a guarantee of a total ordering can be a liability.
Described here in 2002, but I think same is true today:
http://mail.zope.org/pipermail/zodb-dev/2002-February/002304.html

A BTree might contain two objects that are incomparable. That is, they raise 
an exception when compared. However the user will not know this if by 
coincidence the BTree implementation has never needed to compare these two 
objects.

Now removing a third object from the container such that these two 
incomparable objects are adjacent in the BTree. There is a possibility that 
an exception might be raised when *reading* content from the BTree, since the 
BTree implementation now might need to compare this pair of objects.

> What would you have Python do when the programmer tries to perform an 
> invalid comparison (i.e. what are the exact semantics imposed when 
> __cmp__() returns None/raises an exception)?

Its too late to handle this by the time a specific comparison method of an 
individual object is being called. If you need a total ordering across a 
domain of objects then you need to involve some representation of that domain 
as a whole. 


-- 
Toby Dickenson
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Antoon Pardon
Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> I was wondering how people would feel if the cmp function and
>> the __cmp__ method would be a bit more generalised.
>> 
>> The problem now is that the cmp protocol has no way to
>> indicate two objects are incomparable, they are not
>> equal but neither is one less or greater than the other.
>> 
>> So I thought that either cmp could return None in this
>> case or throw a specific exception. People writing a
>> __cmp__ method could do the same.
>> 
> The current behaviour is, of course, by design: """The operators <, >, 
>==, >=, <=, and != compare the values of two objects. The objects need 
> not have the same type. If both are numbers, they are converted to a 
> common type. Otherwise, objects of different types always compare 
> unequal, and are ordered consistently but arbitrarily."""
>
> Personally I'm still not convinced that your requirement reflects a 
> substantial use case (but then I'm getting used to that ;-). Just 
> because an ordering is partial that doesn't mean that two instances of a 
> class shouldn't be compared.

I'm not suggesting that they shouldn't be compared.

> What would you have Python do when the programmer tries to perform an 
> invalid comparison (i.e. what are the exact semantics imposed when 
> __cmp__() returns None/raises an exception)?

My appologies, I should have been more complete.

What I want is a way to say that all of the following are False:

  a < b, a <= b, a == b, a > b, a >= b

and that only the following is True:

  a != b


So if a coder writes one of the comparisons and as a result python
calls the __cmp__ method on one of the terms which would return
either None or raise an exceptions I would like it to reflect
the above behaviour.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread Roedy Green
On Wed, 19 Oct 2005 03:15:03 -0700, "David Schwartz"
<[EMAIL PROTECTED]> wrote or quoted :

>Did I say their obligation was to secure their shareholders as much 
>profit as possible? I said their obligation was to their shareholders.

You are literally saying people work for a company have an obligation
to the shareholders. That is too obvious to be bothered with
announcing. The employees take the shareholder's money, so obviously
they have an obligation to produce something in return.  When I read
your words, I think you really mean this is the prime or sole
obligation of an employee.  I disagree with that. There are many
loyalties that compete.

Personally, the loyalty to the preservation of my planet is far above
loyalty to any company.  For example, I would feel a moral obligation
to be a whistleblower of actions of a company that was destroying the
environment.

-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I call a subclass method from parent class ?

2005-10-20 Thread [EMAIL PROTECTED]
Thanks for the explanation but some how my code fail and since I don't
need multiple inheritance for the moment, I would settle for the not so
clean version.

The documentation of super is not very clear to me too. As seen in my
code, I am using classmethod which may cause some problem.

Steve Holden wrote:

> In point of fact super() is most useful when you *do* have multiple
> inheritance. The classic example is when classes B and C have a common
> supertype A, and then class D is a subclass of both B and C.
>
> Under these circumstances (the so-called "diamond-shaped inheritance
> graph") it can be problematic to ensure that each superclass's methods
> are called exactly once when methods are being extended rather than
> overridden: should a D call B's method, which then calls A's, and if so
> how does a D ensure that C's method gets called without it also calling
> A's method.
>
> Calls to super() are used to effectively place a linearised oredering on
> the superclasses to ansure that the diamond-shaped inheritance pattern
> is correctly handled to give the correct method resolution order.
>
> regards
>   Steve
> --
> Steve Holden   +44 150 684 7255  +1 800 494 3119
> Holden Web LLC www.holdenweb.com
> PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread gene tani
http://blog.ianbicking.org/ruby-python-power.html
http://www.ruby-doc.org/RubyEyeForThePythonGuy.html
http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc
http://www.approximity.com/ruby/Comparison_rb_st_m_java.html
http://www.jvoegele.com/software/langcomp.html
http://reflectivesurface.com/weblog/2004/12/19/why-rails

http://martinfowler.com/bliki/CollectionClosureMethod.html
http://onestepback.org/articles/10things
http://www.cincomsmalltalk.com/userblogs/avi/blogView?showComments=true&entry=3284695382
http://www.tbray.org/ongoing/When/200x/2005/08/27/Ruby
http://pleac.sourceforge.net/
http://dev.rubycentral.com/faq/rubyfaq-2.html



beza1e1 wrote:
> Depends on your experience. If you know C,C++,Java and the whole

-- 
http://mail.python.org/mailman/listinfo/python-list


在消息 "Hi"中发现病毒

2005-10-20 Thread cc
The message contains Unicode characters and has been sent as a binary 
attachment.

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Steve Holden
Antoon Pardon wrote:
> I was wondering how people would feel if the cmp function and
> the __cmp__ method would be a bit more generalised.
> 
> The problem now is that the cmp protocol has no way to
> indicate two objects are incomparable, they are not
> equal but neither is one less or greater than the other.
> 
> So I thought that either cmp could return None in this
> case or throw a specific exception. People writing a
> __cmp__ method could do the same.
> 
The current behaviour is, of course, by design: """The operators <, >, 
==, >=, <=, and != compare the values of two objects. The objects need 
not have the same type. If both are numbers, they are converted to a 
common type. Otherwise, objects of different types always compare 
unequal, and are ordered consistently but arbitrarily."""

Personally I'm still not convinced that your requirement reflects a 
substantial use case (but then I'm getting used to that ;-). Just 
because an ordering is partial that doesn't mean that two instances of a 
class shouldn't be compared.

What would you have Python do when the programmer tries to perform an 
invalid comparison (i.e. what are the exact semantics imposed when 
__cmp__() returns None/raises an exception)?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Steve Holden
Ben Sizer wrote:
> [EMAIL PROTECTED] wrote:
> 
> 
>>Occasionally (perhaps 5% of the time) the following exception gets
>>raised:
>>
>>(10054, 'Connection reset by peer')
> 
> 
> Generally this just means the connection has closed through some
> unusual means, perhaps by being turned off, or a network cable being
> unplugged, or a timeout along the way, etc. 5% is a high figure, but
> perhaps you connect to hosts that are unreliable for some reason.
> 
> You don't have control over this really; just make sure you handle the
> exception. Such is life, when dealing with networking.
> 
Do note, though, that if you aren't using some means (threading, 
forking, etc) of handling the connections asynchronously then your 
server will normally only queue a very limited number of connections 
(usually 5 at most).

So if your service takes a while to run then it's possible that 
connection requests will be rejected when the queue is full, which might 
*possibly* result in the error you are seeing.

Feel free to ignore this if you only have one client at a time.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Perl-Python-a-Day: one-liner loop Functional Style

2005-10-20 Thread Xah Lee
One-Liner Loop in Functional Style

Xah Lee, 200510

Today we show a example of a loop done as a one-liner of Functional
Programing style.

Suppose you have a list of file full paths of images:

/Users/t/t4/oh/DSCN2059m-s.jpg
/Users/t/t4/oh/DSCN2062m-s.jpg
/Users/t/t4/oh/DSCN2097m-s.jpg
/Users/t/t4/oh/DSCN2099m-s.jpg
/Users/t/Icons_dir/icon_sum.gif

For those ending with -s (indicate a smaller version), you want to
change it to the full version without the -s, if it exists. Here's the
code:

# -*- coding: utf-8 -*-
# python

import re, os.path

imgPaths=[u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg',
u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2062m-s.jpg',
u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2097m-s.jpg',
u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2099m-s.jpg',
u'/Users/t/web/Icons_dir/icon_sum.gif']


# change the image path to the full sized image, if it exists
# that is, if image ends in -s.jpg, find one without the '-s'.
imgPaths2=[]
for myPath in imgPaths:
p=myPath
(dirName, fileName) = os.path.split(myPath)
(fileBaseName, fileExtension)=os.path.splitext(fileName)
if(fileBaseName[-2:] == '-s'):
p2=os.path.join(dirName,fileBaseName[0:-2]) + fileExtension
if os.path.exists(p2): p=p2
imgPaths2.append(p)

print imgPaths2

But how do you do it in a functional programing style? Namely,
something of the from imgPath2=f(imgPath), where the f is some
function. Normally, the f would be a pure function construct made up on
the spot, that is, lambda. But Python's lambda is limited to only a
expression as its body. Nevertheless, one can achieve a functional
style with some workaround, using map twice. Here's the code:

imgPaths3 = map( lambda x: os.path.exists(x[1]) and x[1] or x[0], \
map(lambda x: (x, re.sub( r"^(.+?)-s(\.[^.]+)$",r"\1\2", x)),
imgPaths))

The first map:

newList = map(lambda x: (x, re.sub( r"^(.+?)-s(\.[^.]+)$",r"\1\2", x)),
imgPaths)

generate a list of pairs (x, y), where x is the same element in
imgPaths, and y is one without the -s. Then, a second map:

map( lambda x: os.path.exists(x[1]) and x[1] or x[0], newList,
imgPaths))

checks if the path y exists, if so, use that, else, use the x part. The
function body is essentially of a conditional EXPRESSION, of the from
(test, if true return result1, else return result2). This form of a
test that returns a expression is very important in functional
programing. Because, in functional programing a common pattern is to
sequence functions and passing values. One cannot stop in the middle
and use a block structure. Here's how this form's syntax in several
languages:

test? trueExpression: falseExpression  (C, Perl)
If[test, trueExpression, falseExpression]  (Mathematica)
(test trueExpression falseExpression)  (LISP)

In Python, there's no such form for this, but a semantically equivalent
workaround is to sequence boolean expressions as used in our example.
Namely:

test and trueExpression or falseExpression  (Python)

This works because it exploits a particular behavior of how Python
treats boolean sequences. In Python, “x and y” returns y if x is
true. And, “x or y” returns x if x is true. This behavior is
compatible with the mathematical sense of booleans. For example,
mathematically “x and y” should be true if both are true, yet in
Python if x is true then y is returned, and if y is true then this is
compatible with the math sense, but if y is false then the whole result
is also false, so it also satisfies the math sense. Similar is the case
of “x or y”. The point here is that one of the element is returned,
instead of a real True or False value. Therefore, in a twisted way this
can be used for the If[test, trueExpression, falseExpression] form.
Example.

result1= True and 4 or 5# returns 4
result2= False and 4 or 5   # returns 5

print result1
print result2

Such language behavior is a result of the laziness of the compiler
implementation, particular seen in unix shells (&& and ||). The problem
with this design is that codes relying on the the returned element of a
boolean sequence does not clearly indicate the programer's intention.
It works by language pecularities, instead of expressed program logic.

For the official doc on evaluating booleans, see:
http://python.org/doc/2.4.2/lib/boolean.html

Here's the Perl code of the same loop block:

# perl
use File::Basename;

@imgPaths=(
'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg',
'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2062m-s.jpg',
'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2097m-s.jpg',
'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2099m-s.jpg',
'/Users/t/web/Icons_dir/icon_sum.gif');

# change the image path to the full sized image, if it exists
# that is, if image ends in -s.jpg, find one without the '-s'.
$imgPaths2=();
for $myPath (@imgPaths){
$p=$myPath;
($fileBaseName, $dirName, $fileExtension) = fileparse($myPath,
('\.[^.]+$') 

Re: How can I call a subclass method from parent class ?

2005-10-20 Thread Steve Holden
[EMAIL PROTECTED] wrote:
> Jason  Lai wrote:
> 
>>If you use a newstyle class, e.g. class A(object), then you can get the
>>superclass with cls.__base__. You could also use super(cls,cls),
>>although note that it returns a  object that isn't exactly the
>>same thing as a class -- but good enough for just accessing attributes.
>>
>>Make sure to check that your superclass isn't , otherwise it'll
>>complain about  not having a foo attribute. __base__ is
>>probably easier for this purpose. Also be careful with multiple
>>inheritance.
>>
>>No such thing as __super though.
> 
> thanks, it works. Though I don't quite understand what super(cls,cls)
> returns, and it doesn't work if I do a super(cls,cls).foo(). But
> cls.__base__.foo() do the trick.
> 
> thankfully, I don't have multiple inheritance.
> 
> 
In point of fact super() is most useful when you *do* have multiple 
inheritance. The classic example is when classes B and C have a common 
supertype A, and then class D is a subclass of both B and C.

Under these circumstances (the so-called "diamond-shaped inheritance 
graph") it can be problematic to ensure that each superclass's methods 
are called exactly once when methods are being extended rather than 
overridden: should a D call B's method, which then calls A's, and if so 
how does a D ensure that C's method gets called without it also calling 
A's method.

Calls to super() are used to effectively place a linearised oredering on 
the superclasses to ansure that the diamond-shaped inheritance pattern 
is correctly handled to give the correct method resolution order.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Minimizing Connection reset by peer exceptions

2005-10-20 Thread Ben Sizer

[EMAIL PROTECTED] wrote:

> Occasionally (perhaps 5% of the time) the following exception gets
> raised:
>
> (10054, 'Connection reset by peer')

Generally this just means the connection has closed through some
unusual means, perhaps by being turned off, or a network cable being
unplugged, or a timeout along the way, etc. 5% is a high figure, but
perhaps you connect to hosts that are unreliable for some reason.

You don't have control over this really; just make sure you handle the
exception. Such is life, when dealing with networking.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread David Schwartz

"Peter T. Breuer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> Not if they abuse a monopoly position in doing so, which is where we
> started.

In other words, what they did was wrong because it was them who did it. 
It is fine if anyone else does, just not fine if Microsoft does it.

And what is it they have a monopoly in again? Operating systems? What 
about OSX? x86 operating systems? What about Linux? Oh yeah, they have a 
monopoly in "desktop operating systems for x86-based computers".

Can you cite any rational reason whatsoever for defining the market so 
ridiculously narrowly? Of course not.

There is no rational way Microsoft could have expected the irrational 
and nonsensical basis for this argument.

DS


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Antoon Pardon
Op 2005-10-20, Mikael Olofsson schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
>> 
>>>Antoon Pardon wrote:
>>>
>>>
The problem now is that the cmp protocol has no way to
indicate two objects are incomparable, they are not
equal but neither is one less or greater than the other.
>>>
>>>If that is the case then you implement __eq__ and __ne__ to return 
>>>True/False and make cmp throw an exception. I don't see any need to extend 
>>>the cmp protocol.
>> 
>> 
>> That is not sufficient. There are domains where an order exists, but not
>> a total order. So for some couples of elements it is possible to say
>> one is less than the other, but not for all such couples.
>> 
>> Your solution wouldn't allow for such a case.
>
> Wouldn't the full power of rich comparisons be enough? See section 3.3.1 
> in Python Reference Manual:
>
>  http://www.python.org/doc/2.4.2/ref/customization.html
>
> See methods __lt__, __le__, __eq__, __ne__, __gt__, __ge__.

Sure, but it would also be rather cumbersome. It is not uncommon
that a general compare function which could give you one of
four results: one_less_two, one_equal_two, one_greater_two or
one_unequal_two, wouldn't differ much from each of those six
comparison methods. So you either write about six times the
same code or you have to do something like the following:

  class partial_order:

def __compare(self, other):
  ...
  return ...

def __lt__(self, other):
  return self.__compare(other) == one_less_two

def __le__(self, other):
  return self.__compare(other) in [one_less_two, one_equal_two]

def __eq__(self, other):
  return self.__compare(other) == one_equal_two

def __ne__(self, other):
  return self.__compare(other) == one_unequal_two

def __gt__(self, other):
  return self.__compare(other) == one_greater_two

def __ge__(self, other):
  return self.__compare(other) in [one_greater_two, one_equale_two]


And then you still wouldn't get a usefull result from:

  delta = cmp(e1, e2)

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread robic0
On 14 Oct 2005 19:01:42 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote:
I think this guy should run for President. Anybody says M$oft 
is trying to screw the little guy is "alright" in my book.
>Microsoft Hatred, FAQ
>
>Xah Lee, 20020518
>
>Question: U.S. Judges are not morons, and quite a few others are
>not morons. They find MS guilty, so it must be true.
>
>Answer: so did the German population thought Jews are morons by
>heritage, to the point that Jews should be exterminated from earth.
>Apparently, the entire German population cannot be morons, they must be
>right.
>
>Judge for yourself, is a principle i abide by. And when you judge, it
>is better to put some effort into it.
>
>How much you invest in this endearvor depends on how important the
>issue is to you. If you are like most people, for which the issue of
>Microsoft have remote effect on your personal well-being, then you can
>go out and buy a case of beer on one hand and pizza on the other, and
>rap with your online confabulation buddies about how evil is MS. If you
>are an author writing a book on this, then obviously its different
>because your reputation and ultimately daily bread depend on what you
>put down. If you are a MS competitor such as Apple or Sun, then
>obviously you will see to it with as much money as you can cough out
>that MS is guilty by all measures and gets put out of business. If you
>are a government employee such as a judge, of course it is your
>interest to please your boss, with your best accessment of the air.
>
>When i judge things, i like to imagine things being serious, as if my
>wife is a wager, my daughter is at stake, that any small factual error
>or mis-judgement or misleading perspective will cause unimaginable
>things to happen. Then, my opinions becomes better ones.
>
>Q: Microsoft's Operating System is used over 90% of PCs. If that's
>not monopoly, i don't know what is.
>
>A: Now suppose there is a very ethical company E, whose products have
>the best performance/price ratio, and making all the competitors
>looking so majorly stupid and ultimately won over 90% of the market as
>decided by consumers. Is E now a monopoly? Apparently, beer drinkers
>and pizza eaters needs to study a bit on the word monopoly, from the
>perspectives of language to history to law. If they have some extra
>time, they can sharpen views from philosophy & logic contexts as well.
>
>Q: What about all the people in the corporate environments who are
>forced to use MS products and aren't allowed the option/choice to use
>Mac/Linux/UNIX?
>
>A: Kick your boss's ass, or, choose to work for a company who have
>decisions that you liked.
>
>Q: What about MS buying out all competitors?
>
>A: Microsoft offered me $1 grand for saying good things about them.
>They didn't put a gunpoint on my head. I CHOOSE to take the bribe.
>Likewise, sold companies can and have decided what's best for them.
>It's nothing like under gunpoint.
>
>Q: Microsoft forced computer makers to not install competitor's
>applications or OSes.
>
>A: It is free country. Don't like MS this or that? Fuck MS and talk to
>the Solaris or BeOS or AIX or HP-UX or Apple or OS/2 or Amiga or NeXT
>or the Linuxes with their free yet fantastically easy-to-use and
>network-spamming X-Windows. Bad business prospects? Then grab the
>opportunity and become an entrepreneur and market your own beats-all
>OS. Too difficult? Let's sue Microsoft!
>
>Q: Microsoft distributed their Internet Explorer web browser free,
>using their “monopoly” power to put Netscape out of business.
>
>A: entirely inane coding monkeys listen: It takes huge investment to
>give away a quality software free. Netscape can give away Operating
>Systems free to put MS out of business too. Nobody is stopping Sun
>Microsystem from giving Java free, or BeOS a browser free, or Apple to
>bundle QuickTime deeply with their OS free.
>
>Not to mention that Netscape is worse than IE in just about every
>version till they become the OpenSource mozilla shit and eventually
>bought out by AOL and still shit.
>
>• Netscape struggles, announced open browser source code in 1998-01,
>industry shock
>http://wp.netscape.com/newsref/pr/newsrelease558.html
>
>• Netscape browser code released in 1998-03. Mozilla FAQ.
>http://mozilla.org/docs/mozilla-faq.html
>
>• AOL buys Netscape in 1998-11 for 4.2 billion.
>http://news.com.com/2100-1023-218360.html?legacy=cnet
>
>• Jamie Zawinski, resignation and postmortem, 1999-04
>http://www.jwz.org/gruntle/nomo.html
>
>• suck.com, Greg Knauss & Terry Colon, 2000-04, Netscape 6 mockery
>http://www.suck.com/daily/2000/04/10/
>http://xahlee.org/UnixResource_dir/_/24,greg_knauss_netscape.zip
>
>• Xah Lee, Netscape Crap
>http://xahlee.org/Writ_dir/macos-talk/58.txt
>
>Q: Microsoft implemented extra things to standard protocols in
>their OS so that other OS makers cannot be compatible with their OS
>while their OS can be compatible with all. They used this Embrace &
>Extend to lock out

Re: How can I call a subclass method from parent class ?

2005-10-20 Thread [EMAIL PROTECTED]
thanks, it works. Though I don't quite understand what super(cls,cls)
returns, and it doesn't work if I do a super(cls,cls).foo(). But
cls.__base__.foo() do the trick.

thankfully, I don't have multiple inheritance.

Jason  Lai wrote:
> If you use a newstyle class, e.g. class A(object), then you can get the
> superclass with cls.__base__. You could also use super(cls,cls),
> although note that it returns a  object that isn't exactly the
> same thing as a class -- but good enough for just accessing attributes.
>
> Make sure to check that your superclass isn't , otherwise it'll
> complain about  not having a foo attribute. __base__ is
> probably easier for this purpose. Also be careful with multiple
> inheritance.
> 
> No such thing as __super though.

-- 
http://mail.python.org/mailman/listinfo/python-list


All What You Are Looking For And Mor ...

2005-10-20 Thread savatage4ever
Hello Dear friend...
Here http://s14.invisionfree.com/SaVaTaGe4eVeR/
you can find all what you are looking for in all the internet to
download it like ...

Applications
Movies
PC Games
Animes
Musics
Mobile
e-books
and many many more

So please come and see what we can offer for you at
http://s14.invisionfree.com/SaVaTaGe4eVeR/

SaVaTaGe4eVeR forum team

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sequence and/or pattern matching

2005-10-20 Thread Séb
Hi everybody,

Thanks for the time taken to answer my question. Unfortunatly, it seems
that there's a little confusion about what I want to do.

In fact, I don't want to search for a particular path between
computers. What I really want is to detect sequences of connection that
are repeated along the log. Is it clearer, if not, I will put another
exmample ;-)

Thank you !

Ps Python community is very nice, I'm glad I learn this language !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread beza1e1
Depends on your experience. If you know C,C++,Java and the whole
C-syntax-bunch. I'd recommend Python just to learn to adapt a different
syntax. If you want to learn for the learnings sake, i'd also recommend
Haskell to try functional programming, if you do not already know it.

Ruby has some interesting concepts, Python (well CPython) does not
have. Blocks for example, which make Continuations possible. In Python
you need stackless Python (a different implementation) to do this.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Mikael Olofsson
Antoon Pardon wrote:
> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
> 
>>Antoon Pardon wrote:
>>
>>
>>>The problem now is that the cmp protocol has no way to
>>>indicate two objects are incomparable, they are not
>>>equal but neither is one less or greater than the other.
>>
>>If that is the case then you implement __eq__ and __ne__ to return 
>>True/False and make cmp throw an exception. I don't see any need to extend 
>>the cmp protocol.
> 
> 
> That is not sufficient. There are domains where an order exists, but not
> a total order. So for some couples of elements it is possible to say
> one is less than the other, but not for all such couples.
> 
> Your solution wouldn't allow for such a case.

Wouldn't the full power of rich comparisons be enough? See section 3.3.1 
in Python Reference Manual:

 http://www.python.org/doc/2.4.2/ref/customization.html

See methods __lt__, __le__, __eq__, __ne__, __gt__, __ge__.

/MiO


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Duncan Booth
Antoon Pardon wrote:

> Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
>> Antoon Pardon wrote:
>>
>>> The problem now is that the cmp protocol has no way to
>>> indicate two objects are incomparable, they are not
>>> equal but neither is one less or greater than the other.
>>
>> If that is the case then you implement __eq__ and __ne__ to return 
>> True/False and make cmp throw an exception. I don't see any need to
>> extend the cmp protocol.
> 
> That is not sufficient. There are domains where an order exists, but
> not a total order. So for some couples of elements it is possible to
> say one is less than the other, but not for all such couples.
> 
> Your solution wouldn't allow for such a case.
> 

I don't see why not. If an ordering exists then __cmp__ returns a result 
otherwise it throws an exception. So long as you define __eq__ and __ne__, 
__cmp__ is never called when checking for equality.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Antoon Pardon
Op 2005-10-20, Duncan Booth schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>
>> The problem now is that the cmp protocol has no way to
>> indicate two objects are incomparable, they are not
>> equal but neither is one less or greater than the other.
>
> If that is the case then you implement __eq__ and __ne__ to return 
> True/False and make cmp throw an exception. I don't see any need to extend 
> the cmp protocol.

That is not sufficient. There are domains where an order exists, but not
a total order. So for some couples of elements it is possible to say
one is less than the other, but not for all such couples.

Your solution wouldn't allow for such a case.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: override a property

2005-10-20 Thread Kay Schluehr
Robin Becker wrote:

> I thought that methods were always overridable.
> In this case the lookup on the
> class changes the behaviour of the one and only property.

How can something be made overridable that is actually overridable? I
didn't know how to better express the broken polymorphism of Pythons
properties than by stating it as a pleonasm about the used get and set
methods. This way a property don't ever have to be redefined in
subclasses if get_x, set_x etc. are changed. 

Kay

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I call a subclass method from parent class ?

2005-10-20 Thread Jason Lai
If you use a newstyle class, e.g. class A(object), then you can get the
superclass with cls.__base__. You could also use super(cls,cls),
although note that it returns a  object that isn't exactly the
same thing as a class -- but good enough for just accessing attributes.

Make sure to check that your superclass isn't , otherwise it'll
complain about  not having a foo attribute. __base__ is
probably easier for this purpose. Also be careful with multiple
inheritance.

No such thing as __super though.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set an environment variable

2005-10-20 Thread the_crazy88
Just use 
os.system("export PYTHONPATH = %s" %("your_pythonpath"))

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread bruno modulix
Amol Vaidya wrote:
> Hi. I am interested in learning a new programming language, and have been 
> debating whether to learn Ruby or Python. How do these compare and contrast 
> with one another, and what advantages does one language provide over the 
> other? I would like to consider as many opinions as I can on this matter 
> before I start studying either language in depth. Any help/comments are 
> greatly appreciated. Thanks in advance for your help. 

The main point about "advantages" is that Python has a larger community,
a larger choice of libraries, and is somewhat more mature (which is not
surprising since Python is a little bit older than Ruby).

Else, both are hi-level highly dynamic object oriented languages, both
are fun to program with, and both are easy to get started with. So the
best thing to do is to give both a try and go with the one that fits
your brain.

-- 
bruno desthuilliers
ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: destroy your self????

2005-10-20 Thread James
Doesn't work for classes because self has no global reference.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs Ruby

2005-10-20 Thread bruno modulix
Bryan wrote:
> Amol Vaidya wrote:
> 
>> Hi. I am interested in learning a new programming language, and have
>> been debating whether to learn Ruby or Python. 
(snip)
> 
> why don't you do what i did?  download ruby and spend a day or two
> reading "programming ruby" from www.ruby-lang.org/en.  the download
> python and spend a day or two reading the python tuturial from
> www.python.org.

Or better: DiveIntoPython

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


Check it Out!

2005-10-20 Thread nikool29
Friend,
Check out http://ChezBrandon.com As are you, Brandon is highly
intelligent, knowledgeable, and good. May you have an awesome day.
A Succinct Warning: Elements of Mossad, sated with cash from the
murderous and destructive narcotics trade - for example, according to
Reader's Digest, cocaine alone costs US businesses $50+ billion per
year (!) - are using some medical, pharmacy, and food service workers
to murder men, women, and children. (A certain tasteless acid, for
instance, causes cancer.) Victor Ostrovsky's book By Way of Deception
and James Ennes, Jr.'s Assault on the Liberty offer other elucidation
as does the following Daily News article:
www.dailynews.lk/2005/03/01/fea10.html
President of the International Narcotics Control Board, Philip Emafo,
put it excellently when he stated: "Drug trafficking does not
contribute to economic growth and prosperity [rather it] destabilizes
the state, the economy, and civil society apart from the damage to
long-term economic development." On top of this, elements of Mossad
have decided to become serial-killers/terrorists and murder men, women,
and children.
-- Nick

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abstract Methods & Abstract Class

2005-10-20 Thread Gerald Klix
Isn't 

class AbstractBase:
def method(self):
raise NotImplementedError( "abstract method called" )

the right thing to do?

Gerald

- Original Message - 
From: "Andreas Kostyrka" <[EMAIL PROTECTED]>
To: "Iyer, Prasad C" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, October 20, 2005 8:56 AM
Subject: Re: Abstract Methods & Abstract Class


> On Thu, Oct 20, 2005 at 12:05:05PM +0530, Iyer, Prasad C wrote:
> > 
> > Do we have something like abstract methods & Abstract class.
> > 
> > So that my class would just define the method. And the implementation
> > would be defined by somebody else.
> 
> class AbstractBase:
> def method(self):
> raise TypeError("abstract method called")
> 
> But basically, Python does not have abstract methods, and usually doesn't
> need them.
> 
> Andreas
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Any SOAPpy users here?

2005-10-20 Thread Alvin A. Delagon




Hello
python programmers! I would like to add myself to the ever increasing
number of python users. Here's my first question. I've written two SOAP
clients using PERL and a PHP. I tried to wirte a new SOAP client using
python but I'm having problems. First, I can't seem to find a good
documentation of the SOAPpy module. Second, I found a code snippet of a
python SOAP client but it was designed only to use the SOAPproxy
function. How can I create a python SOAP client given these parameters:


URI: urn:TESTWS

HOST: https://hostname/cgi-bin/server.cgi


Here's the PERL snippet that I'm trying to convert into a pythinic
language:


my $login = SOAP::Lite

   -> uri ($URL)

   -> proxy ($host)

   -> login($uname, $epwd);

my $result = $login

   ->result;


Help will be greatly appreciated. Thank you in advance and more power
to python programmers!





-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-20 Thread robic0
On 14 Oct 2005 19:01:42 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote:
Xah Lee, I went through some of your web site, because of time
couldn't examine (but a few) code guides. Read all you philosophy
pages though,  even about languages I didn't know. I took a 
course in my Mechanical Engineering study days, an elective,
based on assembly lang  with a hex input keypad, no saves  
had to be right the first time. Before that, I did several
fortran programs and an array of HP (Hewlet Packard, 
reverse polish) scientific programs. This was my senior
year and I failed that class. The instructor was obnoxious
and that class (credits) prevented me from getting my 
degree (by 3 credits). Now acording to Pavlofs dog theory
I should not have wanted to persue any of these assembly
codes in the future. As it turns out, I threatend the 
dean with a suit, no extended symester, got out with
a 3.4 gpa, got a z80a machine, wrote a dissasembler
within 6 months, wrote a commercial program in assembly
6 months later, wrote a spreadsheet program 6 months 
later. From there I wrote a program called Action Memo,
a few years later (1985) that is something called "Act" now,
licensed by Lotus and Microsoft. Stolen from me in an
Ashton Tate/PC World contest which I only placed 2nd.
I won a software bundle, imagin that. But concept and
sourse was all they needed. Now I'm scratchin out a living
having worked for Quaterdeck, Microsft, McAfee, Symantec.
I applied Perl just over a year ago, the latest, after 
drivers, large scale apps, gui, com, java. I've written
over 14 million lines of code in 20 years and when I 
write in performance mode I rember back to the days
when I wrote TSR's because I don't think in terms of
macro or Perl. I know what the assembly is and man..
that never changes. I'm very afraid of how "hype"
affects new, young programmers. Larry Wall didn't do
so much with Perl, I could have done it in my sleep.
I may do something better, you never know man!!

>Microsoft Hatred, FAQ
>
>Xah Lee, 20020518
>
>Question: U.S. Judges are not morons, and quite a few others are
>not morons. They find MS guilty, so it must be true.
>
>Answer: so did the German population thought Jews are morons by
>heritage, to the point that Jews should be exterminated from earth.
>Apparently, the entire German population cannot be morons, they must be
>right.
>
>Judge for yourself, is a principle i abide by. And when you judge, it
>is better to put some effort into it.
>
>How much you invest in this endearvor depends on how important the
>issue is to you. If you are like most people, for which the issue of
>Microsoft have remote effect on your personal well-being, then you can
>go out and buy a case of beer on one hand and pizza on the other, and
>rap with your online confabulation buddies about how evil is MS. If you
>are an author writing a book on this, then obviously its different
>because your reputation and ultimately daily bread depend on what you
>put down. If you are a MS competitor such as Apple or Sun, then
>obviously you will see to it with as much money as you can cough out
>that MS is guilty by all measures and gets put out of business. If you
>are a government employee such as a judge, of course it is your
>interest to please your boss, with your best accessment of the air.
>
>When i judge things, i like to imagine things being serious, as if my
>wife is a wager, my daughter is at stake, that any small factual error
>or mis-judgement or misleading perspective will cause unimaginable
>things to happen. Then, my opinions becomes better ones.
>
>Q: Microsoft's Operating System is used over 90% of PCs. If that's
>not monopoly, i don't know what is.
>
>A: Now suppose there is a very ethical company E, whose products have
>the best performance/price ratio, and making all the competitors
>looking so majorly stupid and ultimately won over 90% of the market as
>decided by consumers. Is E now a monopoly? Apparently, beer drinkers
>and pizza eaters needs to study a bit on the word monopoly, from the
>perspectives of language to history to law. If they have some extra
>time, they can sharpen views from philosophy & logic contexts as well.
>
>Q: What about all the people in the corporate environments who are
>forced to use MS products and aren't allowed the option/choice to use
>Mac/Linux/UNIX?
>
>A: Kick your boss's ass, or, choose to work for a company who have
>decisions that you liked.
>
>Q: What about MS buying out all competitors?
>
>A: Microsoft offered me $1 grand for saying good things about them.
>They didn't put a gunpoint on my head. I CHOOSE to take the bribe.
>Likewise, sold companies can and have decided what's best for them.
>It's nothing like under gunpoint.
>
>Q: Microsoft forced computer makers to not install competitor's
>applications or OSes.
>
>A: It is free country. Don't like MS this or that? Fuck MS and talk to
>the Solaris or BeOS or AIX or HP-UX or Apple or OS/2 or Amiga or NeXT
>or the Linuxes with thei

Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Duncan Booth
Antoon Pardon wrote:

> The problem now is that the cmp protocol has no way to
> indicate two objects are incomparable, they are not
> equal but neither is one less or greater than the other.

If that is the case then you implement __eq__ and __ne__ to return 
True/False and make cmp throw an exception. I don't see any need to extend 
the cmp protocol.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Some more odd behaviour from the Regexp library

2005-10-20 Thread Steve Holden
Mike Meyer wrote:
> "David Veerasingam" <[EMAIL PROTECTED]> writes:
[...]
> Of course, being the founder of SPARE, I have to point out that
> a.split(': ') will get you the same two strings as the re I used
> above.
> 
Let me guess: the Society for the Prevention of Abuse of Regular 
Expressions?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extention Woes

2005-10-20 Thread Fredrik Lundh
"Tuvas" wrote:

> Well, the point of declaring it as a char was to have it as an 8 bit
> integer, as is requested later on in the program.

since ParseTuple writes an integer to the address you pass in,
that's likely to overwrite some random stuff on the stack.  like-
wise, passing in a character buffer where ParseTuple expects
a pointer to a char pointer isn't going to work either (but that
only writes garbage into the buffer).

> Anyways, I tried making the changes, similar results.

post the new code and the output it's giving you.

> BTW, it doesn't give me one single warning, so I don't think it's a
> casting problem...

the C compiler doesn't understand the ParseTuple format string,
so that doesn't mean anything.  it's up to you to make sure that
the format specifiers and the pointers you pass in match.





-- 
http://mail.python.org/mailman/listinfo/python-list


Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Antoon Pardon
I was wondering how people would feel if the cmp function and
the __cmp__ method would be a bit more generalised.

The problem now is that the cmp protocol has no way to
indicate two objects are incomparable, they are not
equal but neither is one less or greater than the other.

So I thought that either cmp could return None in this
case or throw a specific exception. People writing a
__cmp__ method could do the same.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Steve Holden
Jason Stitt wrote:
> On Oct 19, 2005, at 9:18 PM, [EMAIL PROTECTED] wrote:
> 
> 
> 
>>My solution is sqlstring. A single-purpose library: to create SQL
>>statement objects. These objects (such as sqlstring.Select), represent
>>complex SQL Statements, but as Python objects.
> 
> 
> 
> 
> First of all, I like this idea. I've been thinking about doing  
> something similar but am stuck with SQLObject for the moment. The  
> ability to construct complex expressions in pieces and then mix and  
> match them would be killer.
> 
> I think some operator overloading, especially the obvious cases like  
> ==, is cleaner than using only functions because it lets you order  
> things normally. But some of the operator choices are non-intuitive.  
> Personally, I would make something like 'alias' a function or class,  
> rather than overloading XOR. Not sure about ** for where.
> 
> Using // for 'in' looks really weird, too. It's too bad you can't  
> overload Python's 'in' operator. (Can you? It seems to be hard-coded  
> to iterate through an iterable and look for the value, rather than  
> calling a private method like some other builtins do.)
> 
 >>> class inplus(object):
...   def __contains__(self, thing):
... print "Do I have a", thing, "?"
... return True
...
 >>> x = inplus()
 >>> "Steev" in x
Do I have a Steev ?
True
 >>>
[...]

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Abstract Methods & Abstract Class

2005-10-20 Thread Fredrik Lundh
Andreas Kostyrka wrote:

> > Do we have something like abstract methods & Abstract class.
> >
> > So that my class would just define the method. And the implementation
> > would be defined by somebody else.
>
> class AbstractBase:
> def method(self):
> raise TypeError("abstract method called")
>
> But basically, Python does not have abstract methods, and usually doesn't
> need them.

the NotImplementedError exception is usually a better choice:

class AbstractBase:
def method(self):
raise NotImplementedError("'method' implementation missing")





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread fumanchu
[EMAIL PROTECTED] wrote:
> These objects (such as sqlstring.Select), represent
> complex SQL Statements, but as Python objects. The benefit is that you
> can, at run-time, "build" the statement pythonically, without
> getting bogged down in String Manipulation. The theory is that once in
> use, things that were complex (string magic) become simpler, and allow
> the program to worry about higher-level issues.
> ...
> Some of this stuff has been around for a while (using "magic" objects
> to build where clauses, etc.).  But I'm trying to take it all the
> way--to a legit Select statement.
>
> While still in the early stages, it does work with a great many sql
> statements, as seen in the test suite.  Currently supported are CASE
> statements, Nested conditional clauses, nested queries and most join
> types. At this point, I'm interested in getting feedback from the
> community on several fronts:
>
>1. The Operator Overload model. I've chosen to overload Python's
> operators to give a short-hand syntax to most of the things you'd
> want to do with a select statement. The rest are accessable via
> methods. Currently ** is the "where" operator, // is the "in"
> operator, % the "like" operator and ^ aliases columns. Other
> overloads are as you'd expect- + / - * == all result in Expression
> Objects that dish out the right SQL string. The question is, is the
> "leap" in syntax to confusing? Is there a cleaner way to do this?
> (Functions for example)

The big operator question will be: how will "and" and "or" be
implemented? This is always a sticking point because of Python's
short-circuiting behaviors regarding them (the resultant bytecode will
include a JUMP).

An alternative is to stuff the representation into a string, which can
then be parsed however one likes.

For Dejavu (http://projects.amor.org/dejavu), I didn't do either
one--instead I used lambdas to express the where clause, so that:

f = logic.Expression(lambda x: ('Rick' in x.Name) or
 (x.Birthdate == datetime.date(1970, 1, 1)))
units = sandbox.recall(Person, f)

might produce, in the bowels of the ORM:

"SELECT * FROM [Person] WHERE [Person].[Name] Like '%Rick%' or
[Person].[Birthdate] = #1/1/1970#"

Note that the tablename is provided in a separate step. The translation
is based on the codewalk.py and logic.py modules, which are in the
public domain if you want to use any part of them. See
http://projects.amor.org/dejavu/svn/trunk/

>2. How to best add further sql function support? Adding magic
> callable objects to columns came to mind, but this has it's own set
> of issues. I'm leaning towards a magic object in the sqlstring
> module. For example:
>
>   sqlstring.F.substring(0, 4, person.first_name)
>
>   would result in: substring(0, 4, person.first_name). the F object
> could be put in the local scope for short-hand.

This is a hard problem, since your sqlstring module doesn't control the
result sets, and so can't provide fallback mechanisms if a given
database does not support a given function (or operator, or minute
detail of how a function or operator works; for example, LIKE is
case-insensitive in MS SQL Server but case-sensitive in PostgreSQL). If
you're going to use subclasses to handle "database-specific overwrites"
(below), then you'll probably want to stick such functions in that base
class (and override them in subclasses), as well.

>3. I'm undecided on how best to handle database specific
> overwrites. I want this to be as easy as possible. I'm thinking about
> subclassing Expressions with a naming scheme on the Sub-Class (such as
> CaseExpression_oracle). Then the __init__ factory could dish out the
> right version of the object based on the requestor. This brings up
> lots of questions, such as how to support multiple types of databases
> at the same time.

See the Adapter and SQLDecompiler classes in
http://projects.amor.org/dejavu/svn/trunk/storage/db.py (and the
store*.py modules) for some examples of using subclassing to produce
database-specific syntax. There, it's one Adapter class per supported
DB-type; you might consider keeping the Expression objects themselves
free from SQL, and transform the Expressions to SQL in a separate
class, which you could then subclass.

Just a couple of thoughts from someone who's done the
string-manipulation dance once before. ;) I must admit I've always
punted when it came time to produce complex joins or CASE
statements--Dejavu simply doesn't provide that level of expressivity,
preferring instead to hide it behind the object layer.


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Microsoft Hatred FAQ

2005-10-20 Thread Peter T. Breuer
In comp.os.linux.misc David Schwartz <[EMAIL PROTECTED]> wrote:
> "Peter T. Breuer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>> There would be if an engine manufacturer refused to provide car
>> manufacturers with ANY engines for any model, unless all buyers were
>> charged for THEIR engine in every model, whether their engine was in
>> there or not.
>>
>> You want to cease this line of apologism.

> I'm sorry, that's just crazy.

No it's not.

> An engine manufacturer could refuse to 
> provide car manufacturers with ANY engines at all if they wanted to.

Fine - the car manufacturer would get engines somewhere else. Engine
manufacturers do not appear to hold monopoly positions, so the car
manufacturer is not over a barrel over it.  And gearboxes and clutches
work with any engine, not just that particular manufacturer's engines,
and customers will be used to driving with any engine at all, not just
that one.  Maps and other driver aids also work no matter what engine is
in the car, so there is no industry pressure to use that engine and no
other engine.

> It's 
> their engines. They can use any mutually agreeable method to determine the 
> number of engines provided and the price.

Not if they abuse a monopoly position in doing so, which is where we
started.


> This is not apologism. Microsoft has nothing to apologize for here. 

Then it is apologism. You implode. Thanks and bye.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


<    1   2