pyspread 0.0.7

2008-06-01 Thread Martin Manns
pyspread 0.0.7 has been released.

--

New features:
+ CSV import dialog with preview grid

Bug fixes:
+ setup.py now installs correctly into a sub-folder (tested for Linux
and WinXP).

--

About: 
pyspread is a spreadsheet that accepts a pure python expression in
each cell.

--

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python =2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

Best Regards

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

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


[ANN] Python Summer Courses 2008 in Germany

2008-06-01 Thread Mike Müller

I am pleased to announce Python courses in Germany this summer.

The courses will be in Leipzig, Germany from July 21 to 25, 2008.
(http://www.python-academy.com/courses/python_summer_course.html)

(1) Python for Programmers introduces Python to programmers without
or with little knowledge of Python. This course will be given on
July 21 and 22, 2008. For course details see:
http://www.python-academy.com/courses/python_course_programmers.html

(2) Python for Scientists and Engineers will be held from
July 23 -- 25, 2008. A detailed course outline can be found here:
http://www.python-academy.com/courses/python_course_scientists.html

Both courses can be booked individually or jointly.
Please register here:
http://www.python-academy.com/courses/dates.html

You can take advantage of being in Leipzig to attend the first
EuroSciPy conference on July 26 and 27, 2008. For more details see: 
http://www.scipy.org/EuroSciPy2008


Kind regards,
Mike Müller
(Course Instructor)

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

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


Re: The Importance of Terminology's Quality

2008-06-01 Thread szr
Arne Vajhøj wrote:
 szr wrote:
 Peter Duniho wrote:
 On Fri, 30 May 2008 22:40:03 -0700, szr [EMAIL PROTECTED]
 wrote:
 Arne Vajhøj wrote:
 Stephan Bour wrote:
 Lew wrote:
 } John Thingstad wrote:
 }  Perl is solidly based in the UNIX world on awk, sed, }  bash
 and C. I don't like the style, but many do.
 }
 } Please exclude the Java newsgroups from this discussion.

 Did it ever occur to you that you don't speak for entire news
 groups?
 Did it occur to you that there are nothing about Java in the
 above ?
 Looking at the original post, it doesn't appear to be about any
 specific language.
 Indeed.  That suggests it's probably off-topic in most, if not all,
 of the newsgroups to which it was posted, inasmuch as they exist for
 topics specific to a given programming language.

 Perhaps - comp.programming might of been a better place, but not all
 people who follow groups for specific languages follow a general
 group like that - but let me ask you something. What is it you
 really have against discussing topics with people of neighboring
 groups? Keep in mind you don't have to read anything you do not want
 to read. [1]

 I very much doubt that the original thread is relevant for the Java
 group.

 But the subthread Lew commente don was about Perl and Unix. That is
 clearly off topic.

I agree with and understand what you are saying in general, but still, 
isn't it possible that were are people in the java group (and others) 
who might of been following the thread, only to discover (probably not 
right away) that someone decided to remove the group they were reading 
the thread from? I know I would not like that, even if it wasn't on 
topic at the branch.

Personally, I find it very annoying to have to switch news groups in 
order to resume a thread and weed my way down the thread to where it 
left off before it was cut off from the previous group.
-- 
szr 


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

Re: Bring object 'out of' Class?

2008-06-01 Thread Arnaud Delobelle
dave [EMAIL PROTECTED] writes:

 Hello,

 I'm currently on the class section of my self-taught journey and have
 a question about classes:  is it possible to bring a object created
 inside the class definitions outside the class so it can be accessed
 in the interpreter?

 For example, right now I'm working (within Allen Downey's Python
 Programmer book) with creating a 'hand' of cards.  I want to be able
 to deal to 'x' amount of cards to 'x' amount of hands and then be able
 to manipulate those hands afterwards.  I'm not sure if even what I'm
 asking is possible or if I'm getting ahead of myself.

 As always, thanks for all your help.  My learning is greatly enhanced
 with everyone's input on this board.  Please feel free to
 comment/critique the code...

 Here is the section of code that deals hands (but doesn't do anything
 past that):

def deal_cards(self, num_of_hands, num):
'''deals x amount of cards(num) to each hand'''
for i in range(num_of_hands):
handname = Hand('hand%d' % i)
self.deal(handname, num)
print '%s' % (handname.label), '\n', handname, '\n'


You need to use a 'return' statement:

   def deal_cards(self, num_of_hands, num):
   '''deals x amount of cards(num) to each hand'''
   hands = []
   for i in range(num_of_hands):
   newhand = Hand('hand%d' % i)
   self.deal(newhand, num)
   hands.append(newhand)
   print '%s' % (handname.label), '\n', handname, '\n'
   return Hand


Then you can write:

 hands = deck.deal_cards(4, 5) # On fait une belotte?

And I don't see the need of defining 'Hand' inside 'Deck'.

HTH

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


Re: File browser in python gui

2008-06-01 Thread TheSaint
On 02:48, domenica 01 giugno 2008 TheSaint wrote:

 I'm gonna back to study a little

I'm facing tough time, I can't get clear by Trolltech's C++ examples.
I'm a bit puzzled :), I'd like to remain with the QT widget set, but hard
learning curve.
Other simplified developing TK are giving different widgets, I don't expect
to mix up :(

-- 
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Merging ordered lists

2008-06-01 Thread Raymond Hettinger
On May 31, 10:00 pm, etal [EMAIL PROTECTED] wrote:
 Here's an algorithm question: How should I efficiently merge a
 collection of mostly similar lists, with different lengths and
 arbitrary contents, while eliminating duplicates and preserving order
 as much as possible?

I would do it two steps.  There's a number of ways to merge depending
on whether everything is pulled into memory or not:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305269

After merging, the groupby itertool is good for removing duplicates:

   result = [k for k, g in groupby(imerge(*sources))]


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


Re: The Importance of Terminology's Quality

2008-06-01 Thread Peter Duniho

On Sat, 31 May 2008 23:27:35 -0700, szr [EMAIL PROTECTED] wrote:


[...]

But the subthread Lew commente don was about Perl and Unix. That is
clearly off topic.


I agree with and understand what you are saying in general, but still,
isn't it possible that were are people in the java group (and others)
who might of been following the thread, only to discover (probably not
right away) that someone decided to remove the group they were reading
the thread from? I know I would not like that, even if it wasn't on
topic at the branch.


All due respect, I don't really care if those people find the thread  
gone.  And no one should.


Each individual person has a wide variety of interests.  A thread that is  
off-topic in a newsgroup may in fact be concerning a topic of interest for  
someone who just happened to be reading that newsgroup.  The fact that  
that person might have been interested in it isn't justification for  
continuing the thread in that newsgroup.  The most important question  
isn't who might have been reading the thread, but rather whether the  
thread is on-topic.


What if someone cross-posted a thread about motorcycle racing in the Perl  
newsgroup as well as an actual motorcycle racing newsgroup?  No doubt, at  
least some people reading the Perl newsgroup have an interest in  
motorcycle racing.  They may in fact be racers themselves.  Those people  
may have found the thread about motorcycle racing interesting.


Does that justify the thread continuing to be cross-posted to the Perl  
newsgroup?  No, of course not.


So please.  Quit trying to justify a thread being cross-posted to a  
newsgroup that you aren't even reading just on the sole basis of the  
remote possibility that someone in that newsgroup was interested in the  
thread.  It's not a legitimate justification, and even if it were, there's  
been sufficient opportunity for someone here in the Java newsgroup to  
speak up and say hey, wait!  I was reading that!


But no one's said anything of the sort.  Those people who don't exist have  
no need for you to provide an irrelevant defense for them.



Personally, I find it very annoying to have to switch news groups in
order to resume a thread and weed my way down the thread to where it
left off before it was cut off from the previous group.


If people use the newsgroups responsibly, that never happens.

A thread should never be cut-off midstream like that unless it was  
inappropriately cross-posted in the first place, and if the thread was  
inappropriately cross-posted in the first place, no one has any business  
expecting to be able to continue reading it in any newsgroup where it's  
off-topic.


If you're interested in discussions on Perl and Unix, go read a newsgroup  
about Perl and/or Unix.  Don't look for those discussions in the Java  
newsgroup, and don't get comfy reading the thread in the Java newsgroup  
should you happen across it.  They don't belong, and they should be  
terminated within the Java newsgroup ASAP.  Go follow the thread where  
it's on-topic.


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


Re: The Importance of Terminology's Quality

2008-06-01 Thread szr
Peter Duniho wrote:
 On Sat, 31 May 2008 23:27:35 -0700, szr [EMAIL PROTECTED] wrote:

 [...]
 But the subthread Lew commente don was about Perl and Unix. That is
 clearly off topic.

 I agree with and understand what you are saying in general, but
 still, isn't it possible that were are people in the java group (and
 others) who might of been following the thread, only to discover
 (probably not right away) that someone decided to remove the group
 they were reading the thread from? I know I would not like that,
 even if it wasn't on topic at the branch.

 All due respect, I don't really care if those people find the thread
 gone.  And no one should.

I prefer to be considerate of others.

 Each individual person has a wide variety of interests.  A thread
 that is off-topic in a newsgroup may in fact be concerning a topic of
 interest for someone who just happened to be reading that newsgroup.

Well if a thread has absolutely no relation to a group, then yes, 
cross-posting to said group is inappropiate, and setting follow ups may 
well be warrented. But when there is some relation, sometimes it may be 
better to mark it as [OT] i nthe subject line, a practice that is 
sometimes seen, and seems to suffice.

 What if someone cross-posted a thread about motorcycle racing in the
 Perl newsgroup as well as an actual motorcycle racing newsgroup?

You are comparing apples and oranges now; sure, if you post about 
motorcycles (to use your example) it would be wildly off topic, but the 
thread in question was relating to programming (the naming of functions 
and such) in general.

 Does that justify the thread continuing to be cross-posted to the Perl
 newsgroup?  No, of course not.

but who decides this? And why does said individual get to decide for 
everyone?

 So please.  Quit trying to justify a thread being cross-posted to a
 newsgroup that you aren't even reading

You do not know what groups I read. And I am not attempting to justify 
cross posting at all. Rather I am arguing against deciding for a whole 
news group when a thread should be discontinued.

-- 
szr 


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


Re: Merging ordered lists

2008-06-01 Thread Peter Otten
etal wrote:

 Here's an algorithm question: How should I efficiently merge a
 collection of mostly similar lists, with different lengths and
 arbitrary contents, while eliminating duplicates and preserving order
 as much as possible?
 
 My code:
 
 def merge_to_unique(sources):
 Merge the unique elements from each list in sources into new
 list.
 
 Using the longest input list as a reference, merges in the
 elements from
 each of the smaller or equal-length lists, and removes duplicates.
 
 @return: Combined list of elements.
 
 sources.sort(None, len, True)# Descending length
 ref = sources[0]
 for src in sources[1:]:
 for i, s in enumerate(src):
 if s and (ref[i] != s) and s not in ref:
 ref.insert(ref.index(src[i-1])+1, s)
 # Remove duplicates
 return [r for i, r in enumerate(ref) if r and r not in ref[i+1:]]
 
 
 This comes up with using the CSV module's DictWriter class to merge a
 set (list, here) of not-quite-perfect CSV sources. The DictWriter
 constructor needs a list of field names so that it can convert
 dictionaries into rows of the CSV file it writes. Some of the input
 CSV files are missing columns, some might have extras -- all of this
 should be accepted, and the order of the columns in the merged file
 should match the order of the input files as much as possible (not
 alphabetical). All of the list elements are strings, in this case, but
 it would be nice if the function didn't require it.
 
 Speed actually isn't a problem yet; it might matter some day, but for
 now it's just an issue of conceptual aesthetics. Any suggestions?

#untested
import difflib

def _merge(a, b):
sm = difflib.SequenceMatcher(None, a, b)
for op, a1, a2, b1, b2 in sm.get_opcodes():
if op == insert:
yield b[b1:b2]
else:
yield a[a1:a2]

def merge(a, b):
return sum(_merge(a, b), [])

def merge_to_unique(sources):
return reduce(merge, sorted(sources, key=len, reverse=True))

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


Re: Merging ordered lists

2008-06-01 Thread MClaveau

Hi!

Use set (union).
Example:

   la=[2,1,3,5,4,6]
   lb=[2,8,6,4,12]

   #compact:
   print list(set(la).union(set(lb)))

   #detail:
   s1 = set(la)
   s2 = set(lb)
   s3 = s1.union(s2)
   print list(s3)


@-salutations

Michel Claveau


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


Re: SMS sending and receiving from website?

2008-06-01 Thread Benjamin Kaplan
On Fri, May 30, 2008 at 5:08 PM, globalrev [EMAIL PROTECTED] wrote:

 can i send and receive messages from a website using python?

 how would that work with costs? would the mobileowner pay both ways?
 --
 http://mail.python.org/mailman/listinfo/python-list


I believe that there is a way to use Django to send messages, but I've never
used it myself and I don't know about recieving messages.
--
http://mail.python.org/mailman/listinfo/python-list

Re: Merging ordered lists

2008-06-01 Thread Peter Otten
Peter Otten wrote:

 #untested

Already found two major blunders :(

# still untested
import difflib

def _merge(a, b):
sm = difflib.SequenceMatcher(None, a, b)
for op, a1, a2, b1, b2 in sm.get_opcodes():
if op == insert:
yield b[b1:b2]
elif op == replace:
yield a[a1:a2]
yield b[b1:b2]
else: # delete, equal
yield a[a1:a2]

def merge(a, b):
return sum(_merge(a, b), [])

def merge_to_unique(sources):
return unique(reduce(merge, sorted(sources, key=len, reverse=True)))

def unique(items):
u = set(items)
if len(u) == len(items):
return items
result = []
for item in items:
if item in u:
result.append(item)
u.remove(item)
return result


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


Re: Getting up and running with Python on a Mac

2008-06-01 Thread Tommy Nordgren


On 29 maj 2008, at 22.57, [EMAIL PROTECTED] wrote:


I've just bought an iMac (OS X 10.5.2, will almost immediately jump to
10.5.3), and am looking to install Python on it, and to use it with

There is no need to install Python. It's distributed with the system.


XCode, Apple's IDE. Some googling suggests that a number of people
have had trouble getting Python to run satisfactorily on their Macs.
This is my first Mac, and I'd appreciate some guidance on what to do
(and what not to) when installing Python and potential problems to
keep an eye open for. I want to do a fair bit of scientific /
numerical computing, so it would seem that SAGE ot the Enthought
Python distribution would seem to be the most relevant  - I'd
appreciate your guidance on getting Python to run on a Mac with a
particular focus on these two distributions.

Thank you in advance

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


--
What is a woman that you forsake her, and the hearth fire and the home  
acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the Dane  
women

Tommy Nordgren
[EMAIL PROTECTED]



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


Re: Merging ordered lists

2008-06-01 Thread M�ta-MCI (MVP)

Hi!

Use set (union).
Example:

   la=[2,1,3,5,4,6]
   lb=[2,8,6,4,12]

   #compact:
   print list(set(la).union(set(lb)))

   #detail:
   s1 = set(la)
   s2 = set(lb)
   s3 = s1.union(s2)
   print list(s3)


@-salutations

Michel Claveau

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


python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-01 Thread Alia Khouri
Can we open up the discussion here about how to improve setuptools
which has become the de facto standard for distributing / installing
python software. I've been playing around with ruby's gems which seems
to be more more mature and  usable.

From my perspective, the relative immaturity of setuptools and its
simultaneous widespread use is a clear python weakness and can make
python less easy to absorb than it should be.

A few questions (please add more) so far are:

(1) Should setuptools be standard?

(2) What bugs you most about the current featureset?

(3) Which features do you need the most (list in order of need)?

(4) Shouldn't we just port gems to python?

(5) What's the best community process to improve setuptools?

(6) What's your ideal conception of the 'standard python package
manager?


To give this discussion some ammunition, I will post the output of the
different '--help' for either tool:

==
SETUPTOOLS
==


C:\TMPeasy_install --help

Global options:
  --verbose (-v)  run verbosely (default)
  --quiet (-q)run quietly (turns verbosity off)
  --dry-run (-n)  don't actually do anything
  --help (-h) show detailed help message

Options for 'easy_install' command:
  --prefix   installation prefix
  --zip-ok (-z)  install package as a zipfile
  --multi-version (-m)   make apps have to require() a version
  --upgrade (-U) force upgrade (searches PyPI for
latest
 versions)
  --install-dir (-d) install package to DIR
  --script-dir (-s)  install scripts to DIR
  --exclude-scripts (-x) Don't install scripts
  --always-copy (-a) Copy all needed packages to install
dir
  --index-url (-i)   base URL of Python Package Index
  --find-links (-f)  additional URL(s) to search for
packages
  --delete-conflicting (-D)  no longer needed; don't use this
  --ignore-conflicts-at-my-risk  no longer needed; don't use this
  --build-directory (-b) download/extract/build in DIR; keep
the
 results
  --optimize (-O)also compile with optimization: -O1
for
 python -O, -O2 for python -OO,
and -O0 to
 disable [default: -O0]
  --record   filename in which to record list of
installed
 files
  --always-unzip (-Z)don't install as a zipfile, no matter
what
  --site-dirs (-S)   list of directories where .pth files
work
  --editable (-e)Install specified packages in
editable form
  --no-deps (-N) don't install dependencies
  --allow-hosts (-H) pattern(s) that hostnames must match
  --local-snapshots-ok (-l)  allow building eggs from local
checkouts

usage: easy_install-script.py [options] requirement_or_url ...
   or: easy_install-script.py --help

==
GEMS
==
C:\TMPgem --help

  RubyGems is a sophisticated package manager for Ruby.  This is a
  basic help message containing pointers to more information.

Usage:
  gem -h/--help
  gem -v/--version
  gem command [arguments...] [options...]

Examples:
  gem install rake
  gem list --local
  gem build package.gemspec
  gem help install

Further help:
  gem help commandslist all 'gem' commands
  gem help examplesshow some examples of usage
  gem help platforms   show information about platforms
  gem help COMMAND   show help on COMMAND
 (e.g. 'gem help install')
Further information:
  http://rubygems.rubyforge.org

C:\TMPgem help commands
GEM commands are:

build Build a gem from a gemspec
cert  Manage RubyGems certificates and signing
settings
check Check installed gems
cleanup   Clean up old versions of installed gems in the
local
  repository
contents  Display the contents of the installed gems
dependencyShow the dependencies of an installed gem
environment   Display information about the RubyGems
environment
fetch Download a gem and place it in the current
directory
generate_indexGenerates the index files for a gem server
directory
help  Provide help on the 'gem' command
install   Install a gem into the local repository
list  Display gems whose name starts with STRING
lock  Generate a lockdown list of gems
mirrorMirror a gem repository
outdated  Display all gems that need updates
pristine  Restores installed gems to 

Re: Good grid + calendar, etc.?

2008-06-01 Thread Gilles Ganault
On Sun, 1 Jun 2008 06:00:03 -0700 (PDT), Mike Driscoll
[EMAIL PROTECTED] wrote:
I recall that there is an advanced calendar widget that's been made by
one of the regulars on the wxPython list, but it's not a part of the
official distribution at this time. You'll have to ask about calendar
widgets and such there though.

The impression I get, is that those extra widgets (besides the usual
edit, listbox, etc.) aren't really developped/maintained, which is a
problem when comitting for applications that will have to be
developped for a few years.

For instance, is there a calendar in wxPython that has this look and
feel, and is under active development?
http://www.devexpress.com/Products/VCL/ExScheduler/

The grid can be quite advanced. Did you look at the wxPython demo? Or
Dabo?

Yes, but although the basic wigets are just fine, wxGrid looks a bit
like the basic TStringGrid in Delphi, ie. it's pretty basic so that
several vendors came up with enhanced alternatives. But maybe I
haven't played with it long enough.

www.asiplease.net/computing/delphi/images/string_grid_demo_popstars.gif

It lacks sorting capability, merging cells with the same content, etc.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Gilles Ganault
On Sun, 1 Jun 2008 21:59:29 +0900, Ryan Ginstrom
[EMAIL PROTECTED] wrote:
wxPython can be made to look pretty nice. Check out Chandler for an example.
http://chandlerproject.org/

Yup, they developped some nice-looking widgets, but it doesn't seem
like there's an ecosystem around wxWidgets. I, for one, wouldn't mind
paying for widgets missing from the stock version.

If you don't mind being Windows-only, there's another approach that I've
been working on.

Thanks for the idea, but I don't have the skills for something like
that :-) Besides, the reason for Python is to make it faster/easier to
write apps, so WTL + browser + COM seems too hard for me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Need Tutorial For the following lib

2008-06-01 Thread Gandalf
On Jun 1, 1:41 pm, Larry Bates [EMAIL PROTECTED] wrote:
 Gandalf wrote:
  Hi scott, you couldn't be more wrong about my laziness. I straggle
  with my poor English for hours to fined what I'm looking for.
  I found a very simple and not comprehensive tutorial for the pyWinAuto
  lib in this addresshttp://pywinauto.openqa.org/
  but it only show how to do the basic, and my knowledge at this point
  is not enough to figure the rest I need to know by myself
  I found another simple  lib for the watsup that based on winGuiAuto
  lib in this address
 http://www.tizmoi.net/watsup/intro.html
  But for some risen I couldn't manage to ran it in my computer

  I'm trying to generate auto mouse double click or auto selecting text
  (the selecting text part is the one I interest in. mouse double click
  just do the same effect if the mouse cursor is on text)

  I'm sorry you feel I'm lazy. The truth is that event writing this
  message takes me an enormous power.
  weather you choose to help me or not I still going to keep trying ,
  But you have the opportunity to save me lots of trouble, So maybe one
  day I could help others.

  so if you familiar with any good tutorial for this library please let
  me know and if not then thank you anyway for wonting to help

  Y.G

 What you want is an easy solution to what isn't an easy problem, but (as with
 your other post) you refuse to provide enough information to allow us to help
 you.  If I were you, I would download wxPython and go through the demos that 
 it
 includes.  comp.python.wxpython list is excellent (at least as good as this 
 one)
 for any follow-up questions.  Windows events and mouse clicks are going to 
 take
 a concerted effort (on your part) to learn (especially if you haven't
 accomplished such a task in another language).

 -Larry

Hi, Larry. thank you for your interaction.
I did manage to do half of the things I was asking you about them. I
manage to create an application which react to a mouse and keyboard
events that occur anywhere in the O.P (that done easily by the phHook
library here 
http://mindtrove.info/articles/monitoring-global-input-with-pyhook/#toc-references
)

And I manage to find lib which auto generate event
they event show you with video how simple it's to get done
http://pywinauto.openqa.org/
and this is the video. it's interesting
http://showmedo.com/videos/video?name=UsingpyWinAutoToControlAWindowsApplicationfromSeriesID=7

The only problem is that they show only how to automatically open
notepad. they  have this DoubleClick method as I saw in the
documentation (i think this is what I'm looking for) but they don't
show how to use it.

I'm telling you that because I believe it's not as complex as you
think it is. I think I'm close. if i could just fine a manual which
show more examples or a bit more information i can do this.

Thank you



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


Re: method-wrapper?

2008-06-01 Thread David
 What is method-wrapper?  Google turns up hardly any hits, same with
 searching python.org.


It probably means that one object (A) contains another object (B).
When you call certain methods on object A, those methods call methods
in B, and return B's results to A's caller.

From that docstring:

A.__call__() will run B()
A.__cmp__(C) will run cmp(B, C)

etc.

In other words python code which runs A() will be running the
equivalent of A.B(), where A can do other things besides calling B()
if it wants to.

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


Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Gilles Ganault
On Sun, 1 Jun 2008 21:27:30 +0900, Ryan Ginstrom
[EMAIL PROTECTED] wrote:
For your stated needs, I'd advise checking out IronPython or Python.NET
(which allow use of .NET GUI libraries).

Thanks but I forgot to say that I'd rather not use .Net because
deployment/updates are too problematic for our audience.

.. that's assuming that a GUI Python can install/update itself as
easily as eg. Delphi, which is where I could be wrong :-/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Merging ordered lists

2008-06-01 Thread Taekyon
etal wrote:

 Speed actually isn't a problem yet; it might matter some day, but for
 now it's just an issue of conceptual aesthetics. Any suggestions?

Looks as if set does it for you.

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


RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
 On Behalf Of Gilles Ganault
 Is it hopeless, or did I overlook things? Are  there other 
 solutions I should look at (FLTK, etc.)? For those of you 
 writing business apps in Python for Windows, how do things go 
 as far as GUI widgets are concerned?

To do a bit of shameless plugging, I wrote an overview of Python GUI
platforms for Windows a month or two ago:
http://ginstrom.com/scribbles/2008/02/26/python-gui-programming-platforms-fo
r-windows/

For your stated needs, I'd advise checking out IronPython or Python.NET
(which allow use of .NET GUI libraries).

Regards,
Ryan Ginstrom

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


[Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Gilles Ganault
Hello

Since Python is such a productive language, I'd really like to be
able to use it to write GUI apps for Windows, but business apps
require rich widgets like (DB)grids, calendars, etc.

The ones available in wxWidgets looked a bit too basic compared to
what's available for eg. Delphi or .Net, and don't seem to be under
active development (lots of 1.0, Last updated 2005, etc.)

For instance, here's wxGrid and DevExpress' grid for Delphi:
http://www.simpol.com/guiimages/wxgrid.jpg
http://community.devexpress.com/blogs/thinking/PrintingXtraPivotGridForm.png

Is it hopeless, or did I overlook things? Are  there other solutions I
should look at (FLTK, etc.)? For those of you writing business apps in
Python for Windows, how do things go as far as GUI widgets are
concerned?

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


RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
 On Behalf Of Gilles Ganault
 Thanks but I forgot to say that I'd rather not use .Net 
 because deployment/updates are too problematic for our audience.
 
 .. that's assuming that a GUI Python can install/update 
 itself as easily as eg. Delphi, which is where I could be wrong :-/

wxPython can be made to look pretty nice. Check out Chandler for an example.
http://chandlerproject.org/

Delphi has a truly impressive ecosystem of controls and widgets. If there
were a commercial market for wxPython/wxWidgets widgets, I'm sure we'd get a
bunch of very nice ones as well. There is kind of an analog with the
bounty program for developing widgets, but it doesn't appear very active.

If you don't mind being Windows-only, there's another approach that I've
been working on. I use a WTL application to host the web browser, then pass
the browser instance to a COM server written in Python, along with a COM
wrapper of the application window. This gives me the flexibility of HTML +
JavaScript + Python, but eliminates two of the big issues with web apps:
latency and lack of Windows conventions like keyboard shortcuts and Drag 
Drop. I've yet to deploy this approach in an application, but from my
prototypes I'm liking it.

Regards,
Ryan Ginstrom

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


Ann: Pyparsing 1.5.0 released

2008-06-01 Thread Paul McGuire
I've just uploaded to SourceForge the latest update to pyparsing,
version 1.5.0.  This version includes a number of long-awaited
features, so I thought it was time to bump the minor rev version.

- parsing a complete string without having to add StringEnd() to the
  pyparsing grammar, by adding parseAll argument to the parseString
  method (default value is False to maintain compatibility with prior
  versions, set to True to force parsing of the full input string)

- support for indentation-based grammars (like Python's), using a
  new helper method, indentedBlock.

- improved syntax error detection and reporting, based on the
  ErrStop class submitted by Eike Welk on the  pyparsing forum,
  and Thomas/Poldy's proposal on the pyparsing wiki; the CHANGES
  file includes a detailed example showing how syntax errors can
  be designated by using '-' instead of '+' operators

Pyparsing 1.5.0 also includes a number of bug-fixes, described in
more
detail in the CHANGES file.

(Despite my best efforts, I have *not* been able to include support
for Python 3.0 using a common source code base.  For those who wish
to try out pyparsing with Python 3.0, there is a file pyparsing_py3.py
in the SourceForge Subversion repository.  I have done some testing
of this code, but many of my unit tests still need to be converted to
Python 3.)

Download pyparsing 1.5.0 at http://sourceforge.net/projects/pyparsing/.
The pyparsing Wiki is at http://pyparsing.wikispaces.com

-- Paul


Pyparsing is a pure-Python class library for quickly developing
recursive-descent parsers.  Parser grammars are assembled directly in
the calling Python code, using classes such as Literal, Word,
OneOrMore, Optional, etc., combined with operators '+', '|', and '^'
for And, MatchFirst, and Or.  No separate code-generation or external
files are required.  Pyparsing can be used in many cases in place of
regular expressions, with shorter learning curve and greater
readability and maintainability.  Pyparsing comes with a number of
parsing examples, including:
- Hello, World! (English, Korean, Greek, and Spanish(new))
- chemical formulas
- configuration file parser
- web page URL extractor
- 5-function arithmetic expression parser
- subset of CORBA IDL
- chess portable game notation
- simple SQL parser
- Mozilla calendar file parser
- EBNF parser/compiler
- Python value string parser (lists, dicts, tuples, with nesting)
  (safe alternative to eval)
- HTML tag stripper
- S-expression parser
- macro substitution preprocessor
- TAP output parser (new)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Need Tutorial For the following lib

2008-06-01 Thread Larry Bates

Gandalf wrote:

Hi scott, you couldn't be more wrong about my laziness. I straggle
with my poor English for hours to fined what I'm looking for.
I found a very simple and not comprehensive tutorial for the pyWinAuto
lib in this address http://pywinauto.openqa.org/
but it only show how to do the basic, and my knowledge at this point
is not enough to figure the rest I need to know by myself
I found another simple  lib for the watsup that based on winGuiAuto
lib in this address
http://www.tizmoi.net/watsup/intro.html
But for some risen I couldn't manage to ran it in my computer

I'm trying to generate auto mouse double click or auto selecting text
(the selecting text part is the one I interest in. mouse double click
just do the same effect if the mouse cursor is on text)

I'm sorry you feel I'm lazy. The truth is that event writing this
message takes me an enormous power.
weather you choose to help me or not I still going to keep trying ,
But you have the opportunity to save me lots of trouble, So maybe one
day I could help others.

so if you familiar with any good tutorial for this library please let
me know and if not then thank you anyway for wonting to help

Y.G



What you want is an easy solution to what isn't an easy problem, but (as with 
your other post) you refuse to provide enough information to allow us to help 
you.  If I were you, I would download wxPython and go through the demos that it 
includes.  comp.python.wxpython list is excellent (at least as good as this one) 
for any follow-up questions.  Windows events and mouse clicks are going to take 
a concerted effort (on your part) to learn (especially if you haven't 
accomplished such a task in another language).


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


Re: python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-01 Thread Carl Banks
On Jun 1, 4:47 am, Alia Khouri [EMAIL PROTECTED] wrote:
 Can we open up the discussion here about how to improve setuptools
 which has become the de facto standard for distributing / installing
 python software. I've been playing around with ruby's gems which seems
 to be more more mature and  usable.

 From my perspective, the relative immaturity of setuptools and its
 simultaneous widespread use is a clear python weakness and can make
 python less easy to absorb than it should be.

 A few questions (please add more) so far are:

Oh boy.


 (1) Should setuptools be standard?

Shamelessly speaking as someone who does no wish to enter this
particular niche of Python: I would hope the Python community can do
better.


 (2) What bugs you most about the current featureset?

1. setuptools will download and install dependencies on the user's
behalf, without asking, by default.  It can be disabled, but I think
it's extremely rude: it should ask by default.

2. One cannot simply import modules from packages that use
entry_points: you have to go through package resources.  Very
annoying.

3. Tools such as py2exe don't work with packages that use entry_points
except with some hand tweaks (at least as of the last time I tried).
One might suggest that py2exe should learn how to include setuptools
models, but I don't think people who write tools like py2exe ought to
be burdened with it.  py2exe was possible because the import mechanism
was theretofore so straightforward.

FWIW, I've abandoned usage of a package that used entry points because
of this issue.


 (3) Which features do you need the most (list in order of need)?

Not that my needs are all important, but:

1. Works.
2. Ability to install to unusual locations (BIG)
3. Packages can be installed separately by hand if the user so desires
(copying to site directory, hand editing if necessary)
4. Ability to easily specify compiler options when rebuilding
extension modules.
5. Handles data files reasonably


 (4) Shouldn't we just port gems to python?

Fine with me, some new blood would be useful here.


 (5) What's the best community process to improve setuptools?

Have the BDFL declare that it's the official Python package manager.
Of course, I hope if it ever comes to that the BDFL will pronounce
something else to be the official Python package manager, preferrably
something that isn't based on distutils.


 Hope this discussion can be constructive. In any case, I do appreciate
 the effort that went into creating setuptools (Thanks Phillip J.
 Eby :-). It's existence is clearly better than otherwise.


I don't agree.  It's probably better than otherwise for enterprise
applications, which is the environment for which it was designed.  For
instance, entry points and dependency bookkeeping are useful in such
environments, since there are policies to ensure consistent and
reasonable usage.

For open source, mom-and-pop operations, and other smaller projects, I
think it adds a whole lot of complexity over what otherwise is a
simple thing.


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


SPOJ, Problem Code: sumtrian, Reducing time taken to solve.

2008-06-01 Thread Shriphani
Hi,

I was trying to solve the sumtrian problem in the SPOJ problem set
( https://www.spoj.pl/problems/SUMTRIAN/ ) and this is the solution I
submitted: http://pastebin.ca/1035867

The result was, Your solution from 2008-06-01 15:13:06 to problem
SUMTRIAN, written in Python,
has exceeded the allowed time limit.

I suspect that the first portion of my solution which looks at the
input, figures out the number of triangles and forms a list that
contains lists containing each row of the triangle, is wrong. I am not
too sure how to optimize it. I would appreciate help.

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


Re: Good grid + calendar, etc.?

2008-06-01 Thread Mike Driscoll
On Jun 1, 6:59 am, Gilles Ganault [EMAIL PROTECTED] wrote:
 Hello

         Since Python is such a productive language, I'd really like to be
 able to use it to write GUI apps for Windows, but business apps
 require rich widgets like (DB)grids, calendars, etc.

 The ones available in wxWidgets looked a bit too basic compared to
 what's available for eg. Delphi or .Net, and don't seem to be under
 active development (lots of 1.0, Last updated 2005, etc.)

 For instance, here's wxGrid and DevExpress' grid for 
 Delphi:http://www.simpol.com/guiimages/wxgrid.jpghttp://community.devexpress.com/blogs/thinking/PrintingXtraPivotGridF...

 Is it hopeless, or did I overlook things? Are  there other solutions I
 should look at (FLTK, etc.)? For those of you writing business apps in
 Python for Windows, how do things go as far as GUI widgets are
 concerned?

 Thank you.


The wxPython GUI is updated much more often than the Tkinter toolkit.
I recall that there is an advanced calendar widget that's been made by
one of the regulars on the wxPython list, but it's not a part of the
official distribution at this time. You'll have to ask about calendar
widgets and such there though.

The grid can be quite advanced. Did you look at the wxPython demo? Or
Dabo?

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


Re: SMS sending and receiving from website?

2008-06-01 Thread David
On Fri, May 30, 2008 at 11:08 PM, globalrev [EMAIL PROTECTED] wrote:
 can i send and receive messages from a website using python?

 how would that work with costs? would the mobileowner pay both ways?
 --
 http://mail.python.org/mailman/listinfo/python-list


I use smstools for this.

Homepage:  http://smstools3.kekekasvi.com/

Debian installer:  http://packages.debian.org/sid/smstools

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


Re: python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-01 Thread Paul Boddie
On 1 Jun, 10:47, Alia Khouri [EMAIL PROTECTED] wrote:
 Can we open up the discussion here about how to improve setuptools
 which has become the de facto standard for distributing / installing
 python software. I've been playing around with ruby's gems which seems
 to be more more mature and  usable.

I'm sure people also regard Perl's CPAN-related tools and
infrastructure to be more mature and usable, but I'd like to widen the
discussion beyond language-specific package and dependency management.

 From my perspective, the relative immaturity of setuptools and its
 simultaneous widespread use is a clear python weakness and can make
 python less easy to absorb than it should be.

 A few questions (please add more) so far are:

 (1) Should setuptools be standard?

 (2) What bugs you most about the current featureset?

 (3) Which features do you need the most (list in order of need)?

I'm not really in your target audience for these questions since I
never use setuptools: instead, I use the Debian-based package and
dependency management provided by my system. If any of the system
packages use setuptools, it's to build packages in such a way that
they resemble classic distutils package installations.

However, I do work in environments where I do have to install packages
to non-system locations manually. Even in such situations, the
packages I tend to use employ a plain distutils-based setup script,
and I'm not completely sure that I'd want to use setuptools/
easy_install, since aside from some dependency management (which I
doubt extends to various non-Python libraries) it doesn't provide
compelling advantages over distutils like uninstallation, for example.

 (4) Shouldn't we just port gems to python?

 (5) What's the best community process to improve setuptools?

 (6) What's your ideal conception of the 'standard python package
 manager?

Well, I don't deny the utility of a Python package manager given that
it could be useful for people who use systems which don't provide
system package/dependency management (at least in a consistent or
widely-deployed fashion) or who have to work without taking advantage
of system packages (whether it be due to privileges or issues with
decisions taken by the package maintainers), but the most important
thing from my perspective is that it should complement and co-operate
with system packaging activities. Although distutils is often derided
for its architecture and for some odd usability issues, it does take
away a lot of the tedious work required when laying out installations
for subsequent packaging.

Perhaps efforts should be directed towards the distutils type of work,
making it easier to install things like documentation and non-code
resources, potentially even employing a different architecture: once
upon a time, Python libraries were installed using a Makefile-based
scheme, and there are plenty of Makefile-like tools and libraries
written in Python [1]. In addition, there should be efforts which
integrate this packaging with the existing range of package and
dependency managers: it shouldn't be the case that one only considers
a Python-only dependency manager, because that just leads to the usual
reinvention of what has been done before, plus those people packaging
for Debian, Fedora, *BSD and so on won't see any benefit from what has
been done. Indeed, it shouldn't be inconceivable that a Python-only
dependency management solution might be based on existing tools and
infrastructure, rather than trying to figure out issues like
reliability and redundancy all over again.

I note that the overlap between various mature projects of this nature
and the distutils community seems to be minimal. Once again, I suggest
that people take advantage of the expertise and experience built up in
other projects and communities, and not merely those whose products
conveniently resemble a preconceived notion of what such a solution
should be in the Python world. CPAN and friends and all their baggage
are not universally applicable, and any consideration merely of such
solutions will produce a setuptools successor whose relevance is just
as limited as its predecessor.

Paul

[1] http://wiki.python.org/moin/ConfigurationAndBuildTools
--
http://mail.python.org/mailman/listinfo/python-list


the pipe reading in Thread dose not work.

2008-06-01 Thread Leon zhang

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import string, sys
from threading import Thread
import os
import time

class test_pipe(Thread):
def __init__(self, fd):
Thread.__init__(self)
self.testfd = fd

def run(self):
print started thread begin -
while True:
buf = self.testfd.read()
print receive %s % (buf)
time.sleep(1)
#print hoho

if __name__ == __main__:

stdin_r, stdin_w = os.pipe()
#stdout_r, stdout_w = pipe()

f_w = os.fdopen(stdin_w, w, 0)

thrd = test_pipe(os.fdopen(stdin_r, r, 0))
thrd.start()

time.sleep(1)

while True:
f_w.write(help\r\n)
time.sleep(1)

thrd.join()

well, I want the following small test about pipe() in thread().
OK, I write to the pipe in the main thread, and I created a new thread
for reading from the pipe, then it will print what it received from
the pipe().

But, it seems it block at the self.testfd.read().

So, is there and suggestion and explaination about it?

Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python's doc problems: sort

2008-06-01 Thread Andrew Koenig
[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I want to emphasize a point here, as i have done quite emphatically in
 the past. The Python documentation, is the world's worst technical
 writing. As far as technical writing goes, it is even worse than
 Perl's in my opinion.

I think that this claim says more about its author than it does about its 
subject.

Welcome to my killfile.


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



RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread python
Ryan,

snip
If you don't mind being Windows-only, there's another approach that I've
been working on. I use a WTL application to host the web browser, then
pass
the browser instance to a COM server written in Python, along with a COM
wrapper of the application window. This gives me the flexibility of HTML
+
JavaScript + Python, but eliminates two of the big issues with web apps:
latency and lack of Windows conventions like keyboard shortcuts and Drag
 Drop.
/snip

Instead of the COM approach, have you considered using a local, client
based Python server as a container for your business logic and GUI
(DHTML, AJAX)? This would give you a cross platform solution, without
the typical browser/server latency, and via techniques like AJAX,
perhaps more of a desktop look and feel? I haven't done this yet, but
I'm grappling with the same question (how to create sexy looking
business applications using Python).

Malcolm

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


RE: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Ryan Ginstrom
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Instead of the COM approach, have you considered using a 
 local, client based Python server as a container for your 
 business logic and GUI (DHTML, AJAX)? This would give you a 
 cross platform solution, without the typical browser/server 
 latency, and via techniques like AJAX, perhaps more of a 
 desktop look and feel? I haven't done this yet, but I'm 
 grappling with the same question (how to create sexy looking 
 business applications using Python).

I have used a cherrypy server wrapped with py2exe for a desktop server
app, but the local server in the browser solution has some weaknesses. Drag
and drop is one. Another is native dialog boxes. A third is problems with
firewalls. And although you can do keyboard shortcuts with Ajax, the
mechanism isn't quite the same. 

Also, using COM you can manipulate the DOM from Python, removing the need
for AJAX. In that case, your only need for JavaScript would be for prebuilt
library functionality (assuming you like Python better than JavaScript).

Regards,
Ryan Ginstrom

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


Integrating a code generator into IDLE

2008-06-01 Thread Sam Denton
Code generators seem to be popular in Python. 
(http://www.google.com/search?q=python+code-generator)


I have one that I'd like to integrate into IDLE.  Ideally, I'd like to 
(1) have a new file type show up when I use the File/Open dialog, and 
(2) have a function key that lets me run my generator against the file, 
just like F5 lets me run my Python code; ideally, I'd like to re-purpose 
the F5 key to be file-type aware.  I've got a simple extension written 
that uses the F6 key to compile my files, but two goals I've listed 
seem a bit beyond me.  Does anyone have any advice/pointers?  Or is one 
or both ideas impractical?  Thanks!

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


Re: Bring object 'out of' Class?

2008-06-01 Thread member thudfoo
On 6/1/08, Arnaud Delobelle [EMAIL PROTECTED] wrote:
 dave [EMAIL PROTECTED] writes:

[..]

  
  def deal_cards(self, num_of_hands, num):
  '''deals x amount of cards(num) to each hand'''
  for i in range(num_of_hands):
  handname = Hand('hand%d' % i)
  self.deal(handname, num)
  print '%s' % (handname.label), '\n', handname, '\n'
  


 You need to use a 'return' statement:


def deal_cards(self, num_of_hands, num):
'''deals x amount of cards(num) to each hand'''

hands = []

for i in range(num_of_hands):

newhand = Hand('hand%d' % i)
self.deal(newhand, num)
hands.append(newhand)

print '%s' % (handname.label), '\n', handname, '\n'

return Hand

Should be: return hands



  Then you can write:

   hands = deck.deal_cards(4, 5) # On fait une belotte?

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


Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Gilles Ganault
On Sun, 01 Jun 2008 11:24:17 -0400, [EMAIL PROTECTED] wrote:
Instead of the COM approach, have you considered using a local, client
based Python server as a container for your business logic and GUI
(DHTML, AJAX)?

But web-based apps are even worse, since the set of widgets is even
more basic, and web programming is hell. That's why I don't bother,
and write fat apps instead.

It'd be awesome if someone came up with a commercial offer of widgets
that are either missing or not feature-rich enough in wxPython for
real business apps.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread TheSaint
On 19:59, domenica 01 giugno 2008 Gilles Ganault wrote:

 require rich widgets like (DB)grids, calendars, etc.

Qt seems to go a bit further. Try Eric4 as SDK.
-- 
Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html
--
http://mail.python.org/mailman/listinfo/python-list


ANN: equivalence 0.1

2008-06-01 Thread George Sakkis
Equivalence is a class that can be used to maintain a partition of
objects into equivalence sets, making sure that the equivalence
properties (reflexivity, symmetry, transitivity) are preserved. Two
objects x and y are considered equivalent either implicitly (through a
key function) or explicitly by calling merge(x,y).

Get it from pypi: http://pypi.python.org/pypi/equivalence/

Example
===
Say that you are given a bunch of URLs you want to download and
eventually process somehow. These urls may contain duplicates, either
exact or leading to a page with the same content (e.g. redirects,
plagiarized pages, etc.). What you'd like is identify duplicates in
advance so that you can process only unique pages. More formally, you
want to partition the given URLs into equivalence sets and pick a
single representative from each set.

Getting rid of identical URLs is trivial. A more general case of URLs
that can be easily identified as duplicates can be based on some
simple regular expression based heuristics, so that for instance
'http://python.org/doc/' and 'www.python.org/doc/index.html' are
deemed equivalent. For this case you may have a normalize(url)
function that reduces a URL into its stem (e.g. 'python.org/doc')
and use this as a key for deciding equivalence.

This is fine but it still leaves quite a few URLs that cannot be
recognized as duplicates with simple heuristics. For these harder
cases you may have one or more oracles (an external database, a page
comparison program, or ultimately a human) that decides whether pages
x and y are equivalent. You can integrate such oracles by explicitly
declaring objects as equivalent using Equivalence.merge(x,y).

Both implicit (key-based) and explicit information are combined to
maintain the equivalence sets. For instance:

 from equivalence import Equivalence
 dups = Equivalence(normalize)   # for an appropriate normalize(url)
 dups.merge('http://python.org/doc/', 'http://pythondocs.com/')
 dups.are_equivalent('www.pythondocs.com/index.htm',
'http://python.org/doc/
index.html')
 True

You can find more about the API in the included docs and the unittest
file.

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


Re: Integrating a code generator into IDLE

2008-06-01 Thread Marc 'BlackJack' Rintsch
On Sun, 01 Jun 2008 10:40:09 -0500, Sam Denton wrote:

 Code generators seem to be popular in Python.

I don't think so.

Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list


Re: Conjunction List

2008-06-01 Thread George Sakkis
On May 31, 8:01 pm, [EMAIL PROTECTED] wrote:
 http://codepad.org/MV3k10AU

 I want to write like next one.

 def conjunction(number=a[1],name=b[1],size=c[1]):
   flag = a[0]==b[0]==c[0]
   if flag:
 for e in zip(number,name,size):
   print e

 conjunction(a,b,c)

 -
 function args receive sequence element:

 def somefunc(name=elm1[1], size=elm2[1], color=elm3[1]):
   for e in zip(name, size, color):
 print e,

 conjunction(a,b,c)
 -

 not like two case:
 -

 def somefunc(elm1, elm2, elm3):
   name = elm1[1]; size = elm1[1]; color = elm1[1] # best solution?
   for e in zip(name, size, color):
 print e,

 conjunction(a,b,c)
 -

 def somefunc(elm1, elm2, elm3, **attr):
   for e in zip(attr['name'], attr['size'], attr['color']):
 print e,

 conjunction(a,b,c, name=a[1], size=b[1], color=c[1]) # many args...
 -

 What's a good approach to get the conjunction nest-list-data?

The one you comment with best solution? is ok for this example. If
you dislike the repetitive part of setting the flag and getting the
second element of each argument, or especially if you want to
generalize it to more than three arguments, here's one way to do it:

def conjunction(*args):
if not args: return
first = args[0][0]
if all(arg[0]==first for arg in args):
for e in zip(*(arg[1] for arg in args)):
print e

 conjuction(a,b,c)
('0', 'one', '0%')
('1', 'two', '50%')
('2', 'three', '100%')

HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list


Re: Good grid + calendar, etc.?

2008-06-01 Thread Mike Driscoll
On Jun 1, 8:28 am, Gilles Ganault [EMAIL PROTECTED] wrote:
 On Sun, 1 Jun 2008 06:00:03 -0700 (PDT), Mike Driscoll

 [EMAIL PROTECTED] wrote:
 I recall that there is an advanced calendar widget that's been made by
 one of the regulars on the wxPython list, but it's not a part of the
 official distribution at this time. You'll have to ask about calendar
 widgets and such there though.

 The impression I get, is that those extra widgets (besides the usual
 edit, listbox, etc.) aren't really developped/maintained, which is a
 problem when comitting for applications that will have to be
 developped for a few years.


That's debatable. While I doubt the author of the widgets on this site
is constantly working on them, if you have a problem, he is very
responsive and has been known to fix them within hours of the bug
report:

http://xoomer.alice.it/infinity77/main/freeware.html

The Float Canvas widget is also actively maintained by its author.
These are just a few examples.



 For instance, is there a calendar in wxPython that has this look and
 feel, and is under active 
 development?http://www.devexpress.com/Products/VCL/ExScheduler/


I don't know. You should ask on the wxPython user's list:
http://www.wxpython.org/maillist.php

I have personally written a reminder application that has that same
pop-up window though. The grid in the photo that show the months on
the left and letters on the top would be trivial to create. I don't
know how to overlay the grid with other widgets, but I suspect it
would only require doing something in a paint event or embedding some
additional widgets in it.


 The grid can be quite advanced. Did you look at the wxPython demo? Or
 Dabo?

 Yes, but although the basic wigets are just fine, wxGrid looks a bit
 like the basic TStringGrid in Delphi, ie. it's pretty basic so that
 several vendors came up with enhanced alternatives. But maybe I
 haven't played with it long enough.

 www.asiplease.net/computing/delphi/images/string_grid_demo_popstars.gif

 It lacks sorting capability, merging cells with the same content, etc.

The MegaGrid example demonstrates sorting. You'll have to ask about
the other features on their list. I haven't done that as of yet.

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


Re: the pipe reading in Thread dose not work.

2008-06-01 Thread Jean-Paul Calderone

On Sun, 1 Jun 2008 07:32:39 -0700 (PDT), Leon zhang [EMAIL PROTECTED] wrote:


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import string, sys
from threading import Thread
import os
import time

class test_pipe(Thread):
   def __init__(self, fd):
   Thread.__init__(self)
   self.testfd = fd

   def run(self):
   print started thread begin -
   while True:
   buf = self.testfd.read()
   print receive %s % (buf)
   time.sleep(1)
   #print hoho

if __name__ == __main__:

   stdin_r, stdin_w = os.pipe()
   #stdout_r, stdout_w = pipe()

   f_w = os.fdopen(stdin_w, w, 0)

   thrd = test_pipe(os.fdopen(stdin_r, r, 0))
   thrd.start()

   time.sleep(1)

   while True:
   f_w.write(help\r\n)
   time.sleep(1)

   thrd.join()

well, I want the following small test about pipe() in thread().
OK, I write to the pipe in the main thread, and I created a new thread
for reading from the pipe, then it will print what it received from
the pipe().

But, it seems it block at the self.testfd.read().

So, is there and suggestion and explaination about it?


file.read() reads the entire contents of the file.  Your code never closes
the write end of the pipe, so the read can never succeed - there is always
more for it to read.

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


Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread Stef Mientki

Ryan Ginstrom wrote:

On Behalf Of Gilles Ganault
Is it hopeless, or did I overlook things? Are  there other 
solutions I should look at (FLTK, etc.)? For those of you 
writing business apps in Python for Windows, how do things go 
as far as GUI widgets are concerned?



To do a bit of shameless plugging, I wrote an overview of Python GUI
platforms for Windows a month or two ago:
http://ginstrom.com/scribbles/2008/02/26/python-gui-programming-platforms-fo
r-windows/

For your stated needs, I'd advise checking out IronPython or Python.NET
(which allow use of .NET GUI libraries).
  

AFAIK,
Venster is (at least for windows-mobile-like platforms) replaced by the 
very good and stable  PocketPyGUI.


cheers,
Stef

Regards,
Ryan Ginstrom

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


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


Printing a text file using Python

2008-06-01 Thread Robin Lee
Serge:
in your code i believe that you did one read of your whole input file, and then 
you emitted that to the dc with textout. textout's use  is actually 
(x,y,string).
hence one line got printed (actually the whole file got printed but 
truncated)
you will have to detect all the end of lines and loop a whole lot of dc.textouts

Robin

your code:

dc = win32ui.CreateDC()
  dc.CreatePrinterDC()
dc.SetMapMode(4)# This is UI_MM_LOENGLISH
# With this map mode, 12 points is 12*100/72 units = 16
font = win32ui.CreateFont({'name' : 'Arial', 'height' : 16})
dc.SelectObject(font)
f=open(./Reports/Report.txt,r)
memory=f.read()
f.close
memory.split('\n')
dc.StartDoc(./Reports/Report.txt)
dc.StartPage()
dc.TextOut(10,10,memory)
dc.EndPage()
dc.EndDoc()
--
http://mail.python.org/mailman/listinfo/python-list

Re: SPOJ, Problem Code: sumtrian, Reducing time taken to solve.

2008-06-01 Thread Henrique Dante de Almeida
On Jun 1, 10:25 am, Shriphani [EMAIL PROTECTED] wrote:
 Hi,

 I was trying to solve the sumtrian problem in the SPOJ problem set
 (https://www.spoj.pl/problems/SUMTRIAN/) and this is the solution I
 submitted:http://pastebin.ca/1035867

 The result was, Your solution from 2008-06-01 15:13:06 to problem
 SUMTRIAN, written in Python,
 has exceeded the allowed time limit.

 I suspect that the first portion of my solution which looks at the
 input, figures out the number of triangles and forms a list that
 contains lists containing each row of the triangle, is wrong. I am not
 too sure how to optimize it. I would appreciate help.

 Thanks,
 Shriphani Palakodety

 First, you have to write a correct algorithm. Notice that your code
doesn't correctly calculates the given sample input. Later, think
about optimization.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to get all the variables in a python shell

2008-06-01 Thread Lie
[EMAIL PROTECTED] wrote:
 Hi!

 I'm currently working on a scientific computation software built in
 python.
 What I want to implement is a Matlab style command window -
 workspace interaction.

 For example, you type 'a=1' in the command window, and you see a list
 item named 'a' in the workspace.
 You double click the icon of the item, and you see its value. You can
 modify the value of the list item,
 1 - 100 etc,  after which if you go back to the command window and
 type 'a'  and press enter, you see that
 varable a's value has been changed to 100.

 So my question is : if you have two DOS command windows running under
 WINDOWS OS, how can you make them share the same internal variable
 buffer? Or is there any easier way to implement such kind of
 interaction?

 Maybe I could just build a small database to store all the values and
 access them from both programs, but chances are sometimes I have to
 deal with big arrays, and they will eat extra memory if I keep them in
 a database. Is there anyway to access a shell's local memory buffer?
 I tried to use shell.interp.locals() in wxPython, but there's too many
 variables in the list which I don't actually need.

 Come on guys, give me some ideas. Thanks in advance!

In all kinds of code, it's best to seperate the workers code and the
UI code, in your case, you should create a backend (worker), which is
a class that stands on its own, and two foreground class (UI) that is
completely independent of each other but have the same interface. The
backend code would have an event that is raised when it is changed to
notify the UI (esp. The gui one) that it has changed since last time,
possibly passing info on what have been changed. The front ends, would
watch for this event as necessary (I don't think it is necessary for
the command line to watch this event) and react to it as necessary
like refreshing the view. The front-end window may only call functions
on the backend to interact with the data being worked on (in short the
backend class is opaque).

This obliviate the need to share data between the two (or more)
windows (UI) because all the data are contained in the backend class
that the frontend can't access directly.
--
http://mail.python.org/mailman/listinfo/python-list


Re: python, dlls, and multiple instances

2008-06-01 Thread Martin v. Löwis
 Is it a correct to assume that you can use multiple instances of
 python altogether if each is loaded from a separate dll? For instance,
 if I write a couple of dll/so libs, and each has python statically
 linked in, is it safe to assume that since dlls use their own address
 space

DLLs don't use their own address space. All DLLs of a single operating
system process use the same address space.

Different DLLs do use different portions of that address space.

 then each dll would have it's own GIL, and will therefore
 coexist safely within the same app? This is correct across all
 platforms, yes?

No; it rather depends on the way the operating system resolves symbols.
On some systems (e.g. many Unix systems), there is only a single global
symbol table for the entire process. So when a shared library is loaded,
and needs to resolve its symbols (even the ones that it also defines
itself), it may end up finding the GIL in a different copy of the Python
interpreter, so they all share the GIL (even though there would have
been space for multiple GILs).

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


Re: SPOJ, Problem Code: sumtrian, Reducing time taken to solve.

2008-06-01 Thread Ian Kelly
On Sun, Jun 1, 2008 at 7:25 AM, Shriphani [EMAIL PROTECTED] wrote:
 I was trying to solve the sumtrian problem in the SPOJ problem set
 ( https://www.spoj.pl/problems/SUMTRIAN/ ) and this is the solution I
 submitted: http://pastebin.ca/1035867

 The result was, Your solution from 2008-06-01 15:13:06 to problem
 SUMTRIAN, written in Python,
 has exceeded the allowed time limit.

 I suspect that the first portion of my solution which looks at the
 input, figures out the number of triangles and forms a list that
 contains lists containing each row of the triangle, is wrong. I am not
 too sure how to optimize it. I would appreciate help.

Since you asked, I went and tried the problem myself and managed to
get a solution accepted with a bit of work.  Here are my suggestions
with regard to your code:

* You absolutely need to use psyco for this problem.  The accepted
solutions have memory usage of 36M+, which on SPOJ is a sure sign that
psyco was used, and they're already just a hair under the time limit.

* Instead of guessing it's probably the input step, why don't you
profile your code so that you *know* where the bottlenecks are?

* Use xrange instead of range in for loops, and certainly don't use
while loops for iteration.

* max is quite slow for comparing only two things.  It's faster to
compare the two things yourself.  Since this line may be executed
millions of times, the difference could be quite significant.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to get all the variables in a python shell

2008-06-01 Thread Lie
On Jun 2, 1:29 am, Lie [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  Hi!

  I'm currently working on a scientific computation software built in
  python.
  What I want to implement is a Matlab style command window -
  workspace interaction.

  For example, you type 'a=1' in the command window, and you see a list
  item named 'a' in the workspace.
  You double click the icon of the item, and you see its value. You can
  modify the value of the list item,
  1 - 100 etc,  after which if you go back to the command window and
  type 'a'  and press enter, you see that
  varable a's value has been changed to 100.

  So my question is : if you have two DOS command windows running under
  WINDOWS OS, how can you make them share the same internal variable
  buffer? Or is there any easier way to implement such kind of
  interaction?

  Maybe I could just build a small database to store all the values and
  access them from both programs, but chances are sometimes I have to
  deal with big arrays, and they will eat extra memory if I keep them in
  a database. Is there anyway to access a shell's local memory buffer?
  I tried to use shell.interp.locals() in wxPython, but there's too many
  variables in the list which I don't actually need.

  Come on guys, give me some ideas. Thanks in advance!

 In all kinds of code, it's best to seperate the workers code and the
 UI code, in your case, you should create a backend (worker), which is
 a class that stands on its own, and two foreground class (UI) that is
 completely independent of each other but have the same interface. The
 backend code would have an event that is raised when it is changed to
 notify the UI (esp. The gui one) that it has changed since last time,
 possibly passing info on what have been changed. The front ends, would
 watch for this event as necessary (I don't think it is necessary for
 the command line to watch this event) and react to it as necessary
 like refreshing the view. The front-end window may only call functions
 on the backend to interact with the data being worked on (in short the
 backend class is opaque).

 This obliviate the need to share data between the two (or more)
 windows (UI) because all the data are contained in the backend class
 that the frontend can't access directly.

To clarify what I meant, the front ends should never contain any
working data except the ones needed for the UI to illustrate what it
wanted to show at the moment, and even then, it is accessed in read
only fashion.

And actually because of Python's Global Interpreter Lock, which means
that your program would all be contained in the same python
interpreter instance (unless you do some workarounds), passing objects/
lists around between python program is cheap because they're just a
reference passing (like pointer passing in C/C++)

This approach is a simple server-client method (not a true server-
client method though, since a true one cannot share unserialized
data), and is extremely scalable, it's easy to add a third window for
example, there is no need for every front end to be aware that there
are other front ends, since it just watches for the Changed event
from the backend.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to get all the variables in a python shell

2008-06-01 Thread Lie
On May 29, 1:47 pm, [EMAIL PROTECTED] wrote:
 Hi!

 I'm currently working on a scientific computation software built in
 python.
 What I want to implement is a Matlab style command window -
 workspace interaction.

 For example, you type 'a=1' in the command window, and you see a list
 item named 'a' in the workspace.
 You double click the icon of the item, and you see its value. You can
 modify the value of the list item,
 1 - 100 etc,  after which if you go back to the command window and
 type 'a'  and press enter, you see that
 varable a's value has been changed to 100.

 So my question is : if you have two DOS command windows running under
 WINDOWS OS, how can you make them share the same internal variable
 buffer? Or is there any easier way to implement such kind of
 interaction?

 Maybe I could just build a small database to store all the values and
 access them from both programs, but chances are sometimes I have to
 deal with big arrays, and they will eat extra memory if I keep them in
 a database. Is there anyway to access a shell's local memory buffer?
 I tried to use shell.interp.locals() in wxPython, but there's too many
 variables in the list which I don't actually need.

 Come on guys, give me some ideas. Thanks in advance!

As an addition: Don't try to share data between windows, it's messy,
fragile, and easy to make bugs.

PS: Do not confuse Lie (Me) and Lee (OP)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about files?

2008-06-01 Thread Lie
On Jun 1, 1:44 am, [EMAIL PROTECTED] wrote:
 I want to create a program where a user can type what ever they want
 to, have it saved to a file, and the be able to re-open it and read
 it. How would I do this? Thanks!

Use a multi-line text-input widget (available on any widget library)

To open a file in python for reading:
filepointer = file('path/to/file', 'r')

then read it like this:
for line in filepointer:
dosomethingwith(f)

or:
filecontent = filepointer.read()

To open a file for writing:
filepointer = file('path/to/file', 'w')

to write to a file:
filepointer.write(somestring)

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


Re: ValueError: unknown locale: UTF-8

2008-06-01 Thread Martin v. Löwis
 ValueError: unknown locale: UTF-8

 
 This is on open bug or is there more to it?

Do you have an environment variable set who is named
either LANG or starts with LC_?

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


Re: python's setuptools (eggs) vs ruby's gems survey/discussion

2008-06-01 Thread rurpy
On Jun 1, 2:47 am, Alia Khouri [EMAIL PROTECTED] wrote:
 Can we open up the discussion here about how to improve setuptools
 which has become the de facto standard for distributing / installing
 python software. I've been playing around with ruby's gems which seems
 to be more more mature and  usable.

 From my perspective, the relative immaturity of setuptools and its
 simultaneous widespread use is a clear python weakness and can make
 python less easy to absorb than it should be.

 A few questions (please add more) so far are:

 (1) Should setuptools be standard?

I hope not.  Like many others, I avoid packages
the require installation via setuptools.

My first experience with setuptools (I do not
make much distinction here between setuptools and
packages installed using setuptools) was quite
unpleasant.  It was a couple years ago and I
have forgotten a lot of details but it was roughly:
Downloaded a package from the net, did the usual
python setup.py install and got a messages that
I needed to install setuptools first.  (First time
I'd ever heard of setuptools, not idea what it was
or did.)

Machine not on internet so I looked at readme
for other options for installing.  No information
about dependencies, install, easy_install, setuptools
in any of the readme's or other package doc.
Finally found a url buried in one of .py files.
Eventually, from another machine, I got it
downloaded and installed.  Ran it, and then
the dependency issues popped up with no internet
connection, recollection is messages were obscure.
Got internet connection and tried again, never
did it tell me what it wanted to download or the
sizes (internet connection was a modem).  Somewhere
I got a url for setuptools help that pointed
the Peak website.  I then had to hunt around for
a long time before finding the setuptools docs.
When I did find them they appeared to be written
for a packaging programmer, not for an someone who
just want to get a package installed so he could
continue with his main task.

The kicker was that after all of this BS, I discovered
that I could install the package simply by copying
it's files to the Python install site-lib directory!
Sheesh!!

I have since used setuptools a few more times and
had problems several times.

Now, my complaint about setuptools is not any of
the specific problems I've had using it -- those
presumably could be (perhaps have been) fixed.
The problem is the disconnect between what I see
as blatantly obvious requirements for any kind of
installer and what setuptools provides.  I consider
the need for locally available usage instructions so
obvious as to not needing mentioning.  I consider
sensible behavior in the face of no, slow, or bad
internet connections obvious.  I consider defaults
(not auto-downloading potentially large files) to
be obvious.  That the the setuptools developers do
not share my world view makes me unable to trust
them.  Perhaps they will silently change some settings
on my machine that I depend on?

Setuptools' philosophy seems to me to be fundamentally
Microsoftian: sit back, relax, we'll take care of
everything (which requires you to effectively give
your machine to us, but please don't worry about that.)
It is a philosophy I detest, and use free software
to get away from.

 (2) What bugs you most about the current featureset?

 (3) Which features do you need the most (list in order of need)?

If must *work*, always.

It must have simple, very well written docs, that
are always easily accessible.
Nobody should be expected to become a setuptools
expert in order to install a package, but if they
need to do something out of the ordinary, they
must be able to find out how, quickly and effectively.

It must work reliably and simply in a wide variety
of environments, not just the enviroments the developers
happen to be used to (no, slow, intermittent internet,
unusual install locations, multiple package versions,
multiple python versions, different compilation
environments...)

It's scope should be limited to Python.  There are
OS packaging tools for applications (python or
otherwise), and the ongoing problems with them
(c.f. Fedora's rpm/yum) despite a decade of work
make me doubtful a python centric project that
tried to tackle the problem could get it right.

Need to be able to *manage* packages (remove, list,
maintain info about,...)  as well as install them.

A common way of packaging / installing documentation.
Most of my Python work in on Windows and whenever I
install a Python package (setuptools or otherwise),
I have to look for a sepreate docs package, and if
not exist, download the source package, find the
docs in it, sometimes build them, and if I can't
to that, try to wget the online docs.  Would like
a nerw setuptools to provide the machinery and
conventions to allow packager to easily include
docs in a package and have them installed in a
common, indexed, location on the target machine.
(C.f. Activestate's Perl.)

 (4) Shouldn't we just port gems to 

Re: Python's doc problems: sort

2008-06-01 Thread J�rgen Exner
Andrew Koenig [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote in message 

[Subject:  Python's doc problems: sort]
 I want to emphasize a point here, as i have done quite emphatically in
 the past. The Python documentation, is the world's worst technical

And WTF does Python documentation have to do with Perl of Lisp?

szr, do you still have any doubts about the nature of xahlee?

Welcome to my killfile.

Done a long, long time ago.

Follow-up set.

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


Re: Integrating a code generator into IDLE

2008-06-01 Thread Diez B. Roggisch

Sam Denton schrieb:
Code generators seem to be popular in Python. 
(http://www.google.com/search?q=python+code-generator)


Certainly not. The most of them will be used for generating bindings. 
Apart from that, you rareley (if ever) need to generate code.


I have one that I'd like to integrate into IDLE.  Ideally, I'd like to 
(1) have a new file type show up when I use the File/Open dialog, and 
(2) have a function key that lets me run my generator against the file, 
just like F5 lets me run my Python code; ideally, I'd like to re-purpose 
the F5 key to be file-type aware.  I've got a simple extension written 
that uses the F6 key to compile my files, but two goals I've listed 
seem a bit beyond me.  Does anyone have any advice/pointers?  Or is one 
or both ideas impractical?  Thanks!


You might consider using eric, a python-ide written in python with the 
Qt-Framework. It allows plugins.


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


pyspread 0.0.7

2008-06-01 Thread Martin Manns
pyspread 0.0.7 has been released.

--

New features:
+ CSV import dialog with preview grid

Bug fixes:
+ setup.py now installs correctly into a sub-folder (tested for Linux
and WinXP).

--

About: 
pyspread is a spreadsheet that accepts a pure python expression in
each cell.

--

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python =2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

Best Regards

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


convert binary to float

2008-06-01 Thread Mason
I have tried and tried...

I'd like to read in a binary file, convert it's 4 byte values into
floats, and then save as a .txt file.

This works from the command line (import struct);

In [1]: f = open(test2.pc0, rb)
In [2]: tagData = f.read(4)
In [3]: tagData
Out[3]: '\x00\x00\xc0@'

I can then do the following in order to convert it to a float:

In [4]: struct.unpack(f, \x00\x00\xc0@)
Out[4]: (6.0,)

But when I run the same code from my .py file:

f = open(test2.pc0, rb)
tagData = f.read(4)
print tagData

I get this (ASCII??):
└@

I only know how to work with '\x00\x00\xc0@'.

I don't understand why the output isn't the same. I need a solution
that will allow me to convert my binary file into floats. Am I close?
Can anyone point me in the right direction?

Thanks,
Mason




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

Re: convert binary to float

2008-06-01 Thread George Sakkis
On Jun 1, 3:55 pm, Mason [EMAIL PROTECTED] wrote:
 I have tried and tried...

 I'd like to read in a binary file, convert it's 4 byte values into
 floats, and then save as a .txt file.

 This works from the command line (import struct);

     In [1]: f = open(test2.pc0, rb)
     In [2]: tagData = f.read(4)
     In [3]: tagData
     Out[3]: '\x00\x00\xc0@'

 I can then do the following in order to convert it to a float:

     In [4]: struct.unpack(f, \x00\x00\xc0@)
     Out[4]: (6.0,)

 But when I run the same code from my .py file:

     f = open(test2.pc0, rb)
     tagData = f.read(4)
     print tagData

 I get this (ASCII??):
 „@

Remembering to put that struct.unpack() call in your module might
help ;-)

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


Re: Bring object 'out of' Class?

2008-06-01 Thread dave

Then you can write:


hands = deck.deal_cards(4, 5) # On fait une belotte?


And I don't see the need of defining 'Hand' inside 'Deck'.

HTH


Thanks for the input.

I believe using 'class Hand(Deck):' is to illustrate (in the book) 
inheritance and how it can be used.  By using 'Hand(Deck)' I can then 
use the methods (pop_card, add_cards, etc..) defined in the 'Deck' 
class.



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


Re: Python's doc problems: sort

2008-06-01 Thread szr
Jürgen Exner wrote:
 Andrew Koenig [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote in message

 [Subject:  Python's doc problems: sort]
 I want to emphasize a point here, as i have done quite emphatically
 in the past. The Python documentation, is the world's worst
 technical

 And WTF does Python documentation have to do with Perl of Lisp?

 szr, do you still have any doubts about the nature of xahlee?

I wasn't involved in this thread, but no, after that statement comparing 
Perl's and Python's docs, I no doubts.

-- 
szr 


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

Re: Good grid + calendar, etc.?

2008-06-01 Thread Mike Driscoll
On Jun 1, 8:28 am, Gilles Ganault [EMAIL PROTECTED] wrote:
 On Sun, 1 Jun 2008 06:00:03 -0700 (PDT), Mike Driscoll

 [EMAIL PROTECTED] wrote:
 I recall that there is an advanced calendar widget that's been made by
 one of the regulars on the wxPython list, but it's not a part of the
 official distribution at this time. You'll have to ask about calendar
 widgets and such there though.

 The impression I get, is that those extra widgets (besides the usual
 edit, listbox, etc.) aren't really developped/maintained, which is a
 problem when comitting for applications that will have to be
 developped for a few years.

 For instance, is there a calendar in wxPython that has this look and
 feel, and is under active 
 development?http://www.devexpress.com/Products/VCL/ExScheduler/

 The grid can be quite advanced. Did you look at the wxPython demo? Or
 Dabo?

 Yes, but although the basic wigets are just fine, wxGrid looks a bit
 like the basic TStringGrid in Delphi, ie. it's pretty basic so that
 several vendors came up with enhanced alternatives. But maybe I
 haven't played with it long enough.

 www.asiplease.net/computing/delphi/images/string_grid_demo_popstars.gif

 It lacks sorting capability, merging cells with the same content, etc.

I found one of the projects I was thinking of. It's called pyspread
and has been getting updated quite a bit of late: 
http://sourceforge.net/projects/pyspread/

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


Re: convert binary to float

2008-06-01 Thread Mason
On Jun 1, 6:41 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
 On Sun, 1 Jun 2008 12:55:45 -0700 (PDT), Mason
 [EMAIL PROTECTED] declaimed the following in
 comp.lang.python:

  I have tried and tried...

  I'd like to read in a binary file, convert it's 4 byte values into
  floats, and then save as a .txt file.

  This works from the command line (import struct);

  In [1]: f = open(test2.pc0, rb)
  In [2]: tagData = f.read(4)
  In [3]: tagData

 Interpreter display of raw object name uses repr()

  Out[3]: '\x00\x00\xc0@'

  I can then do the following in order to convert it to a float:

  In [4]: struct.unpack(f, \x00\x00\xc0@)
  Out[4]: (6.0,)

  But when I run the same code from my .py file:

  f = open(test2.pc0, rb)
  tagData = f.read(4)
  print tagData

 Display from a print statement uses str()

  I get this (ASCII??):
  „@

 Probably not ASCII -- ASCII doesn't have that spanish (?) bottom row
 quote... And a pair of null bytes don't take up screen space.

  I only know how to work with '\x00\x00\xc0@'.

  I don't understand why the output isn't the same. I need a solution
  that will allow me to convert my binary file into floats. Am I close?
  Can anyone point me in the right direction?

 Why do you have to /see/ the byte representation in the first
 place... just feed the four bytes to the struct module directly.

 import struct
 fin = open(test2.pc0, rb)
 tagFloat = struct.unpack(f, fin.read(4))[0]
 print tagFloat
 --
 WulfraedDennis Lee Bieber   KD6MOG
 [EMAIL PROTECTED]  [EMAIL PROTECTED]
 HTTP://wlfraed.home.netcom.com/
 (Bestiaria Support Staff:   [EMAIL PROTECTED])
 HTTP://www.bestiaria.com/

Thanks Dennis, I'm OK now. I just sort of dropped the ball for a
bit :).

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


Re: convert binary to float

2008-06-01 Thread Mason
On Jun 1, 5:12 pm, George Sakkis [EMAIL PROTECTED] wrote:
 On Jun 1, 3:55 pm, Mason [EMAIL PROTECTED] wrote:



  I have tried and tried...

  I'd like to read in a binary file, convert it's 4 byte values into
  floats, and then save as a .txt file.

  This works from the command line (import struct);

  In [1]: f = open(test2.pc0, rb)
  In [2]: tagData = f.read(4)
  In [3]: tagData
  Out[3]: '\x00\x00\xc0@'

  I can then do the following in order to convert it to a float:

  In [4]: struct.unpack(f, \x00\x00\xc0@)
  Out[4]: (6.0,)

  But when I run the same code from my .py file:

  f = open(test2.pc0, rb)
  tagData = f.read(4)
  print tagData

  I get this (ASCII??):
  „@

 Remembering to put that struct.unpack() call in your module might
 help ;-)

 George

Wow ... I did have it in there, but I forgot include it in my post.
Anyway, this works just fine:

f = open(test2.pc0, rb)
tagData = f.read(4)
print struct.unpack(f, tagData)

Thanks for waking me up George!
--
http://mail.python.org/mailman/listinfo/python-list


Re: convert binary to float

2008-06-01 Thread Mark Tolonen
George Sakkis [EMAIL PROTECTED] wrote in message 
news:829b1e8f-baac-4ff4-909b-[EMAIL PROTECTED]

On Jun 1, 3:55 pm, Mason [EMAIL PROTECTED] wrote:

I have tried and tried...

I'd like to read in a binary file, convert it's 4 byte values into
floats, and then save as a .txt file.

This works from the command line (import struct);

In [1]: f = open(test2.pc0, rb)
In [2]: tagData = f.read(4)
In [3]: tagData
Out[3]: '\x00\x00\xc0@'

I can then do the following in order to convert it to a float:

In [4]: struct.unpack(f, \x00\x00\xc0@)
Out[4]: (6.0,)

But when I run the same code from my .py file:

f = open(test2.pc0, rb)
tagData = f.read(4)
print tagData

I get this (ASCII??):
„@


Remembering to put that struct.unpack() call in your module might
help ;-)

George


tagData still contains your data, but it is being displayed two different 
ways.  Consult the documentation about str() and repr().


-Mark

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


??? The most EVIL MOTIVE force in HISTORY - The SCHEMING, MANIPULATING and AGGRESSIVE KHAZAR - now also ZIONIST ???

2008-06-01 Thread lemnitzer
Full Article: http://iamthewitness.com/FreedmanFactsAreFacts.html
 KEY DOCUMENT

Steamy Excerpts:


Will you be patient with me while I review here as briefly as I can
the history of that political emergence and disappearance of a nation
from the pages of history?


In the year 1948 in the Pentagon in Washington I addressed a large
assembly of the highest ranking officers of the United States Army
principally in the G2 branch of Military Intelligence on the highly
explosive geopolitical situation in eastern Europe and the Middle
East. Then as now that area of the world was a potential threat to
the
peace of the world and to the security of this nation I explained to
them fully the origin of the Khazars and Khazar Kingdom. I felt then
as I feel now that without a clear and comprehensive knowledge of
that
subject it is not possible to understand or to evaluate properly what
has been taking place in the world since 1917, the year of the
Bolshevik revolution in Russia. It is the key to that problem.


Maybe you can explain to me, my dear Dr. Goldstein, the reason why
and
just how the origin and the history of the Khazars and Khazar Kingdom
was so well concealed from the world for so many centuries? What
secret mysterious power has been able for countless generations to
keep the origin and the history of the Khazars and Khazar Kingdom out
of history text-books and out of class-room courses in history
throughout the world? The origin and history of the Khazars and
Khazar
Kingdom are certainly incontestable historical facts. These
incontestable historic facts also establish beyond any question of
doubt the origin and history of the so-called or self-styled Jews
in
eastern Europe. The origin and history of the Khazars and Khazar
kingdom and their relationship to the origin and early history of the
so-called or self-styled Jews in eastern Europe was one of
history's
best kept secrets until wide publicity was given in recent years to
my
research on this subject. Do you not think, my dear Dr. Goldstein,
that it is time this whole subject was dragged out of its hiding
place?


In the year 1948 in the Pentagon in Washington I addressed a large
assembly of the highest ranking officers of the United States Army
principally in the G2 branch of Military Intelligence on the highly
explosive geopolitical situation in eastern Europe and the Middle
East. Then as now that area of the world was a potential threat to
the
peace of the world and to the security of this nation I explained to
them fully the origin of the Khazars and Khazar Kingdom. I felt then
as I feel now that without a clear and comprehensive knowledge of
that
subject it is not possible to understand or to evaluate properly what
has been taking place in the world since 1917, the year of the
Bolshevik revolution in Russia. It is the key to that problem.


Upon the conclusion of my talk a very alert Lieutenant Colonel
present
at the meeting informed me that he was the head of the history
department of one of the largest and highest scholastic rated
institutions of higher education in the United States. He had taught
history there for 16 years. He had recently been called back to
Washington for further military service. To my astonishment he
informed me that he had never in all his career as a history teachers
or otherwise heard the word khazar before he heard me mention it
there. That must give you some idea, my dear Dr. Goldstein, of how
successful that mysterious secret power was with their plot to block
out the origin and the history of the Khazars and Khazar Kingdom in
order to conceal from the world and particularly Christians the true
origin and the history of the so-called or self- styled Jews in
eastern Europe.


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


*** How the RASCAL President Woodrow Wilson was blackmailed like PUPPET by the AGGRESIVE, MANIPULATIVE KHAZAR Zionists ***

2008-06-01 Thread lemnitzer
Google is Khazar owned and controlled company. The Khazars plan to
electronify and accumulate the whole intellectual property on earth,
esp US, Europe and Australia thru google and already have accumulated
all the mint items in google Israel. This they must do before
launching their ARMAGEDDON. Since they have ALREADY accumulated them,
the copyright laws is like cutting our own feet with our own hand. If
I were the president and loyal to the USA, I would immediately send
federal troups to confiscate the whole operation of google and all
that they have must be made public property since no one can go into
the Israel and stop them from sharing wholesale.

http://iamthewitness.com/audio/Benjamin.H.Freedman/1974.Washington.D.C.speech.html
- The KEY LINK

Steamy Excerpt:

So, we had a President in Washington, Mr. Taft, Mr. Jacob Schiff, of
Kuhn, Loeb  Co., the bankers in New York who are the arm in the
United States of the Rothschild International world wide plutocracy -
Mr. Schiff, with two young men, went down to see Mr. Taft, and he
said, Mr. Taft, . . . (I am not telling you this out of my memory. I
almost know this by heart, because the books are here, in the
Congressional Library. The people who were in the room with President
Taft, at that time, and President Taft were told by Jacob H.
Schiff) . . . We want you to cancel the Most Favored Nation Treaty
with Czarist Russia, and we want you to recall our Ambassador. The
President told them, Mr. Schiff, things are not what you represent
them to be. My ambassador tells me differently. So, Mr. Schiff told
him, in so many words, Is you is, or is you ain't - going to do it?
When the President said that he would not do it, Mr. Schiff said We
will put a political party and a president in Washington, to whom we
can dictate what they should do.

.

They ganged up in New York, to get rid of Taft. I was a protégé of Mr.
Bernard Baruch - a name that I think you are all familiar with. His
father was a doctor, Dr. Simon Baruch, who had brought me into the
world, and Bernard Baruch was a visitor at our home all the time. He
courted my sister; one of my sisters. So the stage was set to get rid
of the Republican Party and the Republican President and put in their
own party and their own President. But it was very difficult, because,
after the Cleveland depression (President Cleveland was a Democrat, we
had Free Trade) we had the worst depression ever seen anywhere. And
that swept the Republican Party into power, because they advocated
tariff, protective tariff to protect the working man against the cheap
labor of Europe and to protect the infant industries, in the United
States against foreign competition.

.

They got Woodrow Wilson, the man who had more ego than any man I have
ever read about, they got him to head the Democratic Party. And they
got into difficulties! Because the Democrats only got the Electoral
votes in the South; where the people in agriculture wanted cheap goods
from Europe. But the North wanted the Republicans. They found out they
could not elect a President in the United States. So, I handled the
money; I was the leg man, the errand boy (I was only a boy then.) They
trotted Theodore Roosevelt out of the political moth-balls (He was
then an editor of a magazine). They told him, You are the
indispensable man. You are the only man who can save the United
States. And with his ego they formed the Bull Moose Party and Mr.
Jacob H. Schiff and the Jews throughout the world - they got plenty of
money from England - they formed the Bull Moose Party. And in that way
they split the Republican vote between Roosevelt and Taft, and Mr.
Wilson walked in with a minority of the popular vote - the lowest man,
(and I knew the inside of his private life, which I don't want to go
into here). But never was a lower rascal in the White House, and I've
known plenty of them since that time!

Now, Mr. Wilson really didn't know enough to come in out of the rain!
I cannot understand how he ever got there, except that in shuffling
the cards, they had the goods on him, You find in politics, every time
they pick a candidate, and put him out in front, they have the goods
on him. You know he had been sleeping with the wife of the professor
who lived next door to him at Princeton, whose name was Peck. And they
used to call Wilson, at Princeton, Peck's bad boy. When she got a
divorce and moved to Washington, she married a man who had a son. And
that son borrowed $40,000 from the bank, without asking them. He
didn't know how to pay it back, and the pressure on him was getting
very, very hot. So this woman heard of Samuel Untermeyer (of the big
firm, Googenheim, Untermeyer and Marshall) a prominent Democrat; and
supplied much money to the party. She went to him with a big package
of letters which I read (Wilson was a great letter writer. He knew the
language; there's no doubt about it, Wilson knew his vocabulary, when
it came to making love, anyway). So, they cooked this up 

Re: Good grid + calendar, etc.?

2008-06-01 Thread Fuzzyman
On Jun 1, 1:43 pm, Gilles Ganault [EMAIL PROTECTED] wrote:
 On Sun, 1 Jun 2008 21:27:30 +0900, Ryan Ginstrom

 [EMAIL PROTECTED] wrote:
 For your stated needs, I'd advise checking out IronPython or Python.NET
 (which allow use of .NET GUI libraries).

 Thanks but I forgot to say that I'd rather not use .Net because
 deployment/updates are too problematic for our audience.

 .. that's assuming that a GUI Python can install/update itself as
 easily as eg. Delphi, which is where I could be wrong :-/

Windows Forms (.NET) is one of the best looking Windows GUI toolkits
I've seen. It is also generally very easy to use from IronPython.

We haven't had a problem with deployment / updates with our customers
[1]. Problems you anticipate may be historical. .NET 2 has been pushed
out by Windows update for quite some time and it is *likely* that your
target computers already have it installed.

Further, the latest release of .NET (.NET 3.5 SP1 - still be in Beta)
includes tools for building 'msi' installers which either bundle the
parts of .NET you need - or handle the download and install of .NET on
the client machine (which approach you take is up to you - and
obviously they *don't* depend on having .NET already installed on the
target machine).

You can see some of the details on Scott Guthrie's blog:

http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx

Scroll down to the parts about .NET Framework Client Profile Setup
Package:

.NET 3.5 SP1 introduces a new setup package option for developers
building .NET client applications called the .NET Framework Client
Profile.  This provides a new setup installer that enables a smaller,
faster, and simpler installation experience for .NET client
applications on machines that do not already have the .NET Framework
installed.

And also .NET Framework Setup Bootstrapper for Client Applications:

.NET 3.5 SP1 introduces a new bootstrapper component that you can
use with client applications to help automate making sure that the
right version of the .NET Framework is installed. The bootstrapper
component can handle automatically downloading and installing either
the .NET Framework Client Profile or the full .NET Framework Setup
Package from the Internet if your machine doesn't have either of them
installed.  The boostrapper can also automatically handle upgrading
machines that have a previous version of the .NET Framework
installed.

All the best,


Michael Foord
http://www.ironpythoninaction.com/


[1] At Resolver Systems: http://www.resolversystems.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-06-01 Thread Arne Vajhøj

szr wrote:

Arne Vajhøj wrote:

szr wrote:

Peter Duniho wrote:

On Fri, 30 May 2008 22:40:03 -0700, szr [EMAIL PROTECTED]
wrote:

Arne Vajhøj wrote:

Stephan Bour wrote:

Lew wrote:
} John Thingstad wrote:
}  Perl is solidly based in the UNIX world on awk, sed, }  bash
and C. I don't like the style, but many do.
}
} Please exclude the Java newsgroups from this discussion.

Did it ever occur to you that you don't speak for entire news
groups?

Did it occur to you that there are nothing about Java in the
above ?

Looking at the original post, it doesn't appear to be about any
specific language.

Indeed.  That suggests it's probably off-topic in most, if not all,
of the newsgroups to which it was posted, inasmuch as they exist for
topics specific to a given programming language.

Perhaps - comp.programming might of been a better place, but not all
people who follow groups for specific languages follow a general
group like that - but let me ask you something. What is it you
really have against discussing topics with people of neighboring
groups? Keep in mind you don't have to read anything you do not want
to read. [1]

I very much doubt that the original thread is relevant for the Java
group.

But the subthread Lew commente don was about Perl and Unix. That is
clearly off topic.


I agree with and understand what you are saying in general, but still, 
isn't it possible that were are people in the java group (and others) 
who might of been following the thread, only to discover (probably not 
right away) that someone decided to remove the group they were reading 
the thread from? I know I would not like that, even if it wasn't on 
topic at the branch.


Personally, I find it very annoying to have to switch news groups in 
order to resume a thread and weed my way down the thread to where it 
left off before it was cut off from the previous group.


I am relative tolerant towards threads that are a bit off topic, if
the S/N ratio overall is good.

But I accept and respect that other people has a more strict
attitude against off topic posts.

And I am very little tolerant towards people that think they
can attack those that want only on topic posts.

One thing is to ask for a bit of slack regarding the rules
something else is attacking those that want the rules
kept.

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


Python needn't apologize (was: Using Python for programming algorithms)

2008-06-01 Thread Cameron Laird
In article [EMAIL PROTECTED],
sturlamolden  [EMAIL PROTECTED] wrote:
On May 18, 5:46 am, inhahe [EMAIL PROTECTED] wrote:

 The numbers I heard are that Python is 10-100 times slower than C.

Only true if you use Python as if it was a dialect of Visual Basic. If
you use the right tool, like NumPy, Python can be fast enough. Also
note that Python is not slower than any other language (including C)
if the code is i/o bound. As it turns out, most code is i/o bound,
even many scientific programs.

In scientific research, CPU time is cheap and time spent programming
is expensive. Instead of optimizing code that runs too slowly, it is
often less expensive to use fancier hardware, like parallell
computers. For Python, we e.g. have mpi4py which gives us access to
MPI. It can be a good advice to write scientific software
parallelizable from the start.
.
[more of same]
.
.
I can hardly overemphasize how often it happens not
just that Python is more than 1% as fast as C, not 
just that Python is fast enough, but that real-world
programs written in Python are FASTER then their
homologs coded in C.

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


Python-URL! - weekly Python news and links (May 26)

2008-06-01 Thread Gabriel Genellina
QOTW:  GHUM:  There are no big applications written in Python.

GHUM:  Big applications are written in JAVA or COBOL or C# or other legacy
programming systems.

GHUM:  If you programm in Python, your applications become quite small. Only
frameworks in Python are big.

JMC:  So the fact that there are no big applications written in Python IS the
success story. - Harald Armin Massa and D'Arcy J.M. Cain

http://coding.derkeiler.com/Archive/Python/comp.lang.python/2008-04/msg03005.html


Assign a value and test for it in a single statement:
http://mail.python.org/pipermail/python-list/2008-May/492988.html
http://mail.python.org/pipermail/python-list/2008-May/492425.html

D'Arcy J.M. Cain et al. combat the heterodoxy of David which questions
the usefulness of unit tests and test-driven development in general:
http://mail.python.org/pipermail/python-list/2008-May/493057.html

Comparing identity vs. comparing equality: what's the difference?
http://mail.python.org/pipermail/python-list/2008-May/492117.html

Relationship between logic and interface: the MVC pattern:
http://mail.python.org/pipermail/python-list/2008-May/492816.html

It isn't easy to alter how functions compare themselves (to avoid
duplicates, for example):
http://mail.python.org/pipermail/python-list/2008-May/493182.html

Organizing a project (directory layout):
http://mail.python.org/pipermail/python-list/2008-May/492010.html

Poll: How do you use Python in non-GUI work?
http://mail.python.org/pipermail/python-list/2008-May/491989.html

PHP compared to Python:
http://mail.python.org/pipermail/python-list/2008-May/492561.html

Is this language suitable for Operations Research?
http://mail.python.org/pipermail/python-list/2008-May/491867.html

Oldest thread still alive (from May 7): lambda expressions, now
talking about decorators:
http://mail.python.org/pipermail/python-list/2008-May/490027.html



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

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

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

Just beginning with Python?  This page is a great place to start:
http://wiki.python.org/moin/BeginnersGuide/Programmers

The Python Papers aims to publish the efforts of Python enthusiats:
http://pythonpapers.org/
The Python Magazine is a technical monthly devoted to Python:
http://pythonmagazine.com

Readers have recommended the Planet sites:
http://planetpython.org
http://planet.python.org

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

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

Python411 indexes podcasts ... to help people learn Python ...
Updates appear more-than-weekly:
http://www.awaretek.com/python/index.html

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

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

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

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

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance.
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch

Although unmaintained since 2002, the Cetus collection of Python
hyperlinks retains a few gems.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a 

Re: php vs python

2008-06-01 Thread Joel Koltner
Ethan Furman [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Jerry Stuckle wrote:
  As I've said before - good programmers can write good code in any
  language.
 So... an eloquent speaker of English is also an eloquent speaker of 
 Spanish/French/German?

There's potentially a large difference between a good speaker of 
English/German/etc. vs. eloquent.

I'd tend to agree with Jerry that if you can write good code in one 
language, you can in pretty much any other as well... but that doesn't imply 
you're necessarily eloquent in any languages. :-)  Eloquence is nice, but 
eradicating bad code in this world is about a million times more important 
than attempting to move people from good code to eloquent code.

To be Pythonic here, eloquent code would perhaps often have clear, clean 
list comprehensions used when good code would use a for loop but still be 
easy to follow as well and perfectly acceptable in the vast majority of cases.



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


a question about the #prefix of sys.argv

2008-06-01 Thread Aldarion
for the little script
#egg.py
import sys
for k,v in enumerate(sys.argv):
print k,v

it ignores  the part after # on linux
below is the running output on windows and linux. no clue here.
D:\python\noteegg.py #test
0 D:\python\note\egg.py
1 #test

D:\python\noteegg.py for bar #spam egg
0 D:\python\note\egg.py
1 for
2 bar
3 #spam
4 egg
[EMAIL PROTECTED]:~/transfer$ python2.5 egg.py #test
0 egg.py
[EMAIL PROTECTED]:~/transfer$ python2.5 egg.py foo bar #spam egg
0 egg.py
1 foo
2 bar
--
http://mail.python.org/mailman/listinfo/python-list


Re: a question about the #prefix of sys.argv

2008-06-01 Thread Peter Otten
Aldarion wrote:

 for the little script
 #egg.py
 import sys
 for k,v in enumerate(sys.argv):
 print k,v
 
 it ignores  the part after # on linux
 below is the running output on windows and linux. no clue here.

This has nothing to do with python, it's the shell that treats the # and
everything that follows as a comment.

$ ./listargs.py alpha #beta
0 ./listargs.py
1 alpha

But you can escape it:

$ ./listargs.py alpha \#beta
0 ./listargs.py
1 alpha
2 #beta

$ ./listargs.py alpha '#beta'
0 ./listargs.py
1 alpha
2 #beta

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

Re: a question about the #prefix of sys.argv

2008-06-01 Thread John Machin
On Jun 2, 9:54 am, Aldarion [EMAIL PROTECTED] wrote:
 for the little script
 #egg.py
 import sys
 for k,v in enumerate(sys.argv):
 print k,v

 it ignores  the part after # on linux

Perhaps it is the linux shell ...

 below is the running output on windows and linux. no clue here.
 D:\python\noteegg.py #test
 0 D:\python\note\egg.py
 1 #test

 D:\python\noteegg.py for bar #spam egg
 0 D:\python\note\egg.py
 1 for
 2 bar
 3 #spam
 4 egg
 [EMAIL PROTECTED]:~/transfer$ python2.5 egg.py #test
 0 egg.py
 [EMAIL PROTECTED]:~/transfer$ python2.5 egg.py foo bar #spam egg
 0 egg.py
 1 foo
 2 bar



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


Re: a question about the #prefix of sys.argv

2008-06-01 Thread Aldarion
On 6月2日, 上午8时05分, Peter Otten [EMAIL PROTECTED] wrote:
 Aldarion wrote:
  for the little script
  #egg.py
  import sys
  for k,v in enumerate(sys.argv):
  print k,v

  it ignores  the part after # on linux
  below is the running output on windows and linux. no clue here.

 This has nothing to do with python, it's the shell that treats the # and
 everything that follows as a comment.

 $ ./listargs.py alpha #beta
 0 ./listargs.py
 1 alpha

 But you can escape it:

 $ ./listargs.py alpha \#beta
 0 ./listargs.py
 1 alpha
 2 #beta

 $ ./listargs.py alpha '#beta'
 0 ./listargs.py
 1 alpha
 2 #beta

 Peter
thanks everyone for the quickly reply, i see now.
--
http://mail.python.org/mailman/listinfo/python-list

Re: Good grid + calendar, etc.?

2008-06-01 Thread Michael Torrie
Gilles Ganault wrote:
 The grid can be quite advanced. Did you look at the wxPython demo? Or
 Dabo?
 
 Yes, but although the basic wigets are just fine, wxGrid looks a bit
 like the basic TStringGrid in Delphi, ie. it's pretty basic so that
 several vendors came up with enhanced alternatives. But maybe I
 haven't played with it long enough.

You don't say anything about looking at Dabo.  If you are serious about
writing real business apps, then you really do need to look at Dabo.
While it's GUI objects may not be quite up to what you need, the
framework itself is very critical to developing business apps.  From
your posts in this thread, it sounds to me like Dabo would greatly help
you build the back-end database and business logic at least.

Despite what you say about web interfaces in business applications, from
what I've seen it's all going that way.  PeopleSoft, etc.  Everything is
about web-delivered apps, with web services and custom integration these
days.  HTML/CSS/Ajax and a bit of Silverlight or Flash for the super
custom widgets is actually competing *very* well with the traditional
Delphi business widgets.  True this requires you to maintain code in
multiple languages, but frankly that's the cost of doing business.
Business apps are *complicated* to build.

When it does come down to it, you'll probably have to build some of your
own widgets.  PyQT makes this quite easy.  Canvases, HTML widgets, etc.
 If you're going to all the work of developing a complete business app,
then the work that goes into developing custom GUI components isn't that
bad, compared.

Since your target audience appears to be windows users, though, I'd
second the notion of using IronPython and leveraging SWF .NET widgets.
In theory this would run fine under Mono on Unix if you wanted to branch
out.
--
http://mail.python.org/mailman/listinfo/python-list


Better performance

2008-06-01 Thread Franck Y
Hello Folks,

I am facing a problem where i need to parse around 200 files, i have a
bit of knowledge in PHP/Perl/Python (the magic P :-P)

Which one would you suggest me since i have to generate a web
interface ?
And each one has his  area of 'work'


Thanks for your help !


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


Better performance

2008-06-01 Thread Franck Y
Hello Folks,

I am facing a problem where i need to parse around 200 files, i have a
bit of knowledge in PHP/Perl/Python (the magic P :-P)

Which one would you suggest me since i have to generate a web
interface ?
And each one has his  area of 'work'


Thanks for your help !


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


[issue3018] tkinter demos fixed

2008-06-01 Thread Guilherme Polo

Changes by Guilherme Polo [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file10492/tkinter_demo_fixes.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3018
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3018] tkinter demos fixed

2008-06-01 Thread Guilherme Polo

Changes by Guilherme Polo [EMAIL PROTECTED]:


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3018
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue837234] Tk.quit and sys.exit cause Fatal Error

2008-06-01 Thread Georg Brandl

Changes by Georg Brandl [EMAIL PROTECTED]:


--
resolution:  - duplicate
status: pending - closed
superseder:  - Tk.quit leads to crash in python.exe

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue837234
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue775544] Tk.quit leads to crash in python.exe

2008-06-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
type:  - crash

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue775544
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1675334] Draft implementation for PEP 364

2008-06-01 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

I guess this is heavily out of date now?

--
nosy: +georg.brandl

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1675334
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2997] PyNumberMethods has left-over fields in Py3

2008-06-01 Thread Stefan Behnel

Stefan Behnel [EMAIL PROTECTED] added the comment:

This seems to have been applied in current SVN.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2997
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3020] doctest should have lib2to3 integration

2008-06-01 Thread Stefan Behnel

New submission from Stefan Behnel [EMAIL PROTECTED]:

Running a doctest with Py2 syntax in Py3 currently involves either
running the 2to3 tool by hand or writing code to convert the doctest
using lib2to3, and then running the modified version. This basically
pushes the burden of automating this step in any test runner script in
the world onto the authors or users of these scripts.

Writing portable code is hard enough, but writing portable doctests that
remain user readable should not remain as hard as it currently is. The
doctest module in Py3 should have a simple option to run a Py2 doctest
(in a file or doc string) without requiring users to write the glue code
for it.

On a related note, if a 3to2 tool becomes available, this should be
directly supported by doctest in Py2.6.

--
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool), Library (Lib)
messages: 67594
nosy: collinwinter, scoder
severity: normal
status: open
title: doctest should have lib2to3 integration
type: feature request
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3020
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2775] Implement PEP 3108

2008-06-01 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser [EMAIL PROTECTED]:


--
nosy: +kbk

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2775
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2917] merge pickle and cPickle in 3.0

2008-06-01 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser [EMAIL PROTECTED]:


--
nosy: +kbk

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2917
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1513695] new turtle module

2008-06-01 Thread Gregor Lingl

Gregor Lingl [EMAIL PROTECTED] added the comment:

Hi,
here is my contribution. 
The zip-file contains

- the module turtle.py
- a doc-file turtle-docs.txt
- a subdirectory with a series of sample scripts and a demoviewer.
  (one of the demoscripts is a standalone script)

Clearly the docs have to be transformed to reST. I would do it or
participate but that certainly would only be ready within 2 or 3 weeks.
The end of the school year is near and I have a huge amount of work
in my school until approx. 20th of June. After this I have plenty of
time also for correcting etc. 

Of course I'll also do bugfixes etc. Anyway I'm interested in feedback
of any sort. 

I worked hard to do my best and I hope the result will be appreciated.
Best regards,
Gregor

Added file: http://bugs.python.org/file10493/turtle.zip

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1513695
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2507] Exception state lives too long in 3.0

2008-06-01 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

A clean solution is now proposed in #3021.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2507
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2833] __exit__ silences the active exception

2008-06-01 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

A clean solution to both #2507 and #2833 is now proposed in #3021.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1883] Adapt pydoc to new doc system

2008-06-01 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

OK, this is fixed by including topic help as a separate module, and not
relying on the HTML documentation, in r63871.

--
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1883
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2873] Remove htmllib use in the stdlib

2008-06-01 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

Removed usage in pydoc in r63871.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2873
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue600362] relocate cgi.parse_qs() into urlparse

2008-06-01 Thread Senthil

Senthil [EMAIL PROTECTED] added the comment:

parse_qs and parse_qsl moved to urlparse with this patch.
I dont think urlencode would be a good method for urlparse. But this
will cease to exist with the addressing of 3108.

--
keywords: +patch
Added file: http://bugs.python.org/file10496/issue600362.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue600362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2507] Exception state lives too long in 3.0

2008-06-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
superseder:  - Lexical exception handlers

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2507
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2833] __exit__ silences the active exception

2008-06-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
superseder:  - Lexical exception handlers

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3022] mailbox module, two small fixes

2008-06-01 Thread Guilherme Polo

Guilherme Polo [EMAIL PROTECTED] added the comment:

Erm.. sorry, the first correction is directly related to get_message not
get_sequences per se.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3022
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3021] Lexical exception handlers

2008-06-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
nosy: +benjamin.peterson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3021
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2775] Implement PEP 3108

2008-06-01 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
dependencies:  -Remove htmllib use in the stdlib

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2775
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >