Any wing2.0 users here?

2006-01-02 Thread Alvin A. Delagon
emacs has been my long time companion for php, perl, and python. My boss 
recommended to me Wing2.0, I find it hard to adjust though. What can you 
say about this IDE? He say's if I think it could improve my productivity 
he's willing to buy it for me. Suggestions  for better python IDE's are 
welcome! Thanks in advance! ^_^
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any wing2.0 users here?

2006-01-02 Thread gene tani

Alvin A. Delagon wrote:
 emacs has been my long time companion for php, perl, and python. My boss
 recommended to me Wing2.0, I find it hard to adjust though. What can you
 say about this IDE? He say's if I think it could improve my productivity
 he's willing to buy it for me. Suggestions  for better python IDE's are
 welcome! Thanks in advance! ^_^

There's a few IDEs with a ~ $30 license and ~ $300 licenses: black
adder, TruStudio, which I don't know anything about.  I like Komodo, it
works well on perl and python (the ruby debugger setup has speed
issues, but otherwise works well for ruby too), colorizes C, SQL and
HTML source pretty well, and the $30 license really isn't missing much
from the $300 license.  And you shd look at jedit, eclipse, and
textmate, since they're out there.

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


Re: Any wing2.0 users here?

2006-01-02 Thread Claudio Grondi
Alvin A. Delagon wrote:
 emacs has been my long time companion for php, perl, and python. My boss 
 recommended to me Wing2.0, I find it hard to adjust though. What can you 
 say about this IDE? He say's if I think it could improve my productivity 
 he's willing to buy it for me. Suggestions  for better python IDE's are 
 welcome! Thanks in advance! ^_^

There was a thread about Python IDEs lately with reviews of many of 
available Python IDE options, so check it out for more details (Wingide 
is a beautiful application December 17, 2005).

I personally currently encourage everyone to use SPE as you can adjust 
it to your own needs and can let others profit from the work you have 
done to improve it.

Wing is interesting only in its professional version beeing quite 
expensive compared to what you gain with it, but if you can get it 'for 
free' I would recommend to use it in parallel to your emacs for the 
Python specific features like go to definition (with automated reloading 
of file on changes made in the other editor) as long as you are in 
process of using the available source code to adapt it to your specific 
needs.

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


Re: PyHtmlGUI Project is looking for developers

2006-01-02 Thread phoenixathell
Hi John,

 I wonder how you're dealing with client-side code (ie. JavaScript)?

At the moment we don't work with javascript. But it should not be to
hard to create a JavaScript Renderer similar to the css one we already
have.

 Have you looked at crackajax or PyPy?

Not really close so far. On of our aims is the avoidance of scripting
languages on the client side. But it could be that these will change a
bit in the future. Some of the parameter checking functionality could
be done on the client side. So i guess we will have a closer look.

Greetings,
Ingo

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


What PyXml provides

2006-01-02 Thread ankit
Python itself provides parsers for xml and Dom support. So, if I
install pyxml what additional advantage or features I will get in pyxml
specially in minidom and parsers.

Anyone, please provide a brirfing on this.

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


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

2006-01-02 Thread Ilias Lazaridis
Alex Martelli wrote:
 Ilias Lazaridis [EMAIL PROTECTED] wrote:
...
 


note: Anton Vredegoor wrote:
only hire people with long backstabbing histories.

Such as...? Guido van Rossum?  Greg Stein?  Vint Cerf?  Ben Goodger?
...
 
The employees you've mentioned should have most possibly the basic 
google employment requirement: BS or MS... [1].
 
 ... or equivalent (I do believe all I named have at least a Bachelor
 degree, but with the undisputable results they've shown afterwards, I
 think they'd all meet the or equivalent clause anyway).

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

This referes to an _academic_ degree.

Very few companies make an explicit statement about non-academic applicants.

It seems Google does not.

I assume that Mr. Vredegoor uses the term backstabbing incorrect. Most
possibly he meand just something like back reaching.
Possibly he can confirm.
 
 Let's wait for him to confirm or deny; I thought he did mean what he
 said.

yes, I've become curious.

btw: I don't understand exactly what Mr. Vredegoor means by having 
worked for the man.
Possibly he can clarify concisely.
 
 By all means, let's hope he does.  In the jargon of the American
 underclass, to work for The Man meant working for law enforcement
 agencies, and somehow it got widened to working for ``the system'',
 i.e., in a socially respectable job.  Maybe in Dutch it means
 something different.

socially respectable would fit.

but let's await his comments.

Mr. Martinelli, you seem to know python.
 
 Sorry, that's a brand of sparking apple cider.  I get my name mispelled
 that way often enough, since I moved to the US, to have become quite
 sensitive about it!-)  In MY name, there is no in...

Mr. Martelli, I apologize for naming you like an soft-drink.

-

Python vs jamLang follows:

May you can showcase how to overcome some of the limitations 
(limitations in context of the evaluation template):

http://lazaridis.com/case/lang/python.html
 
 re: #LIMITATION: automated get/set methods via var-name not available
 see the 'property' built-in.

Can you (or some reader) sent (or fill in) the relevant code?

 re: LIMITATION: InstanceVarName not available
 since any object at a given time may be bound to any number of names,
 from 0 upwards, and none of them has any privileged relation with the
 object, this will never be solved.  If you think an object should have a
 name with some privileged relation to it, I strongly suggest you switch
 to another language.

= the limitation InstanceVarName not available is true.

(I will change the evaluation-template and move this step to the Expert 
Reflective Data Access).

 prints Class Definition (methods, fields), without code
 LIMITATION: no direct access on object-model-level
 not sure what you mean, but maybe see the 'inspect' module.

= Clas Definition is not accessible via MetaClasses
(possible workaround: inspect module)

 #LIMITATION: attribute is not available systemwide in every object
 #LIMITATION: attribute is not on object-model-level
 #LIMITATION: Operation is not Object Oriented
 
 If you think that the syntax x(y,z) is not Object Oriented, then again
 I strongly suggest that you switch to other languages (avoiding other
 powerful object oriented languages such as Dylan, Lisp, or O'CAML, which
 also allow usage of function-call notation for THEIR OO power); in other
 words, if you think the mere presence of a syntax like 'y.x(z)' makes
 any difference wrt accessing a functionality versus 'x(y, z)', you're
 clearly evaluating things at a totally inappropriate level.

I assure you: the level is totally appropriate.

 The notation you choose, setattr(Object, meta, Some meta

I did not choose it.

Someone has posted it.

 information), is, at any rate, absolutely semantically identical to
 Object.meta = Some meta information -- they will both succeed or both
 fail, and when they both succeed they will have identical effects; thus,
 that point about not Object Oriented seems to fall somewhere between
 embarassingly wrong, and crazy-level weird.

= Object.meta = Some meta information
= can be used instead of setattr(Object, meta, Some metainformation)

 It IS true that in Python you cannot set arbitrary attributes on

