Beta 0.19 of MMA - Musical MIDI Accompaniment

2005-12-28 Thread Bob van der Poel

Beta 0.19 of MMA - Musical MIDI Accompaniment - is now
available for downloading. Included in this release:

Many bug fixes, major rewrite of volume code, REPEAT
count enhancements, Lyric autochord transposition,
GOTO recognizes line numbers, MALLET works in all
tracks, and lots more!

MMA is a accompaniment generator -- it creates midi tracks
for a soloist to perform with. User supplied files contain
pattern selections, chords, and MMA directives. For full details
please visit:

http://mypage.uniserve.com/~bvdp/mma/

If you have any questions or comments, please send them
to: [EMAIL PROTECTED]


-- 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: [EMAIL PROTECTED]
WWW:   http://mypage.uniserve.com/~bvdp


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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


PyCon TX 2006: Early-bird registration ends Dec. 31!

2005-12-28 Thread David Goodger
Early bird registration for PyCon TX 2006 ends on December 31st,
so there are only a few days LEFT. To register, please visit:

http://us.pycon.org/TX2006/Registration

You can still register after Dec. 31st, but the cost will go up by
US$65 (US$25 for students).

This year PyCon will feature a day of tutorials before the three days
of regular presentations.  Course outlines for all the tutorials have
been posted; see

http://wiki.python.org/moin/PyCon2006/Tutorials

All of the PyCon tutorials are still open for new registrations, but
space is limited, and we suspect they'll all be filled up by the time
early-bird registration closes.

Don't forget to book your hotel room, too.  PyCon TX 2006 is being
held at a Dallas/Addison hotel, and we have negotiated a special low
rate:

http://us.pycon.org/Addison/Hotels

We hope to see you in Texas!

-- David Goodger
   (on behalf of A.M. Kuchling, Chair, PyCon 2006)





signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: python coding contest

2005-12-28 Thread Bengt Richter
On 27 Dec 2005 09:24:44 GMT, Duncan Booth [EMAIL PROTECTED] wrote:

Scott David Daniels wrote:

 I definitively need a new algorythm. g
 
 And I am sadly stuck at 169.  Not even spitting distance from 149 (which
 sounds like a non-cheat version).

Throw it away and start again with a fresh (clean) solution. That's what I 
did when I'd reached the limit of nested maps and lambdas at 150 
characters. I'm now on 134 characters and the solution is very nearly 
legible. (Frustratingly, I'm away for the next few days, so I may not get a 
chance to submit my solution).

It would be a nice idea to come up with a scoring system which better 
reflects Python's ideals. For example, use the parser in Python to count up 
various syntactic elements, score 0 for comments, indents, dedents, 
newlines, docstrings, 1 for each name or operation used and higher scores 
for things like lambda or overly complex expressions.

[23:28] C:\pywk\clp\seven\pycontest_01py24 test.py
.
--
Ran 1 test in 0.391s

OK

[23:28] C:\pywk\clp\seven\pycontest_01wc -lc  seven_seg.py
  2136  seven_seg.py

2 lines, 136 chars including unix-style lineseps (is that cheating on windows?)
No imports.

Guess I'll have to try another tack ;-/

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python coding contest

2005-12-28 Thread Roman Susi
Tim Hochberg wrote:
 py pan wrote:
 
When you guys say 127~150 characters, did you guys mean
usinging test_vectors.py in some way? Or there's no import at all?

 
 
 No import at all. The shortest solution reported so far is 131 
 characters. Getting down to 127 is just a guess as to where the lower 
 bound is likely to be.
 
 Note that in principle it's possible to encode the data for how to 
 display a digit in one byte. Thus it's at least theoretically possible 
 to condense all of the information about the string into a string that's 
 10 bytes long. In practice it turns out to be hard to do that, since a 
 10 byte string will generally have a representation that is longer than 
 10 bytes because of the way the escape sequences get printed out. As a 
 result various people seem to be encoding the data in long integers of 
 one sort or another. The data is then extracted using some recipe 
 involving shifts and s.
 
 -tim

Condensing is good but only as far as code for decompressing is small...

By the way, after I noticed that I program for 2.3, I tried with 2.4 and
 get out extra characters thanks for generator expression and .join()
integration. So now I am at 147. Probably a lot of reserve as I have 3
fors... One for just for the purpose of getting a name:

...x for x in [scalar]

Probably its time rething solution from scratch...


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


Re: sorting with expensive compares?

2005-12-28 Thread Stuart D. Gathman
On Sat, 24 Dec 2005 15:47:17 +1100, Steven D'Aprano wrote:

 On Fri, 23 Dec 2005 17:10:22 +, Dan Stromberg wrote:

 I'm treating each file as a potentially very large string, and sorting
 the strings.
 
 Which is a very strange thing to do, but I'll assume you have a good
 reason for doing so.

I believe what the original poster wants to do is eliminate duplicate
content from a collection of ogg/whatever files with different names. 
E.g., he has a python script that goes out and collects all the free music
it can find on the web.  The same song may appear on many sites under
different names, and he wants only one copy of a given song.

In any case, as others have pointed out, sorting by MD5 is sufficient
except in cases far less probable than hardware failure - and deliberate
collisions.  E.g., the RIAA creates collision pairs of MP3 files where one
member carries a freely redistributable license, and the other a copy
this and we'll sue your ass off license in an effort to trap the unwary.

-- 
  Stuart D. Gathman [EMAIL PROTECTED]
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
Confutatis maledictis, flamis acribus addictis - background song for
a Microsoft sponsored Where do you want to go from here? commercial.

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


Re: Timing out arbitrary functions

2005-12-28 Thread antti kervinen
AOP would be a quite elegant way set timeouts for functions, in my
opinion. The nice thing in it is that, in principle, you can write a
single timeout advice code and then wrap it over any function you want
to timeout.

I wrote timeout_advice.py to demonstrate this a couple of years ago
(see http://www.cs.tut.fi/~ask/aspects/aspects.html). It may not
directly solve the problem at hand because it is thought to be used
with a wrap_around implementation that  wraps methods in classes rather
than ordinary functions in modules. urllib.URLopener.open is used as an
example in the code. Unfortunately, I still have not implemented the
wrapping for ordinary functions, although it should be straight-forward
with the same idea that is explained in the web page.

Of course, in the real life, timeouts are tricky and dangerous. The
consequences of interrupting a function that is not designed to be
interrupted, or leaving it running in the background after the timeout
(which is what timeout_advice.py does) may be surprising.

-- Antti Kervinen

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


Re: python coding contest

2005-12-28 Thread Duncan Booth
Christian Tismer wrote:

 And then help me to setup a different contest about content -- chris
 
Count me in.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Patch : doct.merge

2005-12-28 Thread Nicolas Lehuen
Here's method 3 :

# Python 2.3 (no generator expression)
a.update([(k,v) for k,v in b.iteritems() if k not in a])

# Python 2.4 (with generator expression)
a.update((k,v) for k,v in b.iteritems() if k not in a)

It's a bit cleaner but still less efficient than using what's already
in the PyDict_Merge C API. It's even less efficient than method 1 and 2
! Here is the benchmark I used :

import timeit

init = '''a = dict((i,i) for i in xrange(1000) if i%2==0); b =
dict((i,i+1) for i in xrange(1000))'''

t = timeit.Timer('''for k in b:\n\tif k not in a:\n\t\ta[k] =
b[k]''',init)
print 'Method 1 : %.3f'%t.timeit(1)

t = timeit.Timer('''temp = dict(b); temp.update(a); a = temp''',init)
print 'Method 2 : %.3f'%t.timeit(1)

t = timeit.Timer('''a.update((k,v) for k,v in b.iteritems() if k not in
a)''',init)
print 'Method 3 : %.3f'%t.timeit(1)

t = timeit.Timer('''a.merge(b)''',init)
print 'Using dict.merge() : %.3f'%t.timeit(1)

Here are the results :

Method 1 : 5.315
Method 2 : 3.855
Method 3 : 7.815
Using dict.merge() : 1.425

So using generator expressions is a bad idea, and using the new
dict.merge() method gives an appreciable performance boost (~ x 3.73
here).

Regards,
Nicolas

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


Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Martin P. Hellwig
Ilias Lazaridis wrote:
 Martin P. Hellwig wrote:
 Ilias Lazaridis wrote:
 cut
 So I guess you volunteer http://www.python.org/psf/volunteer.html ?
 
 I volunteer and contribute already (with a general validity and python 
 specific analysis)
 
 A mediator should communicate the findings and suggestion (after 
 verifying them) to the responsibles / community:
 
 http://lazaridis.com/efficiency/process.html#mediator
 
 This would include to pass the relevant ones to the list you've mentioned:
 
 http://www.python.org/psf/volunteer.html
 
 -
 
 TAG.efficiency.process.mediator
 

Last time I checked a mediator otherwise known to me as a 
communication manager, is only effective when he/she is recognized as 
authoritative by the participating group _and_ him/herself.

As from other posts I read that the last part is the issue, well since 
this is a voluntary bunch of people with a slightly social democratic 
architecture you fall back on spokesman and that can be anybody, 
including or perhaps even especially you.

The only thing that holds you theoretically back is acknowledged 
authority by the participating group _and_ yourself and of course the 
resource for restricted information.
For the first part you got my vote, for second, well that should grow in 
time.

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


getting the status codes from the ftplib module

2005-12-28 Thread Alvin A. Delagon
I'm writing a simple python code that will upload files onto a ftp 
server. Everything's fine and working great except that the script I 
wrote don't know is an upload is successful or not. Is there a way to 
obtain the ftp status codes with this module? Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting the status codes from the ftplib module

2005-12-28 Thread Fredrik Lundh
Alvin A. Delagon wrote:

 I'm writing a simple python code that will upload files onto a ftp
 server. Everything's fine and working great except that the script I
 wrote don't know is an upload is successful or not. Is there a way to
 obtain the ftp status codes with this module? Thanks in advance!

the module raises an exception if something fails.  if you didn't get
an exception, everything worked as expected.

most methods, including the storlines and storbinary methods, also
return the status code.

/F



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


Re: python coding contest

2005-12-28 Thread Shane Hathaway
I just found a 125 character solution.  It's actually faster and more 
readable than the 133 character solution (though it's still obscure.)

It depends on Python 2.4.  If Python 2.3 compatibility is required for 
the contest, I have to add 4 characters.

Shane

[EMAIL PROTECTED] pycontest_01]$ wc -c seven_seg.py
125 seven_seg.py
[EMAIL PROTECTED] pycontest_01]$ python test.py
.
--
Ran 1 test in 0.084s

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


Re: getting the status codes from the ftplib module

2005-12-28 Thread Alvin A. Delagon




[EMAIL PROTECTED] wrote:

  Send Python-list mailing list submissions to
	python-list@python.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
	[EMAIL PROTECTED]

You can reach the person managing the list at
	[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-list digest..."
  
  

Today's Topics:

   1. Re: python bug in this list implementation? (Fredrik Lundh)
   2. Re: python coding contest (Bengt Richter)
   3. Re: python coding contest (Roman Susi)
   4. Re: sorting with expensive compares? (Stuart D. Gathman)
   5. Re: Timing out arbitrary functions (antti kervinen)
   6. Re: python coding contest (Duncan Booth)
   7. Re: Patch : doct.merge (Nicolas Lehuen)
   8. Re: [EVALUATION] - E04 - Leadership! Google, Guido van
  Rossum, PSF (Martin P. Hellwig)
   9. getting the status codes from the ftplib module (Alvin A. Delagon)
  10. Re: getting the status codes from the ftplib module
  (Fredrik Lundh)
  
  
  
  

  

Subject:

Re: python bug in this list implementation?
  
  

From: 
"Fredrik Lundh" [EMAIL PROTECTED]
  
  

Date: 
Wed, 28 Dec 2005 08:50:47 +0100
  
  

To: 
python-list@python.org
  

  
  

  

To: 
python-list@python.org
  

  
  
  Chris Smith wrote:

  
  
I've been working on some multi-dimensional lists and I've encountered some
very strange behaviour in what appears to be simple code, I'm using python
2.4.2 and IDLE. If anyone can tell me why it's behaving so strange please
let me know, any improvements to my general coding style are also
appreciated.
code below:

import sys
import copy

grid = []
oGrid = []
sGrid = []

def createGrid():
f = open(r"...sudoku.txt", "rb") ## see attached for the file.

for line in f:
aLine = line.strip().split(',')
if aLine != [""]:
for i in xrange(len(aLine)):
aLine[i] = int(aLine[i])
grid.append(aLine)

  
  
at this point, grid contains a list of lists.

  
  
oGrid = copy.deepcopy(grid)

  
  
if you assign to a name inside a function, that name is considered to be
*local*, unless you specify otherwise.  in other words, this doesn't touch
the *global* (module-level) oGrid variable.

  
  
sGrid.append(copy.deepcopy(grid))

  
  
here you add a list of lists to a list.  the result is a list with a single item.

  
  
def printGrid():
print "original grid:"
for line in oGrid:
print line#why doesn't this print anything?

  
  
because the *global* oGrid is still empty.

  
  
print "S grid:"
for line in sGrid:
print line  #this prints the grid but the formatting is all over the
place.

  
  
because sGrid contains a single item; a copy of your original grid.

  
  
print "Iteration grid: "
for line in grid:
print line  #works fine!

  
  
as expected.

I suggest reading up on list methods and global variables in your favourite
python tutorial.

also read:

http://www.catb.org/~esr/faqs/smart-questions.html#id3001405

/F




  
  
  
  

  

Subject:

Re: python coding contest
  
  

From: 
[EMAIL PROTECTED] (Bengt Richter)
  
  

Date: 
Wed, 28 Dec 2005 08:09:51 GMT
  
  

To: 
python-list@python.org
  

  
  

  

To: 
python-list@python.org
  

  
  
  On 27 Dec 2005 09:24:44 GMT, Duncan Booth [EMAIL PROTECTED] wrote:

  
  
Scott David Daniels wrote:



  
I definitively need a new algorythm. g


  
  And I am sadly stuck at 169.  Not even spitting distance from 149 (which
sounds like a non-cheat version).
  

Throw it away and start again with a fresh (clean) solution. That's what I 
did when I'd reached the limit of nested maps and lambdas at 150 
characters. I'm now on 134 characters and the solution is very nearly 
legible. (Frustratingly, I'm away for the next few days, so I may not get a 
chance to submit my solution).

It would be a nice idea to come up with a scoring system which better 
reflects Python's ideals. For example, use the parser in Python to count up 
various syntactic elements, score 0 for comments, indents, dedents, 
newlines, docstrings, 1 for each name or operation used and higher scores 
for things like lambda or overly complex expressions.

  
  
[23:28] C:\pywk\clp\seven\pycontest_01py24 test.py
.
--
Ran 1 test in 0.391s

OK

[23:28] C:\pywk\clp\seven\pycontest_01wc -lc  seven_seg.py
  2136  seven_seg.py

2 lines, 136 chars 

Re: help with lists and writing to file in correct order

2005-12-28 Thread Steven D'Aprano
On Tue, 27 Dec 2005 20:11:59 -0800, homepricemaps wrote:

 hey steven-your examlpe was very helpful. is there a paragraph symbolg
 missing in
 
 fp.write(Food = %s, store = %s, price = %s\n % triplet

No, but there is a closing bracket missing:

fp.write(Food = %s, store = %s, price = %s\n % triplet)


-- 
Steven.

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


Re: python bug in this list implementation?

2005-12-28 Thread Steven D'Aprano
On Wed, 28 Dec 2005 07:29:41 +, Chris Smith wrote:

 Hi,
 
 I've been working on some multi-dimensional lists and I've encountered some
 very strange behaviour in what appears to be simple code, I'm using python
 2.4.2 and IDLE. If anyone can tell me why it's behaving so strange please
 let me know, any improvements to my general coding style are also 
 appreciated.

How about some advice about how to ask smart questions?

*What* is so strange about the behaviour -- what are you expecting? You
shouldn't expect people to read your mind and guess what behaviour you
expect, you should say I expect X Y and Z, but I get A B and C instead.
In the future, you may not have somebody like Fredrik willing to read your
code trying to guess what you think it should do.


 code below:
 
 import sys
 import copy
 
 grid = []
 oGrid = []
 sGrid = []

Using global variables is not usually recommended. It is usually better to
pass local variables from function to function. That will avoid the bugs
which your code has, which Fredrik has already pointed out.


 def createGrid():
 f = open(r...sudoku.txt, rb) ## see attached for the file.

Why do you need a raw string? It isn't wrong to do one, but it is rather
unusual and unnecessary.


[snip]
 oGrid = copy.deepcopy(grid)
 sGrid.append(copy.deepcopy(grid))

Why are you doing deepcopies of the lists? That seems to be unnecessary.

Oh, another bit of advice: any time you think you've found a bug in
Python, it almost always is a bug in your code.



-- 
Steven.

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


Re: Python obfuscation

2005-12-28 Thread Peter Maas
Chris Mellon schrieb:
There is a company who is developing and marketing a single application.
It is a simulation software for industrial processes which embodies an
enormous amount of knowledge accumulated by the hard work of many
individuals since about twenty years, algorithmic, process, implementation,
market knowlegde. This application is of great value to the customers
because it helps them save lots of money and improve the quality of their
products. No wonder that they have (and are willing) to pay a considerable
price for it.

 
 
 You just described UNIX, which has been all but replaced by open
 source projects, and the general state of the operating system market
 a few decades ago.

No, I didn't describe UNIX. UNIX and OSs in general are software which is
needed by everybody who is using a computer. You have many developers all
over the world willing to contribute. But the software I mentioned is a
highly specialized field  with a (compared to OS users) a tiny number of
customers and a degree of complexity at least the same as an OS. So I
think that an OSS model wouldn't work here. Also using UNIX as an example
is qustionable here because of its special history. UNIX was to a large
extent developed in academic environments and later closed sourced by ATT
at a time when much OS specific knowledge was available in universities.

If the company would decide to go open source it would be dead very soon
because it wouldn't no longer have a competitive advantage. Most customers
wouldn't see the necessity to pay high prices, the competition would use
the source code in their own products, the earnings would fall rapidly and
there wouldn't be enough money availabe to pay highly skilled developpers,
engineers and scientists for continued development.

In certain sense suppliers and customers ARE enemies because they have
different interests. The customer will pay a price only if it is neccessary
to get the product. If he can get it legally for nothing he won't pay anything
or at least not enough.

So please: continue praising OSS (as I do) but don't make ideological claims
that it fits everywhere.

 You're looking at the wrong things here. What you're describing is
 actually a potentially very successfull open source project

Successful for whom?

  - many
 companies, single source, highly technical, high price. An open source
 project could easily succeed in this area. Of course, it would not be
 in the interest of the current monopoly supplier to open source thier
 product. 

The supplier doesn't have a monopoly. He has competition but the supplier
started first, has always been the pacemaker and has therefore an advance.
His revenues are based on this advance. If somebody would suggest him to
go open source - what would be the advantage for him? Doing business is a
game, games are about winning and it isn't realistic to tell a player
to commit suicide.

 But a third party that started such a project could quite
 possibly succeed.

There are several 3rd parties all with closed source :) If an OSS 3rd
party would enter the game it would have to answer the question how
to fund the development. To succeed the OSS player would have to catch
up to its closed source competitors. This is anything but easy - there
is a lot of knowlegde (a crucial part of it not available for the
public) to be worked out. The developers have to earn money, who pays
them?

I think a lot of people believe OSS isn't about money. This is wrong.
Either OSS developers are working in their spare time for their own
pleasure. This puts some limits on their projects. Or they are working
all the day on OSS projects. Then they have to be paid, e.g. by academic
institutions (tax payer) or by companies like IBM and Novell who are
funding OSS because they have appropriate business models. There's
nothing wrong about this. But to pretend that OSS miraculously solves
the money problem for consumers _and_ producers is wrong IMO.

There are conditions for OSS for to succeed. It is worthwile to get to
know these conditions. To claim that there are no conditions at all and
OSS is successful by itself is certainly not true.

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


csv module

2005-12-28 Thread Laurent Laporte
hello,

I'm using cvs standard module under Python 2.3 / 2.4 to write a file
delimited with tabs. I use the excel-tab dialect to do that.

To read my CSV file, I choose to 'sniff' with a sample data in order to
get the dialect.
The problem I meet is that I get a wrong dialect: the sniffer return an
empty string delimiter. It is probably a bug in _guess_delimiter()
method.

The message I obtain is:
TypeError: bad argument type for built-in operation

Do you know a way to sniff tab-delimited data ?
Is it a known bug ?

Bye.

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


csv.Sniffer: wrong detection of the end of line delimiter

2005-12-28 Thread Laurent Laporte
hello,

I'm using cvs standard module under Python 2.3 / 2.4 to read a CSV
file. The file is opened in binary mode, so I keep the end of line
terminator.

It appears that the csv.Sniffer force the line terminator to be
'\r\n'. It's fine under Windows but wrong under Linux or
Macintosh.

More about this line terminator: Potential bug in the
_guess_delimiter() method.
The first line of code does a wrong splitting:
data = filter(None, data.split('\n'))
It doesn't take care of the real line terminator!

Here is a patch (not a perfect one):
# --- begin of patch ---
class PatchedSniffer(csv.Sniffer):

  def __init__(self):
csv.Sniffer.__init__(self)


  def sniff(self, p_data, p_delimiters = None):
t_dialect = csv.Sniffer.sniff(self, p_data, p_delimiters)
t_dialect.lineterminator = self._guessLineTerminator(p_data)
return t_dialect


  def _guessLineTerminator(self, p_data):
for t_lineTerminator in ['\r\n', '\n', '\r']:
  if t_lineTerminator in p_data:
return t_lineTerminator
else:
  return '\r\n' # Windows default (Excel)


  def _formatDataForGuess(self, p_data):
t_lineTerminator = self._guessLineTerminator(p_data)
return '\n'.join(p_data.split(t_lineTerminator))


  def _guess_delimiter(self, p_data, p_delimiters):
t_data = self._formatDataForGuess(p_data)

(t_delimiter, t_skipInitialSpace) = \
  csv.Sniffer._guess_delimiter(self, t_data, p_delimiters)

if t_delimiter == '' and '\t' in p_data:
  t_delimiter = '\t'

return (t_delimiter, t_skipInitialSpace)
# --- end of patch ---

Bye.
--- Laurent.

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


Re: csv module

2005-12-28 Thread Fredrik Lundh
Laurent Laporte wrote:

 I'm using cvs standard module under Python 2.3 / 2.4 to write a file
 delimited with tabs. I use the excel-tab dialect to do that.

 To read my CSV file, I choose to 'sniff' with a sample data in order to
 get the dialect.
 The problem I meet is that I get a wrong dialect: the sniffer return an
 empty string delimiter. It is probably a bug in _guess_delimiter()
 method.

 The message I obtain is:
 TypeError: bad argument type for built-in operation

 Do you know a way to sniff tab-delimited data ?
 Is it a known bug ?

http://www.python.org/sf/1157169

/F



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


viewcvs 1.0 dev

2005-12-28 Thread Robin Becker
Does anyone know the status of the svn handling version of viewCVS. It seems to 
have disappeared from sourceforge and no mention is made of it on the new 
tigris 
site.
-- 
Robin Becker

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


Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Ilias Lazaridis
Martin P. Hellwig wrote:
 Ilias Lazaridis wrote:
 Martin P. Hellwig wrote:
 Ilias Lazaridis wrote:
 cut
 So I guess you volunteer http://www.python.org/psf/volunteer.html ?

 I volunteer and contribute already (with a general validity and python 
 specific analysis)

 A mediator should communicate the findings and suggestion (after 
 verifying them) to the responsibles / community:

 http://lazaridis.com/efficiency/process.html#mediator

 This would include to pass the relevant ones to the list you've 
 mentioned:

 http://www.python.org/psf/volunteer.html

 -

 TAG.efficiency.process.mediator
 
 Last time I checked a mediator otherwise known to me as a 
 communication manager, is only effective when he/she is recognized as 
 authoritative by the participating group _and_ him/herself.

ok

 As from other posts I read that the last part is the issue, well since 
 this is a voluntary bunch of people with a slightly social democratic 
 architecture you fall back on spokesman and that can be anybody, 
 including or perhaps even especially you.

ok

 The only thing that holds you theoretically back is acknowledged 
 authority by the participating group _and_ yourself and of course the 
 resource for restricted information.

what do you mean by resource for restricted information?

 For the first part you got my vote, for second, well that should grow in 
 time.

second part = resource for restricted information ?


-

(you can use private email if you prefere. If so, I will post an summary 
back to the thread).

-

[sidenote: I am currently preparing diagramms, which will demonstrate 
the several processes more clearly.]

.

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


Re: MySQLdb Python API: Unable to connect

2005-12-28 Thread Mondal
Hi all,

Frederik is right. The hyphen in the port number was inserted when i
copied and pasted the error message. i used the port number 3306 (three
three zero six).

I am sorry about this, but i forgot to mention that my os is Windows
XP. MySQL is installed on my machine itself. Its using port 3306.
'Root' is the only user.

I have tried to connect by omitting the port argument.I have tried by
removing the password also. And I do take care to start an instance of
the server before trying to connect to it.

But I keep getting the same error message.

I hope someone can enlighten me

Regards
Mondal

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


Re: Microsoft's JavaScript doc's newfangled problem

2005-12-28 Thread axel
In comp.lang.perl.misc Xah Lee [EMAIL PROTECTED] wrote:
 If (1), then it would be a fucking incompetence of inordinate order. If

Have you ever thought that your cross-postings are incompetence
of inordinate order?

Of course not since you are a troll.

Axel

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


Re: predicting function calls?

2005-12-28 Thread Steven D'Aprano
On Tue, 27 Dec 2005 23:53:18 -0500, Roy Smith wrote:

 I think I know the answer to this, but I'll ask it just in case
 there's something I hadn't considered...
 
 I'm working on a python interface to a OODB.  Communication with the
 DB is over a TCP connection, using a model vaguely based on CORBA.
 I'll be creating object handles in Python which are proxies for the
 real objects in the database by doing something like:
 
 handle = connection.getObjectHandle (className, instanceName)
 
 Objects can have attributes (data) and operations associated with
 them.  It would be very convenient to use the . syntax to access
 both of these, i.e. be able to say:
 
 print handle.someAttribute
 print handle.someOperation (arg1, arg2)
 
 I'm using __getattr__() to process both of these constructs, and
 herein lies the rub; I need to do different things depending on
 whether the name is an attribute or an operation.

[snip]

 It would be really nice if I had some way to find
 out, from inside __getattr__(), if the value I'm about to return will
 get called as a function (i.e., the name is followed by an open
 paren).

How do you decide whether handle.foo should be treated as an attribute or
an operation?

If your object has an attribute foo, then what should you do when somebody
calls handle.foo()? That is, they treat an attribute as if it were an
operation? And vice versa.

In other words, it is not sufficient to know whether handle.foo is being
used as a operation or an attribute, but you need to know whether it
*should* be called as an operation or an attribute.


-- 
Steven.


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


Re: python coding contest

2005-12-28 Thread Tim Hochberg
Shane Hathaway wrote:
 I just found a 125 character solution.  It's actually faster and more 
 readable than the 133 character solution (though it's still obscure.)
 
 It depends on Python 2.4.  If Python 2.3 compatibility is required for 
 the contest, I have to add 4 characters.

I asked, 2.4 is OK.

Drat: I had a 128 char solution I was keeping in reserve. Now it's back 
to the drawing board

-tim

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


Problem installing libxml2dom on windows

2005-12-28 Thread ankit
I had installed libxml2 for python (libxml2-python-2.6.22.win32-py2.4)
on WINDOWS. For having dom support I am installing libxml2dom (0.3). My
python version on win is 2.4
but when I give run the install  as:

python setup.py install

I get following error:


Traceback (most recent call last):
  File setup.py, line 5, in ?
import libxml2dom
  File C:\Python24\libxml2dom-0.3\libxml2dom\__init__.py, line 9, in
?
from libxml2dom.macrolib import *
  File C:\Python24\libxml2dom-0.3\libxml2dom\macrolib\__init__.py,
line 9, in
?
from libxml2dom.macrolib.macrolib import *
  File C:\Python24\libxml2dom-0.3\libxml2dom\macrolib\macrolib.py,
line 8, in
?
import libxml2mod
ImportError: No module named libxml2mod

---

It cant find libxml2mod package. I suppose it installs with libxml2. Am
I right?

From where I will get this package for WINDOWS? Plz, tell me the site.
I tried googling but it didnt give me any links for download.
 
Can any one help.

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Uwe Hoffmann
Robin Becker schrieb:
 Does anyone know the status of the svn handling version of viewCVS. 

http://viewvc.tigris.org/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem installing libxml2dom on windows

2005-12-28 Thread Fredrik Lundh
ankit wrote:

 From where I will get this package for WINDOWS? Plz, tell me the site.
 I tried googling but it didnt give me any links for download.

first hit for libxml2 python 2.4:

http://users.skynet.be/sbi/libxml-python/

(can also be found two clicks away from the download link on
the libxml2 home page)

/F



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


ANN: xmldict 1.1

2005-12-28 Thread Ivan Voras
As it seems that few people are actually using this, I've made a small 
update to xmldict library, available here:

http://ivoras.sharanet.org/xmldict.py.gz

Some border-cases involving empty tags and atributes are resolved, and 
examples are updated.

WHAT IS IT
--

It's a very small (8KB, possibly  6KB without comments  examples) pure 
python parser for XML data. It doesn't care about fancy things like 
validation, and will probably break in silly ways on malformed input. 
Its only goal is to convert simple XML into nested dictionary-like 
structures. You'd be crazy to use it instead of a real parser for 
arbitrary XML, but it's perfect for parsing configuration files and the 
occasional XML-based network protocol. It uses only sys and re 
libraries, but can easily be reworked to be self-sufficient.

Again, test carefully before use, no gurantees that it will work, etc.

Happy hollidays!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fetching images from web?

2005-12-28 Thread annaiak
[EMAIL PROTECTED] wrote:
 hi, i want to automate some tasks of gathering photos from web, i tried
 urllib/urllib2, both ended up without much success (saved gifs with
 only a border, nothing else)..
 
 the code i used was:
 
 
data = 
urllib2.urlopen(http://aspn.activestate.com/ASPN/img/komodo_aspn_other.gif;)
  #was looking through cookbook, so i used that as a sample image
data = data.read()
file = open(f:/test.gif, w)
file.write(data)
file.close()
 
 
 
 can someone suggest a better way (or what's wrong with urllib/urllib2)?
 thanks alot!
 
fetching images from web is my little hobby (but i dont know, if you 
want fetch this kind of images). i sending my little script.

import urllib
for i in range(25,286,1):
if i100: n='0'+str(i)
else: n=str(i)
for j in range(16):
if j10: o='0'+str(j)
else: o=str(j)
s='used for error detecting'

url='http://www.paradisetoons.com/ima/toon'+str(i)+'/p'+str(j)+'.jpg'
fil='e:/pics/xxz37/prtn_'+n+'_'+o+'.jpg'
try:
s=urllib.urlopen(url).readline(6)
except:
print ''
if s.lower()=='html':
print 'file '+url+' does not exist'
else:   
print 'downloading file: '+url
urllib.urlretrieve(url,fil)

any sugestions for doing this better?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I want to exclude an expression of a sequence of charecters with regex

2005-12-28 Thread 28tommy
Thanks.

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


Re: csv module

2005-12-28 Thread skip

Laurent To read my CSV file, I choose to 'sniff' with a sample data in
Laurent order to get the dialect.  The problem I meet is that I get a
Laurent wrong dialect: the sniffer return an empty string delimiter. It
Laurent is probably a bug in _guess_delimiter() method.

Laurent The message I obtain is:
Laurent TypeError: bad argument type for built-in operation

Laurent Do you know a way to sniff tab-delimited data ?
Laurent Is it a known bug ?

Using a file with the following contents:

 open(tabber.csv, rb).read()
'1\t2\tabc\n3\t4\tdef\n'

I get:

 sniffer = csv.Sniffer()
 d = sniffer.sniff(open(tabber.csv, rb).read())
 d.delimiter
'\t'

Can you provide a concrete example (preferably in a bug report on SF)?

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


Re: csv module

2005-12-28 Thread skip

me Using a file with the following contents:

me  open(tabber.csv, rb).read()
me '1\t2\tabc\n3\t4\tdef\n'

me I get:

me  sniffer = csv.Sniffer()
me  d = sniffer.sniff(open(tabber.csv, rb).read())
me  d.delimiter
me '\t'

BTW, this also seems to work with a Mac-style EOL:

 open(tabber.csv, rb).read()
'1\t2\tabc\r3\t4\tdef\r'
 d = sniffer.sniff(open(tabber.csv, rb).read())
 d.delimiter
'\t'

Perhaps this has been fixed in CVS.

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Robin Becker
Uwe Hoffmann wrote:
 Robin Becker schrieb:
 
Does anyone know the status of the svn handling version of viewCVS. 
 
 
 http://viewvc.tigris.org/index.html

unfortunately there's no mention of svn handling there and the files only show 
0.9[.x] versions.

-- 
Robin Becker

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


some suggestions about GUI toolkits?

2005-12-28 Thread iclinux
I have to build a GUI applicaiton that could run on different OS such
as windows and *nix, which GUI toolkit is better?

Best Regards.

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


Re: csv module

2005-12-28 Thread Laurent Laporte
Sorry,

Here is my example:

Python 2.3.1 (#1, Sep 29 2003, 15:42:58)
[GCC 2.96 2731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type help, copyright, credits or license for more information.
 import csv
 t_sniffer = csv.Sniffer()
 t_data = aaa\tbbb\r\n\r\nAAA\tBBB\r\n
 t_dialect = t_sniffer.sniff(t_data)
 t_dialect.delimiter
''

In fact, I found the pb (thanks to you): I add a newline '\r\n' to
separate the header from the records...

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


Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Martin P. Hellwig
Ilias Lazaridis wrote:
cut
 The only thing that holds you theoretically back is acknowledged 
 authority by the participating group _and_ yourself and of course the 
 resource for restricted information.
 
 what do you mean by resource for restricted information?

Well, I mean that you should know before the others that Guido is 
working for google otherwise such a publication is a bit late :-), 
nevertheless better late then never.

 For the first part you got my vote, for second, well that should grow 
 in time.
 
 second part = resource for restricted information ?
yup
cut

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


Dr. Dobb's Python-URL! - weekly Python news and links (Dec 27)

2005-12-28 Thread Cameron Laird
QOTW:  My wild-ass guess is that, same as most other Open Source
communities, we average about one asshole per member. - Tim Peters
http://groups.google.com/group/comp.lang.python/msg/02236cc5ab54fd90?hl=en

[T]he only fundamentally new concept that has been added since Python
1.5.2 is generators.  And a lot of the stuff you want generators for
can be emulated with sequences and extra buffer layers. - Fredrik Lundh


gene tani and Olivier Grisel collect information about memory- and
time-profiling:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/6186ae64a564ad5a/

Python builds in a convenience for, this segment of
code isn't finished.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/3179dcce33a33fbb/

You want to constrain the time allowed to a particular
Python function to execute.  A reasonably standard solution
is available.  To limit *two* potentially concurrent functions,
though ... well, that's not a strength of Python:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/bd808b80fc8191/

Contest your Python coding:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/ac7fdb93af4e0b2f/

Sorting depends on comparisons.  It is NOT possible, in 
general, to memoize these comparisons, in the sense that
the Python run-time library should take on the responsibility
for developers.  DSU and other situation-specific strategies
always remains available, of course:
http://groups.google.com/group/comp.lang.python/msg/8007c9d7fabe6223

http://groups.google.com/group/comp.lang.python/browse_thread/thread/773d64e6d8b77802/

Yes, Guido's at Google.  He'll work on and with Python.
How much more official do you need it to be?

http://groups.google.com/group/comp.lang.python/browse_thread/thread/32dc95bd671542f3/

Peter Hansen and David Wahler lucidly explain how hard it
is to keep even a little security.  A digital datum in any
one useful place is likely to leak all over, even for a
problem as seemingly simple as protection of a password
used for cron-automated access:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/b8bdb21a084d6a99/

Is it humane that Ruby typically abbreviates get(end)
as last?  Dave Benjamin and Kent Johnson discuss the 
matter seriously and usefully (with examples!):

http://groups.google.com/group/comp.lang.python/browse_thread/thread/d2ada62cd187dd65/



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 

Re: Problem installing libxml2dom on windows

2005-12-28 Thread ankit
I already downloaded the latest
package(libxml2-python-2.6.22.win32-py2.4.exe )  for libxml2 and
installed it.
I want a package for libxml2mod , because that only package is not
getting find. The link you had specifed I already been there.
Only libxml2 for python with win32 are available there.

Can you please be more specific about libxml2mod?

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


Re: Problem installing libxml2dom on windows

2005-12-28 Thread ankit
I also tried installing some different package for dom
libxml_domlib(1.2a) on windows with python 2.4 and libxml2(2.6.22)
but in this case it gives some differnet error while build only, The
error is as
--
running build
running build_ext
building 'libxml_domlib' extension
error: Python was built with version 7.1 of Visual Studio, and
extensions need to be built with the same version of the compiler, but
it isn't installed.
---

What is this. Plz help

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



Re: csv module

2005-12-28 Thread Laurent Laporte
In fact, there is another bug:

In my CVS file, all the records ends with a trailing tab '\t'
except the header because the last field is always empty.

For example, I get :
 import csv
 t_sniffer = csv.Sniffer()
 t_data = aaa\tbbb\r\nAAA\t\r\nBBB\t\r\n
 t_dialect = t_sniffer.sniff(t_data)
 t_dialect.delimiter
''

It is done in the _guess_delimiter() method during the building of
frequency tables. A striping is done for each line (why??)
If I change:
  freq = line.strip().count(char)
by:
  freq = line.count(char)
It works fine.

Do you have a workaround for that?

--- Laurent.

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


Re: some suggestions about GUI toolkits?

2005-12-28 Thread Luis M. González
This question comes up in this mailing list every two or three days...
I suggest taking some time to read previous threads (use Google Groups
for en easier experience) and you'll find thousands of opinions and
suggestions.

My advice: check PythonCard http://pythoncard.sourceforge.net/

Good luck!
Luis

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


Re: Problem installing libxml2dom on windows

2005-12-28 Thread ankit
I also tried installing some different package for dom
libxml_domlib(1.2a) on windows with python 2.4 and libxml2(2.6.22)
but in this case it gives some differnet error while build only, The
error is as
--
running build
running build_ext
building 'libxml_domlib' extension
error: Python was built with version 7.1 of Visual Studio, and
extensions need to be built with the same version of the compiler, but
it isn't installed.
---

libxml_domlib available at:
http://www.rexx.com/~dkuhlman/libxml_domlib.html



What is this. Plz help

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


Re: some suggestions about GUI toolkits?

2005-12-28 Thread bytecolor
I recently wrote a small application using wxPython (my first with this
GUI). I've used it on
Windows XP, Debian GNU/Linux (sarge) and OS X (Panther). The
application only uses a few widgets but it wasnt difficult at all to
get up and running.

-- 
bytecolor

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


Re: python coding contest

2005-12-28 Thread Marius Gedminas
Jean-Paul Calderone wrote:
 On Tue, 27 Dec 2005 14:02:57 -0700, Tim Hochberg [EMAIL PROTECTED] wrote:
 Shane Hathaway wrote:
  Paul McGuire wrote:
 
 
  Also, here's another cheat version.  (No, 7seg.com does not exist.)
 
 import urllib2
 def seven_seg(x):return urllib2.urlopen('http://7seg.com/'+x).read()
 
 And another one from me as well.
 
 class a:
   def __eq__(s,o):return 1
 seven_seg=lambda i:a()
 

 This is shorter as __eq__=lambda s,o:1.

Or even

  class seven_seg(str):__eq__=lambda*a:1

39 characters; passes the test suite.  I'm sure it would be
disqualified for cheating, though. :-)

 But I can't find the first post in this thread... What are you
 guys talking about?

http://www.pycontest.net

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


libxml_domlib installation in linux : problems

2005-12-28 Thread ankit
 am installing libxml_domlib(1.2a) on linux but when I build it it
searches for  includes of libxml2 in folder
/usr/local/include/libxml2 but  libxml2 have includes under
/usr/include/libxml2. For this reason it gives me following error:
--
gcc -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC
-fPIC -I. -I/usr/local/include/libxml2 -I/usr/include/python2.2 -c
libxml_domlib.c -o build/temp.linux-i686-2.2/libxml_domlib.o
libxml_domlib.c:32:30: libxml/xmlmemory.h: No such file or directory
libxml_domlib.c:33:27: libxml/parser.h: No such file or directory
--

In makefile I changed the places for libs and given the correct path
for includes of libxml2 under INCL_DIR instead of that its picking up
/usr/local/include/libxml2 and searches headers there . the
makefile(afer chages) I am using is following:

---
PYTHON_DIR=/usr/include/python2.2/
INCL_DIRS=-I/usr/include/libxml2/ \
  -I${PYTHON_DIR}
CFLAGS=-c -g ${INCL_DIRS} -Wall -fPIC
#LINKFLAGS=-shared -L/usr/local/lib/python2.1/config/ -lpython2.1 \
#   -L/usr/local/lib -lxml2 -lz -lm -lz
LINKFLAGS=-shared -L/usr/lib/python2.2/config/ -lpython2.2 \
-L/usr/lib -lxml2 -lm
OBJS=libxml_domlib.o domlib_node.o domlib_doc.o \
domlib_ns.o domlib_attrs.o
libxml_domlib.so: ${OBJS}
gcc ${LINKFLAGS} ${OBJS} -o libxml_domlib.so
libxml_domlib.o: libxml_domlib.c domlib_node.h
gcc ${CFLAGS} libxml_domlib.c -o libxml_domlib.o
domlib_node.o: domlib_node.c domlib_node.h
gcc ${CFLAGS} domlib_node.c -o domlib_node.o
domlib_doc.o: domlib_doc.c domlib_doc.h
gcc ${CFLAGS} domlib_doc.c -o domlib_doc.o
domlib_ns.o: domlib_ns.c domlib_ns.h
gcc ${CFLAGS} domlib_ns.c -o domlib_ns.o
domlib_attrs.o: domlib_attrs.c domlib_attrs.h
gcc ${CFLAGS} domlib_attrs.c -o domlib_attrs.o
clean:
rm -f ${OBJS} libxml_domlib.so

---

How can I override this behaviour of inclusions of header?
and Also is there any version of libxml_domlib availaible for windows.
?

Can anyone help

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


Re: help with lists and writing to file in correct order

2005-12-28 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
 sorry guys, here is the code
 
 for incident in bs('a',  {'class' : 'price'}):
 price = 
 for oText in incident.fetchText( oRE):
   price += oText.strip() + ','
 
 for incident in bs('div',  {'class' : 'store'}):
 store = 
 for oText in incident.fetchText( oRE):
 store += oText.strip() + ','
 
 for incident in bs('h2',  {'id' : 'food'}):
   food = 
   for oText in incident.fetchText( oRE):
 food += oText.strip() + ','
 

I would use a loop that finds the row for a single item with something like
for item in bs('tr',  {'class' : 'base'}):

then inside the loop fetch the values for store, food and price for that 
item and write them to your output file.

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


Re: python bug in this list implementation?

2005-12-28 Thread Christoph Zwerschke
Steven D'Aprano wrote:
 On Wed, 28 Dec 2005 07:29:41 +, Chris Smith wrote:
 
def createGrid():
f = open(r...sudoku.txt, rb) ## see attached for the file.
 
 Why do you need a raw string? It isn't wrong to do one, but it is rather
 unusual and unnecessary.

Chris is probably working on Windows where it is handy to enter paths as 
raw strings because of the backslashes. Unusual however, and problematic 
if you want to use the program on other platforms, is opening a text 
file in binary mode.

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


Re: predicting function calls?

2005-12-28 Thread Roy Smith
Steven D'Aprano [EMAIL PROTECTED] wrote:
 How do you decide whether handle.foo should be treated as an attribute or
 an operation?

That's exactly what I'm trying to figure out.  In the legacy system I'm 
trying to emulate, the interpreter knows the from syntax (i.e. whether 
handle.foo is followed by an open paren or not).  I'm looking for some way 
I can emulate that behavior in Python.
 
 If your object has an attribute foo, then what should you do when somebody
 calls handle.foo()? That is, they treat an attribute as if it were an
 operation? And vice versa.

That's easy.  In such a case, the database will generate an error, which I 
can then pass on to the user, probably by raising some subclass of 
TypeError.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: predicting function calls?

2005-12-28 Thread Roy Smith
In article [EMAIL PROTECTED], Mike Meyer [EMAIL PROTECTED] 
wrote:

 Fnorb (a pure-Python CORBA orb) dealt with this by not allowing
 attributes per se. Instead, it provided _get_AttributeName and
 _set_AttributeName as appropriate for each attribute in the IDL. Doing
 this means that *everything* you hand back from __getattr__ is going
 to be a callable, and presumably called at some point.

That's exactly what the low-level C/C++ API does in the system I'm working 
with.  It is, unfortunately, not the interface that's exposed by the serial 
protocol.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python coding contest

2005-12-28 Thread Tim Hochberg
Marius Gedminas wrote:
 Jean-Paul Calderone wrote:
 
On Tue, 27 Dec 2005 14:02:57 -0700, Tim Hochberg [EMAIL PROTECTED] wrote:

Shane Hathaway wrote:

Paul McGuire wrote:


Also, here's another cheat version.  (No, 7seg.com does not exist.)

   import urllib2
   def seven_seg(x):return urllib2.urlopen('http://7seg.com/'+x).read()


And another one from me as well.

class a:
 def __eq__(s,o):return 1
seven_seg=lambda i:a()


This is shorter as __eq__=lambda s,o:1.
 
 
 Or even
 
   class seven_seg(str):__eq__=lambda*a:1
 
 39 characters; passes the test suite.  I'm sure it would be
 disqualified for cheating, though. :-)


Tricky. That leads to this 30 character gem:

class seven_seg(str):__eq__=id

-tim

 
 
But I can't find the first post in this thread... What are you
guys talking about?
 
 
 http://www.pycontest.net
 

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


pyfltk2 tutorial

2005-12-28 Thread Siraj Kutlusan
I want to use pyfltk2 because of its simplicity but there seem to be no
tutorials done for it. Could anyone give me a link to one please?
-- 
http://mail.python.org/mailman/listinfo/python-list


PyCon TX 2006: Early-bird registration ends Dec. 31!

2005-12-28 Thread David Goodger
Early bird registration for PyCon TX 2006 ends on December 31st,
so there are only a few days LEFT. To register, please visit:

http://us.pycon.org/TX2006/Registration

You can still register after Dec. 31st, but the cost will go up by
US$65 (US$25 for students).

This year PyCon will feature a day of tutorials before the three days
of regular presentations.  Course outlines for all the tutorials have
been posted; see

http://wiki.python.org/moin/PyCon2006/Tutorials

All of the PyCon tutorials are still open for new registrations, but
space is limited, and we suspect they'll all be filled up by the time
early-bird registration closes.

Don't forget to book your hotel room, too.  PyCon TX 2006 is being
held at a Dallas/Addison hotel, and we have negotiated a special low
rate:

http://us.pycon.org/Addison/Hotels

We hope to see you in Texas!

-- David Goodger
   (on behalf of A.M. Kuchling, Chair, PyCon 2006)



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Anton Vredegoor

Michael wrote:

 Ilias Lazaridis wrote:
  [ panic, fear, worry ]

 What's wrong with just saying Congratulations! ? First thing I thought was
 ooh, maybe Guido will be able to work on P3K there - after all that would
 benefit Google *and* everyone else :-)

Google's not a nice company (yeah, I know I'm posting from a google
account). If you look at their job requirements it's clear they will
only hire people with long backstabbing histories. There seems to be no
room left for world improving undamaged souls in that company.

 (Especially if he uses PyPy to experiment and play in ... :)

Yes PyPy could save Python, or destroy the world. I have the impression
not many enough people realize that a selfhosting programming language
is something on the same level as a nano assembler or an artificial
intelligence. There is not much time anymore for idealists to start
trying to save the world, and I don't think we can count on google in
that respect.

Anton

'make my day, prove me wrong'

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


Re: python bug in this list implementation?

2005-12-28 Thread Steven D'Aprano
On Wed, 28 Dec 2005 15:07:52 +0100, Christoph Zwerschke wrote:

 Steven D'Aprano wrote:
 On Wed, 28 Dec 2005 07:29:41 +, Chris Smith wrote:
  
def createGrid():
f = open(r...sudoku.txt, rb) ## see attached for the file.
 
 Why do you need a raw string? It isn't wrong to do one, but it is rather
 unusual and unnecessary.
 
 Chris is probably working on Windows where it is handy to enter paths as 
 raw strings because of the backslashes. Unusual however, and problematic 
 if you want to use the program on other platforms, is opening a text 
 file in binary mode.

Sure, but then the file name doesn't have any backslashes. 

I've never understood why binary mode is supposed to be bad. By my
understanding, binary mode simply means that no line endings are
translated, regardless of whether the file uses \n, \r or a combination of
the two. Surely the worst that can happen in binary mode is that your
strings end up having some carriage returns you have to deal with yourself?



-- 
Steven.

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


Re: html resize pics

2005-12-28 Thread Peter Hansen
rbt wrote:
 I use Python to generate html pages. I link to several 
 large images at times. I'd like to display a thumbnail image that when 
 clicked will go to the original, large jpg for a more detailed view.

I use PIL with the thumbnail() function for that...  depending on what 
sort of web server/framework you are using, you could generate the 
thumbnails dynamically, or you could pre-generate them and store both 
files (this is probably the most common way to do it).  The HTML, of 
course, has to be generated to refer to the appropriate file: the IMG 
source is the thumbnail, the anchor's href points to the larger image.

-Peter

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Robert Kern
Anton Vredegoor wrote:
 Michael wrote:
 
Ilias Lazaridis wrote:

[ panic, fear, worry ]

What's wrong with just saying Congratulations! ? First thing I thought was
ooh, maybe Guido will be able to work on P3K there - after all that would
benefit Google *and* everyone else :-)
 
 Google's not a nice company (yeah, I know I'm posting from a google
 account). If you look at their job requirements it's clear they will
 only hire people with long backstabbing histories. There seems to be no
 room left for world improving undamaged souls in that company.

I have a friend who works at Google. He has no backstabbing history at all. Stop
insulting my friends.

For Software Engineer:


Requirements:

* BS or MS in Computer Science or equivalent (PhD a plus).
* Several years of software development experience.
* Enthusiasm for solving interesting problems.
* Experience with Unix/Linux or Windows environments, C++ development,
distributed systems, machine learning, information retrieval, network
programming and/or developing large software systems a plus.


I don't see any damaged soul requirement.

(Especially if he uses PyPy to experiment and play in ... :)
 
 Yes PyPy could save Python, or destroy the world. I have the impression
 not many enough people realize that a selfhosting programming language
 is something on the same level as a nano assembler or an artificial
 intelligence.

??? What the hell are you smoking? We already have self-hosting programming
languages.

 Anton

 'make my day, prove me wrong'

Prove yourself right.

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die.
  -- Richard Harter

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


Re: Humane programmer interfaces

2005-12-28 Thread kpd
list[-1] maps very well to my mental concept of list.  To me  'List'
brings to mind a bunch of things in a line.  It's intuitive to count
forward  or backward.

Ruby's 'last'  doesn't map as well for me because I don't think of the
list as having an attribute of 'last.'

Java just annoys me because I can never remember if it is 'size',
'length' or something else.  Similarly, Java's conversion operators -
string to int or back - are something I am *always* referring to as
they just don't fit my mental model.

I agree with Kent, it's so subjective, but I've also found that Python
hits the right level.

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Uwe Hoffmann
Robin Becker schrieb:
 Uwe Hoffmann wrote:
 
 Robin Becker schrieb:

 unfortunately there's no mention of svn handling there and the files 
 only show 0.9[.x] versions.
 
at least you can get the sources via subversion and have a look at the 
INSTALL file (e.g.
http://viewvc.tigris.org/source/browse/viewvc/trunk/INSTALL?rev=1213view=autocontent-type=text/vnd.viewcvs-markup
)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: csv module

2005-12-28 Thread skip

Laurent If I change:
Laurent   freq = line.strip().count(char)
Laurent by:
Laurent   freq = line.count(char)
Laurent It works fine.

Laurent Do you have a workaround for that?

Nope.  I just checked in precisely your fix to the Python repository.

Skip

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


Re: PyCon TX 2006: Early-bird registration ends Dec. 31!

2005-12-28 Thread Thomas Wouters
On Wed, 28 Dec 2005 10:06:43 -0500, David Goodger wrote:

 Don't forget to book your hotel room, too.  PyCon TX 2006 is being
 held at a Dallas/Addison hotel, and we have negotiated a special low
 rate:

FWIW, for some days, the special-rate 1-2 person rooms are out of stock.
Feb 22nd, 26th and 27th, to be precise, when I booked this morning. That
means you can't conveniently book online (it will just tell you you can't
get that group rate for your entire stay) but I was able to get it sorted
over the phone. The hotel booked me for the 1-2 person special rate for
most of the nights, and the 3-4 person special rate (still cheaper than
most alternatives) the three troublesome nights. Anyone still
trying to get their hotel reserved might want to keep this in mind.

A-hotel-with-rooms-out-of-stock--what's-next-ly y'rs,
-- 
Thomas Wouters [EMAIL PROTECTED]

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

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


Re: predicting function calls?

2005-12-28 Thread OKB (not okblacke)
Roy Smith wrote:

 print handle.someAttribute
 print handle.someOperation (arg1, arg2)
 
 I'm using __getattr__() to process both of these constructs, and
 herein lies the rub; I need to do different things depending on
 whether the name is an attribute or an operation.  I can ask the DB
 for a list of the names of all the operations supported by a given
 object, but that's a fairly expensive thing to do, so I'd rather avoid
 it if possible.  It would be really nice if I had some way to find
 out, from inside __getattr__(), if the value I'm about to return will
 get called as a function (i.e., the name is followed by an open
 paren).

What do you do if the person does:

x = handle.someOperation
x(arg1, arg2)

-- 
--OKB (not okblacke)
Brendan Barnwell
Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail.
--author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Anton Vredegoor
Robert Kern wrote:

 I have a friend who works at Google. He has no backstabbing history at all. 
 Stop
 insulting my friends.

Your friends work for people who would never hire me. My resume sucks,
but I'm not a bad person or a mediocre programmer. They sold out.

 For Software Engineer:

 
 Requirements:

 * BS or MS in Computer Science or equivalent (PhD a plus).

Right here.

 * Several years of software development experience.
 * Enthusiasm for solving interesting problems.
 * Experience with Unix/Linux or Windows environments, C++ development,
 distributed systems, machine learning, information retrieval, network
 programming and/or developing large software systems a plus.
 

 I don't see any damaged soul requirement.

I do. Experience here is an eufemism for having worked for the man.

 (Especially if he uses PyPy to experiment and play in ... :)
 
  Yes PyPy could save Python, or destroy the world. I have the impression
  not many enough people realize that a selfhosting programming language
  is something on the same level as a nano assembler or an artificial
  intelligence.

 ??? What the hell are you smoking? We already have self-hosting programming
 languages.

Yes. We have humans too.

  Anton
 
  'make my day, prove me wrong'

 Prove yourself right.

Ok. That's a bit harder. I suppose we agree that if we have an
intelligent program that is more intelligent than a human and have this
program design an even more intelligent program than things start to
accelerate pretty fast?

Now the combination of a programmer with a tool (program) that can be
used to make a better tool. This gives a better human-machine
combination, which then can be used to further improve the combination.
I don't think I have completely proven my point now, but since the
danger is very real and big, coming close is already reason enough to
watch this carefully. Why hasn't it happened yet with lisp? I don't
know, why didn't the world get destroyed by all out atomic warfare?
Couldn't it have happened?

If we create AI why would AI keep us around if we ourselves won't even
hire people that do not comply to absurdly specific preconditions?
Don't we let our poor people starve in the undeveloped countries or
even in our own cities? If we want to prove we belong to the next world
we should start now. Open work communities where everyone can start
working and get paid. The same thing as open source code or usenet but
now with money for everyone.

Anton

'sorry, I don't want to start a flamewar, but I really believe what I
wrote here'

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


Re: python coding contest

2005-12-28 Thread Tim Peters
[Bengt Richter]
 ...
 [23:28] C:\pywk\clp\seven\pycontest_01wc -lc  seven_seg.py
   2136  seven_seg.py

 2 lines, 136 chars including unix-style lineseps (is that cheating on 
 windows?)

Na.  Most native Windows apps (including native Windows Python) don't
care whether \n or \r\n in used as the line terminator in text files. 
This is because the platform C library changes \r\n to \n on input of
a text-mode file, and leaves \n alone:  the difference is literally
invisible to most apps.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Luis M. González
Anton Vredegoor wrote:

 Google's not a nice company (yeah, I know I'm posting from a google
 account). If you look at their job requirements it's clear they will
 only hire people with long backstabbing histories. There seems to be no
 room left for world improving undamaged souls in that company.

  (Especially if he uses PyPy to experiment and play in ... :)

 Yes PyPy could save Python, or destroy the world. I have the impression
 not many enough people realize that a selfhosting programming language
 is something on the same level as a nano assembler or an artificial
 intelligence. There is not much time anymore for idealists to start
 trying to save the world, and I don't think we can count on google in
 that respect.


Huh?

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


Re: PyCon TX 2006: Hotel problems

2005-12-28 Thread Aahz
In article [EMAIL PROTECTED],
Thomas Wouters  [EMAIL PROTECTED] wrote:
On Wed, 28 Dec 2005 10:06:43 -0500, David Goodger wrote:

 Don't forget to book your hotel room, too.  PyCon TX 2006 is being
 held at a Dallas/Addison hotel, and we have negotiated a special low
 rate:

FWIW, for some days, the special-rate 1-2 person rooms are out of stock.
Feb 22nd, 26th and 27th, to be precise, when I booked this morning. That
means you can't conveniently book online (it will just tell you you can't
get that group rate for your entire stay) but I was able to get it sorted
over the phone. The hotel booked me for the 1-2 person special rate for
most of the nights, and the 3-4 person special rate (still cheaper than
most alternatives) the three troublesome nights. Anyone still
trying to get their hotel reserved might want to keep this in mind.

They're not out of stock, they just fscked their reservation system.  Our
contract says that we get the special rate as long as they actually have
rooms available.  We'll post another announcement when the reservation
problems get fixed; at that point, we'll give ya'll the option of giving
us your reservation number (and we'll fix it for you) or handling the
problem yourselves.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

Given that C++ has pointers and typecasts, it's really hard to have a serious 
conversation about type safety with a C++ programmer and keep a straight face.
It's kind of like having a guy who juggles chainsaws wearing body armor 
arguing with a guy who juggles rubber chickens wearing a T-shirt about who's 
in more danger.  --Roy Smith
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: viewcvs 1.0 dev

2005-12-28 Thread Martin v. Löwis
Robin Becker wrote:
 Does anyone know the status of the svn handling version of viewCVS. 

It works:

http://svn.python.org/view/

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python bug in this list implementation?

2005-12-28 Thread Roel Schroeven
Steven D'Aprano wrote:
 On Wed, 28 Dec 2005 15:07:52 +0100, Christoph Zwerschke wrote:
Chris is probably working on Windows where it is handy to enter paths as 
raw strings because of the backslashes. Unusual however, and problematic 
if you want to use the program on other platforms, is opening a text 
file in binary mode.
 
 I've never understood why binary mode is supposed to be bad. By my
 understanding, binary mode simply means that no line endings are
 translated, regardless of whether the file uses \n, \r or a combination of
 the two. Surely the worst that can happen in binary mode is that your
 strings end up having some carriage returns you have to deal with yourself?

Yes. The larger problem is when you don't explicitly use binary mode
while handling binary data on other platforms, and then port it to Windows.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Robin Becker
Martin v. Löwis wrote:
 Robin Becker wrote:
 
Does anyone know the status of the svn handling version of viewCVS. 
 
 
 It works:
 
 http://svn.python.org/view/
 
 Regards,
 Martin
yes I ahd it working and updated my freebsd and then couldn't locate the latest 
version. If the svn head stuff from tigris works that'll do. On another point I 
thought the whole point of sourceforge was that the files wouldn't get 
removed/deleted. Does whining and begging work for remove my old project?
-- 
Robin Becker

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Mike Meyer
Anton Vredegoor [EMAIL PROTECTED] writes:
 Ok. That's a bit harder. I suppose we agree that if we have an
 intelligent program that is more intelligent than a human and have this
 program design an even more intelligent program than things start to
 accelerate pretty fast?

There's your fundamental flaw. Programs aren't intelligent, any more
than submarines swim.

 Now the combination of a programmer with a tool (program) that can be
 used to make a better tool. This gives a better human-machine
 combination, which then can be used to further improve the combination.

Key word: tool. Nothing is said about the intelligence of said
tool. It doesn't have to be intelligent at all. It just has to be able
to do one single task better than the human. The intelligence in this
combination is coming from the human.

 I don't think I have completely proven my point now, but since the
 danger is very real and big, coming close is already reason enough to
 watch this carefully.

We aren't any closer to having a real AI than we were in the 60s. On
my list of man-made, world-ending catastrophes, a world-dominating AI
is easily outranked by grey goo, and just barely beats out the nine
billion names of god.

 'sorry, I don't want to start a flamewar, but I really believe what I
 wrote here'

I think you're taking to many bad scifi movies seriously.

mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Late binding and late execution (was: Beautiful Python)

2005-12-28 Thread Cameron Laird
In article [EMAIL PROTECTED],
Dennis Lee Bieber  [EMAIL PROTECTED] wrote:
On Tue, 27 Dec 2005 21:35:46 -0600, [EMAIL PROTECTED] declaimed the
following in comp.lang.python:

 Wow ?!   I've only started looking at python but that sounds like very
 dangerous programming !  Can you give an example.

   Even a simple def statement is an executed statement in Python.

   There is no difference, in Python, between an imported file and a
file invoked directly on the command line -- other than the name given
the module. Many files take advantage of that to supply a stand-alone
mode by putting something like:

if __name__ == __main__:
   # do something as a stand-alone module
   # likely by setting up some parameters from the command line
   # and invoking the real work function/class
   # for example:
   term1 = sys.argv[1]
   optionals = sys.argf[2:]
   myWorkRoutine(term1, optionals)

---

   If imported (call it module impy), one could then do things like

import impy

...# other stuff
impy.myWorkRoutine(stuff, nonsense)
.
.
.
Along with all the other true things that have been written in this
thread, I wonder whether some participants realize how often real-world
code needs some sort of conditional source--for example, if we're in
a context where a particular database manager is locally-licensed, then
we need to import and use a particular set of definitions, otherwise we
fall back to network access of ...  Contingent declarations, such as
global or import, might seem to be mere optimizations, but they're
important ones for the kinds of problems I encounter that need to do
real work.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: viewcvs 1.0 dev

2005-12-28 Thread Martin v. Löwis
Robin Becker wrote:
 yes I ahd it working and updated my freebsd and then couldn't locate the
 latest version. If the svn head stuff from tigris works that'll do. On
 another point I thought the whole point of sourceforge was that the
 files wouldn't get removed/deleted. Does whining and begging work for
 remove my old project?

No: it's still there. The viewcvs viewcvs is at

http://cvs.sourceforge.net/viewcvs.py/viewcvs/

and the viewcvs CVS should be at (untested)
:pserver:[EMAIL PROTECTED]:/cvsroot/viewcvs

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Fredrik Lundh
Mike Meyer wrote:

 We aren't any closer to having a real AI than we were in the 60s.

note that the name of the the poster who started this thread only needs minimal
adjustments to become an anagram for alien lizard AI, which might indicate 
that
the government has access to some kind of AI, but that it's completely useless.

/F



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


How do I redirect output to a file and to the console screen?

2005-12-28 Thread 28tommy
Hi there,

I'm doing some TELNET and FTP sessions with my scripts. I need to
redirect all the output (and not just what I print) to an output file,
but still be able to see the session in process on the console.

The Console screen is of less importance, so I could give it up, but
what I'm looking for is a way to see all the interaction with the
remote seesions on a file, that all the console data was redirected to
it from within the script file.

P.S. - the command python script_file  output_file is not from
within the file, so it won't work for me. 

Thank you (-:

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Robert Kern
Anton Vredegoor wrote:
 Robert Kern wrote:
 
I have a friend who works at Google. He has no backstabbing history at all. 
Stop
insulting my friends.
 
 Your friends work for people who would never hire me.

This is not a crime.

 My resume sucks,
 but I'm not a bad person or a mediocre programmer.

Okay. Still has nothing to do with my friend or anyone else who works at Google.
Still doesn't mean my friend has a backstabbing history, whatever that is.

 They sold out.

rolls eyes No, he accepted a job. He has a family to feed. Google may or may
not be unethical, but their requirement for experienced developers is not
unethical. Just because they might not hire you doesn't mean they are unethical.
They simply have needs that you can't fill.

Your sense of entitlement is showing.

For Software Engineer:


Requirements:

* BS or MS in Computer Science or equivalent (PhD a plus).
 
 Right here.
 
* Several years of software development experience.
* Enthusiasm for solving interesting problems.
* Experience with Unix/Linux or Windows environments, C++ development,
distributed systems, machine learning, information retrieval, network
programming and/or developing large software systems a plus.


I don't see any damaged soul requirement.
 
 I do. Experience here is an eufemism for having worked for the man.

Who is the man? If Google were to hire you with no experience, would you then
have worked for the man?

(Especially if he uses PyPy to experiment and play in ... :)

Yes PyPy could save Python, or destroy the world. I have the impression
not many enough people realize that a selfhosting programming language
is something on the same level as a nano assembler or an artificial
intelligence.

??? What the hell are you smoking? We already have self-hosting programming
languages.
 
 Yes. We have humans too.

Some Lisps are self-hosting. C is self-hosting. The world is not yet destroyed.
Do you understand what self-hosting means?

Anton

'make my day, prove me wrong'

Prove yourself right.
 
 Ok. That's a bit harder. I suppose we agree that if we have an
 intelligent program that is more intelligent than a human and have this
 program design an even more intelligent program than things start to
 accelerate pretty fast?

PyPy will not bring about the Singularity.

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die.
  -- Richard Harter

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread Hans Nowak
Robert Kern wrote:

 PyPy will not bring about the Singularity.

But if it did, imagine how cool that would look on the developers 
resumes... :-)

-- 
Hans Nowak
http://zephyrfalcon.org/
-- 
http://mail.python.org/mailman/listinfo/python-list


Draw over video

2005-12-28 Thread Zarathustra
Hi, I'm an italian student in telecommunication engineering.For an
examen i will realize an object tracking.I 'm going to do it in java
with the JMF, but it's impossible to draw over a video.Now, I have been
tought to  make it in Python, with PyGtk or Pyqt and Pymedia.It's
possible to draw over a video with this struments??It's better gtk or
qt?

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


Re: Draw over video

2005-12-28 Thread Guyon Morée
hi, i used pygame to display video and draw over it.

check out:
http://gumuz.looze.net/wordpress/index.php/archives/2005/06/06/python-webcam-fun-motion-detection/

cheers,
http://gumuz.looze.net

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


Re: How to get started in GUI Programming?

2005-12-28 Thread Kay Schluehr
D H wrote:
 Kay Schluehr wrote:
  [EMAIL PROTECTED] wrote:
 
 I am trying to learn GUI programming in Python, but have to confess I
 am finding it difficult.
 
 
  Don't do it if you can prevent it.

 What kind of helpful advice is that?

  Conclusion: if you are already familiar with BASIC I would just
  continue writing BASIC apps using VisualBasic dotNet, Windows Forms as
  the underlying GUI toolktit and VisualStudio as IDE. Forget the
  coolness factor of the language. Cool people never care a lot what
  other people think. If you finally want to glue assemblys/controls
  together in Python this is still possible with IronPython or
  Python-dotNet ( which is a CPython binding to the CLR, available at
  Zope.org ).

 So you recommend VB.NET on comp.lang.python, and then later publicly
 flame me for mentioning boo a year ago, as well as spew FUD about other
 languages you don't like.  Doesn't the python community already have
 enough assholes as it is?

The tone makes the music Doug. The usual crank is obsessed with a few
random ideas and if he does not get enough attention and respect for
them and his own ideosyncratic work he is running around and breathes
fire. The therapeutical advise is usually quite simple: being a little
patient and social but I admit this is very hard for a bloated and
aggrieved ego.

I do not want to repeat my observations and alienations about some
attitudes within the Ruby community in detail. It may suffice to say
that I'm not a Hippie, that I do not consider any PL as love and
agree mostly with Bruce Eckels concluding remarks. Nevertheless I find
this new-age / postmodern crossover quite interesting and I do think
that it has certainly it's place in the programming world - no less
than the scientific attitude of e.g. Haskellians or the power
triumphalism of SUN and MS.

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread skip

Hans Robert Kern wrote:
 PyPy will not bring about the Singularity.

Hans But if it did, imagine how cool that would look on the developers
Hans resumes... :-)

+1 QOTW

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Robin Becker
Martin v. Löwis wrote:
 Robin Becker wrote:
 
yes I ahd it working and updated my freebsd and then couldn't locate the
latest version. If the svn head stuff from tigris works that'll do. On
another point I thought the whole point of sourceforge was that the
files wouldn't get removed/deleted. Does whining and begging work for
remove my old project?
 
 
 No: it's still there. The viewcvs viewcvs is at
 
 http://cvs.sourceforge.net/viewcvs.py/viewcvs/
 
 and the viewcvs CVS should be at (untested)
 :pserver:[EMAIL PROTECTED]:/cvsroot/viewcvs
 
 Regards,
 Martin
OK I'm obviously being driven mad by successful attempts to stop me using the 
project pages :( and the downloads can be removed. But anyhow if I'm cvs'ing I 
might as well use the latest from tigris.
-- 
Robin Becker

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


Re: pyfltk2 tutorial

2005-12-28 Thread Peter Hansen
Siraj Kutlusan wrote:
 I want to use pyfltk2 because of its simplicity but there seem to be no
 tutorials done for it. Could anyone give me a link to one please?

Judging by the comments on the home page, it's probably premature for 
someone who needs a tutorial to be trying to use it.  It clearly says 
it's a largely unfinished product:


Todo:
The major items left are:

 * Almost everything!


Also, if Googling for pyfltk2 tutorial doesn't produce any useful 
hits, it's almost inconceivable that one actually exists yet.

-Peter

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


Re: How do I redirect output to a file and to the console screen?

2005-12-28 Thread Martin Miller
The basic way to redirect output is to reassign a value to sys.stdout
-- something along these lines:

# redirect stdout to a disk file
import sys
saveout = sys.stdout
outfile = open('output.txt', 'w')
sys.stdout = outfile

# output stuff
print 'hello world'

# restore stdout
outfile.flush()
outfile.close()
sys.stdout = saveout:

Essentially what you want is to have output redirected to *two*
different streams at the same time, the original stdout and a file.
Here's a link to a (very old) post on the subject that should help (see
'class Tee') if coupled with the above:

 http://groups.google.com/group/comp.lang.python/msg/5ab52448c1cbc10e

-Martin

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


Cannot build Python 2.4.2 for Cygwin

2005-12-28 Thread Micheal . LeVine
I have not succeeded to build Python 2.4.2 from the source distn for
Cygwin on XP (cygwin1.dll version 1005.7.0.0, Cygwin POSIX Emulation
DLL).

I have applied the bandaid solution in README,

./configure --with-threads=no

and edited the resulting Modules/Setup file for SSL.

The make process always terminates with the following error message:

Creating library file: libpython2.4.dll.a
Python/pystate.o(.text+0x344): In function `PyThreadState_New':
/cygdrive/c/WINDOWS/Temp/Python-2.4.2/Python/pystate.c:191: undefined
reference to `__PyGILState_NoteThreadState'
Modules/posixmodule.o(.text+0x131b): In function `posix_fdatasync':
/cygdrive/c/WINDOWS/Temp/Python-2.4.2/Modules/posixmodule.c:541:
undefined reference to `_fdatasync'
collect2: ld returned 1 exit status
make: *** [libpython2.4.dll.a] Error 1

Does anyone have an idea what is wrong?

Micheal

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


How to handle HTTP redirect using SOAPpy

2005-12-28 Thread Sameer Deshpande
Hi,

I am using python SOAPpy module to call a web service. Call to web
service gets executed successfully. I am facing a problem if the call
to WS results into redirect. I get HTTPError: HTTPError 302 Moved
Temporarily

If I enable the debug info, I do get the new redirected url. How do I
divert my WS request to new url?

Here is my code

import SOAPpy
reqUrl = http://localhost:8099/VS/SR/wp?wsdl;
srv = SOAPpy.WSDL.Proxy(reqUrl)
srv.soapproxy.config.dumpHeadersIn = 1
srv.logIn(userID = myusr, password = mypwd)

 srv.logIn(userID = myusr, password = mypwd)
*** Incoming HTTP headers
**
HTTP/1.? 302 Moved Temporarily
Date: Wed, 28 Dec 2005 14:06:25 GMT
Server: Jetty/5.1.4 (Windows 2000/5.0 x86 java/1.4.2_08
Content-Type: text/xml;charset=ISO-8859-1
Location: http://localhost:8080/VS/SR/wp?method=null
Connection: close

Traceback (most recent call last):
  File interactive input, line 1, in ?
  File C:\PYTHON23\lib\site-packages\SOAPpy\Client.py, line 470, in
__call__
return self.__r_call(*args, **kw)
  File C:\PYTHON23\lib\site-packages\SOAPpy\Client.py, line 492, in
__r_call
self.__hd, self.__ma)
  File C:\PYTHON23\lib\site-packages\SOAPpy\Client.py, line 363, in
__call
config = self.config)
  File C:\PYTHON23\lib\site-packages\SOAPpy\Client.py, line 263, in
call
raise HTTPError(code, msg)
HTTPError: HTTPError 302 Moved Temporarily

How do I divert all my requests to new url.

Thanks

Sameer

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


Simple question on Parameters...

2005-12-28 Thread KraftDiner
I have defined a method as follows:

def renderABezierPath(self, path, closePath=True, r=1.0, g=1.0, b=1.0,
a=1.0, fr=0.0, fg=0.0, fb=0.0, fa=.25):

Now wouldn't it be simpler if it was:

def renderABezierPath(self, path, closePath=True, outlineColor,
fillColor):

But how do you set default vaules for outlineColor and fillColors?
Like should these be simple lists or should they be structures or
classes...

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


Re: Simple question on Parameters...

2005-12-28 Thread Jean-Paul Calderone
On 28 Dec 2005 12:37:32 -0800, KraftDiner [EMAIL PROTECTED] wrote:
I have defined a method as follows:

def renderABezierPath(self, path, closePath=True, r=1.0, g=1.0, b=1.0,
a=1.0, fr=0.0, fg=0.0, fb=0.0, fa=.25):

Now wouldn't it be simpler if it was:

def renderABezierPath(self, path, closePath=True, outlineColor,
fillColor):

But how do you set default vaules for outlineColor and fillColors?
Like should these be simple lists or should they be structures or
classes...

  def renderABezierPath(self, path, closePath=True,
outlineColor=(1, 1, 1),
fillColor=(0, 0, 0.25)):
  ...

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


Re: Simple question on Parameters...

2005-12-28 Thread Lawrence Oluyede
Il 2005-12-28, KraftDiner [EMAIL PROTECTED] ha scritto:
 I have defined a method as follows:

 def renderABezierPath(self, path, closePath=True, r=1.0, g=1.0, b=1.0,
 a=1.0, fr=0.0, fg=0.0, fb=0.0, fa=.25):

 Now wouldn't it be simpler if it was:

 def renderABezierPath(self, path, closePath=True, outlineColor,
 fillColor):

 But how do you set default vaules for outlineColor and fillColors?

You can make renderABezierPath like this:

def renderABezierPath(self, path, closePath=True,
outlineColor=(1.0, 1.0, 1.0, 1.0), fillColor=(0.0, 0.0, 0.0, 0.25)):

and in the body you unpack the tuples


-- 
Lawrence - http://www.oluyede.org/blog
Anyone can freely use whatever he wants but the light at the end
of the tunnel for most of his problems is Python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python coding contest

2005-12-28 Thread Claudio Grondi
Simon Hengel wrote:
 Hello,
 we are hosting a python coding contest an we even managed to provide a
 price for the winner...
 
 http://pycontest.net/
 
 The contest is coincidentally held during the 22c3 and we will be
 present there.
 
 https://events.ccc.de/congress/2005/wiki/Python_coding_contest
 
 Please send me comments, suggestions and ideas.
 
 Have fun,
 

A funny thing happened to me.

   The http://www.pycontest.net/ site was down for some minutes because :

   A problem occurred in a Python script. 

it seems, that

   'some clever cheat'

has crashed it.

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


Re: PyHtmlGUI Project is looking for developers

2005-12-28 Thread John J. Lee
[EMAIL PROTECTED] writes:

 the PyHtmlGUI Project (http://www.sourceforge.net/projects/pyhtmlgui)
 is looking for developers that want to join.
 
 The aim of the project is to create a web application framework. The
 API of PyHtmlGUI wants to be close to Trolltechs famous Qt API but
 incooperates the idea of a text based renderengine instead of the pixel
 based one. The obviouse target is html/css but through xml rendering
 process nearly every textual output could be generated.
 
 So far we finished a proof-of-concept prototype that is available via
 CVS from sourceforge. Now we would like to extend this prototype to a
[...]

This is great news.

I hope you manage to keep it pragmatic enough that people can always
be confident of getting their work done, but without losing the
benefits of abstraction.

I wonder how you're dealing with client-side code (ie. JavaScript)?
Have you looked at crackajax or PyPy?


John

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


Re: deal or no deal

2005-12-28 Thread Duncan Smith
Chip Turner wrote:
 On 2005-12-26 15:05:21 -0500, [EMAIL PROTECTED] said:
 
 I believe not; the Monty Hall problem is biased by the fact that the
 presenter knows where the prize is, and eliminates one box accordingly.
  Where boxes are eliminated at random, it's impossible for any given
 box to have a higher probability of containing any given amount of
 money than another.  And for the contestants box to be worth more or
 less than the mean, it must have a higher probability of containing a
 certain amount.
 
 
 Agreed -- unless the presenter takes away a case based on knowledge he
 has about the contents, then Monty Hall doesn't enter into it.  Deal or
 No Deal seems to be a purely chance based game.  However, that doesn't
 mean there aren't strategies beyond strictly expecting the average payout.
 
 Like another member of the group, I've seen them offer more than the
 average on the UK version, which puzzled me quite a lot.
 
 
 I imagine it is about risks.  Many gameshows take out insurance policies
 against the larger payoffs to protect the show and network from big
 winners.  I believe Who Wants to be a Millionaire actually had some
 difficulty with their insurance when they were paying out too often, or
 something.  Perhaps the UK Deal or No Deal didn't want to risk
 increasing their premium :)
 
 But even the contestant has a reason to not just play the average,
 thereby bringing psychology into the game.  It comes down to the odd
 phenomenon that the value of money isn't linear to the amount of money
 in question.  If you're playing the game, and only two briefcases are
 left -- 1,000,000 and 0.01, and the house offers you 400,000... take
 it!  On average you'll win around 500,000, but half the time, you'll get
 a penny.  Averages break down when you try to apply them to a single
 instance.  On the flip side, if you think about how much difference
 500,000 will make in your life vs, say, 750,000, then taking a risk to
 get 750,000 is probably worth it; sure, you might lose 250,000 but on
 top of 500,000, the impact of the loss you would suffer is significantly
 lessened.  In the end, it comes down to what the money on the table
 means to *you* and how willing you are to lose the guaranteed amount to
 take risks.
 
 It's similar to the old game of coin flipping to double your money.  Put
 a dollar on the table.  Flip a coin.  Heads, you double your bet, tails
 you lose it all.  You can stop any time you want.  The expected outcome
 is infinite money (1 * 1/2 + 2 * 1/4 + 4 * 1/8 ...), but a human playing
 it would do well to stop before the inevitable tails comes along, even
 though mathematically the house pays out an expected infinite number of
 dollars over time.  Exponential growth in winnings doesn't offset
 exponential risk in taking a loss because, once you hit a certain point,
 the money on the table is worth more than the 50% chance of having twice
 as much.
 
 Chip
 

As you say, it depends on the player's utility function.  But it's not a
straightforward question of comparing the offer to the expected values
of the remaining boxes, even for a risk-neutral player.  At most stages
of the game refusing an offer means that there will be a future offer,
and, later in the game, these tend to be closer to (or even greater
than) the expected value.

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


Re: Simple question on Parameters...

2005-12-28 Thread Will McGugan
KraftDiner wrote:
 I have defined a method as follows:
 
 def renderABezierPath(self, path, closePath=True, r=1.0, g=1.0, b=1.0,
 a=1.0, fr=0.0, fg=0.0, fb=0.0, fa=.25):
 
 Now wouldn't it be simpler if it was:
 
 def renderABezierPath(self, path, closePath=True, outlineColor,
 fillColor):
 
 But how do you set default vaules for outlineColor and fillColors?
 Like should these be simple lists or should they be structures or
 classes...

You could define a class for the r, g, b, a values, or just use tuples 
thusly..

def renderABezierPath(self, path, closePath=True, outlineColor=(1.0, 
1.0, 1.0, 1.0), fillColor=(0.0, 0.0, 0.0, 0.25)):

It all depends on what you find the most elegant solution. Im guessing 
you will use color values a lot, so I would recommend writing a simple 
class. Its also more natural to refer to the components of the color by 
name, rather than an index to the tuple.


Will McGugan
-- 
http://www.willmcgugan.com
.join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in 
jvyy*jvyyzpthtna^pbz)
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: OSCON 2006 Call for Proposals

2005-12-28 Thread Kevin Altis
OSCON 2006: Opening Innovation
http://conferences.oreillynet.com/os2006/

Save the date for the 8th annual O'Reilly Open Source Convention, happening
July 24-28, 2006 at the Oregon Convention Center in beautiful Portland,
Oregon.



Call For Participation
--

Submit a proposal-fill out the form at:

http://conferences.oreillynet.com/cs/os2006/create/e_sess/

Important Dates:

* Proposals Due: Midnight (PST) February 13, 2006
* Speaker Notification: March 27, 2006
* Tutorial Presentation Files Due: June 12, 2006
* Session Presentation Files Due: June 26, 2006
* Conference: July 24-28, 2006

Proposals
-

We are considering proposals for 45 minute sessions and 3 hour tutorials.
We rarely accept 90 minute proposals, as most general sessions are 45
minutes in length.  Your proposals are examined by a committee which draws
from them and which also solicits proposals to build the program.  Proposals
are due by midnight (PST), Feb. 13, 2006.  The OSCON Speaker Manager, Vee
McMillen, emails notification of the status of your talk (accepted or
otherwise) by March 27, 2006.  Unless the content of your talk is
particularly timely (e.g., features of a product that will be launched at
OSCON), you are required to send us your slides several weeks before the
conference begins. Submit proposals via the form below.

Some tips for writing a good proposal for a good talk:

* Keep it free of marketing: talk about open source software, but not about
a commercial product--the audience should be able to use and improve the
things you talk about without paying money
* Keep the audience in mind: they're technical, professional, and already
pretty smart.
* Clearly identify the level of the talk: is it for beginners to the topic,
or for gurus?  What knowledge should people have when they come to the talk?
* Give it a simple and straightforward title: fancy and clever titles make
it harder for people (committee and attendees) to figure out what you're
really talking about
* Limit the scope of the talk: in 45 minutes, you won't be able to cover
Everything about Widget Framework X.  Instead, pick a useful aspect, or a
particular technique, or walk through a simple program.
* Pages of code are unreadable: mere mortals can deal with code a line at a
time.  Sometimes three lines at a time.  A page of code can't be read when
it's projected, and can't be comprehended by the audience.
* Explain why people will want to attend: is the framework gaining traction?
Is the app critical to modern systems?  Will they learn how to deploy it,
program it, or just what it is?
* Let us know in your proposal notes whether you can give all the talks you
submitted proposals for
* Explain what you will cover in the talk

NOTE: All presenters whose talks are accepted (excluding Lightning Talks)
will receive free registration at the conference. For each half-day
tutorial, the presenter receives one night's accommodation, a limited travel
allowance, and an honorarium. We give tutors and speakers registration to
the convention (including tutorials), and tutors are eligible for a travel
allowance: up to US$300 from the west coast of the USA, up to US$500 from
the east coast of the USA, up to US$800 from outside the USA.

Registration opens April, 2006. If you would like to be notified by email
when registration opens, please use the form on our main page.



CONFERENCE INFO
===

The O'Reilly Open Source Convention is where coders, sysadmins,
entrepreneurs, and business people working in free and open source software
gather to share ideas, discover code, and find solutions. At OSCON 2005,
more than 2,400 attendees took part in 241 sessions and tutorials across
eleven technology tracks, learning about the newest features and versions
from creators and experts. A record number of products launches and
announcements were made, and sponsors and exhibitors from a wide range of
companies filled the largest exhibit hall in OSCON's history. We anticipate
that OSCON 2006 will be even more successful, and continue to be the place
for the open source community to meet up, debate, make deals, and connect
face to face. OSCON 2006 will take place at the Oregon Convention Center in
Portland, Oregon July 24-28, 2006.

OSCON 2006 will feature the projects, technologies, and skills that you need
to write and deploy killer modern apps.  We're looking for proposals on
platforms and applications around:

* Multimedia including voice (VoIP) and video
* AI including spam-busting, classification, clustering, and data mining
* Collaboration including email, calendars, RSS, OPML, mashups, IM,
presence, and session initialization
* Project best practices including governance, starting a project, and
managing communities
* Microsoft Windows-based open source projects including .NET, Mono, and
regular C/C++/Visual Basic Windows apps
* Enterprise Java techniques including integration, testing, and scalable
deployment solutions
* Linux kernel skills for 

Re: Cannot build Python 2.4.2 for Cygwin

2005-12-28 Thread Jason Tishler
Micheal,

On Wed, Dec 28, 2005 at 11:02:55AM -0800, Micheal LeVine wrote:
 I have not succeeded to build Python 2.4.2 from the source distn for
 Cygwin on XP (cygwin1.dll version 1005.7.0.0, Cygwin POSIX Emulation
 DLL).

The above is a very old version of Cygwin:

http://www.cygwin.com/ml/cygwin-announce/2004-01/msg00020.html

 [snip]
 
 Does anyone have an idea what is wrong?

Yes, upgrading to the latest Cygwin should fix your build problem.

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python coding contest

2005-12-28 Thread Simon Hengel
 the dream of winning the contest seems to be over.

Sorry for that, I'm considering doing a ranking on the nicest cheats too.

Have fun,

Simon Hengel

-- 
python coding contest - http://www.pycontest.net/

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


Re: Beautiful Python

2005-12-28 Thread John J. Lee
[EMAIL PROTECTED] writes:
[...]
  Sometimes putting import statements at the beginning is not feasible
  (i.e. only when some condition has been met), as importing has some
  impact on program execution (importing executes code in imported
  module). This does not resemble Java imports (I don't know Perl).
  
  -- 
 Wow ?!   I've only started looking at python but that sounds like very
 dangerous programming !  Can you give an example.

Leaving aside that the first import of a Python module *always*
executes code -- even if that code be something like a 'def' statement
(I assume that's NOT what worried you), you're certainly correct that
anything anywhere near this sort of thing is harmful:

#---8-
# this is file mymodule.py

def good():
print m

evil = good
evil()  # because importing shouldn't have side-effects
#---8-


Though you may perfectly well do this:

#---8-
# this is file mymodule2.py

try:
from goodstuff import good
except ImportError:
def good():
print m
#---8-

(and of course, if statements are just as acceptable in that example
as try/except -- though try/except is often handier than if/else in
this sort of case)


Or this, using the standard idiom to have a module work also as a
script:

#---8-
# this is file mymodule3.py

def good():
print m

if __name__ == __main__:
# only executed if we're running as a script
good()
#---8-


Just in passing, this is the standard idiom when you want to change
some global setting:

#---8-
# this is file weird.py

def enable_weird_shit():
...
#---8-

One then does:

import weird; weird.enable_weird_shit()


This last style is used, eg. by things like module cgitb (replaces the
standard global traceback handler with a different one) and PTL
(introduces a global import hook of some kind for .ptl template
files).


 BTW this topic relates to a recent point raised by the C man's
 [I think Richie, dated ca. 1973] crit of Pascal. He said that
 Pascal's restriction of not being able to declare globals, near
 where they were needed, was bad.  And I thought so too, before I
 considered that the programmer must KNOW that they are global.
 Ie. the ability to declare them at a 'nice' place is just syntactic
 sugar, hiding the reality the globals are bad, and have to be avoided
 and respected.

Maybe so (though not sure I understand exactly what you're saying),
but not relevant to the question at hand, so far as I can see: Python
import statements inside a function or class scope do NOT contaminate
the global namespace.  sys.modules (which is global state) may grow a
new key/value pair, but that's a different thing, and non-harmful.

One good thing about local imports is that you can keep a function or
class self-contained, so it can easily be moved to another module
without import changes.

A bad thing is that it becomes less easy to see at a glance what a
module's dependencies are (but a quick search for the string 'import'
is all that's needed there).

I always used to stick to the 'imports at the top' style.  Having been
introduced to the other way of doing it at work, I still don't have an
opinion on whether it's just a matter of mix-n-match (applying good
taste and experience to pick which style to use for each import
statement) or whether it's best to stick rigidly to one style or the
other.  So I just try to stick to the When in Rome principle, and
follow local conventions, unless it seems stupid to do so.


John

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


Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2005-12-28 Thread John J. Lee
Harald Armin  Massa [EMAIL PROTECTED] writes:
[...]
 Allow me to quote Greg Stein:
 Ha! Guido would quit in a heartbeat if you tried to make him manage
 people. That just isn't where he's at. He's absolutely brilliant and
 loves to write excellent code. Great. We're gonna let him do just that
 :-)
[...]

Guido may or may not realise it, but he seems to have been managing
people (in some sense of 'managing', anyway) quite successfully over
the past decade or so.


John

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


Re: any Adobe Reader like apps written in python, for examination?

2005-12-28 Thread John J. Lee
Alex Gittens [EMAIL PROTECTED] writes:

 Yeah, pygame is not what I'm looking for. I'm looking for a good
 example of cross platform non-trivial page-layout and font handling.
 The project I'm working on-- a typographically correct interface to a
 CAS-- requires pixel-perfect font handling.
 
  I'll definitely look into Grail: I'm sure as a browser it has to
 address these problems. But I'm open to further suggestions.
[...]

Grail was a research project -- not sure pixel-perfect is something
you'd *expect* to find there, but maybe you'll be lucky.

Sketch, OTOH, is certainly worth a look.  It's a vector graphics app.
IIRC it does handle bitmaps.


John

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


Re: viewcvs 1.0 dev

2005-12-28 Thread Martin v. Löwis
Robin Becker wrote:
 OK I'm obviously being driven mad by successful attempts to stop me
 using the project pages :( and the downloads can be removed. But anyhow
 if I'm cvs'ing I might as well use the latest from tigris.

I can sympathize with the viewcvs people wanting to hide the CVS;
if they didn't, people would use it forever, and just wonder why it is
so outdated. I had the same feelings when moving the Python CVS off SF.

I can also sympathize with SF not wanting to let people completely
remove the code, because of open source principles. So this status
is a good compromise, IMO.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple question on Parameters...

2005-12-28 Thread KraftDiner
I guess its all good...
I just am not crazy about using fillColor[0]  id rather use fillColor.r
So is that a structure I need to define or a class...
I'm kind of new to python what would that class or structure look like?
and then do the default parameters still work?

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


  1   2   >