ANN: JpyDbg V0.0.13

2005-10-01 Thread Jean-Yves Mengant
JpyDbg is a Python/Jython IDE/Debugging environnement pluggin for
JEdit editor.(http://www.jedit.org)

Version 0.0.13 of JpyDbg has been released.

Check the Home page : http://jpydbg.sourceforge.net for details
  blog page : http://jpydbg.blogspot.com/

What's new in V0.013 :

+ IMPROVEMENT:  Pylint GUI interface is now available.
+ IMPROVEMENT :  Tiny fixes around PYTHONPATH and some unix machine.

Next planified features to come :

- profiling  
- Netbeans IDE plugin module.(More on blog page for this topic)
 
Cheers
Jean-Yves


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

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


ZRS Now Available for FREE 30-day Evaluation

2005-10-01 Thread Brian Lloyd

Hi all,

We are happy to announce that Zope Corporation is now 
offering Zope Replication Services (ZRS) in a 30-day 
evaluation format!

For more information and to download the evaluation 
release, visit:

http://customers.zope.com/ZRS/


About ZRS:

Zope Replication Services (ZRS) increases the reliability 
of all Zope enterprise clusters and eliminates the storage 
system as a single point of failure. 

Sites with high availability requirements must manage 
planned and unplanned downtimes. Planned outages include 
system maintenance, software / operating system upgrades, 
and backups. Unplanned outages include hardware and network
failures. ZRS reduces the downtime associated with these 
events by replicating and distributing mission-critical 
data storage across distinct physical storages (possibly 
in distinct geographic locations).

Should a primary storage fail, a secondary storage can 
take its place. Secondary servers can be taken off-line 
at any time to undergo repairs, backups, or system 
upgrades. When a secondary returns to service, it 
automatically resynchronizes with the primary server. 

ZRS also improves scalability since secondary servers can 
optionally provide additional read-only ZEO connections 
while maintaining their replication functions. ZEO client 
storages can be configured to connect to any available 
secondary, and can be load-balanced among the available 
secondary ZRS servers to implement highly-available and 
highly-scalable Zope clusters. 

ZRS is a 'battle-tested' solution that has provided the 
high-availability and disaster recovery solution critical 
to large-scale public and internal Zope deployments for 
years. Premier brands including the VIACOM radio and 
television group, AARP, Community Newspaper Holdings 
Inc. (CNHI), and the Joint Intelligence Center, Pacific 
(JICPAC) rely on ZRS to ensure reliability and scalability 
for their mission-critical Web sites. 

The 30-day evaluation release allows organizations to 
install and operate ZRS on up to five primary ZODB servers 
and on an unlimited number of secondary servers for up to 
thirty days.

The current evaluation release (ZRS 1.4.2) is compatible 
with Zope versions 2.4 - 2.7. Full releases of ZRS
compatible with Zope 2.8.x and Zope 3.x are also available.


Brian Lloyd[EMAIL PROTECTED]
V.P. Engineering   540.361.1716  
Zope Corporation   http://www.zope.com 

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

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Ron Adam wrote:

 It will be
 
 A if B else (C if D else F)
 
 So this evaluates as if there are parentheses around each section.. Hmm?
 
(A) if (B) else ( (C) if (D) else (F) )
 
 The first 'if' divided the expr, then each succeeding 'if' divides the 
 sub expressions, etc...  ?
 
 So ...
 
A if B else C + X * Y
 
 Would evaluate as... ?
 
A if B else (C + X * Y)
 
 
 and...
 
 value = X * Y + A if B else C
 
 would be ?
 
 value = (X * Y + A) if B else C
 
 or ?
 
 value = X * Y + (A if B else C)
 
 
 
 I think I'm going to make it a habit to put parentheses around these 
 things just as if they were required.

Yes, that's the best way to make it readable and understandable.

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Erik Max Francis wrote:
 Dave Benjamin wrote:
 
 Hooray! After years of arguing over which syntax to use, and finally 
 giving up since nobody could agree, the Benevolent Dictator did what 
 only a dictator can do, and just made a damn decision already.
 
 Thank you, Guido! =)
 
 Yes, hear hear.
 
 So what made him change his mind?  When the debates raged over PEP 308, 
 he seemed pretty dead set against it (at least by proxy) ...

Raymond Hettinger proposed to change the behavior of and/or to return one
of their arguments because he had been bitten by the common trap of
C and X or Y when X is False.

People were positive about it, but said that then a conditional would have
to be introduced. So Guido considered it again. He says himself that the
greatest problem last time was that no consensus over syntax was reached,
and he solved the problem this time by deciding himself.

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Reinhold Birkenfeld
Sam wrote:
 Jaime Wyant writes:
 
 On 9/30/05, Sam [EMAIL PROTECTED] wrote:
 Reinhold Birkenfeld writes:

  Hi,
 
  after Guido's pronouncement yesterday, in one of the next versions of 
  Python
  there will be a conditional expression with the following syntax:
 
  X if C else Y
 
  which is the same as today's
 
  (Y, X)[bool(C)]

 What's wrong with C ? X:Y?

 Aside from : being overloaded?

 
 First thing that comes to my mind is that it is more C-ish (read
 cryptic) than pythonic (read elegant and understandable).
 
 And foo if bar is Perl-ish; yet, even Perl has the ? : operators.

Perl's foo if bar is very different to this one, you should know about this.

For a conditional, syntax must be found, and the tradition of Python
design is not to use punctuation for something that can be solved with
keywords.

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Paul Rubin
Reinhold Birkenfeld [EMAIL PROTECTED] writes:
 For a conditional, syntax must be found, and the tradition of Python
 design is not to use punctuation for something that can be solved with
 keywords.

Yeah, if C then A else B is a ancient tradition stretching from
Algol-60 to OCAML, and who knows what all else in between.  I'm not
sure what Guido saw in the A if C else B syntax but it's not a big deal.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Leif K-Brooks
Sam wrote:
 And foo if bar is Perl-ish; yet, even Perl has the ? : operators.

What _isn't_ Perl-ish?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what does 0 mean in MyApp(0)

2005-10-01 Thread vincent wehren
Alex [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
| Thanks for the replies. It seems that I have three options
| 1. app=MyApp()
| 2. app=MyApp(0)
| 3. app=MyApp('myfile.txt')
|
| 1. In the first case the output stream will be set to stdout/stderr,
| which means that errors will be sent to a window which will be closed
| when the app crashes.
| 2. In the second case the output will be set to the command prompt
| window, which means that I will be able to catch the errors when my app
| crashes.
| 3. There is also a third alternative which is to set the output to  a
| file.
|
| Alterbnative 2 is simple and useful, so that's why everybody use that
| alternative.
|
| Is that correct?

Not entirely:

1. app=MyApp(): stdout/stderr is redirected to its own window, so you're
right here
2. app=MyApp(0): stdout/stderr is not redirected to a window.
Tracebacks will show up at  the console. So you're right here to...

But:
3(a). app=MyApp(1, 'some/file/name.txt'):
   stdout/stderr is redirected to to the file 'some/file/name.txt').

The arguments you pass to MyApp are named parameters, so for improved
readability you may want to use:

3(b). app=MyApp(redirect=1, filename='some/file/name'): will redirect stdout
  to 'filespec'

and instead of 2:

2(b). app=MyApp(redirect=0) # stdout/stderr will stay at the console...

Anyway, if you omit the parameter names, make sure you you position them 
correctly, i.e., a filename should only be positioned as /second/ argument.

HTH,
--

Vincent Wehren



| Alex
| 


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


Re: Will python never intend to support private, protected and public?

2005-10-01 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes:
 Unless your compiler detects and flags passing private variables to
 external functions all you've got is a convention that you don't pass
 private variables to external functions.

Yes, the point is that it's something that you can check for by
examining the class in question without having to examine any other
classes.

 Are you going to try and tell me thas using builtin functions on
 private variables is something you don't allow in your projects?

You have to treat builtin functions as part of the language.  Of
course Python has this situation where someone could rebind the name
len to some other function, so you have to deal with that too, maybe
just at the file scope.  An OOP approach (lst.len() instead of
len(lst)) that binds the builtin names to datatypes might be
preferable in some situations but I'll leave that one for the
theorists.

 Of course, there's nothing wrong with catching errors earlier. Might I
 suggest that you file a change request for pylint (or your favorite
 error checker) asking that it start issuing warnings for
 object._variable?

I don't see how pylint could know which instances to flag, without
doing type inference on all the objects to know that the variable
belonged to an instance of some other class.
-- 
http://mail.python.org/mailman/listinfo/python-list


Not defined

2005-10-01 Thread Rob
When trying the basic tutorial for cgkit I always seem to get a not defined 
error as follows.

Pythonwin GUI

 from cgkit import *
 Sphere()
Traceback (most recent call last):
  File interactive input, line 1, in ?
NameError: name 'Sphere' is not defined
 b=Box(name=Cube, pos=(1.5,2,0))
Traceback (most recent call last):
  File interactive input, line 1, in ?
NameError: name 'Box' is not defined


I am useing  ver 2.4

A little help would be most appreciated.

Forgive me please if this is not the proper place for this ?  I am trying to 
keep an active brain :)

Regards Gramps



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


Re: A Moronicity of Guido van Rossum

2005-10-01 Thread Gerrit Holl
Tony Meyer wrote:
 X-Spambayes-Classification: ham; 0.008
 
 On 30/09/2005, at 10:56 PM, Gerrit Holl wrote:
  Tony Meyer wrote:
  X-Spambayes-Classification: ham; 0.048
 
 Unless I'm misreading things, that's *my* message that scored 0.048  
 (the from:addr:ihug.co.nz, from:name:tony meyer, and spambayes  
 tokens make it seem that way)...

It is, and that's very surprising, but apparantly it was not really
hammy enough. But don't worry, by ham_cutoff is 0.2, and out of the 10
'unsure' messages per week, 2 are spam, 2 are ham, and 6 are, well,
unsure. Note that with all my mailinglists, the number of messages
handled is more than 2500 per week, so I'm very, very happy with
spambayes...

Gerrit.

-- 
Temperature in Luleå, Norrbotten, Sweden:
| Current temperature   05-10-01 09:49:529.7 degrees Celsius ( 49.5F) |
-- 
Det finns inte dåligt väder, bara dåliga kläder.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-10-01 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes:
 A cautionary tale of what happens when religious wars enter programming
 debates. For all I know, Paul Rubin is intelligent, gentle, kind to
 animals and small children, generous, charitable and modest.

Don't bet on it.

 But touch his religious belief in the necessity of truly private
 variables, and boy oh boy does he lose the plot.

I haven't claimed necessity (except in some specific types of
applications).  I've said it's a useful feature in a certain type of
development process.  So I think you're the one losing the plot and
acting like a religious whacko.  If there's a feature you don't want
to use, nobody is making you use it.  You're going off the deep end
saying nobody else should be allowed to use it either.

 Paul misses the point: in a language like Python that allows the dynamic
 modification of public methods (as well as private ones) you can't be
 sure with absolute 100% mathematical certainty that your public interface
 is the same at runtime as it was when you did your last code audit.

Obviously any privacy-enforcement mechanism has to cope with that.
Think of the situation with Bastion, back when it existed and was
believed to sort-of work.

 If your development team uses test-driven development, you will catch this
 breakage immediately you check the code in. If you don't, you've got
 lots more bugs that you don't know about, so one more is no big deal.

Methinks you have too much faith in testing.  It only shows that your
program handles the test cases that you give it.  To show that the
program handles all the other cases, you need actual logic.

  Why on earth would you want to unnecessarily introduce random bugs
  into a word processor or anything else?  
 
 Paul puts words into my mouth: I never suggested that it was good to
 introduce bugs, unnecessarily or otherwise. What I said was that aiming
 for 100% mathematical certainty that there are no bugs in a word processor
 is pointless. No lives are at stake. The fate of nations doesn't rest on
 your ability to make sure that PyWord is 100% bug free. Relax dude, the
 world won't end if there is a bug or two in your code.

See:  http://vowe.net/archives/005838.html  
(found with about 5 seconds of Google searching).

People could very well have died over disclosures like that, whether
caused by software bugs or (as in this instance) by unlucky
interaction of intentional features.  These things happen over and over.  

If you look at the NSA's initial release of the Skipjack algorithm
spec, it was a PDF file containing a bitmap that was obviously a scan
of a fax of a document that had come out of a word processing program.
People chuckled that a mighty operation like the NSA could be so
technologically backward that they couldn't just put the word
processor file directly online.  Later they realized that maybe the
NSA was simply being careful, that the document had been prepared in a
classified environment and they didn't trust their word procssing
software to not leak classified info into the file, so they stuck to a
policy of only moving data like that around on paper and not in
computer files.

Information leakage from word processors is a serious problem.

 Of course, if Paul had been paying attention, he would have realised that
 100% certainty is not possible in general no matter what style of
 development you use. Perhaps folks have heard of the halting problem?

You don't know what you're talking about.  That is a red herring.

 You can reduce the probability of bugs by using best practices, but never
 reduce it to zero. How small do you need? Is it really shocking to suggest
 that while a one in a billion billion chance of a bug might be
 needed for a nuclear reactor, we might be satisfied with just one in a
 million for a word processor?

In some ways, word processors are harder to write safely than nuclear
reactor code.  Nuclear reactors usually run in carefully controlled
environments and the field is mature enough that you can have some
reasonable confidence that the data going into the program (e.g. from
sensors) will be similar to the data that you tested the program with.
What you're left with is Murphy's Law: something unexpected could
happen by accident and you can make some reasonable assumptions about
the distribution of inputs to make sure the probability is low.  Ross
Anderson calls this programming Murphy's computer.

A word processor, on the other hand, has to deal with malicious input,
that can be fiendishly crafted in ways that the implementer never
dreamed of.  It's the difference between worrying about being hit by a
meteor at random, and worrying about being hit by a meteor because
someone in the asteroid belt is steering them towards you on purpose.
Anderson calls this programming Satan's computer.

 Should we decide that C is not suitable for critical applications?

Yes, absolutely.  C (by which term I include C++) is unsuitable for
critical applications 

Recursive Property of Octal Numbers

2005-10-01 Thread James Stroud
I'm very curious about what is going on here. I'm sure my curiosity has 
something to do with ignorance of some fundamental concept of computer 
science (maybe that 8 is just a vertical infinity?):

py b = '\xb6'
py b[0]
'\xb6'
py b[0][0]
'\xb6'
py b[0][0][0]
'\xb6'
py b[0][0][0][0]
'\xb6'
py b[0][0][0][0][0]
'\xb6'



James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

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


Re: Recursive Property of Octal Numbers

2005-10-01 Thread PoD
On Fri, 30 Sep 2005 15:40:51 -0700, James Stroud wrote:

 I'm very curious about what is going on here. I'm sure my curiosity has 
 something to do with ignorance of some fundamental concept of computer 
 science (maybe that 8 is just a vertical infinity?):
 
 py b = '\xb6'
 py b[0]
 '\xb6'
 py b[0][0]
 '\xb6'
 py b[0][0][0]
 '\xb6'
 py b[0][0][0][0]
 '\xb6'
 py b[0][0][0][0][0]
 '\xb6'
 
 
 
 James

b is a 1 character string.
b[0] is a one character string which is the first character of b.
Therefore b[0] == b.

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


Re: Google Not Universal Panacea [was: Re: Where to find python c-sources]

2005-10-01 Thread Steve Holden
Erik Max Francis wrote:
 Steve Holden wrote:
 
 
While a snappish go and look it up on Google might suffice for a 
mouthy apprentice who's just asked their thirteenth question in the last 
half hour, it's (shall we say) a little on the brusque side for someone 
who only appears on the group last February, and has a history of asking 
reasonably pertinent though sometimes beginner-level questions.
 
 
 I told him exactly where it was.  I just also pointed out that he could 
 have trivially found out the answer on his own by using Google for 
 fifteen seconds.  It would be one thing if I (and nobody else) answered 
 his question and just rudely pointed him to Google.  But since I 
 actually answered his question, looks to me like someone just wanted to 
 stand on his soapbox today.
 
I don't think The source tarball on python.org could claim to be 
telling him exactly where it was given that my copy of the web site 
has 341 MB of stuff in it.

Just that same, if you are saying that your behaviour didn't really 
merit my response then I'd probably agree. Your post was the straw that 
broke the camel's back rather than an egregious example of bad manners. 
So I'm sorry if it looked as though the soapboxing was directed 
primarily at you, which it wasn't.

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

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


Re: Recursive Property of Octal Numbers

2005-10-01 Thread Paul Rubin
James Stroud [EMAIL PROTECTED] writes:
 I'm very curious about what is going on here. I'm sure my curiosity has 
 something to do with ignorance of some fundamental concept of computer 
 science (maybe that 8 is just a vertical infinity?):

Python doesn't have a character type.  A character is just a string of
length 1.  So 'a'[0] is the same as 'a'.  Thus 'a'[0][0][0]...[0] is
also the same as 'a'.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Google Not Universal Panacea [was: Re: Where to find python c-sources]

2005-10-01 Thread Erik Max Francis
Steve Holden wrote:

 I don't think The source tarball on python.org could claim to be 
 telling him exactly where it was given that my copy of the web site 
 has 341 MB of stuff in it.

He doesn't have to search through the whole thing, there's a link on the 
front page, so this 341 MB figure is meaningless.

I certainly understand laziness.  I don't approve of it, but I can 
understand it.  But I really don't understand _defending_ laziness.

His grasp of the English language was just fine.  He could have gotten 
the answer to his question by using Google with less time and effort 
than it took him to post to Usenet, wait for a response, and then act on 
it.  Even if he were totally lazy and selfish, he could have gotten the 
answer more easily by using Google for ten seconds.  Language was 
obviously not a barrier here, since the very words he used in asking the 
question could have been typed into a search engine to get exactly the 
answer he wanted.

There are plenty of questions that are complex enough, or require 
knowing the right terminology which might not be obvious to an 
interested amateur, such that a search engine won't be the most 
practical way to do research.  This was _certainly_ not one of those cases.

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
San Jose, CA, USA  37 20 N 121 53 W  AIM erikmaxfrancis
   No mistaking / Just reflecting what you radiate
   -- Anggun
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 308 accepted - new conditional expressions

2005-10-01 Thread John J. Lee
Michele Simionato [EMAIL PROTECTED] writes:
[...]
 Guido could have decided two years ago, sparing us the PEP 308 ordalia.
 So, I am happy that at the end we will have a conditional operator, but
 I am not happy of how the process worked out. It was just an enormous
 waste of resources that could have been employed much better :-(

Seems that's what Guido thinks too:


http://mail.python.org/pipermail/python-dev/2005-September/056561.html

| If there's one thing I've learned from the PEP 308 vote, it is that
| votes for language don't work. I prefer some discussion on Python-dev
| after which I pick one.

I think he said at the time that it was an experiment.


John

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


Nufox : Xul + Python

2005-10-01 Thread salvatore . didio
Hello,

You can test Nufox (with Firefox) at :

http://artyprog.no-ip.org

Regards

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


Re: pywordnet install problems

2005-10-01 Thread vdrab
hello Steve,

I had WordNet 2.0 installed but just now I tried it with 1.7.1 as well
and the result was the same. It's a shame, glossing over the pywordnet
page really made me want to give it a try.
Are there any workarounds you can recommend ?
I had a quick look at the wordnet.py file, and it looks readable enough
to try and fiddle around with it, but if possible I'd like to avoid
having to mess with the source file.
Is there any other person / list I can ask for help on this?

thanks a lot.
vdrab.

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


Re: Where to find python c-sources

2005-10-01 Thread Michael
John J. Lee wrote:
 Tor Erik Sønvisen [EMAIL PROTECTED] writes:
 Erik Max Francis [EMAIL PROTECTED] wrote in message
  Tor Erik S�nvisen wrote:
  I need to browse the socket-module source-code. I believe it's
  contained in the file socketmodule.c, but I can't locate this file...
  Where should I look?
  The source tarball, available on python.org.  Are people really too
  lazy to do elementary research on Google?
 Thanks for the answers... And yes, I have searched google!
...
 Does google vary in its results across the globe?

Aside from Paul Boddie's comment to the effect of yes, there is a very
important thing that people forget - *no everyone is as good at using a
search engine as others*. People are not simply as good at finding the same
information using the same tools as others.

You liken the problem to a library. If you understand how a library is laid
out, you can find the information alot quicker. If however you're looking
in a library for a book on how to create those odd things for computers
and you've been told it involves python you're as likely to end up in the
fiction section as you are zoology.

If you can't figure out the right search terms you need, google can be
useless. (That said when that happens to me, I tend to either use
kartoo.com or ask a friend)

The search terms might be obvious to you, but it simply means your google-fu
is strong, and the strong should help the weak. (or not attack them at
least...)


Michael.

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

Re: Not defined

2005-10-01 Thread Pekka Karjalainen
In article [EMAIL PROTECTED], Rob wrote:
Forgive me please if this is not the proper place for this ?  I am trying to 
keep an active brain :)

Seems proper to me :)

You can see what you've just imported by using the built-in
dir() function. Here's an example from my PyWin window:

 dir()
['__builtins__', '__doc__', '__name__', 'pywin']
 from math import *
 dir ()
['__builtins__', '__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2',
'ceil', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod',
'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'pywin',
'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh']
 

Note that the first time I use dir() it lists just four items. After from
math import * it lists all the stuff I got from the math module in
addition.

How does your dir() look after the import statement?

-- 
Pekka Henrik Karjalainen

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


Re: Not defined

2005-10-01 Thread Kent Johnson
Rob wrote:
 When trying the basic tutorial for cgkit I always seem to get a not defined 
 error as follows.
 
 Pythonwin GUI
 
 
from cgkit import *
Sphere()
 
 Traceback (most recent call last):
   File interactive input, line 1, in ?
 NameError: name 'Sphere' is not defined

Which version of cgkit are you using?

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


Re: Not defined

2005-10-01 Thread Pekka Karjalainen
I looked around a bit and found the answer. At least the change I
recommend below worked for me.

In article [EMAIL PROTECTED], Rob wrote:
When trying the basic tutorial for cgkit I always seem to get a not defined 
error as follows.

Pythonwin GUI

 from cgkit import *

This is from cgkit.all import * in the tutorial here:

http://cgkit.sourceforge.net/doc2/node6.html

It seems the tutorial you are using is out of date vis-a-vis the version
of cgkit you use.

-- 
Pekka Henrik Karjalainen

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


list.join()... re.join()...? Do they exist? (newbie questions...)

2005-10-01 Thread googleboy
Hi.

In some google posts I searched suggested that there was a list.join()
thing that I assume works like string.join [which I notice is now
deprecated in favour of S.join()]

It seems that I have been misled.

I start with a text file that I split up to run some formatting over
the various sections with re.split.  I want to join it back together
again with a | delimeter and write it out to a new file.  I looked for
a re.join, but it seems that doesn't exist.   I looked for a list.join
after reading the aforementioned posts, but it doesn't seem to exist
either.

To get it to work I did this:


List[0] = list0
List[1] = list1
List[2] = list2
List[3] = list3
cat_list = list0 + '|' + flatblurb + '|' + flatcontents + '|' + flates
+ '\n'
file.write(concat_list)


But it seems to me that there is probably something more pythonic than
having to go about it in such a laborious fashion

Would someone be so kind as to fill me in?

TIA!

googleboy

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


Re: list.join()... re.join()...? Do they exist? (newbie questions...)

2005-10-01 Thread Benji York
googleboy wrote:
 To get it to work I did this:
 
 
 List[0] = list0
 List[1] = list1
 List[2] = list2
 List[3] = list3
 cat_list = list0 + '|' + flatblurb + '|' + flatcontents + '|' + flates
 + '\n'
 file.write(concat_list)
 
 But it seems to me that there is probably something more pythonic than
 having to go about it in such a laborious fashion

Indeed. :)

cat_list = '|'.join(List)
--
Benji York


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


Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-01 Thread Bart Lateur
Steven D'Aprano wrote:

A skeptical policeman who says he doesn't actually believe the moon
affects behaviour nevertheless reports that last weekend things were
really crazy, and it was a full moon. Somebody writes in to correct him:
no, the full moon is actually tomorrow.

As a similar example: I've been told by various women independently,
that there are more babies born near a full moon.

So... is there a correlation between insanity and babies being born?  :)

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


Re: Python 3! Finally!

2005-10-01 Thread Duncan Booth
Stefan Behnel wrote:

 Hi!
 
 I just firefoxed to Python.org and clicked on the bz2 link at
 http://python.org/2.4.2/ and what did I get?
 
 Python-3.4.2.tar.bz2 !!
 
 Python 3 - what we've all been waiting for, finally, it's there!
 
 Weird, though, the md5sum is the same as for the Python-2.4.2.tar.bz2
 that I downloaded late (late!) yesterday evening and had forgotten in
 my download directory... just found it next to the new one... was
 still there, not overwritten...
 
 Well, maybe the changes needed to merit a V3 weren't that big after
 all... 
 
Did you download the file using Firefox? It seems to have a 'feature' that 
when you download a file and there is already a file of the same name it 
finds the first number in the filename and increments it.

e.g. I just downloaded TortoiseSVN-1.2.4.4479-svn-1.2.3.msi and then 
immediately re-downloaded it and got TortoiseSVN-2.2.4.4479-svn-1.2.3.msi

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


Re: A Moronicity of Guido van Rossum

2005-10-01 Thread Xah Lee
the programers in the industry, including bigwigs such as Guido or that
Larry Wall fuckhead, really don't know shit about computer languages.
Sometimes i get pissed by Stephen Wolfram's megalomaniac cries, but in
many ways, i think his statements about the fucking moronicities of the
academicians and otherwise dignitaries are justified.

here i will try to illuminate some miscellaneous things regarding the
lambda in Python issue.

as i have hinted
( http://xahlee.org/perl-python/list_comprehension.html ), the
so-called List Comprehension is just a irregular syntax to facilitate
generating lists. The name is a terrible jargon, and the means is also
quite fucked up. The proper name should be something like
ListGenerator, and the proper means should be the plain function.

For instance, Python's range() is such a list generator, only that it
is limited in scope.

For a example of a powerful list generator, see Mathematica's Table
function:
http://documents.wolfram.com/mathematica/functions/Table

i'm running a project that will code Table in Perl and Python and Java.
You can read about the spec and source code here:
http://xahlee.org/tree/Table.html
(note: the Python version there isn't complete)

Note Table's power in generating not just flat lists, but trees. And if
one really want flat lists, there's the Flatten function that flats any
nested lists. (Python should have this too)

Python's reduce() is Mathematica's Fold. See
http://documents.wolfram.com/mathematica/functions/Fold
Besides Fold, there's FoldList, FixedPoint, FixedPointList, Nest,
NestList and others. In Python's terms, FoldList is like reduce()
except it returns a list of each steps. FixedPoint recursively applies
a function to itself until the result no longer changes (or when a
optional function returns true) Nest is similar except it limits the
iteration by a number. The NestList and FixedPointList are similar
except that they return a list, containing all the steps.

All these can be written as a loop, but they make the code condensed
and meaning clear. More so, they are important when programing in a
functional style. In functional programing, you don't litter lots of
variables or temporary functions or intermediate loops here or there on
every other line. The code is usually tight and inline. When sequencing
a series of functions, you can't stop in the middle and do some loop or
auxiliary calculation. All these are made inline into a function. (that
is: constructed as lambda) A block of code usually corresponds to a
unit of the algorithm used, as opposed to the particular unit of the
implementation of the algorithm. You don't read the minute details of
the code. You read the algorithmic unit's comments, or just the input
and output of a code block.

Also, these inline loop constructs are not just for computing numbers
as Guido likes to ignorantly think. They are specialized forms of
generic loop constructs. Their first argument is a function, and second
argument is a list. Their generality lies with the fact that their
first argument is a function. If a language does not provide a
convenient way to represent the concept of a function, than these
functional loop constructs will suffer in usability.

The Python morons, did not provide a convenient way to represent a
function. (they tried, with their limited implementation of lambda and
shun it like a plaque)

The way Guido puts it gives us a nice glimpse of their retarded
mentality: “Also, once map(), filter() and reduce() are gone, there
aren't a whole lot of places where you really need to write very short
local functions;”

As we can see here, in Pythoner's mind, lambda is for “very short
local functions”.

Python's limited lambda coupled with their lambda attitude problem
among imperative morons, therefore functional programing suffers in
Python, and consequently one becomes so stupid as to come up with a
bunch of feelings about lambda, map, reduce, filter.

For Python's map(), look at Mathematica's Map on how it might be
extended.
http://documents.wolfram.com/mathematica/functions/Map
Note the ability to map to not just flat lists but trees (nested
lists). Note the power of expressing the concept of levels of a tree.

For Python's filter(), check out the equivalent in Mathematica's
Select:
http://documents.wolfram.com/mathematica/functions/Select
Note how it provides a third option for picking just the first n items.
Also note, that Select is just a way to pick elements in a list.
Mathematica provides a set to do these: Part, Take, Drop, Select,
Cases. All uniformly uses the function syntax and all operate
semantically by returning a new list. In Python and other imperative
clown's language, usually they provide a limited varieties to do such a
task, and also inconsistent like piled on. (e.g. alist[5:9], filter(),
alist.remove(...), del alist[...]). Some modify the list in-place, some
returns a new list.

-

one is quite sorry to read a big shot contemplating on 

Re: Help with syntax warnings

2005-10-01 Thread Ivan Shevanski
Well I've been experimenting with the warning filter and it doesn't seem to 
be working. . .I think it has something to do with the fact that warnings 
are issued during the compiling and not during the excecution. . .So the 
filter would come in to late to block them? Any ideas?

-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Re: Help with syntax warnings

2005-10-01 Thread Fredrik Lundh
Ivan Shevanski wrote:

 Well I've been experimenting with the warning filter and it doesn't seem to
 be working. . .I think it has something to do with the fact that warnings
 are issued during the compiling and not during the excecution. . .So the
 filter would come in to late to block them? Any ideas?

fix your code.

fixing syntaxwarnings is almost always trivial; most of the time, all you
have to do is to remove (or rephrase) some statement that doesn't do
what you think it does anyways...

if you really cannot motivate yourself to fix your code, you have to add
an extra bootstrap module.  if your program is named myprogram.py,
rename that file to myactualprogram.py, and add a myprogram.py that
looks like this:

# File: myprogram.py

import warnings
warnings.simplefilter(ignore, SyntaxWarning)
import myprogram

(you may have to fix any __name__ == __main__ clauses in your original
program).

but you really should fix your program, instead of wasting time on stupid
workarounds.

/F



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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Sam

Leif K-Brooks writes:


Sam wrote:

And foo if bar is Perl-ish; yet, even Perl has the ? : operators.


What _isn't_ Perl-ish?


BASIC?




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

Re: A Moronicity of Guido van Rossum

2005-10-01 Thread gene tani
(posted c.l.python ONLY)

Xah (may i call you Xah?)

SOrry to say, but your older posts were much funnier:

http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/15f7015d23a6758e/9ee26da60295d7c8?lnk=stq=rnum=5hl=en#9ee26da60295d7c8

(also seems your anti-cult cult really hasn't gotten a lot of
followers.  You might want to change password on your email account and
this time not give it out to all your friends.

Anyway, good luck in all your future endeavors.  Um, don't have to keep
in touch, tho.

Xah Lee wrote:
 the programers in the industry, including bigwigs such as Guido or that
 Larry Wall fuckhead, really don't know shit about computer languages.

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Ron Adam
Reinhold Birkenfeld wrote:

 Ron Adam

I think I'm going to make it a habit to put parentheses around these 
things just as if they were required.


 Yes, that's the best way to make it readable and understandable.
 
 Reinhold

Now that the syntax is settled, I wonder if further discussion on the 
contextual behavior could be done?  Or maybe it was already done off 
line or in private email?

To me the advantage of a if b else c form is the easy chaining to build 
up a sum of conditional parts, where each next part is dependent on the 
previous result.

The advantage of the nested form, is it can be used in place of an 
if-elif-else structure.  But I think the (a if b else c) syntax doesn't 
match that behavior very well so I was expecting the default behavior to 
be the sequential chaining and not nested evaluation.

But of course, by explicitly placing parentheses, you can do either. 
Shrug

Cheers,
Ron








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


Re: Will python never intend to support private, protected and public?

2005-10-01 Thread Mike Meyer
Paul Rubin http://[EMAIL PROTECTED] writes:

 Mike Meyer [EMAIL PROTECTED] writes:
 Unless your compiler detects and flags passing private variables to
 external functions all you've got is a convention that you don't pass
 private variables to external functions.
 Yes, the point is that it's something that you can check for by
 examining the class in question without having to examine any other
 classes.

That's a pretty restrictive convention to follow. For instance, I
might want an error dialog to be a private variable of a class
representing a window - after all, I don't want anyone else writing to
it, or using it in any way. Except, of course, for any GUI framework
routines I have to pass it to in order to use it. This problem crops
up for every utility routine in every library I might want to
use. Opening files by name, concatenatting strings (or are we going to
have a convention that implicit invocation of functions with the
operator syntax don't count, and another one that you don't overload
operators with destructive functions, and so on), etc.

So it turns out that getting the behavior you desire involves
following a lot of conventions.

 I you going to try and tell me thas using builtin functions on
 private variables is something you don't allow in your projects?

 You have to treat builtin functions as part of the language.  Of
 course Python has this situation where someone could rebind the name
 len to some other function, so you have to deal with that too, maybe
 just at the file scope.

File scope isn't good enough for python.

import madhouse
madhouse.len = my_len_breaker
fool = madhouse.Fool()
print fool.break()

and fool._foo is broken again.

 An OOP approach (lst.len() instead of len(lst)) that binds the
 builtin names to datatypes might be preferable in some situations
 but I'll leave that one for the theorists.

In other words, to get this to work the way you want, you need yet
another convention - this one being about how one goes about writing
utility functions. It may be that you can design a language and
support libraries so that the compiler can enforce all your
conventions. There are languages that try to do that. I recall one I
ran into in the 70s that distinguished between functions (which
returned values) and procedures (which had side effects), and the
compiler enforced (or tried to) the distinction. I think you'd need
something like that.

But that isn't what we've got. What we've got is Python. Which means
you need a whole boatload of conventions to make this work the way you
want.

In other words, by adding private to python, you're making it so that
bugs involving overwriting a private attribute will involve only the
owning classes code so long as everyone follows the conventions that
exist about the use of such variables.

This should be contrasted with the current situation, where bugs that
involve overwriting an _-prefixed attribute will involve only the
owning classes code so long as everyone follows the conventions that
exist about the use of such variables.

Yeah, I guess private makes things a lot better.

 Of course, there's nothing wrong with catching errors earlier. Might I
 suggest that you file a change request for pylint (or your favorite
 error checker) asking that it start issuing warnings for
 object._variable?

 I don't see how pylint could know which instances to flag, without
 doing type inference on all the objects to know that the variable
 belonged to an instance of some other class.

I was thinking it would flag any use of such a variable where the
target variable wasn't self. That may be a stronger constraint than
you wanted - but that's good, right?

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


Re: Nufox : Xul + Python

2005-10-01 Thread salvatore . didio
Oops:

http://artyprog.noip.org:8080

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


Re: OT: Phases of the moon

2005-10-01 Thread Mike Meyer
Bart Lateur [EMAIL PROTECTED] writes:

 Steven D'Aprano wrote:

A skeptical policeman who says he doesn't actually believe the moon
affects behaviour nevertheless reports that last weekend things were
really crazy, and it was a full moon. Somebody writes in to correct him:
no, the full moon is actually tomorrow.

 As a similar example: I've been told by various women independently,
 that there are more babies born near a full moon.

 So... is there a correlation between insanity and babies being born?  :)

If what they say is true, then yes, there is. That doesn't mean
there's a logical - or even rational - explanation for that
correlation.

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


Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-01 Thread Paul F. Dietz
Bart Lateur wrote:

 As a similar example: I've been told by various women independently,
 that there are more babies born near a full moon.

That's also a myth.

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


Re: Nufox : Xul + Python

2005-10-01 Thread Lars Heuer
Hi,

 Oops:

 http://artyprog.noip.org:8080


Again Oops:  :))

http://artyprog.no-ip.org:8080

Best regards,
Lars
-- 
http://semagia.com

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


Re: Help with syntax warnings

2005-10-01 Thread Peter Otten
Ivan Shevanski wrote:

 Well I've been experimenting with the warning filter and it doesn't seem
 to be working. . .I think it has something to do with the fact that
 warnings are issued during the compiling and not during the excecution. .
 .So the filter would come in to late to block them? Any ideas?

$ cat syntaxwarning.py
def f():
x = 42
global x
$ python2.4 syntaxwarning.py
syntaxwarning.py:1: SyntaxWarning: name 'x' is assigned to before global
declaration
  def f():

Method 1: precompile the py-file and then invoke the compiled variant:

$ python2.4 -c 'import syntaxwarning'
syntaxwarning.py:1: SyntaxWarning: name 'x' is assigned to before global
declaration
  def f():
$ python2.4 syntaxwarning.pyc

Method 2: switch off the warning:

$ python2.4 -Wignore::SyntaxWarning syntaxwarning.py

Peter

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


Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-01 Thread Ulrich Hobelmann
Paul F. Dietz wrote:
 Bart Lateur wrote:
 
 As a similar example: I've been told by various women independently,
 that there are more babies born near a full moon.
 
 That's also a myth.

Right, everybody knows that it's not natural (moon) light that 
influences reproductive behavior, it's artificial light -- TV.

When TV is turned off by a power failure, lots of people that usually 
never have sex start making love, and lots of people that usually use 
contraception lose their minds and forget about it.

9 months later more babies are born, unless that's also a myth.

-- 
We're glad that graduates already know Java,
so we only have to teach them how to program.
somewhere in a German company
(credit to M. Felleisen and M. Sperber)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private,protected and public?

2005-10-01 Thread en.karpachov
On 30 Sep 2005 15:00:39 -0700
Paul Rubin wrote:

 Rocco Moretti [EMAIL PROTECTED] writes:
  There is little in the way of technical problems that are solved by
  language level enforcement of private variables. The issues in
  question are mostly social ones, and if you're not reading and
  following the documented interface, stopping private variable access
  is not going to prevent most of your problems.
 
 Well, that says you consider both code auditing and debugging to be
 social problems rather than technical ones.  Maybe that's reasonable,

By the way, any programming language is a social issue; only machine code
is technical.

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread en.karpachov
On Fri, 30 Sep 2005 21:28:26 -0400
Terry Reedy wrote:
 
 The lesson for me is to spend much less time on Python discussion and much 
 more on unfinished projects.  So even if I never use the new syntax, I will 
 have gained something ;-)

QOTW?

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


Re: Will python never intend to support private, protected and public?

2005-10-01 Thread en.karpachov
On 30 Sep 2005 22:11:46 +
John J. Lee wrote:

 Steve Holden [EMAIL PROTECTED] writes:
  That would make a good Onion (www.TheOnion.com) headline: Users 
  Discover Computer Security Conflicts with Desire for Convenience
 
 :-) The Onion, yay.
 
 Area Man Forgets Work Password, Will Employ Post-It Notes in Future

Sure. It would be fun to read something about Consenting Adults there,
too.

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


Printing and prompting adds a mysterious extra space

2005-10-01 Thread Christoph Haas
Evening...

I'm writing a simple interactive program to maintain a database.
The goal was to print   at the beginning of the line, wait for
user input and then deal with it. Minimal test program:

import sys; print , ; print sys.stdin.readline()

However when I run the program and enter foobar it looks like this:

./test.py
foobar
 foobar
^--- where does this space come from?

I wonder where the space comes from in the line where I print what the
user typed. Does it have to do with the , after the print which I use
to suppress the newline? Any ideas?

Regards
 Christoph
-- 
I'm still confused - just on a higher level now.
~
~
.signature [Modified] 1 line --100%--1,48 All
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nufox : Xul + Python

2005-10-01 Thread bearophileHUGS
Nufox seems a really interesting thing (probably it can even be used to
design GUIs for local desktop apps), but the site seems down at the
moment.

Bye,
bearophile

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


Re: OT: Phases of the moon

2005-10-01 Thread Sherm Pendley
Bart Lateur [EMAIL PROTECTED] writes:

 As a similar example: I've been told by various women independently,
 that there are more babies born near a full moon.

 So... is there a correlation between insanity and babies being born?  :)

If you weren't insane before the baby was born, you will be soon after. ;-)

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Not defined

2005-10-01 Thread Rob
Thanks for the replies gives me something to chew on.

Regards Gramps 


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


Re: Printing and prompting adds a mysterious extra space

2005-10-01 Thread [EMAIL PROTECTED]

Christoph Haas wrote:
 Evening...

 I'm writing a simple interactive program to maintain a database.
 The goal was to print   at the beginning of the line, wait for
 user input and then deal with it. Minimal test program:

 import sys; print , ; print sys.stdin.readline()

 However when I run the program and enter foobar it looks like this:

 ./test.py
 foobar
  foobar
 ^--- where does this space come from?

 I wonder where the space comes from in the line where I print what the
 user typed. Does it have to do with the , after the print which I use
 to suppress the newline? Any ideas?

Another question you could ask is: why is there NO space after
the ''? Have a look at this.

import sys

print ,

s = sys.stdin.readline()

print len(s)
print s
for i in s:
print ord(i),i

Instead of printing the input, I'm assigning it to a variable.
Notice that the extra space appears on the next print statement
and is not part of the input. this is verified by showing that
the input has exactly 4 characters and is huh\n.


huh
 4
huh

104 h
117 u
104 h
10


So it looks like the space was sitting in the output buffer.


 Regards
  Christoph
 --
 I'm still confused - just on a higher level now.
 ~
 ~
 .signature [Modified] 1 line --100%--1,48 All

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


Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-01 Thread Running Bare
Ulrich Hobelmann [EMAIL PROTECTED] writes:

 When TV is turned off by a power failure, lots of people that
 usually never have sex start making love, and lots of people that
 usually use contraception lose their minds and forget about it.

 9 months later more babies are born, unless that's also a myth.

http://www.snopes.com/pregnant/blackout.htm

Despite initial reports of New York City hospitals' seeing a
dramatic increase in the number of births nine months after the
1965 blackout, later analyses showed the birth rate during that
period to be well within the norm.


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


Re: Zope3 Examples?

2005-10-01 Thread Jaime Wyant
If you're experimenting with frameworks, try out django.  I've only
completed a few parts of the tutorial.  However, what amazes me is how
much I got for so little code.  It's slick.

http://www.djangoproject.com/

jw

On 9/30/05, Markus Wankus [EMAIL PROTECTED] wrote:
 Gerhard Häring wrote:
  Markus Wankus wrote:
  [...] Thanks for the reply - maybe I'll give it another shot.  I'm
  currently demoing Snakelets.  Quite a turn in the opposite direction,
  but small and super-easy to get going with. [...]
 
  I also found Snakelets a pleasure to use and chose it for implementing a
  clan homepage in early 2005.
 
  I'm still very interested in the Python/Web/RDBMS field and tried to
  follow the developments since then. I didn't actually build anything
  real, only played a little bit with CherryPy and the megaframeworks
  built upon, Subway and TurboGears.
 
  If I had to choose again, I'd use TurboGears, despite the fact that it's
  very young and still developing.
 
  -- Gerhard
 

 Good to know.  I have watched the screencast for Turbogears but haven't
 tried it yet.  There seemed to be a lot of magic methods going on
 there, and you could tell the guy doing the screencast had done that
 more than once. ;o)  I guess once you run through the manual it would
 all make sense.

 I figure I'll give Snakelets a good go first.  Is your Snakelets-based
 page up and accessible somewhere?

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

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


Re: Printing and prompting adds a mysterious extra space

2005-10-01 Thread Christoph Haas
On Sat, Oct 01, 2005 at 01:17:41PM -0700, [EMAIL PROTECTED] wrote:
 Christoph Haas wrote:
  I'm writing a simple interactive program to maintain a database.
  The goal was to print   at the beginning of the line, wait for
  user input and then deal with it. Minimal test program:
 
  import sys; print , ; print sys.stdin.readline()
 
  However when I run the program and enter foobar it looks like this:
 
  ./test.py
  foobar
   foobar
  ^--- where does this space come from?
 
 Another question you could ask is: why is there NO space after
 the ''? Have a look at this.
 [...]
 So it looks like the space was sitting in the output buffer.

Yes, probably. But how do I get that buffer flushed? I tried
sys.stdout.flush() after the print statement but it wasn't printed,
either. I probabl need something like...

print  +

instead of

print ,

How could I solve that decently?

 Christoph
-- 
I'm still confused - just on a higher level now.
~
~
.signature [Modified] 1 line --100%--1,48 All
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nufox : Xul + Python

2005-10-01 Thread Michael
Lars Heuer wrote:
 Oops:

 http://artyprog.noip.org:8080
 
 
 Again Oops:  :))
 
 http://artyprog.no-ip.org:8080

Looks intriguing, but the examples on the site won't work for me. I
suspect they won't for anyone else either, because the code in the
webpages appears to try and contact a server in a private address
space, specifically 192.168.0.40.

Which is a pity, because it looks interesting :-)

Regards,


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


Re: Printing and prompting adds a mysterious extra space

2005-10-01 Thread jepler
Use sys.stdout.write instead of print.  It will solve these problems you are
having.

If you really want to know what's going on, read the language manual,
http://docs.python.org/ref/print.html It explains the behavior of this extra
space, which is output by a successive 'print' statement.  The implementation
uses an attribute called 'softspace', which is described in
http://docs.python.org/lib/bltin-file-objects.html 

Jeff


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

Re: Class Help

2005-10-01 Thread Ron Adam
Ivan Shevanski wrote:
 To continue with my previous problems, now I'm trying out classes.  But 
 I have a problem (which I bet is easily solveable) that I really don't 
 get.  The numerous tutorials I've looked at just confsed me.For intance:
 
 class Xyz:
 
 ... def y(self):
 ... q = 2
 ...
 
 Xyz.y()
 
 Traceback (most recent call last):
  File stdin, line 1, in ?
 TypeError: unbound method y() must be called with Xyz instance as first 
 argument
 (got nothing instead)
 
 
 So. . .What do I have to do? I know this is an extremley noob question 
 but I think maybe if a person explained it to me I would finally get it =/
 
 
 thanks in advance,
 
 -Ivan

Generally you don't use class's directly.  Think if them as templates 
for objects.  Then you can use that class (template) to create many objects.

To create an object just call the class and assign the result to a name.

xyz = Xyz()
xyz.y()


Also,

In your example 'q' is assigned the value 2, but as soon as the method 
'y' exits, it is lost.  To keep it around you want to assign it to self.y.

class Xyz(object):   #  create an class to create an object instance.
def y(self)
   self.q = 2

xyz = Xyz()
xyz.y()
print xyz.q  #  prints 2



Cheers,
Ron











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


Re: Class Help

2005-10-01 Thread marduk
On Sat, 2005-10-01 at 18:58 -0400, Ivan Shevanski wrote:
 To continue with my previous problems, now I'm trying out classes.  But I 
 have a problem (which I bet is easily solveable) that I really don't get.  
 The numerous tutorials I've looked at just confsed me.For intance:
 
 class Xyz:
 ... def y(self):
 ... q = 2
 ...
 Xyz.y()
 Traceback (most recent call last):
   File stdin, line 1, in ?
 TypeError: unbound method y() must be called with Xyz instance as first 
 argument
 (got nothing instead)
 
 
 So. . .What do I have to do? I know this is an extremley noob question but I 
 think maybe if a person explained it to me I would finally get it =/


When you define a class, say Xyz, your are defining your own type.  Say
that Person is a class.  And person has a method walk():

class Person:
def walk(self):
...

now to use the Person class, you need to create an instance of it.  You
can't just say Person.walk() because Person is a classification, not a
real object.  You need an instance of person.

jane = Person()

This creates a new person called jane.  jane is an instance of the
class Person.

 jane
 __main__.Person instance at 0x2c723710

Now we can tell jane to walk:

jane.walk()

So what the error is telling you (in a bit confusing way if you're a
newbie) is that you are calling a method y() but you have not created an
instance of your Xyz class to do y().  Or, to use my analogy, you are
telling Person to walk, but you can't make Person walk, you have to
create a person, jane, and have jane walk.

Hope this helps, but I recommend you read a good intro to
object-oriented programming.

-a

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


Re: Class Help

2005-10-01 Thread Jean-François Doyon
You have to crate an instanciation of the class before you can use one.

So you want to do:

instance = Xyz()
instance.y()

You won't get any output though, might want to do:

class Xyz:
 def y(self):
 print 'y worked!'

it's more satisfying :)

Basically, look into the difference between a class, and the INSTANCE of 
a class.

Cheers,
J.F.

Ivan Shevanski wrote:
 To continue with my previous problems, now I'm trying out classes.  But 
 I have a problem (which I bet is easily solveable) that I really don't 
 get.  The numerous tutorials I've looked at just confsed me.For intance:
 
 class Xyz:
 
 ... def y(self):
 ... q = 2
 ...
 
 Xyz.y()
 
 Traceback (most recent call last):
  File stdin, line 1, in ?
 TypeError: unbound method y() must be called with Xyz instance as first 
 argument
 (got nothing instead)
 
 
 So. . .What do I have to do? I know this is an extremley noob question 
 but I think maybe if a person explained it to me I would finally get it =/
 
 
 thanks in advance,
 
 -Ivan
 
 _
 Express yourself instantly with MSN Messenger! Download today - it's 
 FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Background process for ssh port forwarding

2005-10-01 Thread Jesse Rosenthal
Hello all,

I'm writing a script which will backup data from my machine to a server
using rsync. It checks to see if I am on the local network. If I am, it
runs rsync over ssh to 192.168.2.6 using the pexpect module to log in.
That's the easy part.

Now, when I'm not on the local network, I first want to open up an ssh
connection to do port forwarding, so something like this:

def hostforward():
#This is based on the assumption that the passfile is the gnus
#authinfo file, or has a similar format...
f = open(PASS_FILE, r)
f_list = f.read().split(' ')
f.close()
#Now, we get the entry after password (be slicker to make it a
#dictionary, but maybe wouldn't work as well).
pass_index = f_list.index('password') + 1
forwardpass = f_list[pass_index]
#now we connect
command = 'ssh -l %s -L 2022:%s:22 %s' % \
  (login, my_server, forwarding_server)
connection = pexpect.spawn(command)
connection.expect('.*assword:')
connection.sendline(forwardpass)

If I end this with 'connection.interact()', I will end up logged in to the
forwarding server. But what I really want is to go on and run rsync to
localhost port 2022, which will forward to my_server port 22. So, how can
I put the ssh connection I set up in hostforward() in the background?
I need to make sure that connection is made before I can run the rsync
command.

I've looked at threading, but that seems excessive. There must be an
easier way. Whatever I do, though, I'll need to use pexpect to spawn the
processes, since I'll need to log in to ssh servers with a password.

Thanks for any help.

--Jesse


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


Re: Class Help

2005-10-01 Thread Ron Adam
Ron Adam wrote:

 Also,
 
 In your example 'q' is assigned the value 2, but as soon as the method 
 'y' exits, it is lost.  To keep it around you want to assign it to self.y.

Ooops,  That should say ...
To keep it around you want to assign it to self.q.   ---self.q

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


Re: Printing and prompting adds a mysterious extra space

2005-10-01 Thread Christoph Haas
On Sat, Oct 01, 2005 at 05:09:48PM -0500, [EMAIL PROTECTED] wrote:
 Use sys.stdout.write instead of print.  It will solve these problems you are
 having.
 
 If you really want to know what's going on, read the language manual,
 http://docs.python.org/ref/print.html It explains the behavior of this extra
 space, which is output by a successive 'print' statement.  The implementation
 uses an attribute called 'softspace', which is described in
 http://docs.python.org/lib/bltin-file-objects.html 

Thank you for the technical explanation. print a,b is nice to read
in simple Python programs. But when you need to get more control of
I/O it's better to know what's really happening inside.

So the softspace is always added after a print a, statement but only
printed if Python thinks it is not at the beginning of a terminal line.
Interesting.

Again, thanks. I'll rest my case.

 Christoph
-- 
I'm still confused - just on a higher level now.
~
~
.signature [Modified] 1 line --100%--1,48 All
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A rather unpythonic way of doing things

2005-10-01 Thread Tom Anderson
On Thu, 29 Sep 2005, Peter Corbett wrote:

 One of my friends has recently taken up Python, and was griping a bit 
 about the language (it's too prescriptive for his tastes). In 
 particular, he didn't like the way that Python expressions were a bit 
 crippled. So I delved a bit into the language, and found some sources of 
 syntactic sugar that I could use, and this is the result:

 http://www.pick.ucam.org/~ptc24/yvfc.html

It's this sort of thing that makes it clear beyond all shadow of a doubt 
that Cambridge should be razed to the ground.

Keep up the good work.

tom

-- 
I'm not quite sure how that works but I like it ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: User-defined augmented assignment

2005-10-01 Thread Tom Anderson
On Thu, 29 Sep 2005, Pierre Barbier de Reuille wrote:

 a discussion began on python-dev about this. It began by a bug report, 
 but is shifted and it now belongs to this discussion group.

 The problem I find with augmented assignment is it's too complex, it's
 badly explained, it's error-prone. And most of all, I don't see any
 use-case for it !

 The most common error is to consider that :

 a += b == a.__iadd__(b)

 when the truth is :

 a += b == a = a.__iadd__(b)

 which can be very confusing, as the two a are not necessarily the
 same.

Indeed. I certainly didn't realise that was how it worked.

 So, what I would suggest is to drop the user-defined augmented 
 assignment and to ensure this equivalence :

 a X= b = a = a X b

 with 'X' begin one of the operators.

That seems quite an odd move. Your proposal would lead to even more 
surprising behaviour; consider this:

a = [1, 2, 3]
b = a
a += [4, 5, 6]
print b

At present, this prints [1, 2, 3, 4, 5, 6]; if we were to follow your 
suggestion, it would be [1, 2, 3].

So, -1, i'm afraid.

I think the right solution here is staring us in the face: if everyone 
seems to think that:

a += b == a.__iadd__(b)

Then why not make it so that:

a += b == a.__iadd__(b)

Principle of Least Surprise and all that.

Since not everything that should support += is mutable (integers, for 
example), how about saying that if the recipient of a += doesn't have an 
__iadd__ method, execution falls back to:

a = a + b

I say 'a + b', because that means we invoke __add__ and __radd__ 
appropriately; indeed, the __add__ vs __radd__ thing is a precedent for 
this sort of fallback.

Doesn't that leave everyone happy?

tom

-- 
I'm not quite sure how that works but I like it ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3! Finally!

2005-10-01 Thread Tom Anderson
On Fri, 30 Sep 2005, Stefan Behnel wrote:

 I just firefoxed to Python.org and clicked on the bz2 link at
 http://python.org/2.4.2/ and what did I get?

 Python-3.4.2.tar.bz2 !!

 Python 3 - what we've all been waiting for, finally, it's there!

Not only that, but they've skipped the tiresome 3.0.x early release 
teething phase and gone straight to the mature, solid-as-a-rock middle 
releases! God, i love python!

Hey, and it's still got lambdas! WE WON!!!

tom

-- 
I'm not quite sure how that works but I like it ...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Class Help

2005-10-01 Thread Steven D'Aprano
On Sat, 01 Oct 2005 18:58:45 -0400, Ivan Shevanski wrote:

 To continue with my previous problems, now I'm trying out classes.  But I 
 have a problem (which I bet is easily solveable) that I really don't get.  
 The numerous tutorials I've looked at just confsed me.For intance:

[code snipped]


You have to keep in mind the difference between a class and an instance of
a class. To make an analogy with real life, a class is like the idea of
dogs in general and an instance is a specific dog (like Ol' Yella, or
Rin Tin Tin, or or that little beagle on the Enterprise).

Normally you create a class, then make one or more instance of the class,
and work with the instances.

Some terminology for you to learn: when you create a function inside a
class, it is called a class method, or just method. Functions and methods
are not exactly the same, but for now the differences don't concern us.

So, you create a class with a single method:

class Klass:
def spam(self):
return spam  * 5

Notice that the first argument of the method is always self, even when
you don't need any arguments.

Klass is an object, and you can call Klass.spam() if you like, but it will
fail because you haven't included an argument for self. self must be an
instance of Klass. So you could do this:

spam_maker = Klass()  # create an instance
print Klass.spam(spam_maker)

which will print spam spam spam  as expected.

But that's doing extra work. Once you have your instance, you can just
call the method as if it were a normal function:

print spam_maker.spam()

and it will work the way you expect it to. Behind the scenes, Python
passes a copy of spam_maker to spam_maker.spam() for you. It can do that
because spam_maker is an instance.

A class is a description of how a type of object should work, but you
normally don't work directly on that high-level description. Normally you
will work with individual instances, not the class itself. When Timmy
falls down the well, you tell Rin Tin Tin to go get help, not dogs in
the general.

Python built in objects like lists, strings, ints etc are special types of
classes built into the language. Here is how we might create a (very
inefficient!) Python implementation of list:

class MyList:

# Class attributes:

left_delimiter = [
right_delimiter = ]
item_delimiter = , 

# Class methods:

def __init__(self, *arguments):
Create a new instance and fill it with arguments.
self.data = arguments  # create an instance attribute
def __str__(self):
Convert instance to a string for printing.
holder = self.left_delimiter
for item in self.data:
holder = holder + str(item) + self.item_delimiter
holder = holder + self.right_delimiter
return holder
def append(self, obj):
Append an object to the instance.
self.data.append(obj)
# real lists have many more methods...



Hope this helps.


-- 
Steven.


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


Re: Soap Question (WSDL)

2005-10-01 Thread Armin
Thanks for the comment everyone.

I was considering to write my own soap interface to Flickr as apposed
to use the ready to go libraries for Flickr as Fredrik pointed out. I
got to get FlickrClient to work. Nonetheless, I am excited to use soap
services for my needs.

Thanks for your support,
Armin

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


How is wxWindows related to Python?

2005-10-01 Thread Sathyaish
My question will sound daft to the good old craftsmen, but they will
excuse my nescience on the subject. I come new to the Pythonic world
from the land of .NET languages, VB6 and some familiarity in C and C++.

I just read about wxWindows last night. From my understanding, it is a
GUI framework like MFC that lets you create UI apps with ease calling a
standard set of API accross multiple platforms (unlike MFC) and if the
Windows port is complementary to MFC in that it shields you from
calling the Win32 API directly.

However, I do not understand its correlation with Python. The
documentation page says, wxWindows 2.4.2: A portable C++ and Python
GUI toolkit. So, my question is, How is wxWindows related to Python?

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


Re: PyWin SendMessage

2005-10-01 Thread Tim Roberts
Gonzalo Monzón [EMAIL PROTECTED] wrote:

Hi Gerd,

I'm not really sure of, but I think you must use a message value in 
range of WM_USER or WM_APP so this fact maybe let the receiver window 
getting bad data... 

No.  WM_COPYDATA is designed specifically for his use case -- interprocess
communication.  The WM_USER range is only if you are inventing a custom
message for some new purpose.
-- 
- Tim Roberts, [EMAIL PROTECTED]
  Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How is wxWindows related to Python?

2005-10-01 Thread Jaime Wyant
That is a reference to wxPython.  wxPython is a thin wrapper around
the wxWidgets c++ library.  But really, it has grown quite a bit
lately and has a bunch of neato widgets that aren't included with
wxWidgets c++.

Visit www.wxpython.org.

jw

On 1 Oct 2005 18:36:06 -0700, Sathyaish [EMAIL PROTECTED] wrote:
 My question will sound daft to the good old craftsmen, but they will
 excuse my nescience on the subject. I come new to the Pythonic world
 from the land of .NET languages, VB6 and some familiarity in C and C++.

 I just read about wxWindows last night. From my understanding, it is a
 GUI framework like MFC that lets you create UI apps with ease calling a
 standard set of API accross multiple platforms (unlike MFC) and if the
 Windows port is complementary to MFC in that it shields you from
 calling the Win32 API directly.

 However, I do not understand its correlation with Python. The
 documentation page says, wxWindows 2.4.2: A portable C++ and Python
 GUI toolkit. So, my question is, How is wxWindows related to Python?

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

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


Re: How is wxWindows related to Python?

2005-10-01 Thread Benji York
Sathyaish wrote:
 However, I do not understand its correlation with Python. The
 documentation page says, wxWindows 2.4.2: A portable C++ and Python
 GUI toolkit. So, my question is, How is wxWindows related to Python?

Pure wxWindows (actually it's been renamed wxWidgets at the demand of 
Microsoft) is for C++.  You're looking for wxPython: http://wxpython.org/
--
Benji York



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


Re: How is wxWindows related to Python?

2005-10-01 Thread Brett Hoerner
I guess it is referring to the closely related (maybe even same dev
group? I don't know why the wxWindows docs would mention Python unless
they specifically support the wxPython project, too.)

wxWindows + Python = wxPython

wxPython is a Python extension module that provides a set of bindings
from the wxWindows library to the Python language. In other words, the
extension module allows Python programers to create instances of
wxWindows classes and to invoke methods of those classes.

More from this Chapter:

· Using Tkinter

· Using PythonWin

The wxPython extension module attempts to mirror the class hierarchy of
wxWindows as closely as possible. This means that there is a wxFrame
class in wxPython that looks, smells, tastes, and acts almost the same
as the wxFrame class in the C++ version.

wxPython is close enough to the C++ version that the majority of the
wxPython documentation is actually annotations to the C++ documentation
that describe the places where wxPython is different. There is also a
series of sample programs included, and a series of documentation pages
that assist the programmer in getting started with wxPython. 
http://www.onlamp.com/pub/a/python/excerpts/chpt20/wxpython.html

http://www.wxpython.org/

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


Re: Class Help

2005-10-01 Thread Peter
Ivan Shevanski wrote:

To continue with my previous problems, now I'm trying out classes.  But I 
have a problem (which I bet is easily solveable) that I really don't get.  
The numerous tutorials I've looked at just confsed me.For intance:

  

class Xyz:


... def y(self):
... q = 2
...
  

Xyz.y()


Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: unbound method y() must be called with Xyz instance as first 
argument
(got nothing instead)


So. . .What do I have to do? I know this is an extremley noob question but I 
think maybe if a person explained it to me I would finally get it =/

  

You have to create an instance of the class before it can be called. Ex:
class foo:
def bar(self):
print Hello, World!
foo().bar()

This is because foo is a reference to a classobj, however, when you call 
the class, it becomes an instance.

Ex:
  type(foo)
type 'classobj'
  type(foo())
type 'instance'

When an instance is created it tells Python to pass the instance as the 
first argument (self).
Otherwise it gives it None or something similer. (Note that im not 100% 
sure about why it does'nt work, im just guessing from the way it _seems_ 
to work. I have read no documentation on this.

If you want it to work before you create an instance, then you can do 
that with
class foo:
@classmethod
def bar(self):
   print Hello, World!

or the older (but exactly the same):
class foo:
def bar(self):
   print Hello, World!
bar = classmethod(bar)

thanks in advance,

-Ivan

  

HTH,
Peter

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


Re: How is wxWindows related to Python?

2005-10-01 Thread Sathyaish
Thanks, guys.

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


Re: Recursive Property of Octal Numbers

2005-10-01 Thread Dan Christensen
James Stroud [EMAIL PROTECTED] writes:

 I'm very curious about what is going on here. I'm sure my curiosity has 
 something to do with ignorance of some fundamental concept of computer 
 science (maybe that 8 is just a vertical infinity?):

 py b = '\xb6'
 py b[0]
 '\xb6'
 py b[0][0]
 '\xb6'

Maybe this clarifies things?

 b='a'
 b[0]
'a'
 b[0][0]
'a'
 b[0] == b
True

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