= #LIMITATION: Cannot add arbitrary attributes to arbitrary objects.

 arbitrary objects.  The workaround is to use a dict, indexed by the id
 of the object you want to set arbitrary attributes on; this has the
 helpful consequence that separate namespaces are used, so your arbitrary
 setting of metadata cannot interfere with the `true' attributes of the
 object in question.

= possible workaround: use dict.

 I'm unable to understand what you're trying to do in the extend talker
 code box following that one.

Someone has posted this code, to solve Applying metadata (or 
attributes, as you prefere) to Class, Object, 

I understand that the poster has send code which does not work.

-

see the ruby result as a reference:


Re: Hypergeometric distribution

2006-01-02 Thread Raven
Well, what to say? I am very happy for all the solutions you guys have
posted :-)
For Paul:
I would prefer not to use Stirling's approximation


The problem with long integers is that to calculate the hypergeometric
I need to do float division and multiplication because integer division
returns 0. A solution could be to calculate log(Long_Factorial_Integer)
and finally calculate the hypergeometric with the logarithmic values.
I've done a test: iterated 1000 times two different functions for the
hypergeometric, the first one based on scipy.special.gammaln:

from scipy.special import gammaln

def lnchoose(n, m):
  nf = gammaln(n + 1)
  mf = gammaln(m + 1)
  nmmnf = gammaln(n - m + 1)
  return nf - (mf + nmmnf)

def hypergeometric_gamma(k, n1, n2, t):
  if t  n1 + n2:
t = n1 + n2
  if k  n1 or k  t:
return 0
  elif t  n2 and ((k + n2)  t):
return 0
  else:
c1 = lnchoose(n1,k)
c2 = lnchoose(n2, t - k)
c3 = lnchoose(n1 + n2 ,t)

return exp(c1 + c2 - c3)

and the second one based on the code by Steven and Scott:


import time
from math import log, exp

def bincoeff1(n, r):
  if r  n - r:
r = n - r
  x = 1
  for i in range(n, r, -1):
x *= i
  for i in range(n - r, 1, -1):
x /= i
  return x

def hypergeometric(k, n1, n2, t):
  if t  n1 + n2:
t = n1 + n2
  if k  n1 or k  t:
return 0
  elif t  n2 and ((k + n2)  t):
return 0
  else:
c1 = log(raw_bincoeff1(n1,k))
c2 = log(raw_bincoeff1(n2, t - k))
c3 = log(raw_bincoeff1(n1 + n2 ,t))

return exp(c1 + c2 - c3)

def main():
  t = time.time()
  for i in range(1000):
r = hypergeometric(6,6,30,6)
  print time.time() - t

  t = time.time()
  for i in range(1000):
r = hypergeometric_gamma(6,6,30,6)
  print time.time() - t


if __name__ == __main__:
  main()


and the result is:

0.0386447906494
0.192448139191

The first approach is faster so I think I will adopt it.

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


Running external programs: what is the best way?

2006-01-02 Thread sir_alex
If i have to execute an external program (for example, in the frontend
that i created for convert, from ImageMagick) i have 2 possibilities: i
can call one function between the exec* family, or i can call the
system function: so, which in your opinion is the best? The only
difference that i know (but i may be in error) between these 2
functions is that the former doesn't return (so you have to create a
child process), but the latter returns. Is this the only difference?

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


Re: Python or Java or maybe PHP?

2006-01-02 Thread Peter Hansen
Alex Martelli wrote:
 One great programming principle is Dont' Repeat Yourself: when you're
 having to express the same thing over and over, there IS something
 wrong.  I believe the DYR phrasing is due to the so-called Pragmatic
 Programmers, who are paladins of Ruby, but I also believe it's a
 principle most experienced programmers could accept.

Shall we assume DYR == Do You Ruby? ?  wink

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


Re: Running external programs: what is the best way?

2006-01-02 Thread Peter Hansen
sir_alex wrote:
 If i have to execute an external program (for example, in the frontend
 that i created for convert, from ImageMagick) i have 2 possibilities: i
 can call one function between the exec* family, or i can call the
 system function: so, which in your opinion is the best? The only
 difference that i know (but i may be in error) between these 2
 functions is that the former doesn't return (so you have to create a
 child process), but the latter returns. Is this the only difference?

Those are options.  So is the newer subprocess module, which I believe 
is considered to be a reason to deprecate almost all other ways of doing 
the same thing (os.system, possibly excluded, because of it's sheer 
simplicity).

-Peter

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


Re: Application architecture (long post - sorry)

2006-01-02 Thread limeydrink

Bump

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


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

2006-01-02 Thread Anton Vredegoor
Alex Martelli wrote:

 Anton Vredegoor [EMAIL PROTECTED] 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.

 Such as...? Guido van Rossum?  Greg Stein?  Vint Cerf?  Ben Goodger?
 Please DO share your insider-information about the long backstabbing
 histories of each and every one of these people, I'm sure it will be
 most fascinating (as well as useful for self-protection to future
 potential victims), and, after all, they ARE all rather public
 figures... TIA!

No insider information is necessary, the job requirements make it
absolutely clear (at least to me) that Google is a company with an
elitist culture, just like most universities. In fact I am convinced
that universities (and this time I have extensive, first person and
historic information) are elitist.

We can discuss that if you want but to me it's appararent that *titles*
are a strong indication of elitism. Further more I am convinced that
universities spend about 95 percent of their effort into maintaining
the hierarchy (socializing the students), and spend almost no time on
creating new knowledge. A kind of 'piltdown' phenomenon.

Also when considering this massive scientific fraude (because that's
what it is) it is very illustrative to use the same deconstructing
methods that Randi, if that's not the name of a beverage, no:

http://en.wikipedia.org/wiki/James_Randi

uses to discredit paranormal phenomena. For example, careers are
construed because scientific success is credited to persons higher in
the hierarchy and mistakes are the faults of research assistents or
students. Only if this system breaks down we see reports of scientific
fraude in the media, which according to me is more a sign of the
social network around the scientist collapsing than it is a sign of
their research data being any more fabricated than other scientific
data.

There is a lot of this inbred and invisible corruption everywhere in
our societies and I tried to name it by using the term working for the
man by which I meant throwing away ones own moral compass and
confining ones efforts to further the interests of a small sub-system
(like soldiers) and thereby stabbing oneself and the rest of humanity
in the back (figuratively) and often not even sparing coworkers in
order to please the master.

Why is this not absolutely clear and apparent? Because when trying to
feed ones wife and children it is almost impossible to do so without
*proving* that one has *experience* in working for these corrupt
entities (and possibly having become corrupt oneself)  and doing a lot
for the community but still being blind to the faults of ones employer
does count as condoning corruption, at least in my world.

Most people can survive (without damaging their souls so to speak) when
working for corruption themselves in this way, but sooner or later one
is asked to corrupt others (defending one's title during a promotion,
leading a community and so on). This is the crucial point where
corruption definitively occurs: where silence is not enough anymore to
keep one employed.

The human brain can withstand extreme amounts of conficting sensory
data and still maintain a sense of continuity and order while from all
sides things seem to fall apart. Such continuity is highly valuable
because it is the only thing that keeps chaos at arms length. The same
thing can be applied to whole societies (see for example the state
American politics is in now). So that is the reason these kind of
things normally are swept under the carpet.

However for *me* personally, because I am deserted by my government,
the university community, friends and family, and left to fend for
myself, there is no pressing need to keep up the facade so I can
finally see it for what it is.

I hope this answers some of your questions about my position. Anyway, I
think its better to talk about positive things, like trying to convince
google to hire any and all people who can program irrespective of their
corruption history. For example to help manning their commercial ask
google service. I read that nowadays people can get payed for playing
*games*, by taking the virtual personae of people who don't have time
to play themselves.

Oh, and here [1] is another job posting, which seems a lot better than
the Google example IMO, but which still misses a plan for what to do
when thousands of programmers would apply and which also misses a
mission statement for what they plan to do to save the world community
from becoming slaves to a select group of elitists hiding behind
webservices. The junior/senior divisioning in the job offerring below
worries me too. Well I guess it's a step by step process, but if it
were my call (which it obviously isn't, and maybe deciding on the basis
of this data is premature anyway) I'd rather have Guido working there
instead of at google.

Anton

[1]


Re: Any wing2.0 users here?

2006-01-02 Thread Franz GEIGER
Alvin A. Delagon wrote:

 emacs has been my long time companion for php, perl, and python. My boss
 recommended to me Wing2.0, I find it hard to adjust though. What can you
 say about this IDE? He say's if I think it could improve my productivity
 he's willing to buy it for me. Suggestions  for better python IDE's are
 welcome! Thanks in advance! ^_^

I like WingIDE best on Windows. You can try Wing: They offer a 30 day eval
version.

HTH
Franz GEIGER

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


pdb.py - why is this debugger different from all other debuggers?

2006-01-02 Thread R. Bernstein
Okay, a bit of an exaggeration. 

Recently, I've been using Python more seriously, and in using the
debugger I think one of the first things I noticed was that there is
no restart (R in perldb) or run (gdb) command.

I was pleasantly pleased discover how easy though it was patch pdb.py
and pdb.doc; my patch for this is here:
http://sourceforge.net/tracker/index.php?func=detailaid=1393667group_id=5470atid=305470

Encouraged, the next thing I noticed lacking from my usual debugging
repertoire was gdb's frame command which is the absolute-position
version of up and down. Clearly since up and down are there,
adding a frame command is also pretty simple.

Perhaps I should explain that I noticed the lack of and wanted a
frame command because I had noticed that prior to adding restart
that when the program was restarted through a post-mortem dump, the
first line number in the post-mortem dump was not getting reported. So
Emacs was showing a weird position in the source; it was confusing and
not clear that a restart had actually taken place. When Emacs and the
debugger are out of sync, my usual way of fixing this is by issuing
frame 0, which usually means go to the top (or is it bottom?) of the
stack which has a side effect of forcing emacs to update the display.

Well, so now we get to the second issue. Python's stack numbering is
different from the way most (all?) other languages. And up and
down in pdb.py follow the Python notion of direction rather than
what is common among debuggers. Yes, I realize Python's stack
numbering is the one true the right way; I have no doubt that Python
programmers draw their trees with the root at the bottom. So at least
for now I hacked in frame -1 to mean what is generally called frame
0 in other debuggers. And frame 0 in my private hacked pdb.py goes
to the most least-recently encountered entry or the grand-daddy place
which calls all of the others.

Finally, we come to listing breakpoints. Showing my gdb orientation,
the first thing tried and looked for was info break. Nope, not
there. For a while I just thought one just couldn't list breakpoints
and lived with that. Then when I decided I'll hack in an info break
I realized that if you type break without any arguments it lists the
breakpoints. (And yes, I see that the behavior is documented.)

In fact the breakpoint-listing output looks similar to what gdb
uses. That's nice, but in both gdb and Perl's debugger a break
without an argument *sets* a breakpoint at the current the line, it
doesn't list it.

Here I'm in a little quandary as to what to do. My take would be to
just change the behavior of break so it works like the other debuggers
mentioned. In contrast to say the frame command, I fail to see how
pdb.py's lingo for list breakpoints superior. In fact it seems
inferior. If one wanted to extend the debugger command set to include
a list information about breakpoint number n (which gdb does by
info break n), I'm not sure this would fit in with the existing
lingo.

My guess is that pdb.py started as a small undertaking and grew
without all that much thought or concern as to what a full debugger
command set should or would be.

So what I am suggesting is that it would be helpful to just follow an
existing debugger paradigm (or follow more closely) so folks don't
have to learn yet another interface.

Let me close with a rather pleasant experience when I tried something
like that in my debugger for Bash (http://bashdb.sourceforge.net). In
doing that I decided that I'd just try follow the gdb command set. Not
that I think gdb's is the most wonderful, orthogonal or well-designed
command set, but just that it is commonly used and rather
complete. For example, whereas pdb.py has up and down, gdb's
version also allows a numeric argument to indicate how many places up
or down - again something pretty easy to hack in. No doubt someone at
some point found this useful, so it was added. And no doubt there are
programmers who use this. Might that not also apply to people
debugging Python programs? At any rate I wanted to reduce the learning
curve of folks using my debugger.

At some point someone asked for a GUI interface. I thought okay, and
found this GUI front-end called ddd. Naturally it handled gdb and Perl
as back ends. So to add in my bash debugger support, basically all I
had do do was tell ddd that handling this construct (say
breakpoints) is like gdb. There were a few places where I told ddd
not to follow gdb but Perl instead because the paradigm needed had to
be more like a scripting language than a compiled language. But in the
end, adding support for bash inside ddd was much more straightforward
and required much less thought than if I had invented my own debugger
command set.

Well after this was done and I fire up ddd, I notice that when my
cursor is hovering over some of the buttons I see short descriptions
for what that command does. And there is this button called customize
bash and in that there are all these setting 

Re: Python or Java or maybe PHP?

2006-01-02 Thread Ilias Lazaridis
[EMAIL PROTECTED] wrote:
 Hi everyone,
 
 I need to write a web app, that will support millions of user accounts,
 template-based user pages and files upload. The client is going to be
 written in Flash. I wondered if I coudl get your opinions - what do you
 think is the best language to use for the server? Python or Java? And
 I'm talking scalability, object oriented, development tools etc.
 
 Thansk for any idea! I'd love to hear it
 Happy New 2006,
 Lior

You may want to review some basic evaluations, which can simplify the 
selection process:

(note that this is a work in progress)

http://lazaridis.com/case/lang/index.html

and some community evaluations:

http://lazaridis.com/core/eval/index.html

-

You have to define your requirements.

This way you can manage the complexity of the evaluation.

-

please feel free to contact me with private email.

.

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


Re: PYTHONDOCS

2006-01-02 Thread Dan Sommers
On Mon, 02 Jan 2006 04:33:44 GMT,
J. D. Leach [EMAIL PROTECTED] wrote:

 ... This is in spite of my setting the .bash profile correctly. As it
 stands, I am at a loss for how to fix the problem ...

As a long shot, and I don't mean to insult anyone, but what is the name
of your .bash profile, and are you sure it's executing?  My bash man
page mentions a lot of profile files, none of which is called .bash;
bash seems to have a mind of its own when it comes to deciding which
profile files to read at which times; and it's not uncommon to set a
variable and not export it, which means that echo works but nothing else
does.

Regards,
Dan

-- 
Dan Sommers
http://www.tombstonezero.net/dan/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can Python write BBcode modules?

2006-01-02 Thread [EMAIL PROTECTED]
if you don't need really goof perfomances, you ca use regular
expression... but in fact, string processing would be really better !

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


Re.'Compressing folders in Windows using Python'

2006-01-02 Thread sri2097
Hi all,This is in reply to the 'Compressing folders in Windows using
Python' query I raised y'day.

I figured out that windows does not allow command line zipping so I
started looking for alternatives.

I found some modules in Perl which does zipping. I guess it goes by the
name 'gzip'. I plan to write the zipping feature in Perl and import it
into Python.

Thanx a lot for all those who took time to answer my query. If you find
any loophole in the above approach feel free to drop me mail...

Srikar

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


Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Peter Hansen
sri2097 wrote:
 Hi all,This is in reply to the 'Compressing folders in Windows using
 Python' query I raised y'day.
 
 I figured out that windows does not allow command line zipping so I
 started looking for alternatives.
 
 I found some modules in Perl which does zipping. I guess it goes by the
 name 'gzip'. I plan to write the zipping feature in Perl and import it
 into Python.

Cool!  When you're done, check out 
http://docs.python.org/lib/module-gzip.html and see how yours compares 
with the standard one... ;-)

-Peter

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


Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Ravi Teja
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299412

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


Re: how to scrape url out of href

2006-01-02 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
 mike's code worked like a charm.  i have one more question.  i have an
 href which looks like this:
 
 td class=all
 a class=btn name=D1 href=http://www.cnn.com;
 /a
 
 i thought i would use this code to get the href out but it fails, gives
 me a keyerror:
 
 for incident in row('td', {'class':'all'}):
   n = incident.findNextSibling('a', {'class': 'btn'})
   link = incident.findNextSibling['href'] + ','
 
 
 any idea what i'm doing wrong here with the syntax?  thanks in advance
 

ISTM that a class=btn is a child of td, not a sibling, and 
findNextSibling is a method, not an indexable element. Try
   n = incident('a', {'class': 'btn'})
   link = n['href'] + ','

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


Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Tim N. van der Leeuw
Isn't it much easier to figure out how python built-in module 'zipfile'
works?

Pseudo-code would be something like:

#UNTESTED
import zipfile
import os
import os.path

zf = zipfile.ZipFile('myzipfilename.zip', 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk('compressthisdir'):
for f in riles:
fullname = os.join(root, f)
zf.write(fullname)
zf.close()


Cheers,

--Tim

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


Re: Re.'Compressing folders in Windows using Python'

2006-01-02 Thread Tim N. van der Leeuw
Using gzip means you can compress only 1 file per gzip; so you'll have
to invent something like tar to put all your files in your directories
together into 1 file and then apply gzip on that file to get it
compressed...

Using the zipfile module should allow you to create a standard
winzip-compatible archive that puts all files directly into 1
compressed archive.

cheers,

--Tim

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


Productivity and Quality of IDE

2006-01-02 Thread Claudio Grondi

In todays posting
   Any wing2.0 users here?
I found in the sentence
   What can you say about this IDE? He say's 'if I think it could 
improve my productivity he's willing to buy it for me.

the indirect question:

Can a better Python IDE increase programmers productivity?

 From my experience as (part-time) programmer I would tell, that the 
actual productivity depends heavily on so many other things, that it 
makes the IDE the last one in the chain of factors behind productivity.

What is your opinion?

Does the answer differ when coming from a programming team manager or 
from a programmer himself?

If you are a Python software house manager, would you buy me the WingIDE 
(a single OS license for Wing IDE Pro is $179 and a dual OS license is 
$295) if I were working for you as a Python programmer or would you 
point me to freeware solutions instead? Or would you expect me to buy it 
myself as I should be interested to increase my productivity myself?

What IDE do the professional Python programmer teams behind Python 
Software Foundation use?

And the most interesting question:

   Which Python programming environment uses Guido van Rossum ???


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


Re: Any wing2.0 users here?

2006-01-02 Thread RunLevelZero
I think it's one of the best myself. I littel laggy on windows but you
get use to it. Just my .02

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


HELP! on wxPython Error

2006-01-02 Thread Suranga Sarukkali
Hello, I'm Sam and I've been under som trouble with using wxPython
that when I try to execute code containing wxPython gui programs
provided with wxPython geting started sample progams it's giving a
error but when I type the code to the shell prompt it works fine. Is
it beacus I'm on windows or will I have to download again? or is it
else. Please answer my deeply troblesome question replying to me at
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Sort dictionary

2006-01-02 Thread Markus Franz
Hi!

I have:

x = {'a':3, 'b':2, 'c':4}

How can I sort x by value? (I tried using sorted() with x.items() - but I
didn't get a dictionary as response.)

My second question:
How can I reduce the dictionary to 2 items (so delete everything after the
first two items)

Thanks in advance.

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


Re: Sort dictionary

2006-01-02 Thread Claudio Grondi
Markus Franz wrote:
 Hi!
 
 I have:
 
 x = {'a':3, 'b':2, 'c':4}
 
 How can I sort x by value? (I tried using sorted() with x.items() - but I
 didn't get a dictionary as response.)
 
 My second question:
 How can I reduce the dictionary to 2 items (so delete everything after the
 first two items)
 
 Thanks in advance.
 
 Best regards,
 Markus

See my reply in de.comp.lang.python

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


ActiveX parameters

2006-01-02 Thread g.franzkowiak
Hello everybody,

my little problem resurfaced together with COM.
The generated .py file contains the following function:

def showApplication(self, show=defaultNameNotOptArg):
return self._oleobj_.InvokeTypes(...,show)

The value for show (defaultNameNotOptArg) must be True|False.
I read in Mark Hammonds book the part over python objects and VARAIANT
types. There is True|False the the way for translation to VT_BOOL.

Now I use myOCX.showApplication(False)... but nothing, I can see the
application anyime ?
I tried it with ctypes and ctypes.c_short(False) but the same :-(

If I use functions without parameters or functions with string parameter
 from the generated .py file, then is the sequence as expected.

Can anybody explain my mistake ?

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


Re: Productivity and Quality of IDE

2006-01-02 Thread Daniel J. Rubin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I say it entirely depends on what your programming.  For instance, if
creating a GUI, there is no question that a well developed high quality
IDE is a huge help -- from the point of view of stub generation and code
completion, as well as the GUI designer.

Conversly, if I'm writing a daemon or other text program, it matters
less.  Code completion, syntax verification, and the like is still
useful (hence I use Eclipse -- but others do as well), but not nearly as
mandatory as it would be with other developments.

Dan

Claudio Grondi wrote:
 
 In todays posting
   Any wing2.0 users here?
 I found in the sentence
   What can you say about this IDE? He say's 'if I think it could
 improve my productivity he's willing to buy it for me.
 
 the indirect question:
 
 Can a better Python IDE increase programmers productivity?
 
 From my experience as (part-time) programmer I would tell, that the
 actual productivity depends heavily on so many other things, that it
 makes the IDE the last one in the chain of factors behind productivity.
 
 What is your opinion?
 
 Does the answer differ when coming from a programming team manager or
 from a programmer himself?
 
 If you are a Python software house manager, would you buy me the WingIDE
 (a single OS license for Wing IDE Pro is $179 and a dual OS license is
 $295) if I were working for you as a Python programmer or would you
 point me to freeware solutions instead? Or would you expect me to buy it
 myself as I should be interested to increase my productivity myself?
 
 What IDE do the professional Python programmer teams behind Python
 Software Foundation use?
 
 And the most interesting question:
 
   Which Python programming environment uses Guido van Rossum ???
 
 
 Claudio

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDuVrVxR8T9cTCOI0RApO1AKDErYia76nsMgoXMpY3YKOG70STqACbBWY5
PLt4cWe19CgvMdRxQo64Q6w=
=wVl8
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hypergeometric distribution

2006-01-02 Thread Scott David Daniels
Raven wrote:
 ...
 def main():
   t = time.time()
   for i in range(1000):
 r = hypergeometric(6,6,30,6)
   print time.time() - t
 
   t = time.time()
   for i in range(1000):
 r = hypergeometric_gamma(6,6,30,6)
   print time.time() - t
 
 and the result is:
 
 0.0386447906494
 0.192448139191
 
 The first approach is faster so I think I will adopt it.
 

You should really look into the timeit module -- you'll get nice
solid timings slightly easier to tweak.
Imagine something like:

 import timeit
 ...
 t0 = timeit.Timer(stmt='f(6, 6, 30, 6)',
setup='from __main__ import hypergeometric as f')
 t1 = timeit.Timer(stmt='f(6, 6, 30, 6)',
setup='from __main__ import hypergeometric_gamma as f')

 repetitions = 1   # Gross under-estimate of needed repetitions
 while t0.timeit(repetitions)  .25:   # .25 = minimum Secs per round
 repetitions *= 10
 print 'Going for %s repetitions' % repetitions
 print 'hypergeometric:', t0.repeat(3, repetitions)
 print 'hypergeometric_gamma:', t1.repeat(3, repetitions)

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONDOCS

2006-01-02 Thread Peter Hansen
J. D. Leach wrote:
 I'm lost. Surely I've missed something simple.

Maybe you can look in the source.  help is an object defined by 
site.py to be a Helper object from pydoc.py.  Look in your Python lib 
folder for pydoc.py and you should be able to trace through and find the 
source of the problem.  You can probably insert some print statements, 
or maybe use import pdb; pdb.set_trace or some such approach.

-Peter

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


important for me!!

2006-01-02 Thread aysun ergin
Question:
write a word jumble game. the program will read a word from a file of words, 
scramble the order of letters of the word, print the scrambled word, ask the 
user to make a guess, congratulate the user if she/he was able to correctly 
figure out the word, and repeat this process until the file runs out of 
words. (Hint:you can use ramdom.shufflefunction to scramble the letters)

Please can you answer this problem?

thanks...
Aysun


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


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

2006-01-02 Thread Alex Martelli
Ilias Lazaridis [EMAIL PROTECTED] wrote:
   ...
  ... or equivalent (I do believe all I named have at least a Bachelor
  degree, but with the undisputable results they've shown afterwards, I
  think they'd all meet the or equivalent clause anyway).
 
* BS or MS in Computer Science or equivalent (PhD a plus). 
 
 This referes to an _academic_ degree.

Ah, I see.  It depends on the job; for example,
http://www.google.com/support/jobs/bin/answer.py?answer=23641 phrases
the requirement in a more explicit way:

* BS in Computer Science or equivalent experience.

so it's obvious that instead of the academic degree equivalent
experience is accepted, while other job offers are very specific in
requiring SOME degree.  I had always taken the shorter or equivalent
as standing for the same concept, or equivalent experience, as is
spelled out for some jobs, rather than like, say,
http://www.google.com/support/jobs/bin/answer.py?answer=23604 which is
very specific about requiring:

* A BS degree in mechanical, electrical or industrial technology.

 Very few companies make an explicit statement about non-academic applicants.
 
 It seems Google does not.

It seems we do, for some but not all of our job openings -- that or
equivalent experience being the key, where it appears (and, in my
personal opinion the shorter or equivalent not being poles apart - but
that's a separate issue of interpretation).

Of course, a candidate who's not already a legal resident of the country
where they want to work may face other issues, visa-related ones, that
are not decided by Google but rather by governments and legislatures of
the various countries involved.  I know I did have, among other things,
to document my academic history to the satisfaction of the US Government
(not of Google;-) to obtain my visa, once Google had extended me an
offer, and I believe that getting a visa would have been an even bigger
hassle if I did not have a degree (still, it's _possible_: my compatriot
Roberto Benigni does not have an academic degree, yet he did manage to
get visas to come collect his Oscar prizes, act in Jarmusch's Coffe and
Cigarettes, and so on;-).

 Mr. Martinelli, you seem to know python.
  
  Sorry, that's a brand of sparking apple cider.  I get my name mispelled
  that way often enough, since I moved to the US, to have become quite
  sensitive about it!-)  In MY name, there is no in...
 
 Mr. Martelli, I apologize for naming you like an soft-drink.

Thanks: if I have to get mis-spelled, I prefer the alternate
mis-spelling Martel, which at least refers to a potable cognac!-)

  re: #LIMITATION: automated get/set methods via var-name not available
  see the 'property' built-in.
 
 Can you (or some reader) sent (or fill in) the relevant code?

# within file talker.py, class Talker: (take care of indentations)

def __init__(self):
self.name = '' 
self.age = 0 

def setName(self, value):
self.name = value

def getName(self):
return self.name

def setAge(self, value):
self.age = value

def getAge(self):
return self.age

zName = property(getName, setName)
zAge = property(getAge, setAge)

Normally, we would name the properties just 'name' and 'age' (and pick
different names for the internal attributes, such as '_name' and
'_age'), but in this case you're already using the plain names for the
attributes, so I've made up different varnames for the properties.

At any rate, with this class definition,
john.zName = 'John Doe Python'
john.zAge = 19
perform the calls to setName and setAge respectively.


  prints Class Definition (methods, fields), without code
  LIMITATION: no direct access on object-model-level
  not sure what you mean, but maybe see the 'inspect' module.
 
 = Clas Definition is not accessible via MetaClasses
 (possible workaround: inspect module)

You can surely define a custom metaclass with methods that call
inspect.whatever, or directly perform whatever introspection you
require; it just seems strange to me to put this functionality in the
metaclass.  At any rate, SOME code will need to execute to perform this
task, so without code cannot be accomplished.  (Looking at your
evaluation of Ruby I note there's a LOT of code for this corresponding
case, indeed through inspect, despite the 'without code' specification).

Depending on what exactly you mean here, a simple dir() may in fact
suffice.  For example:

 class Foo(object):
...   def __init__(self): self.zap=23
...   def zapper(self): return self.zap
... 
 f=Foo()
 dir(f)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__',
'zap', 'zapper']

The issues are obvious: you only get the names ('zap' and 'zapper' are
both just names here, no immediate 

Re: PYTHONDOCS

2006-01-02 Thread Peter Otten
J. D. Leach wrote:

 found online. However, neither of my Python installations (2.4
 in /usr/bin/, and 2.4.2 in /usr/local/bin/) recognize the existence of the
 html docs. The following error from within the Python shell yields the
 same result:

 Then when I enter the os.environ.get('PYTHONDOCS') method, the following
 is produced:
 
 os.environ.get('PYTHONDOCS')
 '/usr/share/doc/python-2.4/html'
 help('if')
 
 ...Sorry, topic and keyword blah, blah, blah. No inline info
 available...blah, blah, bite me dolt...
 
 I'm lost. Surely I've missed something simple.
 Thank you for your time and sorry about the long post. I just wanted to
 document in detail what is going on.
 
 J. D. Leach

What do you get if you do

 import pydoc
 pydoc.help.docdir
'/should/be/path/to/docs'

I believe there is a bug in the documentation-finding code. With the current
logic PYTHONDOCS will only be honoured if none of the following directories
exist:

$PYTHONHOME/lib
(sys.executable)/doc/lib
/usr/doc/python-docs-2.4.2/lib
/usr/doc/python-2.4.2/lib
/usr/doc/python-docs-2.4/lib
/usr/doc/python-2.4/lib
(sys.prefix)/Resources/English.lproj/Documentation/lib

I think (untested) the proper fix would be an extra break

--- pydoc.py2006-01-02 18:54:04.870404232 +0100
+++ pydoc1.py   2006-01-02 18:54:30.440516984 +0100
@@ -1635,6 +1635,7 @@
 os.path.join(sys.prefix,
'Resources/English.lproj/Documentation')]:
 if dir and os.path.isdir(os.path.join(dir, 'lib')):
 self.docdir = dir
+break

 def __repr__(self):
 if inspect.stack()[1][3] == '?':

Consider filing a bug report.

Peter

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


Groupkit and python

2006-01-02 Thread [EMAIL PROTECTED]
Hi,
I've built an app using this great software called groupkit
(http://www.groupkit.org/) based on tcl/tk language, now I'd like to
test python possibilities for groupware.  Anyone knows about this, I
have made a google search; crossing groupkit and python, but I haven´t
found any project except this one called twisted-python.  Do you
believe twisted-python could be a substitute for groupkit?.

thx,
jrpm

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


Re: important for me!!

2006-01-02 Thread Gary Herron
aysun ergin wrote:

Question:
write a word jumble game. the program will read a word from a file of words, 
scramble the order of letters of the word, print the scrambled word, ask the 
user to make a guess, congratulate the user if she/he was able to correctly 
figure out the word, and repeat this process until the file runs out of 
words. (Hint:you can use ramdom.shufflefunction to scramble the letters)

Please can you answer this problem?
  

This sounds like a school assignment. We make it a habit here to *not* 
answer such questions.

Sorry, and good luck with your studies.

Gary Herron

thanks...
Aysun


  


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


Re: important for me!!

2006-01-02 Thread Bas
Read this first:
http://www.catb.org/~esr/faqs/smart-questions.html
and then try again.

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


application and web app technologies

2006-01-02 Thread cartercc
January, 2006.

I do not intend to start any kind of flame war, but only to seek advice
about different technologies concerning which I am mostly ignorant.

I am the database manager for a unit of a major state university. A
part of my job includes building database access and web enabled
applications for student services, faculty, and staff. These include
both information gathering applications and dynamic updates from our
big database to other applications. About 90 percent of our current
programming is in Perl. Of the rest, some is in ColdFusion, some is in
VB6, and we may have snippets in other languages. I might add that our
WWW pages are all in ColdFusion, which we like very much and have no
interest in changing.

I have been tasked by me IT department with investigating different
technologies for what will be a total rewrite and major update of our
applications. The problem with Perl is that it seems dowdy and old
fashioned, and that we never really investigate alternatives. We just
fell into Perl because that's what people knew. Also, we have had some
staff changes, and updating Perl code, some of which is years old,  has
proved to be a real nightmare. Perl works great! ... but trying to read
and modify someone else's code, or even your own, is pretty darn tough.

A real important part of this is database connectivity. We use a number
of different databases, Access, SQL Server, Datatel (the big University
DB), PostgreSQL (my favorite), MySQL, and a couple of others.

Here is where we currently are:

 * Java/JSP -- We have already made the decision to go with Java, but
we haven't started with it, and have not committed to Java.
 * Python -- Some of us have had limited experience with Python.
 * Ruby -- We have a Ruby advocate here, but no one knows anything
about it.
 * .NET/ASP -- We have a MS shop, I think that we have two UNIX servers
out of several dozen, and we are pretty firmly committed to Windows,
but no one is real excited about .NET, and the chances that we will
choose .NET seem real remote. Are there any advantages to using .NET?
 * OO Perl/Perl6 -- Perl has worked real well for us, but we have
doubts that it is the best technology, and we want to make a serious
attempt to look at other things.
 * C/C++ -- I mention this only because this is what IT uses. We have
no interest in C/C++, unless it really is the best.

We want something that we can use across the board, from web apps to
sys admin (which is why ColdFusion is not a candidate). I'm not
interested in advocacy, but if anyone has experience in and compare
these technologies, we would be grateful for your experiences.

My apologies for cross posting, I don't do it often, but I'd like to
reach as wide an audience as possible.

CC

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


Re: generators in Java?

2006-01-02 Thread Dave Benjamin
On Fri, 30 Dec 2005, Tom Sheffler wrote:

 Does Java have generators?  I am aware of the Iterator interface,
 but it seems much more restrictive.  Python generators are useful
 for many more things than simply list enumeration, but the Java
 Iterator seems limited.

What makes you think that Java's Iterators are more restrictive or 
limited? As far as I understand, Java's hasNext/next protocol is 
essentially the same as Python's next/StopIteration protocol. The main 
advantage of the use of generators is that, when converting from a 
callback-style or non-streaming function to one that produces values 
on-demand, you don't have to rewrite your function to save intermediate 
states (which can be a considerable amount of work).

A good explanation of the rationale for generators in Python is in the 
Motivation section of PEP 255:

http://www.python.org/peps/pep-0255.html

-- 
  .:[ dave benjamin: ramen/[spoomusic.com] ]:.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Productivity and Quality of IDE

2006-01-02 Thread [EMAIL PROTECTED]
Daniel J. Rubin wrote:
 I say it entirely depends on what your programming.  For instance, if
 creating a GUI, there is no question that a well developed high quality
 IDE is a huge help -- from the point of view of stub generation and code
 completion, as well as the GUI designer.

Most non-IDE users still use GUI designers and other tools (and many
standalone programmer's editors had code completion long before Eclipse
existed).  I've had no problem using unintegraded gui designers to
build large GUIs.  I fail to see how bundling it in a package with my
editor and debugger would make it more productive.

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


About zipfile on WinXP

2006-01-02 Thread rzed
I create a zip file on my WinXP system, using this function:

fn
import zipfile
import os
import os.path

def zipdir(dirname, zfname):
zf = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk(dirname):
for f in files:
fullname = os.path.join(root, f)
zf.write(fullname)
zf.close()
/fn

The file is created, and, again using zipfile, I can read it and 
extract from it and so on. 

However, WinXP has a feature (if that's what it is): if you click 
on a zip file in explorer, an explorer window opens that shows the 
contents of the zip file. If I use WinZip or UltimateZip to create 
the files, this works more-or-less okay, but when I click on the 
zip file Python creates, no content shows at all (just a blank 
explorer window). If I explicitly use one of the other zip-handling 
packages, I can view the python-created file's contents.

Has anyone else observed this? If not, is there something in the 
code that I should change to permit XP to view the contents? 

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


multidimensional array of objects in scipy core

2006-01-02 Thread Stormslayer
Folks: How do you create a multidimesional array of objects w/ the size
of the array entered at runtime?  So basically, for an arbitrary class,
create an array and then *.resize it to be of size NXM, and then
populate the elements of the objects.

thanks for any help.
Scott

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


Re: application and web app technologies

2006-01-02 Thread Reinder Verlinde
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] wrote:

 January, 2006.
 
 I do not intend to start any kind of flame war, but only to seek advice
 about different technologies concerning which I am mostly ignorant.
 [...]
 I have been tasked by me IT department with investigating different
 technologies for what will be a total rewrite and major update of our
 applications.

From your post, it is not clear what these applications do. That may 
hugely influence any advice you can get.

For instance: if you are running weather simulations on your back end, 
Fortran and C would probably be good choices for part of your system. If 
you are mostly running static web pages, your choice of CMS will 
probably have more impact than your choice of scripting language.

Moreover, you do not tell who will do the maintenance on these systems. 
If it is IT, the choice might move towards C/C++ or a C/C++-like 
scripting language.

 [...]
 The problem with Perl is that it seems dowdy and oldfashioned,

Never dismiss anything because it 'seems' bad. Your 'seems 
old-fashioned' is someone else's 'proven technology'. You should work on 
objectifying this statement (because I am not a Perl fan, I expect that 
this will be possible).

 A real important part of this is database connectivity. We use a number
 of different databases, Access, SQL Server, Datatel (the big University
 DB), PostgreSQL (my favorite), MySQL, and a couple of others.

Any decent scripting language will be able to connect to most, if not 
all, of these.

  * Java/JSP -- We have already made the decision to go with Java, but
 we haven't started with it, and have not committed to Java.

If your 'deciding to' does not imply commitment, you have larger 
problems then choosing a technology.

  * Ruby -- We have a Ruby advocate here, but no one knows anything
 about it.

Never trust an advocate who knows nothing about the thing (s)he 
advocates.

However, you should really take a look at Ruby on Rails 
(www.rubyonrails.org). It is both good under the hood, and well-marketed 
(check out some of the videos)

  * C/C++ -- I mention this only because this is what IT uses. We have
 no interest in C/C++, unless it really is the best.

If your web apps contain stuff that needs high performance and is CPU 
bound, you should keep these in as a language. Calling C/C++ code from 
any decent scripting language is easy. Also, if you need commitment from 
IT, choosing a less than best language may be a good idea.

Having said that, as far as I know, there are good reasons C and C++ are 
not really popular for the development of web applications.

 We want something that we can use across the board, from web apps to
 sys admin

Why would you? programming languages all have their strengths and 
weaknesses. Good programmers will be able to choose a midway path 
between standardisation on a single language and using the best language 
for every task.

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


Why is 'None' not assignable but 'True'/'False' are?

2006-01-02 Thread Rodney Maxwell
In Python 2.4.1:

 None = 99
SyntaxError: assignment to None
 True = 99
 False = 99
 True == False
True
---
So why is 'None' special?

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


Re: Python or Java or maybe PHP?

2006-01-02 Thread Alex Martelli
Peter Hansen [EMAIL PROTECTED] wrote:

 Alex Martelli wrote:
  One great programming principle is Dont' Repeat Yourself: when you're
  having to express the same thing over and over, there IS something
  wrong.  I believe the DYR phrasing is due to the so-called Pragmatic
  Programmers, who are paladins of Ruby, but I also believe it's a
  principle most experienced programmers could accept.
 
 Shall we assume DYR == Do You Ruby? ?  wink

Heh, I _did_ mean DRY of course;-)


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


Re: Why is 'None' not assignable but 'True'/'False' are?

2006-01-02 Thread Alex Martelli
Rodney Maxwell [EMAIL PROTECTED] wrote:

 In Python 2.4.1:
 
  None = 99
 SyntaxError: assignment to None
  True = 99
  False = 99
  True == False
 True
 ---
 So why is 'None' special?

A legacy/backwards compatibility issue: None has been there 'forever',
so that no sensible code ever had any business assigning to it; but
'False' and 'True' were introduced just a few years ago, and it was
important to not break sensible existing code doing something like

True = 1
False = 0

at the very start.  In Python 3.0, when backwards compatibilities can be
introduced, True and False will become keywords (as will None); see
http://www.python.org/peps/pep-3000.html.


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


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

2006-01-02 Thread Jaap Spies
Alex Martelli wrote:
 Anton Vredegoor [EMAIL PROTECTED] wrote:
...
 
only hire people with long backstabbing histories.

Such as...? Guido van Rossum?  Greg Stein?  Vint Cerf?  Ben Goodger?
 
...
 
No insider information is necessary, the job requirements make it
absolutely clear (at least to me) that Google is a company with an
elitist culture,
 
 
 Absolutely yes, in terms of who we want to work at Google:  we DO want
 GREAT people.  And we don't keep this a secret, either: right up there
 at http://www.google.com/jobs/, we say our strategy is simple: we
 hire great people.  Rather than hiring a LOT of people, we prefer to be
 extremely, obsessively selective, and try to hire ONLY a few people,
 ones who we can convince ourselves do deserve that adjective, great.
 
 This does mean that we definitely tend err on the side of caution, and
 FAIL to hire some people who are also great, just because we can't
 determine with sufficient certainty that they indeed are -- I've seen
 this happen more than once, and deeply regret it (for both Google and
 the person), but I have no idea how we could do better without relaxing
 our extremely elitist standards (we do debate these issues internally
 all of the time, trying to do better, but have found no magic wand yet).
 
 But this has nothing to do with only people with backstabbing
 histories, which looks like an unsupported, generalized insult.
 
 
just like most universities. In fact I am convinced
that universities (and this time I have extensive, first person and
historic information) are elitist.
 
 
 No doubt they try to be, mostly (except where governments or other
 institutions twist their arms to force them to admit huge masses of
 students), but I've met many people with advanced degrees from even the
 best/most elitist universities, such as Stanford or MIT, where it sure
 looked to me as if the university's attempts to only graduate the very
 best have definitely failed.
 
 
We can discuss that if you want but to me it's appararent that *titles*
are a strong indication of elitism. Further more I am convinced that
 
 
 Requiring a certain title for a job is mostly a desperate attempt to
 reduce the huge amount of work and effort it takes to hire great people,
 whittling down the number of resumes to be considered divided by the
 number of hires from the high thousands to the low hundreds.  If there
 were available infinite resources for the job of hiring/selection, we
 could easily interview, say, 6000 candidates for a post, giving each a
 week or so of concentrated attention to probe their abilities; alas,
 this would require about 120 person-years from our people for the
 selection process.  So, if nobody at Google did ANYTHING BUT interview
 candidates, given that we have a bit over 5000 employees now, we could
 hire in the course of 2006 another 40 or so, without doing anything
 else.  (The numbers are all off the top of my head, but I think they may
 be roughly the right orders of magnitude).
 
 This is just impractical: we need to hire many more than 40, AND cannot
 afford to have all existing employees do nothing but select new ones.
 So, we need to shrink the ratio drastically, on both factors: say 10
 instead of 40 hours of selection per candidate, and 50 rather than 6000
 candidates being considered per post.  So we perform selection in
 stages, and most candidates out of those many thousands-per-job are
 weeded out at the very first stage, e.g. by failing to meet specific
 qualifications.
 
 I wish that, as you say, titles were indeed strong indications of
 excellence.  Unfortunately, they aren't, but in some cases they're
 better than nothing.  Many of our job descriptions, as I pointed out in
 another post on this thread, say BS or equivalent experience or words
 to that effect; if you can show the or equivalent, and can get past
 the first hurdle, then that title is the least of the issues.  For
 example, if we advertised a job requiring PhD or equivalent, and among
 the candidates were Bill Gates, Larry Page, and Sergey Brin, none of
 whom has obtained a PhD to the best of my knowledge, they would surely
 be able to display the or equivalent based on their accomplishments
 and experience, and thus get past that first hurdle.
 
 
 
uses to discredit paranormal phenomena. For example, careers are
construed because scientific success is credited to persons higher in
the hierarchy and mistakes are the faults of research assistents or
students. Only if this system breaks down we see reports of scientific
 
 
 Can you show that happening for Guido van Rossum, for example, or Greg
 Stein?  What hierarchy were they in, to enable them, as you're
 accusing, to take credit for accomplishments that are not their own, and
 deflect blame to poor maligned underlings?
 
 You've made a very specific and insulting claim about Google hiring only
 people with long histories of backstabbing, and yet it appears that
 you're failing to substantiate it.  

Re: Humane programmer interfaces

2006-01-02 Thread Alex Martelli
Andrew Durdin [EMAIL PROTECTED] wrote:

 On 29 Dec 2005 09:50:57 -0800, colinwb [EMAIL PROTECTED] wrote:
 
   puts ck.first, ck[0], '*', ck.last, ck[-1]
 
 One of the points at issue (minimalism/monotony) relates to TOOWTDI,
 which has implications for language/module design and for code
 readability. Ruby supports negative indices in the same way as Python,
 so why add .last as an alias for [-1]? It's just added mental baggage.

In this particular case, it can be opined that it's more readable to
code goo.last than goo[-1].  For an analogy, consider, in Python,
somestr.startswith('glab') as a more readable equivalent of
somestr[:4]=='glab' -- the why add? question is easily answered,
although it's of course possible to disagree with the specific decision
made in each and every single case in which the same functionality is
provided in two distinct ways.

Python has a LOT of cases in which you can get the same functionality in
distinct ways, and not all of them are judged to fall afoul of the
there should ideally be only one way principle.  Operations that have
to do with slicing of sequences are a substantial class of this added
mental baggage, and not just for strings' endswith and startswith
methods.  Consider, for example:

del somelist[start:finish]
somelist[start:finish] = []

exactly identical semantics.  Or:

somelist.extend(another)
somelist[len(somelist):] = another

or (for suitable values of i, only):

somelist.insert(i, blah)
somelist[i-1:i] = [blah]

or

acopy = somelist[:]
acopy = list(somelist)

In each case, one could argue that the named alternative (del, extend,
insert, list, ...) is more readable; but the slice-based alternative is
also provided because slicing is such a powerful and general tool, and
when you're computing the slice's boundaries at runtime it's precious.

So, I don't think it would violate the spirit of Python to have
somelist.last mean the same as somelist[-1], e.g.:

class listwithlast(list):
def getLast(self): return self[-1]
def setLast(self, value): self[-1] = value
last = property(getLast, setLast)

Such tradeoffs need to be decided case by case, and, in Python, they
have been -- e.g., there's no somelist.getodd() synonym for
somelist[::2], for example;-).  I think the myriad specific decisions
and trade-offs may be disputed (and it's not impossible that a strong
enough case can be made for one more such synonym, so that a PEP
proposing it might in theory be accepted for a future Python version),
but essentially only on a case by case basis (it's good to keep in mind
principles such as all other things being equal it's better to have one
way than more than one, of course, while taking such decisions).

I do draw the line at foo.size being defined as identical to foo.length,
which I personally classify as a design error (I don't think Python is
exempt from design errors at this minute level, either -- e.g., the
method name 'setdefault' is murky, though I can't propose a better one,
and the existence of both pop and popitem in dictionaries appears to
cause more confusion than benefit, where it might have sufficed to make
pop's argument optional if one wanted popitem's functionality).

 And if you think .last is significantly more readable or convenient
 than [-1], why not add .secondlast ?  And .first, and .second ?   With
 one simple, obvious, general interface, these special cases only add
 unneeded complexity.

first and last make sense (though it's debatable whether they should
exist or not, it's not obvious that they're design errors, not at all);
second, penultimate, and other variations, would be gilding the lily.
Just like startswith and endswith may (debatably) make sense, but, say,
hasrightinthemiddle would be surely inappropriate;-)


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


Re: application and web app technologies

2006-01-02 Thread Matt Garrish

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 January, 2006.

 * OO Perl/Perl6 -- Perl has worked real well for us, but we have
 doubts that it is the best technology, and we want to make a serious
 attempt to look at other things.

It might help if you elaborated on what these doubts are. It doesn't sound 
like you know any of the languages you've listed and are hoping that somehow 
you'll find one magical beast by cross-posting to a bunch of groups. I don't 
expect you're going to have much luck.

The fact that you list Perl 6 shows you aren't following Perl's development 
very closely. Perl 6 is not on the near horizon, and even as an avid Perl 
enthusiast I'd say you'd have to be insane to jump on it for production use 
as soon as it is.

That said, Perl is still one of the best choices for both Web and admin 
scripting, and I don't see that you'd gain anything by rewriting all of your 
existing code to Ruby or Python just for the sake of saying you now use Ruby 
or Python (not that there's anything wrong with either, but why rewrite code 
for the sake of rewriting it?). If you wrote terrible and unreadable Perl 
code, what's really going to stop you from writing terrible and unreadable 
Ruby and Python code? That's more a statement on your programmers and lack 
of in-house style than the language.

C# isn't too bad for Web scripting and quick GUIs, but I've never used it 
for admin scripting and the downside is that it takes a lot of effort to do 
tasks in .Net that are simple in Perl/Python/Ruby (particularly database 
work). I wouldn't use C/C++ for the web, but there's nothing stopping you.

Matt 


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


Re: HELP! on wxPython Error

2006-01-02 Thread stelki
Hello, you smell.

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


Re: Python or Java or maybe PHP?

2006-01-02 Thread Cameron Laird
In article [EMAIL PROTECTED],
Alex Martelli [EMAIL PROTECTED] wrote:
.
[much valuable and
correct detail that
somehow managed to 
avoid mentioning
Forth or Smalltalk]
.
.
Despite the many differences of detail (mostly, though not exclusively,
details of syntax sugar), I consider Ruby and Python to be essentially
equivalent *as languages*, so I would suggest you choose on a strictly
pragmatical basis -- quality of framework and library, execution speed,
tools, books, third-party extensions, c.  I see it as a tribute to both
.
.
.
I think it's worth repeating, Alex, a point you've made in the
past, and that tangentially supports your elided example about
c = d unless ...:  it's possible to distinguish Python from
Ruby in another way.  Python is arguably better for group work,
or at least more standard for team projects, because it more
consistently exposes one correct solution, while Ruby both 
admits more stylistic variation, *and* encourages construction
of novel control structures.
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter Scrollbar not working

2006-01-02 Thread Dustan
I'm trying to get a scrollbar bound with a Frame, and I keep on getting
a scrollbar, but it doesn't actually scroll. Some help, please?

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


Re: PYTHONDOCS

2006-01-02 Thread J. D. Leach
Peter Otten wrote:

 What do you get if you do
 
 import pydoc
 pydoc.help.docdir
 '/should/be/path/to/docs'

The response is:
import pydoc
print pydoc.help.docdir
None


Obviously not there.

 
 I believe there is a bug in the documentation-finding code. With the
 current logic PYTHONDOCS will only be honoured if none of the following
 directories exist:
 
 $PYTHONHOME/lib
 (sys.executable)/doc/lib
 /usr/doc/python-docs-2.4.2/lib
 /usr/doc/python-2.4.2/lib
 /usr/doc/python-docs-2.4/lib
 /usr/doc/python-2.4/lib
 (sys.prefix)/Resources/English.lproj/Documentation/lib
 
 I think (untested) the proper fix would be an extra break
 
 --- pydoc.py2006-01-02 18:54:04.870404232 +0100
 +++ pydoc1.py   2006-01-02 18:54:30.440516984 +0100
 @@ -1635,6 +1635,7 @@
  os.path.join(sys.prefix,
 'Resources/English.lproj/Documentation')]:
  if dir and os.path.isdir(os.path.join(dir, 'lib')):
  self.docdir = dir
 +break
 
  def __repr__(self):
  if inspect.stack()[1][3] == '?':
 
 Consider filing a bug report.
 
 Peter

I believe you are right, a bug report is probably warranted here.

-- 
J. D. Leach
Columbus, Indiana USA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Scrollbar not working

2006-01-02 Thread Dustan
BTW, experience tells me it is necessary for me to explicitly state
that I'm a newbie (otherwise I get rude people saying I should already
know such-and-such).

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


OOP: method overriding works in mysterious ways?

2006-01-02 Thread John M. Gabriele
Consider the following:

#!/usr/bin/python

#-
class Grand_parent( object ):

 def speak( self ):
 print 'Grand_parent.speak()'
 self.advise()

 def advise( self ):
 print 'Grand_parent.advise()'
 self.critique()

 def critique( self ):
 print 'Grand_parent.critique()'


#-
class Parent( Grand_parent ):

 def speak( self ):
 print '\tParent.speak()'
 self.advise()

 def advise( self ):
 print '\tParent.advise()'
 self.critique()

 # ATM, the Parent is at a loss for words, and has no critique.


#-
class Child( Parent ):

 def speak( self ):
 print '\t\tChild.speak()'
 self.advise()

 # Currently, the Child has no really useful advice to give.

 def critique( self ):
 print '\t\tChild.critique()'


#-
print 'speak() calls advise(), then advise() calls critique().'
print

people = [ Grand_parent(), Parent(), Child() ]
for person in people:
 person.speak()
 print




The output is:

speak() calls advise(), then advise() calls critique().

Grand_parent.speak()
Grand_parent.advise()
Grand_parent.critique()

 Parent.speak()
 Parent.advise()
Grand_parent.critique()

 Child.speak()
 Parent.advise()
 Child.critique()


What's going on here with that last Child.critique()? The
Parent called self.critique(), and since it *had* no critique()
method, it should've deferred to it's parent's critique()
method, right? But instead, somehow Child.critique() got called.
Why?

---J

-- 
(remove zeez if demunging email address)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread Dustan
Parent.critique() is calling self.critique(), which has been overriden
by Child.critique() instead of Parent.critique. It makes perfect sense
to me.

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


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread Dustan
Oh, I see what you mean. From my experience, the methods are passed
down, not referred to from the parent. That is, Parent does have its
own critique method, not a reference to Grand_parent.critique(). So
when Child calls self.advise, it is calling its inherrited copy. Then,
since the inherited Child.advise() from Parent.advise() calls
self.critique, it calls it's own overriden critique method.

I hope this makes sense.

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


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread André
John M. Gabriele wrote:
 Consider the following:

[snip]

 #-
 class Parent( Grand_parent ):

  def speak( self ):
  print '\tParent.speak()'
  self.advise()

  def advise( self ):
  print '\tParent.advise()'
  self.critique()

  # ATM, the Parent is at a loss for words, and has no critique.


 #-
 class Child( Parent ):

  def speak( self ):
  print '\t\tChild.speak()'
  self.advise()

  # Currently, the Child has no really useful advice to give.

  def critique( self ):
  print '\t\tChild.critique()'



Since Child has no advice() method, it inherits the one for Parent.
Thus, Child can be thought of as being defined as follows:

. class Child( Parent ):
.
.  def speak( self ):
.  print '\t\tChild.speak()'
.  self.advise()
.
.  def advise( self ):   # inherited from Parent
.  print '\tParent.advise()'
.  self.critique()
.
.  def critique( self ):
.  print '\t\tChild.critique()'
.
Note that self refer to the *instance* created, not the *class*.

 print 'speak() calls advise(), then advise() calls critique().'
 print

 people = [ Grand_parent(), Parent(), Child() ]
 for person in people:
  person.speak()   ### calls the instance's relevant method
  print

[snip]

  Child.speak()
  Parent.advise()   #inherited from Parent
  Child.critique()
 
 

Now, does the output make sense?

André

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


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread Dustan
 it calls it's own overriden critique method

(overriden meaning the one that did the overriding)

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


Re: Python or Java or maybe PHP?

2006-01-02 Thread Alex Martelli
Cameron Laird [EMAIL PROTECTED] wrote:
   ...
 c = d unless ...:  it's possible to distinguish Python from
 Ruby in another way.  Python is arguably better for group work,
 or at least more standard for team projects, because it more
 consistently exposes one correct solution, while Ruby both 
 admits more stylistic variation, *and* encourages construction
 of novel control structures.

Arguably, yes; but in the end any team (or firm working as a set of
fluid teams) that really wants such uniformity (and, it _should_;-),
can't rely on just the language, but must supplement it with an internal
coding style guide.  It will supplement Python's rules by (say) PEP 8
and more rigid choices about capitalization of names (such guidance
about capitalization IS embedded in Ruby, btw -- one aspect where Ruby
promotes uniformity more than Python does); it will supplement Ruby's
rules by similar sets of style constraints.  You can construct novel
control structures with Python's generators (particularly in 2.5, with
the already-accepted enrichments of generator functionality) just as you
can in Ruby by passing blocks to methods; whether you DO so on a routine
basis (rather than, say, in a few specific common modules that are
collectively accepted and maintained by the whole team or firm) does not
depend so much on the language, as on the team's/firm's central
collective coordination.  (Much the same, in spades, could be said of
macros in Common Lisp, of course).

Yes, Python has a cultural, community value of uniformity -- that may
make it easier to convince Python enthusiasts of the need to agree
collectively on strict coding-style standards, compared to doing the
same convincing on enthusiasts of languages whose cultural values
include enthusiastic, exhuberant acceptance of individual variation.
But I do not think that such cultural and philosophical differences as
they apply to a whole community are more than a secondary factor in
determining the culture and philosophy of a specific team, or firm...


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


Re: Any wing2.0 users here?

2006-01-02 Thread Jarek Zgoda
Alvin A. Delagon napisał(a):

 emacs has been my long time companion for php, perl, and python. My boss
 recommended to me Wing2.0, I find it hard to adjust though. What can you
 say about this IDE? He say's if I think it could improve my productivity
 he's willing to buy it for me. Suggestions  for better python IDE's are
 welcome! Thanks in advance! ^_^

Never used any IDE for a long time with Python, as any of them lacked
the thing I would be willing to spend $$$ for. I couldn't go for Java
without Eclipse's debugger, but I am happy to write Python code without
debugger. Strange, isn't?

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: important for me!!

2006-01-02 Thread superfun
Aysun,

out of curiousity: where do you go to school?  is your
teacher/professor making use of Python? what class is this for?

I agree with previous posters, and I'm not trying to get you in
trouble. I'm just curious.

-Mark

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


Re: PYTHONDOCS

2006-01-02 Thread Peter Otten
J. D. Leach wrote:

 The response is:
import pydoc
print pydoc.help.docdir
 None

 
 Obviously not there.

You are getting no match rather than the wrong one. Have you verified that a
subdirectory

/usr/share/doc/python-2.4/html/lib

exists on your system? If not, the documentation may not be properly
installed.

Peter

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


Work with Windows workgroups under Python?

2006-01-02 Thread Karlo Lozovina
I'm running Python 2.4 under WinXP Pro, and I would like to do some basis 
operations on my LAN - get list of workgroups, list the computers in each 
workgroup and possibly connect to specific computer and get 
share/directory list? Is there some Pythonic way of doing this? Or any 
other less Pythonic way?

Thanks...

-- 
 ___Karlo Lozovina - Mosor
|   |   |.-.-. web: http://www.mosor.net || ICQ#: 10667163
|   ||  _  |  _  | Parce mihi domine quia Dalmata sum.
|__|_|__||_|_|
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About zipfile on WinXP

2006-01-02 Thread Scott David Daniels
rzed wrote:
 I create a zip file on my WinXP system, using this function:
 ... 
 However, WinXP has a feature (if that's what it is): if you click 
 on a zip file in explorer, an explorer window opens that shows the 
 contents of the zip file. If I use WinZip or UltimateZip to create 
 the files, this works more-or-less okay, but when I click on the 
 zip file Python creates, no content shows at all (just a blank 
 explorer window). If I explicitly use one of the other zip-handling 
 packages, I can view the python-created file's contents.
 
 Has anyone else observed this? If not, is there something in the 
 code that I should change to permit XP to view the contents? 

Are you using a name like 'mumble.zip'?  Some identification goes
by extension.  Other possible tests include trying to make a minimal
zip with a tiny file in it.  compare both the binary contents of the
file and any attributes it get through the file system.

Here's an interesting experiment:

1) Make a zip file (original.zip) with one of the apps that works.
2) Run the following code:
 original = open('original.zip', 'rb')
 copy = open('copy.zip', 'wb')
 copy.write(original.read())
 original.close()
 copy.close()
3) Now see if copy.zip can be opened by clicking.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to scrape url out of href

2006-01-02 Thread [EMAIL PROTECTED]
hey ken thanks for writing.  when i try that i get told

KeyError: 'href'

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


Xah's Edu Corner: the bug-reporting attitude

2006-01-02 Thread Xah Lee
The Bug-Reporting Attitude

Xah Lee, 2005-02, 2006-01

People,

There is a common behavior among people in software geek forums, that
whenever a software is crashing or behaving badly, they respond by
“go file a bug report” as if it is the duty of software consumers.

When a software is ostensibly incorrect, and if it is likely in
connection to egregious irresponsibility as most software companies are
thru their irresponsible licensing, the thing one should not do is to
fawn up to their ass as in filing a bug report, and that is also the
least effective in correcting the software.

The common attitude of bug-reporting is one reason that contributed to
the tremendous egregious irresponsible fuckups in computer software
industry that each of us have to endure daily all the time. (e.g.
software A clashed, software B can't do this, C can't do that, D i
don't know how to use, E download location broken, F i need to join
discussion group to find a work-around, G is all pretty and
dysfunctional... )

When a software is ostensibly incorrect and when the organization
behind it is irresponsible with its licensing, the most effective and
moral attitude is to do legal harm to the legal entity. This one can do
by filing a law suit or spreading the fact. Filing a law suit is
appropriate in severe and serious cases, and provided you have such
devotion to the cause. For most cases, we should just spread the fact.
When the organization sees facts flying about its incompetence or
irresponsibility, it will immediately mend the problem source, or cease
to exist.

Another harm sprang from the fucking bug-reporting attitude rampant
among IT morons is the multiplication of pop-ups that bug users for
bug-reporting, complete with their privacy legalese infomercial
intrusion.

2006-01 Addendum

• In early 2005 or late 2004, OS X's Safari browser contains a button
on the top right that is use to send bugs to Apple. As late as 2006-01
in Safari 2.0.2, one can turn on the send bug button by right clicking
on the toolbar. (screenshot).

• In about 2004-2005, every Mac OS X's tool bar has a Quality
Feedback button for user to report problems and suggestions to Apple.
Mac fanatics are fanatical about reporting bugs back to Apple.

• In 2004-2005, the Adium multi-chat client for OS X will popup a
dialogue box whenever it crashes, and ask the user whether if he wishes
to report the bug.

• In 2005, Microsoft Windows XP will popup a dialogue box when a
program crashed, and will ask the user about whether she want to report
it back to Microsoft.

• In 2005, the Open Sourced Netscape/FireFox browser will auto-start
a separate bug-report program whenever it crashed, and will bother the
user about whether to report the bug.

Much of these harassment come with technical notices and or privacy
legalese, that assures the user nothing personal is being sent or
collected. Some will also contain an option to turn this
user-contribution auto-solicitation off for good, but not all.

These bug-reporting phenomenon didn't start until early 21st century.
Such direct user intrusion was unknown or unthinkable in 1990s. Part of
the reason of their rise can be attributed by a few factors: (1) the
mainstreaming of the internet. (2) The collectivism and fanaticism
ushered by Open Sourcers. (3) The fanaticism ushered by Mac fanatics.
Group (2) and (3) are largely incompatible, but each lives in their
utopian vision.


This post is archived at:
http://www.xahlee.org/UnixResource_dir/writ/bug_report_attitude.html

 Xah
 [EMAIL PROTECTED]
 ∑ http://xahlee.org/

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

Re: how to scrape url out of href

2006-01-02 Thread [EMAIL PROTECTED]
actuall the full error is this:


  File /home/felafela/BeautifulSoup.py, line 301, in __getitem__
return self._getAttrMap()[key]
KeyError: 'href'

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


Re: Hypergeometric distribution

2006-01-02 Thread Bengt Richter
On 2 Jan 2006 03:35:33 -0800, Raven [EMAIL PROTECTED] wrote:
[...]

The problem with long integers is that to calculate the hypergeometric
I need to do float division and multiplication because integer division
returns 0. A solution could be to calculate log(Long_Factorial_Integer)

ISTM you wouldn't get zero if you scaled by 10**significant_digits (however many
you require) before dividing. E.g., expected hits per trillion (or septillion 
or whatever)
expresses probability too. Perhaps that could work in your calculation?

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


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread Scott David Daniels
Dustan wrote:
  From my experience, the methods are passed
 down, not referred to from the parent. That is, Parent does have its
 own critique method, not a reference to Grand_parent.critique(). 
This is typical of static binding as (for example) seen in C++.  If you
think of dynamically bound systems like Smalltalk, Ruby, and Python, the
more unusual case is wanting to go up the hierarchy (where you use super
to get the behavior you are apparently expecting).  Think of Python's
method dispatch as always being virtual.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Spiritual Programming (OT, but Python-inspired)

2006-01-02 Thread UrsusMaximus
While preparing a Python411 podcast about classes and OOP, my mind
wondered far afield. I found myself constructing an extended metaphor
or analogy between the way programs are organized and certain
philosophical ideas. So, going where my better angels dare not, here is
the forbidden fruit of my noodling:

Spiritual Programming:

It seems to me that, if anything of a person survives death in any way,
it must do so in some way very different from that way in which we
exist now.

For now, we live in a  temporal world, and once our body and brain
ceases to function, then our mind can no longer function in this
temporal world, and we cease to exist in this temporal world

So, our current consciousness and awareness is a temporal one. We
experience the one way flow of time. We are not actually conscious of
any permanent thing, only of the changing world as time flows forward.

In this sense, we are like the ghost in the machine of a computer
system running a computer program, or programs, written in a procedural
language and style. That is, the instructions in our program flow in a
linear sequence, with each instruction impacting and giving way to the
next instruction. Oh, there are the occasional looping structures, and
even the occasional out-of-left-field chaos causing go-to; but we
nevertheless experience all these things as linear and procedural.

It seems apparent to me that , if anything of us survives it must do so
outside time, and any surviving consciousness could not experience the
same sort of temporal, linear, procedural existence of which we are now
aware. Oh, I can imagine a timeless essence of our being existing
timelessly but statically, observing the remnant of our informational
holes evolving and dissolving away in the temporal universe; but this
would be a cold survival after all, hardly worthy of the name.

But perhaps there is a non-temporal world of eternity, that has
structures more reminiscent of higher order programming structures. So,
for instance, functional programming takes and builds upon its
procedural predecessors. So maybe our better, more re-useable parts,
that we develop in this temporal existence, are recycled into
functional units in a non-temporal world. There would still be a
direction of logic flow, but it would be a higher order reality than a
linear, procedural one.

But beyond this perhaps we can imagine an object oriented world, one in
which the more functional, re-useable parts of people and things from
this lower, temporal world are re-packaged into objects containing both
functional methods and also parameters of state. These higher order
objects, and the relationships they form amongst themselves, can be
imagined to exist in a more timeless state than mere procedural
programs, or even functional ones, in that the complex object oriented
structures of such a timeless world would hold meaning even when viewed
as a whole, and not just when played linearly like a phonograph record.


There must be some higher order cognate of time, in this object
oriented world, but we are not able to conceive of it at this time. Our
awareness of existence in this higher order world would be very
different than our current awareness of linearly flowing time, but must
be more in the way of sensing the movements of meaning and
relationships amongst the informational matrices of this higher order,
object oriented universe.

One can visualize a universe in which there are are an infinite number
of infinite dimensions, but these dimensions also keep expanding at an
infinite rate forever. This expansion could be thought of as the
cognate of time. Entities in this world could freely move back and
forth in any dimension, and could experience the totality of reality
all at once, but still experience the novelty of time.

I do not know how Aspect Oriented Programming fits into this picture,
if at all. But one can imagine higher orders of programming logic and
structure than  OOP, whether AOP qualifies or some other, yet
undescribed programing paradigm.  And, we do not know how many higher
layers of programming structure exist  beyond our current technical
understanding.

Perhaps this is one reason why programmers are so passionate, and even
religious, about their programming tools; because they intuitively
sense that we are dealing with ideas that, however crudely, mirror
eternal realities of immense significance.

Ron Stephens
a href=http://www.awaretek.com/python/index.html;Python411 Podcast
Series/a

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


Re: Sort dictionary

2006-01-02 Thread Luis M. González
This function return a tuple of value-key pairs, sorted by value:

 x = {'a':3, 'b':2, 'c':4}
 def sortByValue(myDict):
return sorted( [(v,k) for k,v in myDict.items()] )

If you want to get the first two value-key pairs:

 sortByValue(x)[:2]
[(2, 'b'), (3, 'a')]

Hope this helps...
Luis

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


Re: Sort dictionary

2006-01-02 Thread Luis M. González
This function returns a tuple of value-key pairs, sorted by value:

 x = {'a':3, 'b':2, 'c':4}
 def sortByValue(myDict):
return sorted( [(v,k) for k,v in myDict.items()] )

If you want to get the first two value-key pairs:
 sortByValue(x)[:2]
[(2, 'b'), (3, 'a')]

Hope this helps...
Luis

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


Re: Spiritual Programming (OT, but Python-inspired)

2006-01-02 Thread Claudio Grondi
There are many ways of going crazy, but the most valuable of them is 
this one which makes a genius out of an ordinary man.

Claudio

[EMAIL PROTECTED] wrote:
 While preparing a Python411 podcast about classes and OOP, my mind
 wondered far afield. I found myself constructing an extended metaphor
 or analogy between the way programs are organized and certain
 philosophical ideas. So, going where my better angels dare not, here is
 the forbidden fruit of my noodling:
 
 Spiritual Programming:
 
 It seems to me that, if anything of a person survives death in any way,
 it must do so in some way very different from that way in which we
 exist now.
 
 For now, we live in a  temporal world, and once our body and brain
 ceases to function, then our mind can no longer function in this
 temporal world, and we cease to exist in this temporal world
 
 So, our current consciousness and awareness is a temporal one. We
 experience the one way flow of time. We are not actually conscious of
 any permanent thing, only of the changing world as time flows forward.
 
 In this sense, we are like the ghost in the machine of a computer
 system running a computer program, or programs, written in a procedural
 language and style. That is, the instructions in our program flow in a
 linear sequence, with each instruction impacting and giving way to the
 next instruction. Oh, there are the occasional looping structures, and
 even the occasional out-of-left-field chaos causing go-to; but we
 nevertheless experience all these things as linear and procedural.
 
 It seems apparent to me that , if anything of us survives it must do so
 outside time, and any surviving consciousness could not experience the
 same sort of temporal, linear, procedural existence of which we are now
 aware. Oh, I can imagine a timeless essence of our being existing
 timelessly but statically, observing the remnant of our informational
 holes evolving and dissolving away in the temporal universe; but this
 would be a cold survival after all, hardly worthy of the name.
 
 But perhaps there is a non-temporal world of eternity, that has
 structures more reminiscent of higher order programming structures. So,
 for instance, functional programming takes and builds upon its
 procedural predecessors. So maybe our better, more re-useable parts,
 that we develop in this temporal existence, are recycled into
 functional units in a non-temporal world. There would still be a
 direction of logic flow, but it would be a higher order reality than a
 linear, procedural one.
 
 But beyond this perhaps we can imagine an object oriented world, one in
 which the more functional, re-useable parts of people and things from
 this lower, temporal world are re-packaged into objects containing both
 functional methods and also parameters of state. These higher order
 objects, and the relationships they form amongst themselves, can be
 imagined to exist in a more timeless state than mere procedural
 programs, or even functional ones, in that the complex object oriented
 structures of such a timeless world would hold meaning even when viewed
 as a whole, and not just when played linearly like a phonograph record.
 
 
 There must be some higher order cognate of time, in this object
 oriented world, but we are not able to conceive of it at this time. Our
 awareness of existence in this higher order world would be very
 different than our current awareness of linearly flowing time, but must
 be more in the way of sensing the movements of meaning and
 relationships amongst the informational matrices of this higher order,
 object oriented universe.
 
 One can visualize a universe in which there are are an infinite number
 of infinite dimensions, but these dimensions also keep expanding at an
 infinite rate forever. This expansion could be thought of as the
 cognate of time. Entities in this world could freely move back and
 forth in any dimension, and could experience the totality of reality
 all at once, but still experience the novelty of time.
 
 I do not know how Aspect Oriented Programming fits into this picture,
 if at all. But one can imagine higher orders of programming logic and
 structure than  OOP, whether AOP qualifies or some other, yet
 undescribed programing paradigm.  And, we do not know how many higher
 layers of programming structure exist  beyond our current technical
 understanding.
 
 Perhaps this is one reason why programmers are so passionate, and even
 religious, about their programming tools; because they intuitively
 sense that we are dealing with ideas that, however crudely, mirror
 eternal realities of immense significance.
 
 Ron Stephens
 a href=http://www.awaretek.com/python/index.html;Python411 Podcast
 Series/a
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any wing2.0 users here?

2006-01-02 Thread Claudio Grondi
Jarek Zgoda wrote:
 Alvin A. Delagon napisał(a):
 
 
emacs has been my long time companion for php, perl, and python. My boss
recommended to me Wing2.0, I find it hard to adjust though. What can you
say about this IDE? He say's if I think it could improve my productivity
he's willing to buy it for me. Suggestions  for better python IDE's are
welcome! Thanks in advance! ^_^
 
 
 Never used any IDE for a long time with Python, as any of them lacked
 the thing I would be willing to spend $$$ for. I couldn't go for Java
 without Eclipse's debugger, but I am happy to write Python code without
 debugger. Strange, isn't?
 
Not strange for me.

To be honest, the more experience I have, the less I can understand what 
a debugger is for. Can't even remember when used one last time. This is 
valid also for programming in C/C++ or Java, so in my eyes the 
Debugger? No, Thanks! is not limited only to Python or other script 
programming languages.

Any professional programmer here who were really missing something very 
important when forced to program without a sofisticated debugger?
If yes, could it be, that they program hardware driver or operating 
system kernels?

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


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

2006-01-02 Thread Martin P. Hellwig
Anton Vredegoor wrote:
cut description of modern western society
 
 Most people can survive (without damaging their souls so to speak) when
 working for corruption themselves in this way, but sooner or later one
 is asked to corrupt others (defending one's title during a promotion,
 leading a community and so on). This is the crucial point where
 corruption definitively occurs: where silence is not enough anymore to
 keep one employed.
 
 The human brain can withstand extreme amounts of conficting sensory
 data and still maintain a sense of continuity and order while from all
 sides things seem to fall apart. Such continuity is highly valuable
 because it is the only thing that keeps chaos at arms length. The same
 thing can be applied to whole societies (see for example the state
 American politics is in now). So that is the reason these kind of
 things normally are swept under the carpet.
 
 However for *me* personally, because I am deserted by my government,
 the university community, friends and family, and left to fend for
 myself, there is no pressing need to keep up the facade so I can
 finally see it for what it is.
 
Modern life has modern problem, well that isn't quite true, the problems 
are actually the same since the moment organisms began to group to 
enlarge their chance of survival.
The funny thing is that the problem, in its essentials, is still the 
same, how to enlarge the chance of survival, this time within the group.
En zie daar (pardon my dutch) we have created hierarchy and within 
that the problem of the individuals identity versus the groups identity, 
mix it with diplomacy and unreal friendship (the ones that are based 
on a persons status) and you got enough material to create Hollywood and 
everything that comes from it. If you add take one for the group you 
got yourself an action movie.

Now theory is all fine and dandy especially if its common sense but 
where does it leave us? Well most of the time, screwed, for the lack of 
a better word. But is it fair to negatively mark people because their 
personal identity for whatever reason fitted better to the common group 
identity? Sure it's bitter but don't be bitter about it, you know 
probably more then anybody else where that bitterness leads to.

What we can do about it? I have no clue, I'll just use that frustration 
to work on a personal project or making a song on my guitar, but YMMV 
;-). Perhaps being happy for somebody's else's luck is the key to ones 
own happiness, at least it works for me.

Now luckily where on the Internet where anybody can be anybody or not if 
they like to, at least everybody got a chance (not an equal one but 
still) to show what they are worth of. Perhaps you could too?

I wish you the best of wisdom and luck and I mean that most sincerely.
cut rest

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


indentation preservation/restoration

2006-01-02 Thread smichr
I have (inadvertently) wiped out the functionality of my personal
python snippets by eliminating leading space. I have also just visited
http://www.python.org/tim_one/000419.html and saw a piece of code with
the indentation gone. Python code is fragile in this regard. One
solution that occurs to me is that a indentation code could be
appended to a script which could be used to rebuild the script if
necessary. e.g. if we let letters represent the number of spaces before
a line and numbers to indicate how many lines have that spacing, then
A2E2A1 could represent the leading space on the code,

# A Hello Program
def hi():
msg = 'hello world!'
return msg
print hi()

If the line returns are gone (as they are at the url above) then this
wouldn't work and perhaps the number of characters on each line could
be encoded as well. I'm not sure what the best way to do that would be.


I'm not sure where the best time and place to add such a coding to file
would be, however. If you  do as I did to my library (anyone?) then
having the code placed at the bottom of the script as save time
wouldn't have helped in the recovery.  Placing the code with scripts
that are placed on the web or archived might be smart.

Any thoughts?

/c

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


Re: Any wing2.0 users here?

2006-01-02 Thread Jarek Zgoda
Claudio Grondi napisał(a):

 To be honest, the more experience I have, the less I can understand what
 a debugger is for. Can't even remember when used one last time. This is
 valid also for programming in C/C++ or Java, so in my eyes the
 Debugger? No, Thanks! is not limited only to Python or other script
 programming languages.
 
 Any professional programmer here who were really missing something very
 important when forced to program without a sofisticated debugger?
 If yes, could it be, that they program hardware driver or operating
 system kernels?

Nonono, interactive debuggers are very nice and helpful in most of
cases, such as in Java or C programs. I just didn't found any use for
interactive debugger with Python, so IDE's offer of interactive
debugger is no-op for me.

Anyway, I like Komodo and PyDev, only because they have nice project
management features (also available at no cost in jEdit and Kate). I
think, most of commercially available IDE's have something like that.

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Application architecture (long post - sorry)

2006-01-02 Thread Mike Meyer
[EMAIL PROTECTED] writes:

 In response to Mike's post...

 I know exactly where you're coming from and you are right a web based
 solution is the simplest and would be the fastest to develop and
 rollout etc. but..

 The cost is in the data, in the uk you get charged for the amount of
 data you send/receive  by GPRS and this data you are paying for would
 ideally be useful data and not the HTML to present it.

I'll take your word for it that you don't have GPRS providers in the
UK that have an all-you-can eat plan. They all do in the US.

However, HTML doesn't *have* to be the bloated crap that seems to be
produced by most designers - more more accurately, by the GUI tools
they use to produce HTML. Used properly, it can be a very sparse
encoding system. Not as good something designed for the data at hand,
and not as good a binary format, but not awful, either.

Further, you may be able to save bandwidth by putting some of the HTML
on the mobile device. For example, the form your field engineers fill
in to note that a job has been done could be kept on the PDA (assuming
it's static), and just opened in the browser, filled in, and
submitted. Palm did this with their PQA technology - a PQA was a set
of HTML files that were compiled into a representation their browser
understood.

Finally, if the data bandwidth is really a serious problem, you might
want to look into a solution at a different level. For instance, if
you're using a VPN to get to your internal network, some VPN
technologies include facilities to compress the data traveling across
the network. That will reduce the difference in bandwidth usage
between the various encoding formats you might consider.

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: Work with Windows workgroups under Python?

2006-01-02 Thread Jarek Zgoda
Karlo Lozovina napisał(a):

 I'm running Python 2.4 under WinXP Pro, and I would like to do some basis 
 operations on my LAN - get list of workgroups, list the computers in each 
 workgroup and possibly connect to specific computer and get 
 share/directory list? Is there some Pythonic way of doing this? Or any 
 other less Pythonic way?

You can get these things from ActiveDirectory. Google for that, there is
even wrapper module for querying AD server.

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: indentation preservation/restoration

2006-01-02 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
 I have (inadvertently) wiped out the functionality of my personal
 python snippets by eliminating leading space. I have also just visited
 http://www.python.org/tim_one/000419.html and saw a piece of code with
 the indentation gone. Python code is fragile in this regard. One
 solution that occurs to me is that a indentation code could be
 appended to a script which could be used to rebuild the script if
 necessary. e.g. if we let letters represent the number of spaces before
 a line and numbers to indicate how many lines have that spacing, then
 A2E2A1 could represent the leading space on the code,
 
 # A Hello Program
 def hi():
 msg = 'hello world!'
 return msg
 print hi()
 
 If the line returns are gone (as they are at the url above) then this
 wouldn't work and perhaps the number of characters on each line could
 be encoded as well. I'm not sure what the best way to do that would be.
 
 
 I'm not sure where the best time and place to add such a coding to file
 would be, however. If you  do as I did to my library (anyone?) then
 having the code placed at the bottom of the script as save time
 wouldn't have helped in the recovery.  Placing the code with scripts
 that are placed on the web or archived might be smart.
 
 Any thoughts?
 
 /c

Usually the problem can be solved by looking at the source code of an 
HTML page. The people programming Python are not always good 
Web-programmer and forget to put their code into textarea or pre tags in 
order to make the code pastable directly from the web page.

This seems also to be for the mentioned page the case. So go to see the 
source code of the HTML page in your editor and you will get the lost 
spaces.

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


Re: PyHtmlGUI Project is looking for developers

2006-01-02 Thread John J. Lee
Sybren Stuvel [EMAIL PROTECTED] writes:

 [EMAIL PROTECTED] enlightened us with:
  At the moment we don't work with javascript. But it should not be to
  hard to create a JavaScript Renderer similar to the css one we already
  have.
 
 Isn't CSS for rendering, and JavaScript for client-side scripting?

I guess this is 'rendering' in a more general/abstract sense than
'graphical rendering'.


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


Re: PYTHONDOCS

2006-01-02 Thread J. D. Leach
Peter Otten wrote:

 
 You are getting no match rather than the wrong one. Have you verified that
 a subdirectory
 
 /usr/share/doc/python-2.4/html/lib
 
 exists on your system? If not, the documentation may not be properly
 installed.
 
 Peter

I checked it Peter and rearranged the files in the python-2.4 directory
every which way absent deleting them, all to no avail. Interestingly, the
format and placement of the documentation was (before my modifications of
today) as originally installed when downloaded from python.org. I would
assume that they should have been in the correct order and directories when
initially installed.

-- 
J. D. Leach
Columbus, Indiana USA

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


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread John M. Gabriele
Scott David Daniels wrote:
 Dustan wrote:
 
  From my experience, the methods are passed
 down, not referred to from the parent. That is, Parent does have its
 own critique method, not a reference to Grand_parent.critique(). 
 
 This is typical of static binding as (for example) seen in C++.  If you
 think of dynamically bound systems like Smalltalk, Ruby, and Python, the
 more unusual case is wanting to go up the hierarchy (where you use super
 to get the behavior you are apparently expecting).  Think of Python's
 method dispatch as always being virtual.

Ah. Not only that, but the other ingredient (I think) is to keep in mind 
that you're always calling instance methods via the self object -- and 
that self object is always the same object regardless of how far up the 
inheritance tree you go with those method calls, right?

 --Scott David Daniels
 [EMAIL PROTECTED]

---J
-- 
(remove zeez if demunging email address)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread John M. Gabriele
Dustan wrote:
 [snip] That is, Parent does have its
 own critique method, not a reference to Grand_parent.critique().

Interesting. It has its own critique method? Hm. Not quite sure what 
that means exactly...

Anyhow, I wasn't suggesting that Parent had a reference to 
Grand_parent.critique(), only that Python would search *up* the tree 
looking for the method it's looking to call.

Thanks!

 So
 when Child calls self.advise, it is calling its inherrited copy. Then,
 since the inherited Child.advise() from Parent.advise() calls
 self.critique, it calls it's own overriden critique method.
 
 I hope this makes sense.
 


-- 
(remove zeez if demunging email address)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OOP: method overriding works in mysterious ways?

2006-01-02 Thread John M. Gabriele
André wrote:
 John M. Gabriele wrote:
 
 Since Child has no advice() method, it inherits the one for Parent.
 Thus, Child can be thought of as being defined as follows:
 
 . class Child( Parent ):
 .
 .  def speak( self ):
 .  print '\t\tChild.speak()'
 .  self.advise()
 .
 .  def advise( self ):   # inherited from Parent
 .  print '\tParent.advise()'
 .  self.critique()
 .
 .  def critique( self ):
 .  print '\t\tChild.critique()'
 .

That's a very interesting way to look at it... But I thought
that the Python interpreter takes care of walking up the
inheritance tree looking for the instance methods, rather
than what you've written above...

 Note that self refer to the *instance* created, not the *class*.

Thanks. Right -- the self object always refers to the object that
you originally used to call the instance method (here, speak()).

 
 Now, does the output make sense?
 
 André
 

Bearing in mind what self is referring to, then yes,
the output does make sense. Thanks. :)

---J

-- 
(remove zeez if demunging email address)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hypergeometric distribution

2006-01-02 Thread Raven
Scott David Daniels ha scritto:

 You should really look into the timeit module -- you'll get nice
 solid timings slightly easier to tweak.

This seems a very interesting module, I will give it a try as soon as
possible. Thanks Scott.
Ale

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


Bug ??

2006-01-02 Thread Eddy Ilg
Hi,

I have a class and I am trying to set the instance varirable 'variables'
(also tried different names). The variable gets initialized by
default-value parameter of the constructor. When I change the variable and
call the constructor again, the default value changes !!! Is this supposed
to happen? See code and example below:

class url:
def __init__(self,link,vars={}):
self.link=link
print vars:,vars
if hasattr(self,'vars'):
print self.variables:,self.variables
self.variables=vars
print self.variables:,self.variables

def set_var(self,name,value):
self.variables[name]=value


 from generator import url
 u=url('image')
vars: {}
self.variables: {}
 u.set_var('a',5)
 v=url('test')
vars: {'a': 5}
self.variables: {'a': 5}

See that 'vars' gets the old value of 'variables' passed? How can this be???
I am using python version 2.3.5

Eddy


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


Re: About zipfile on WinXP

2006-01-02 Thread Kent Johnson
rzed wrote:
 I create a zip file on my WinXP system, using this function:
 
 fn
 import zipfile
 import os
 import os.path
 
 def zipdir(dirname, zfname):
 zf = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
 for root, dirs, files in os.walk(dirname):
 for f in files:
 fullname = os.path.join(root, f)
 zf.write(fullname)
 zf.close()
 /fn
 
 The file is created, and, again using zipfile, I can read it and 
 extract from it and so on. 
 
 Has anyone else observed this? If not, is there something in the 
 code that I should change to permit XP to view the contents? 

A couple of guesses:

- If dirname is an absolute path then you are including the drive 
specifier in the path in the zip file. If dirname is a relative path 
with elements like '.' or '..' then you are including them in the zip. 
Try something like
   fullname = os.path.join(root, f)[len(dirname):]
to get relative paths in the zip

- WinZip puts empty entries for directories in the zip. Maybe WinXP 
requires these.

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


Re: Problem overriding sys.excepthook

2006-01-02 Thread Patrick Maupin
Lunchtimemama wrote:
 What is the superior method of exception handling:
...

For a start, note that the exception hook does not _really_ have to be
in the main module, just imported before any protected code is to be
executed.

Having said that, what I personally typically do for exception trapping
doesn't even require an exception hook.  I will execute all my code
from inside a try/except block in the main module.  If the exception is
invoked, you can query and get all the data about the exception like
you are currently doing, and then re-raise the exception (or not).

I haven't given too much thought to when I would set an exception hook.
 It seems like more of a debugger kind of thing.  Especially if you
have control over the entire app, a try/except at the top level feels
cleaner to me.

Regards,
Pat

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


Re: Xah's Edu Corner: the bug-reporting attitude

2006-01-02 Thread robic0
On 2 Jan 2006 13:16:26 -0800, Xah Lee [EMAIL PROTECTED] wrote:

The Bug-Reporting Attitude

Xah Lee, 2005-02, 2006-01

People,

There is a common behavior among people in software geek forums, that
whenever a software is crashing or behaving badly, they respond by
“go file a bug report” as if it is the duty of software consumers.

software found 3 x

When a software is ostensibly incorrect, and if it is likely in
connection to egregious irresponsibility as most software companies are
thru their irresponsible licensing, the thing one should not do is to
fawn up to their ass as in filing a bug report, and that is also the
least effective in correcting the software.

software 3x ...  companies 1 x

The common attitude of bug-reporting is one reason that contributed to
the tremendous egregious irresponsible fuckups in computer software
industry that each of us have to endure daily all the time. (e.g.
software A clashed, software B can't do this, C can't do that, D i
don't know how to use, E download location broken, F i need to join
discussion group to find a work-around, G is all pretty and
dysfunctional... )

software industry found 1 x

When a software is ostensibly incorrect and when the organization
behind it is irresponsible with its licensing, the most effective and
moral attitude is to do legal harm to the legal entity. This one can do
by filing a law suit or spreading the fact. Filing a law suit is
appropriate in severe and serious cases, and provided you have such
devotion to the cause. For most cases, we should just spread the fact.
When the organization sees facts flying about its incompetence or
irresponsibility, it will immediately mend the problem source, or cease
to exist.

software(1x)...organization(2x)
 
Another harm sprang from the fucking bug-reporting attitude rampant
among IT morons is the multiplication of pop-ups that bug users for
bug-reporting, complete with their privacy legalese infomercial
intrusion.

2006-01 Addendum


Since I work for a software industry, company, organization,
I thought I'd offer my 2 cents here.

The software industry/company/organization are run by
snake-oil salesmen/marketing who discard the programmers as fast
as they do bug reports. Given that, who do you think cuts out 
the problem parameters for the programmer? Think its a master
problem solver programmer/manager who is not influenced by 
marketing? Got a bright programmer who looks at the condition
then at the parameters for the fixes to implement who see's the
fallicy of the fix parameters. Why yes, yes you do. Well why
doesen't he jump up and down in the organization then?

Because his job hangs by a thread, with seasonal layoffs and
outsoursing, lessening pay/benifits, contract status, etc...
Contrary to popular belief the fixer has to research his part
of the code, and is forced to know more than what he is being 
tasked to do. The falicy is that he has control of it, he see's
the big picture fopa's but can't do a thing about it.

So you see, when you say software so many times, you imply the
programmer is at fault. For simple bugs that may be true, however
in the face of induced snake oil marketing induced CONCEPTUAL ERRORS,
well brother, what have I got to do to just get my next paycheck?

Imagine that software designed by snake-oil salesmaen/marketing,
comercial ad agencies, conceptual designers without proof-of-concept.

In todays world, the word software is a mis-nomer. Its not 
software anymore, its a concept of some dude on ACID !!!

Any questions?

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


Re: Hypergeometric distribution

2006-01-02 Thread Raven

Bengt Richter wrote:

 ISTM you wouldn't get zero if you scaled by 10**significant_digits (however 
 many
 you require) before dividing. E.g., expected hits per trillion (or septillion 
 or whatever)
 expresses probability too. Perhaps that could work in your calculation?

 Regards,
 Bengt Richter

Sorry Bengt but I can't figure out how to do it, can you give me an
example please? Thanks in advance.
Ale

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


Re: Hypergeometric distribution

2006-01-02 Thread Raven

Bengt Richter wrote:


 ISTM you wouldn't get zero if you scaled by 10**significant_digits (however 
 many
 you require) before dividing. E.g., expected hits per trillion (or septillion 
 or whatever)
 expresses probability too. Perhaps that could work in your calculation?

 Regards,
 Bengt Richter

Sorry but I can't figure out how to do it, can you give me an example
please? 
Thnx

Ale

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


Re: Application architecture (long post - sorry)

2006-01-02 Thread Frithiof Andreas Jensen

[EMAIL PROTECTED] skrev i en meddelelse 
news:[EMAIL PROTECTED]

 It would give me great satisfaction though to roll my own solution to
 this

Ahh - a bright young employee ready to meet the realities of corporate life, 
much like a bike rider meets the concrete he drives on ;-)

 and then at least prove the benefits to the company, even if just
 to convince them to purchase a system from a vendor, and even if that
 happens i will have learnt a lot in the process.


Company will not give a rats arse - really, they will not!!

Benefits to *management* is what this game is about; If the implementation 
provides management with good material for powerpoint slides that they can 
use to impress their betters and move up a notch then, obviously, some of 
the blessings will shine upon you too - if it causes management grief, then 
you will be made to suffer.

What can the project provide in the way of opportunity to Management? is 
what you should look into. Opportunity for company is in an entirely 
different stratosfhere. Mere employees shall not try to second-guess the 
Gods.

Bragging rights are allways good - but keeping the level of trouble below 
the upper layers of management attention level is a *much, much* better 
career move.  *I* would certainly go for the primitive, but almost 
certain-to-work, Web solution rather than being clever and having to deal 
with the weirdness on how f.ex. sockets happen to be implemented on the 
mobile device and the 2 year's to obsolensence of the hardware+os (Those 
mobile devices *are* in general proprietary and deviant from RFC standards 
in unpublished but painful ways).

I would also have some people that knows how to integrate with the existing 
Management Information System do it too. Usual business rules apply: ssume 
responsibility if it goes well, blame contractors if it does not. That sort 
of thing.

... Ignore the cost issue - if management think it is worth it to them 
they buy the project whatever the actual price or actual benefit - after 
all, it is only money for shareholders and tax people they spend anyway!!! 
And if they do not, then the work you do not have to do is the easiest.

 Thanks for your replies, they are much appreciated.


Nah - probably not (I am getting too old for this business and I *still* 
have 20 years to go ;-)
But in 20 years you will say the same. And whoever you say it to will go 
ahead with his own thing anyway. 


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


Re: Spiritual Programming (OT, but Python-inspired)

2006-01-02 Thread Steven D'Aprano
On Mon, 02 Jan 2006 13:38:47 -0800, UrsusMaximus wrote:

 It seems to me that, if anything of a person survives death in any way,
 it must do so in some way very different from that way in which we
 exist now.
[snip]

I don't dare ask where your evidence for this hypothesis is, but I will
ask what are your reasons for imagining this? What is the chain of thought
that leads from:

Step 1: We live in a temporal world.

to:

Step N: Our ghost/soul must therefore live in a timeless state.

?

Apart from wishful thinking of course. That's always the major component
in any reasoning about the afterlife. Life is a process, not a thing --
when a clock runs down and stops ticking, there is no essence of ticking
that keeps going, the gears just stop. When I stop walking, there is no
spirit of walk that survives me coming to a halt. I just stop walking.


-- 
Steven.

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


Re: PYTHONDOCS

2006-01-02 Thread Mike Meyer
J. D. Leach [EMAIL PROTECTED] writes:
 Mike Meyer wrote:
 Chris Smith [EMAIL PROTECTED] writes:
 J == J D Leach [EMAIL PROTECTED] writes:
 I'm stupider; I can't ATFQ for you.
 But last night I stayed at a Holiday Inn Express, and can recommend

 http://projects.edgewall.com/python-sidebar/
  
 Which, assuming you've got connectivity, is teh shiznit.
 
 Along the same lines, the OS X application launcher Butler comes
 pre-configured with a search python reference materials
 shortcut. I launch the shortcut, type in what I want,and hit enter,
 and a browser window opens displaying the results of the
 search. Adding other things - like searching the Python cookbook - is
 relatively easy.
 
mike

 Thanks Mike for the link.

To give credit where credit is due, Chris Smimth provided the link to
the sidebar. I didn't provide a link, but just mentioned a great
product that can be found at your favorite Mac software repository.

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: Bug ??

2006-01-02 Thread Brian van den Broek
Eddy Ilg said unto the world upon 02/01/06 05:43 PM:
 Hi,
 
 I have a class and I am trying to set the instance varirable 'variables'
 (also tried different names). The variable gets initialized by
 default-value parameter of the constructor. When I change the variable and
 call the constructor again, the default value changes !!! Is this supposed
 to happen? See code and example below:
 
 class url:
   def __init__(self,link,vars={}):
   self.link=link
   print vars:,vars
   if hasattr(self,'vars'):
   print self.variables:,self.variables
   self.variables=vars
   print self.variables:,self.variables
 
   def set_var(self,name,value):
   self.variables[name]=value
 
 
 
from generator import url
u=url('image')
 
 vars: {}
 self.variables: {}
 
u.set_var('a',5)
v=url('test')
 
 vars: {'a': 5}
 self.variables: {'a': 5}
 
 See that 'vars' gets the old value of 'variables' passed? How can this be???
 I am using python version 2.3.5
 
 Eddy

Visit 
http://www.python.org/doc/faq/general.html#why-are-default-values-shared-between-objects
 
and if that doesn't clear it up, ask again.

Best,

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


Re: indentation preservation/restoration

2006-01-02 Thread Steven D'Aprano
On Mon, 02 Jan 2006 14:19:15 -0800, smichr wrote:

 I have (inadvertently) wiped out the functionality of my personal
 python snippets by eliminating leading space. I have also just visited
 http://www.python.org/tim_one/000419.html and saw a piece of code with
 the indentation gone. Python code is fragile in this regard. One
 solution that occurs to me is that a indentation code could be
 appended to a script which could be used to rebuild the script if
 necessary. e.g. if we let letters represent the number of spaces before
 a line and numbers to indicate how many lines have that spacing, then
 A2E2A1 could represent the leading space on the code,

What a great idea! I had a similar problem, your scheme could be adapted
to solve that too. I accidentally deleted all the numeric literals from my
Python code, and Python is fragile in this regard. So we could have a
number code appended to a script which could be used to rebuild the
script if necessary: e.g. a code like E,D,CA means the fourth token of
the fifth line is 31.

With a little bit of work, this could be expanded to add redundancy for
not just indentation and numeric literals, but also string literals,
keywords, operators, and anything else. Using compression and
error-correcting codes should mean that your Python scripts will then be
safe from absolutely anything short of deleting the entire file -- and for
that, you have backups.



-- 
Steven.

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


Re: application and web app technologies

2006-01-02 Thread Roedy Green
On 2 Jan 2006 10:24:54 -0800, [EMAIL PROTECTED] wrote, quoted or
indirectly quoted someone who said :

 * Java/JSP -- We have already made the decision to go with Java, but
we haven't started with it, and have not committed to Java.
 * Python -- Some of us have had limited experience with Python.
 * Ruby -- We have a Ruby advocate here, but no one knows anything
about it.

In many shops, perhaps yours too, you are relying on volunteers.  The
problem is they suddenly disappear on you leaving no notes.   In that
situation, you want to push for as vanilla technology as possible so
that you have maximal chance the next guy will already be familiar
with the tools.

From that point of view Java is a nice choice, as is MySQL and JSP.
-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >