[Click the star to watch this topic] HOT LINKS FOR YOUTH ONLY

2012-04-11 Thread e kartheeka
[Click the star to watch this topic]HOT LINKS FOR YOUTH ONLY
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f python?

2012-04-11 Thread WJ
Xah Lee wrote:

> 
> so recently i switched to a Windows version of python. Now, Windows
> version takes path using win backslash, instead of cygwin slash. This
> fucking broke my find/replace scripts that takes a dir level as input.
> Because i was counting slashes.

Slashes can work under windows, up to a point:

C:\>cd info/source

C:\info\source>


Also, most languages I use under windows allow you to use
slashes in paths:

C:\>ruby -e "puts IO.read( 'c:/info/frag' )"
275439
10
102972
10
102972
11
102972
10

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


Re: functions which take functions

2012-04-11 Thread Kiuhnm

On 4/10/2012 23:43, Eelco wrote:

On Apr 10, 3:36 am, Kiuhnm  wrote:

On 4/10/2012 14:29, Ulrich Eckhardt wrote:


Am 09.04.2012 20:57, schrieb Kiuhnm:

Do you have some real or realistic (but easy and self-contained)
examples when you had to define a (multi-statement) function and pass it
to another function?



Take a look at decorators, they not only take non-trivial functions but
also return them. That said, I wonder what your intention behind this
question is...



:)


That won't do. A good example is when you pass a function to re.sub, for
instance.

Kiuhnm


Wont do for what? Seems like a perfect example of function-passing to
me.


That's more an example of function transformation.


If you have such a precise notion of what it is you are looking for,
why even ask?


As I said, I need real-life examples. Enough with prime numbers and 
recursive qsort...


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


Re: functions which take functions

2012-04-11 Thread Dave Angel
On 04/11/2012 06:55 AM, Kiuhnm wrote:
> On 4/10/2012 23:43, Eelco wrote:
>> On Apr 10, 3:36 am, Kiuhnm  wrote:
>>> On 4/10/2012 14:29, Ulrich Eckhardt wrote:
>>>
 Am 09.04.2012 20:57, schrieb Kiuhnm:
> Do you have some real or realistic (but easy and self-contained)
> examples when you had to define a (multi-statement) function and
> pass it
> to another function?
>>>
 Take a look at decorators, they not only take non-trivial functions
 but
 also return them. That said, I wonder what your intention behind this
 question is...
>>>
 :)
>>>
>>> That won't do. A good example is when you pass a function to re.sub,
>>> for
>>> instance.
>>>
>>> Kiuhnm
>>
>> Wont do for what? Seems like a perfect example of function-passing to
>> me.
>
> That's more an example of function transformation.
>
>> If you have such a precise notion of what it is you are looking for,
>> why even ask?
>
> As I said, I need real-life examples. Enough with prime numbers and
> recursive qsort...
>
> Kiuhnm

How about any GUI application?  Every gui interface I've seen makes you
register your callbacks as functions, by passing the function object
into some gui function specific to an event or class of events.

Then when the event fires, the function is actually called.

-- 

DaveA

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


Webhosting, Domain Name, Data Center Cyprus, Hosting Services

2012-04-11 Thread Webhosting, Domain Name, Data Center Cyprus, Hosting Services
Webhosting – postcy - a leading web hosting company. We offer
webhosting, domain name, hosting services, cyprus domain, domain names
cyprus at affordable cost.
for more details please contact : http://www.postcy.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski


I wrote about a straightforward way to program D. E. Knuth in Python,
and received an excellent communcation about programming Deterministic
Finite Automata (Finite State Machines) in Python.

The following stems from my Knuth in Python programming exercises,
according to that very good communication.  (By Roy Smith.)

I'm in the process of delving carefully into Knuth's brilliant and
voluminous work The Art of Computer Programming, Parts 1--3 plus the
Fascicles in Part 4 -- the back cover of Part 1 reads:

"If you think you're a really good programmer -- read [Knuth's] Art of
Computer Programming... You should definitely send me a résumé if you
can read the whole thing."  -- Bill Gates.

(Microsoft may in the future receive some e-mail from me.)

But now for programming Knuth with the DFA construct.  Following is a
working Python program which (almost) calculates the date of the
Easter in the given year.  See Donald E. Knuth: The Art of Computer
Programming, VOLUME 1, 3rd Edition, p. 160, Algorithm E, Date of
Easter.  I chose something trivial because I want the programming
methodology to be as clearly visible as possible.  The program
contains quite a ballet between integers and floats, but I wanted to
do this as meticulously as possible.






# Date of Easter from D. E. Knuth.  Antti J Ylikoski 04-11-2012.
#
# See Donald E. Knuth: The Art of Computer Programming, VOLUME 1, 3rd
# Edition, ISBN 0-201-89683-4, ADDISON-WESLEY 2005, p. 160.
#
# The following stems from Roy Smith in the news:comp.lang.python.
#
# 
#
#When I've done FSMs in Python, I've found the cleanest way is to make
#each state a function.  Do something like:
#
#def a1(input):
#   # (Do the work of Phase A1.)
#if :
#return a5  # goto state a5
#else:
#return a1  # stay in the same state
#
## and so on for the other states.
#
#next_state = a1
#for input in whatever():
#   next_state = next_state(input)
#   if next_state is None:
#  break
#
#You can adjust that for your needs.  Sometimes I have the states return
#a (next_state, output) tuple.  You could use a distinguished done()
#state, or just use None for that.  I wrote the example above as global
#functions, but more commonly these would be methods of some StateMachine
#class.
#
# 
#
# The program calculates correctly after D. E. Knuth but it has the
# actual
# yearly calendar Easter dates wrong.  See Knuth's text.
#


import math


def E1():
# Phase E1 in Knuth's text.
global G, Y
G = (Y % 19) +1
return E2 # next state: E2


def E2():
# Phase E2 in Knuth's text.
global Y, C
C = math.floor(float(Y)/100.0) + 1
return E3 # next state: E3


def E3():
# Phase E3 in Knuth's text.
global X, Z, C
X = math.floor((3.0*float(C))/4.0)
Z = math.floor((8.0*float(C) + 5.0)/25.0) - 5
return E4 # next state: E4


def E4():
# Phase E4 in Knuth's text.
global D, X
D = math.floor((5.0*float(Y))/4.0) - X - 10
return E5 # following state: E5


def E5():
# Phase E5 in Knuth's text.
global E, G, Z
auxE = (11*G + 20 + Z - X)
if auxE < 0:
auxE += 30
E =  auxE % 30
if (E == 25 and G > 11) or E == 24:
E += 1
return E6 # following state: E6


def E6():
# Phase E6 in Knuth's text.
global N, E
N = 44 - E
if N < 21:
N = N + 30
return E7 #  next state: E7


def E7():
# Phase E7 in Knuth's text.
global N, D
N = N + 7 - ((D + N) % 7)
return E8 # following state: E8


def E8():
# Phase E8 in Knuth's text.
global N, Y
if N > 31:
print(int((N - 31)), "th ", "APRIL, ", Y)
else:
print(int(N), "th ", "MARCH, ", Y)
return None # No following state



# Next, the main function:
#
#next_state = a1
#for input in whatever():
#   next_state = next_state(input)
#   if next_state is None:
#  break


def Easter(Year):
global G, Y, C, X, Z, D, N, E
Y = Year
nextState = E1
continueLoop = 1
while continueLoop:
nextState = nextState()
if nextState is None:
break


if __name__ == '__main__':
inp0 = int(input("The year: "))
Easter(inp0)


# Plaudite cives, acta est fabula.
#
# AJY 04-11-2012.






kind regards, Antti J Ylikoski
Helsinki, Finland, the EU
http://www.tkk.fi/~ajy/
http://www.tkk.fi/~ajy/diss.pdf
[email protected]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Grant Edwards
On 2012-04-11, Antti J Ylikoski  wrote:

> I wrote about a straightforward way to program D. E. Knuth in Python,

Yikes. I think if you're going to try to write AI in Pyton, you might
want to start out programming something a bit simpler...

;)

-- 
Grant Edwards   grant.b.edwardsYow! I'm RELIGIOUS!!
  at   I love a man with
  gmail.coma HAIRPIECE!!  Equip me
   with MISSILES!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f python?

2012-04-11 Thread Seymour J.
In <[email protected]>, on 04/10/2012
   at 09:10 PM, Rainer Weikusat  said:

>'car' and 'cdr' refer to cons cells in Lisp, not to strings. How the
>first/rest terminology can be sensibly applied to 'C strings' (which
>are similar to linked-lists in the sense that there's a 'special
>termination value' instead of an explicit length)

A syringe is similar to a sturgeon in the sense that they both start
with S. LISP doesn't have arrays, and C doesn't allow you to insert
into the middle of an array.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to [email protected]

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski

On 11.4.2012 16:23, Grant Edwards wrote:

On 2012-04-11, Antti J Ylikoski  wrote:


I wrote about a straightforward way to program D. E. Knuth in Python,


Yikes. I think if you're going to try to write AI in Pyton, you might
want to start out programming something a bit simpler...

;)



:-)))

As to AI in Python, see

http://code.google.com/p/aima-python/

kind regards, Andy Y. alias Dr. Why

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


Re: functions which take functions

2012-04-11 Thread Antti J Ylikoski

On 9.4.2012 21:57, Kiuhnm wrote:

Do you have some real or realistic (but easy and self-contained)
examples when you had to define a (multi-statement) function and pass it
to another function?
Thank you.

Kiuhnm


A function to numerically integrate another function comes as follows:

--

# Adaptive Simpson's integral.
#
# AJY 03-28-2012 from the Wikipedia.

import math

def simpsonsRule(f,a,b):
c = (a+b) / 2.0
h3 = abs(b-a) / 6.0
return h3*(f(a) + 4.0*f(c) + f(b))

def recursiveASR(f,a,b,eps,whole):
"Recursive implementation of adaptive Simpson's rule."
c = (a+b) / 2.0
left = simpsonsRule(f,a,c)
right = simpsonsRule(f,c,b)
if abs(left + right - whole) <= 15*eps:
return left + right + (left + right - whole)/15.0
return recursiveASR(f,a,c,eps/2.0,left) + \
recursiveASR(f,c,b,eps/2.0,right)

def adaptiveSimpsonsRule(f,a,b,eps):
"Calculate integral of f from a to b with max error of eps."
return recursiveASR(f,a,b,eps,simpsonsRule(f,a,b))

def invx(x):
return 1.0 / x


print("Simpson integral : ", \
adaptiveSimpsonsRule(invx,1.0,2.0,.1))
print("Exact value ln(2): ", math.log(2.0))
print("Value of epsilon : ", .1)





kind regards, Antti J Ylikoski
Helsinki, Finland, the EU
http://www.tkk.fi/~ajy/
http://www.tkk.fi/~ajy/diss.pdf
[email protected]
--
http://mail.python.org/mailman/listinfo/python-list


Re: f python?

2012-04-11 Thread Kaz Kylheku
["Followup-To:" header set to comp.lang.lisp.]
On 2012-04-11, Shmuel Metz  wrote:
> In <[email protected]>, on 04/10/2012
>at 09:10 PM, Rainer Weikusat  said:
>
>>'car' and 'cdr' refer to cons cells in Lisp, not to strings. How the
>>first/rest terminology can be sensibly applied to 'C strings' (which
>>are similar to linked-lists in the sense that there's a 'special
>>termination value' instead of an explicit length)
>
> A syringe is similar to a sturgeon in the sense that they both start
> with S. LISP doesn't have arrays, and C doesn't allow you to insert
> into the middle of an array.

Lisp, however, has arrays. (Not to mention hash tables, structures, and
classes). Where have you been since 1960-something?

  (let ((array #(1 2 3 4)))
(aref array 3)) ;; -> 4, O(1) access
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread mwilson
Antti J Ylikoski wrote:

> 
> I wrote about a straightforward way to program D. E. Knuth in Python,
> and received an excellent communcation about programming Deterministic
> Finite Automata (Finite State Machines) in Python.
[ ... ]
> #You can adjust that for your needs.  Sometimes I have the states return
> #a (next_state, output) tuple.  You could use a distinguished done()
> #state, or just use None for that.  I wrote the example above as global
> #functions, but more commonly these would be methods of some StateMachine
> #class.
> #
> # 
> #
> # The program calculates correctly after D. E. Knuth but it has the
> # actual
> # yearly calendar Easter dates wrong.  See Knuth's text.
> #
[ ... ]
> def Easter(Year):
>  global G, Y, C, X, Z, D, N, E
>  Y = Year
>  nextState = E1
>  continueLoop = 1
>  while continueLoop:
>  nextState = nextState()
>  if nextState is None:
>  break

def Easter (year):
global Y
Y = year
nextState = E1
while nextState is not None:
nextState = nextState()


would be a little cleaner.  As you say, to be really clean, make a class.

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


Re: f python?

2012-04-11 Thread Rainer Weikusat
Shmuel (Seymour J.) Metz  writes:
> In <[email protected]>, on 04/10/2012
>at 09:10 PM, Rainer Weikusat  said:
>
>>'car' and 'cdr' refer to cons cells in Lisp, not to strings. How the
>>first/rest terminology can be sensibly applied to 'C strings' (which
>>are similar to linked-lists in the sense that there's a 'special
>>termination value' instead of an explicit length)
>
> A syringe is similar to a sturgeon in the sense that they both start
> with S.

And the original definition of 'idiot' is 'a guy who cannot learn
because he is too cocksure to already know everything'. Not that this
would matter in the given context ...

> LISP doesn't have arrays,

Lisp has arrays.

> and C doesn't allow you to insert
> into the middle of an array.

Well, of course it does: You just have to move the content of all
memory cells 'after' the new insert 'one up'. But unless I'm very much
mistaken, the topic was "first and rest" (car and cdr), as the terms
could be used with a C string and not "whatever Shmuel happens to
believe to know" ...
-- 
http://mail.python.org/mailman/listinfo/python-list


python module development workflow

2012-04-11 Thread Peng Yu
Hi,

It is confusing to me what the best workflow is for python module
development. There is setup.py, egg. Also, pip, easy_install.

Could any expert suggest an authoritative and complete guide for
developing python modules? Thanks!

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


Re: python module development workflow

2012-04-11 Thread John Gordon
In <2900f481-fbe9-4da3-a7ca-5485d1ceb...@m13g2000yqc.googlegroups.com> Peng Yu 
 writes:

> It is confusing to me what the best workflow is for python module
> development. There is setup.py, egg. Also, pip, easy_install.

It's unclear what you are asking.

How to develop your own modules?

How to package and distribute your own modules once they're finished?

How to install modules that other people have developed?

-- 
John Gordon   A is for Amy, who fell down the stairs
[email protected]  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


Re: f python?

2012-04-11 Thread Pascal J. Bourguignon
Shmuel (Seymour J.) Metz  writes:

> In <[email protected]>, on 04/10/2012
>at 09:10 PM, Rainer Weikusat  said:
>
>>'car' and 'cdr' refer to cons cells in Lisp, not to strings. How the
>>first/rest terminology can be sensibly applied to 'C strings' (which
>>are similar to linked-lists in the sense that there's a 'special
>>termination value' instead of an explicit length)
>
> A syringe is similar to a sturgeon in the sense that they both start
> with S. LISP doesn't have arrays, and C doesn't allow you to insert
> into the middle of an array.

You're confused. C doesn't have arrays.  Lisp has arrays.
C only has vectors (Lisp has vectors too).

That C calls its vectors "array", or its bytes "char" doesn't change the
fact that C has no array and no character.


cl-user> (make-array '(3 4 5) :initial-element 42)
#3A(((42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42))
((42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42))
((42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42) (42 42 42 42 42)))

cl-user> (make-array 10 :initial-element 42)
#(42 42 42 42 42 42 42 42 42 42)



-- 
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python module development workflow

2012-04-11 Thread Peng Yu
On Apr 11, 10:25 am, John Gordon  wrote:
> In <2900f481-fbe9-4da3-a7ca-5485d1ceb...@m13g2000yqc.googlegroups.com> Peng 
> Yu  writes:
>
> > It is confusing to me what the best workflow is for python module
> > development. There is setup.py, egg. Also, pip, easy_install.
>
> It's unclear what you are asking.
>
> How to develop your own modules?
>
> How to package and distribute your own modules once they're finished?

I'm asking these two questions.
-- 
http://mail.python.org/mailman/listinfo/python-list


red-black tree data structure

2012-04-11 Thread Jabba Laci
Hi,

It's not really a Python-related question, sorry for that. Does anyone
know why red-black trees got these colors in their names? Why not
blue-orange for instance? I'm just curious.

Thanks,

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Kurt Mueller

Am 11.04.2012 16:38, schrieb [email protected]:

Antti J Ylikoski wrote:

I wrote about a straightforward way to program D. E. Knuth in Python,


Maybe it's godly coded...


$ python Easter.py
The year: 2012
(20, 'th ', 'APRIL, ', 2012)
$

AFAIK it was the 8th of April 2012?



Grüessli
--
Kurt Müller, [email protected]

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


Re: red-black tree data structure

2012-04-11 Thread Ian Kelly
On Wed, Apr 11, 2012 at 11:14 AM, Jabba Laci  wrote:
> Hi,
>
> It's not really a Python-related question, sorry for that. Does anyone
> know why red-black trees got these colors in their names? Why not
> blue-orange for instance? I'm just curious.

http://programmers.stackexchange.com/questions/116614/where-does-the-term-red-black-tree-come-from
-- 
http://mail.python.org/mailman/listinfo/python-list


How to filter a dictionary ?

2012-04-11 Thread Wenhua Zhao
Hi,

Nikhil Verma writes:
 > In [9]: (k for k,v in for_patient_type.iteritems() if v == 'Real')

You can use dict comprehension, just change () to {}.

>>> for_patient_type = {37: u'Test', 79: u'Real', 80: u'Real', 81: u'Real', 83: 
>>> u'Real', 84: u'Real', 91: u'Real', 93: u'Real'}
>>> {k:v for k,v in for_patient_type.iteritems() if v == 'Real'}
>>> 
>>>
{79: u'Real', 80: u'Real', 81: u'Real', 83: u'Real', 84: u'Real', 91: u'Real', 
93: u'Real'}   
>>> 

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


Re: red-black tree data structure

2012-04-11 Thread Jabba Laci
Hi,

Thanks for the answer. I copy the solution here:

According to wikipedia: "The original structure was invented in 1972
by Rudolf Bayer and named "symmetric binary B-tree," but acquired its
modern name in a paper in 1978 by Leonidas J. Guibas and Robert
Sedgewick."

Answer from Professor Guidas:

"from Leonidas Guibas [email protected] to of the "Red-Black"
term mailed-by cs.stanford.edu hide details 16:16 (0 minutes ago)

we had red and black pens for drawing the trees."

Laszlo

On Wed, Apr 11, 2012 at 19:39, Ian Kelly  wrote:
> On Wed, Apr 11, 2012 at 11:14 AM, Jabba Laci  wrote:
>> Hi,
>>
>> It's not really a Python-related question, sorry for that. Does anyone
>> know why red-black trees got these colors in their names? Why not
>> blue-orange for instance? I'm just curious.
>
> http://programmers.stackexchange.com/questions/116614/where-does-the-term-red-black-tree-come-from
-- 
http://mail.python.org/mailman/listinfo/python-list


Wing IDE 4.1.5 released

2012-04-11 Thread Wingware

Hi,

Wingware has released version 4.1.5 of Wing IDE, an integrated development
environment designed specifically for the Python programming language.

Wing IDE is a cross-platform Python IDE that provides a professional code
editor with vi, emacs, and other key bindings, auto-completion, call tips,
refactoring, context-aware auto-editing, a powerful graphical debugger,
version control, unit testing, search, and many other features.

**Changes**

Recent changes include:

* Add Show in Explorer/Finder and Copy File Path to editor tab context menu
* Include special and inherited methods names in the auto-completer
* Option to sort unit tests by source order
* Item in Options menu of Search in Files to copy results to clipboard
* Print and Select All in the debug I/O context menu
* Project property to override the Strip Trailing White Space preference
* Improved auto-editing with repeated press of :
* Auto-wrap auto-entered invocations
* Added support for debugging QThreads in PySide and PyQt4
* Option to auto-show Debug I/O tool on first output in each debug run
* Added support for Python 3.3 alpha1
* Emacs mode Alt-{ and Alt-}
* Improved Python turbo completion mode
* Several VI mode improvements
* About 50 other bug fixes and minor improvements

Complete change log: http://wingware.com/pub/wingide/4.1.5/CHANGELOG.txt

**New Features in Version 4**

Version 4 adds the following new major features:

* Refactoring -- Rename/move symbols, extract to function/method, and 
introduce variable

* Find Uses -- Find all points of use of a symbol
* Auto-Editing -- Reduce typing by auto-entering expected code
* Diff/Merge -- Graphical file and repository comparison and merge
* Django Support -- Debug Django templates, run Django unit tests, and more
* matplotlib Support -- Maintains live-updating plots in shell and debugger
* Simplified Licensing -- Includes all OSes and adds Support+Upgrades 
subscriptions


Details on licensing changes: http://wingware.com/news/2011-02-16

**About Wing IDE**

Wing IDE is an integrated development environment designed specifically for
the Python programming language.  It provides powerful editing, testing, and
debugging features that help reduce development and debugging time, cut down
on coding errors, and make it easier to understand and navigate Python code.
Wing IDE can be used to develop Python code for web, GUI, and embedded
scripting applications.

Wing IDE is available in three product levels:  Wing IDE Professional is
the full-featured Python IDE, Wing IDE Personal offers a reduced feature
set at a low price, and Wing IDE 101 is a free simplified version designed
for teaching beginning programming courses with Python.

Version 4.0 of Wing IDE Professional includes the following major features:

* Professional quality code editor with vi, emacs, and other keyboard
  personalities
* Code intelligence for Python:  Auto-completion, call tips, find uses,
  goto-definition, error indicators, refactoring, context-aware 
auto-editing,

  smart indent and rewrapping, and source navigation
* Advanced multi-threaded debugger with graphical UI, command line 
interaction,

  conditional breakpoints, data value tooltips over code, watch tool, and
  externally launched and remote debugging
* Powerful search and replace options including keyboard driven and 
graphical

  UIs, multi-file, wild card, and regular expression search and replace
* Version control integration for Subversion, CVS, Bazaar, git, 
Mercurial, and

  Perforce
* Integrated unit testing with unittest, nose, and doctest frameworks
* Django support:  Debugs Django templates, provides project setup tools,
  and runs Django unit tests
* Many other features including project manager, bookmarks, code snippets,
  diff/merge tool, OS command integration, indentation manager, PyLint
  integration, and perspectives
* Extremely configurable and may be extended with Python scripts
* Extensive product documentation and How-Tos for Django, matplotlib,
  Plone, wxPython, PyQt, mod_wsgi, Autodesk Maya, and many other frameworks

Please refer to http://wingware.com/wingide/featuresfor a detailed listing
of features by product level.

System requirements are Windows 2000 or later, OS X 10.3.9or later (requires
X11 Server), or a recent Linux system (either 32 or 64 bit).  Wing IDE 
supports

Python versions 2.0.x through 3.2.x and Stackless Python.

For more information, see the http://wingware.com/

**Downloads**

Wing IDE Professional and Wing IDE Personal are commercial software and
require a license to run. A free trial can be obtained directly from the
product when launched.

Wing IDE Pro -- Full-featured product:
http://wingware.com/downloads/wingide/4.1

Wing IDE Personal -- A simplified IDE:
http://wingware.com/downloads/wingide-personal/4.1

Wing IDE 101 -- For teaching with Python:
http://wingware.com/downloads/wingide-101/4.1

**Purchasing and Upgrading**

Wing 4.x requires an upgrade for Wing IDE 2.x and 3.x users at a cost of

Re: functions which take functions

2012-04-11 Thread Tim Chase

On 04/10/12 08:36, Kiuhnm wrote:

On 4/10/2012 14:29, Ulrich Eckhardt wrote:

Am 09.04.2012 20:57, schrieb Kiuhnm:

That won't do. A good example is when you pass a function to
re.sub, for instance.


If that's a good example, then why not use it?  I've used it on 
multiple occasions to do lookups for replacements, math on the 
match bits, or other more complex calculations.


-tkc


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


[RELEASED] Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3

2012-04-11 Thread Benjamin Peterson
We're bursting with enthusiasm to announce the immediate availability of Python
2.6.8, 2.7.3, 3.1.5, and 3.2.3. These releases included several security fixes.

Note: Virtualenvs created with older releases in the 2.6, 2.7, 3.1, or 3.2
series may not work with these bugfix releases. Specifically, the os module may
not appear to have a urandom function. This is a virtualenv bug, which can be
solved by recreating the broken virtualenvs with the newer Python versions.

The main impetus for these releases is fixing a security issue in Python's hash
based types, dict and set, as described below. Python 2.7.3 and 3.2.3 include
the security patch and the normal set of bug fixes. Since Python 2.6 and 3.1 are
maintained only for security issues, 2.6.8 and 3.1.5 contain only various
security patches.

The security issue exploits Python's dict and set implementations. Carefully
crafted input can lead to extremely long computation times and denials of
service. [1] Python dict and set types use hash tables to provide amortized
constant time operations. Hash tables require a well-distributed hash function
to spread data evenly across the hash table. The security issue is that an
attacker could compute thousands of keys with colliding hashes; this causes
quadratic algorithmic complexity when the hash table is constructed. To
alleviate the problem, the new releases add randomization to the hashing of
Python's string types (bytes/str in Python 3 and str/unicode in Python 2),
datetime.date, and datetime.datetime. This prevents an attacker from computing
colliding keys of these types without access to the Python process.

Hash randomization causes the iteration order of dicts and sets to be
unpredictable and differ across Python runs. Python has never guaranteed
iteration order of keys in a dict or set, and applications are advised to never
rely on it. Historically, dict iteration order has not changed very often across
releases and has always remained consistent between successive executions of
Python. Thus, some existing applications may be relying on dict or set ordering.
Because of this and the fact that many Python applications which don't accept
untrusted input are not vulnerable to this attack, in all stable Python releases
mentioned here, HASH RANDOMIZATION IS DISABLED BY DEFAULT. There are two ways to
enable it. The -R commandline option can be passed to the python executable. It
can also be enabled by setting an environmental variable PYTHONHASHSEED to
"random". (Other values are accepted, too; pass -h to python for complete
description.)

More details about the issue and the patch can be found in the oCERT advisory
[1] and the Python bug tracker [2].

Another related security issue fixed in these releases is in the expat XML
parsing library. expat had the same hash security issue detailed above as
Python's core types. The hashing algorithm used in the expat library is now
randomized.

A few other security issues were fixed. They are described on the release pages
below.

These releases are production releases.

Downloads are at

http://python.org/download/releases/2.6.8/
http://python.org/download/releases/2.7.3/
http://python.org/download/releases/3.1.5/
http://python.org/download/releases/3.2.3/

As always, please report bugs to

http://bugs.python.org/

Happy-to-put-hash-attack-issues-behind-them-ly yours,
The Python release team
Barry Warsaw (2.6), Georg Brandl (3.2), and Benjamin Peterson (2.7 and 3.1)

[1] http://www.ocert.org/advisories/ocert-2011-003.html
[2] http://bugs.python.org/issue13703
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Library or Module for clipping audio files

2012-04-11 Thread Miki Tebeka
> I'm trying to find a good python library/module that will allow me to
> clip audio files, preferably mp3/ogg format. Does anyone have any good
> suggestions?
I never used it, but I think pymedia might fit the bill.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python module development workflow

2012-04-11 Thread Miki Tebeka
> Could any expert suggest an authoritative and complete guide for
> developing python modules? Thanks!
I'd start with http://docs.python.org/distutils/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Framework for a beginner

2012-04-11 Thread biofobico
I am new to python and only have read the Byte of Python ebook, but want to 
move to the web. I am tired of being a CMS tweaker and after I tried python, 
ruby and php, the python language makes more sense (if that makes any "sense" 
for the real programmers). I heard a lot of good things about Django, Pyramid, 
etc, but I dont want to pick the most used or the one with the most magic. 
Instead I was thinking about one that could "teach" me python along the way. My 
plan is to rebuild my portfolio using python and a framework and also benefit 
my python learning along the way.

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread John Nagle

On 4/11/2012 6:03 AM, Antti J Ylikoski wrote:


I wrote about a straightforward way to program D. E. Knuth in Python,
and received an excellent communcation about programming Deterministic
Finite Automata (Finite State Machines) in Python.

The following stems from my Knuth in Python programming exercises,
according to that very good communication. (By Roy Smith.)

I'm in the process of delving carefully into Knuth's brilliant and
voluminous work The Art of Computer Programming, Parts 1--3 plus the
Fascicles in Part 4 -- the back cover of Part 1 reads:

"If you think you're a really good programmer -- read [Knuth's] Art of
Computer Programming... You should definitely send me a résumé if you
can read the whole thing." -- Bill Gates.

(Microsoft may in the future receive some e-mail from me.)


You don't need those books as much as you used to.
You don't have to write collections, hash tables, and sorts much
any more.  Those are solved problems and there are good libraries.
Most of the basics are built into Python.

Serious programmers should read those books, much as they should
read von Neumann's "First Draft of a Report on the EDVAC", for
background on how things work down at the bottom.  But they're
no longer essential desk references for most programmers.

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


Re: red-black tree data structure

2012-04-11 Thread Dan Stromberg
Bringing this back  to Python a bit:
http://newcenturycomputers.net/projects/rbtree.html
http://pypi.python.org/pypi/bintrees/0.3.0
http://pypi.python.org/pypi/treap/0.995

Red-Black trees are supposed to be slower than treaps on average, but
they're also supposed to have a lower standard deviation in execution times
compared to treaps.  So for batch processing, the treap might be better,
while for use in an interactive application, red-black trees might be
better - because for batch processing no one cares about a little
jerkiness, while in an interactive app it might annoy users.

Apparently there was an effort,  briefly, to get a red-black tree into
Python's collections module, but it was rejected.

Treaps are supposed to have a simpler implementation than red-black trees.

I'm amused by the "red and black pens" thing.  ^_^

On Wed, Apr 11, 2012 at 10:14 AM, Jabba Laci  wrote:

> Hi,
>
> It's not really a Python-related question, sorry for that. Does anyone
> know why red-black trees got these colors in their names? Why not
> blue-orange for instance? I'm just curious.
>
> Thanks,
>
> Laszlo
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


trac.util

2012-04-11 Thread cerr
Hi,

I want to install some python driver on my system that requires trac.util (from 
Image.py) but I can't find that anywhere, any suggestions, anyone?

Thank you very much, any help is appreciated!

Error:
File "/root/weewx/bin/Image.py", line 32, in 
from  trac.util import escape
ImportError: No module named trac.util


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


Re: trac.util

2012-04-11 Thread Benjamin Kaplan
On Wed, Apr 11, 2012 at 4:52 PM, cerr  wrote:
>
> Hi,
>
> I want to install some python driver on my system that requires trac.util
> (from Image.py) but I can't find that anywhere, any suggestions, anyone?
>
> Thank you very much, any help is appreciated!
>
> Error:
> File "/root/weewx/bin/Image.py", line 32, in 
>    from  trac.util import escape
> ImportError: No module named trac.util
>
>
> Ron
> --

Trac is a project management program. I'm not sure why anything other
than a Trac plugin would have it as a dependency, but there is a
trac.util.escape defined in there.


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


Re: Framework for a beginner

2012-04-11 Thread Micky Hulse
Hello,

I've got more experience with PHP stuff, but for Python, I would
recommend checking out Django "getting started":



... to see if you like it.

Having used a few PHP frameworks and CMSs, I really dig that Django
has a built-in admin; I am in the same boat as you for when it comes
to "rebuild my portfolio using python and a framework", and I am happy
to use the Django admin as it saves me the headache of having to build
one myself.

For hosting (more than Django too) I highly recommend WebFaction:



The one-click install process is awesome. Great support too. Cheap
with lots of control and room to grow.

Hope that helps!

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Dan Sommers
On Wed, 11 Apr 2012 13:20:29 -0700
John Nagle  wrote:

>  You don't need those books as much as you used to.  You
> don't have to write collections, hash tables, and sorts much any
> more.  Those are solved problems and there are good libraries.
> Most of the basics are built into Python.

"Need" is an interesting word.  I don't have to write those
things, but I need to understand them well enough to choose the
right one, to use it effectively, and to debug it (or its
behavior) when things don't go as planned.

These days, every job interview includes (or should include!)
questions regarding which structures and which algorithms are
better (or worse) for which circumstances, not to mention
questions about algorithm complexity and big-O-notation.  I find
that people who *understand* the built-ins can *use* them much
more effectively than people who don't.

>  Serious programmers should read those books, much as they
> should read von Neumann's "First Draft of a Report on the
> EDVAC", for background on how things work down at the bottom.
> But they're no longer essential desk references for most
> programmers.

And that's the difference between "serious programmers" and "most
programmers."

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


RE: Framework for a beginner

2012-04-11 Thread Ed W LaHay
You may want to look at udacity.com CS101.  This is a free web based
training program. CS101 introduces Python the next sessions starts the week
of April 16.  During the 7 weeks of sessions you will build a web browser.


Ed W LaHay
+1 925 429 1958



-Original Message-
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, April 11, 2012 1:12 PM
To: [email protected]
Subject: Framework for a beginner

I am new to python and only have read the Byte of Python ebook, but want to
move to the web. I am tired of being a CMS tweaker and after I tried python,
ruby and php, the python language makes more sense (if that makes any
"sense" for the real programmers). I heard a lot of good things about
Django, Pyramid, etc, but I dont want to pick the most used or the one with
the most magic. Instead I was thinking about one that could "teach" me
python along the way. My plan is to rebuild my portfolio using python and a
framework and also benefit my python learning along the way.

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

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski

On 11.4.2012 23:20, John Nagle wrote:

On 4/11/2012 6:03 AM, Antti J Ylikoski wrote:


I wrote about a straightforward way to program D. E. Knuth in Python,
and received an excellent communcation about programming Deterministic
Finite Automata (Finite State Machines) in Python.

The following stems from my Knuth in Python programming exercises,
according to that very good communication. (By Roy Smith.)

I'm in the process of delving carefully into Knuth's brilliant and
voluminous work The Art of Computer Programming, Parts 1--3 plus the
Fascicles in Part 4 -- the back cover of Part 1 reads:

"If you think you're a really good programmer -- read [Knuth's] Art of
Computer Programming... You should definitely send me a résumé if you
can read the whole thing." -- Bill Gates.

(Microsoft may in the future receive some e-mail from me.)


You don't need those books as much as you used to.
You don't have to write collections, hash tables, and sorts much
any more. Those are solved problems and there are good libraries.
Most of the basics are built into Python.

Serious programmers should read those books, much as they should
read von Neumann's "First Draft of a Report on the EDVAC", for
background on how things work down at the bottom. But they're
no longer essential desk references for most programmers.

John Nagle


Well -- so far I have read about a half of the Part I -- and for an 
individual with a modern computer science education, the contents are 
rather familiar and easy.


Andy Y.

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


Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Mark Lawrence

On 11/04/2012 22:03, Dan Sommers wrote:

These days, every job interview includes (or should include!)
questions regarding which structures and which algorithms are
better (or worse) for which circumstances, not to mention
questions about algorithm complexity and big-O-notation.  I find
that people who *understand* the built-ins can *use* them much
more effectively than people who don't.

And that's the difference between "serious programmers" and "most
programmers."

Dan


Reminds me of a design review at which the database manager stated that 
a binary chopping algorithm would be used.  Someone queried this, 
stating that a hashing algorithm would be better suited to the task. 
The reply was "What's a hashing algorithm?".  Last I heard the person 
who made this quote was a director of the last major defence contractor 
in the UK.


--
Cheers.

Mark Lawrence.

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


[ANN] Distutils2 Sprint in Montreal

2012-04-11 Thread Éric Araujo
  Hi all,

  The Montreal-Python user group (http://montrealpython.org/) is hosting
a sprint on the 21st of April to work on Distutils2.  I will lead the
sprint and commit the patches into the main distutils2 and cpython
repositories, with the help of a few local hackers. If you live in
Montreal, bring your laptop and your enthusiasm, we will provide the
food and the good times!  No previous knowledge of Distutils2 is
required, just general Python skills.

  Distutils2 is the official successor of Distutils. It aims to be a
better, more flexible and more featureful packaging tool for Python
authors, as well as a reusable library for packaging tools developers.
Distutils2 is included in the Python 3.3 standard library under the name
“packaging”; the module named “distutils2” is the standalone backport
for Python versions 2.5 to 2.7, and 3.x.  The first beta versions of
Python 3.3 and Distutils2 are coming in June, and we are planning a
series of sprints to make it ready for the release.

  A sprint is simply programmers meeting together face-to-face to work
on the same project.  The organization team will guide you through the
codebase and provide help and review if you need them.  Previous sprints
held in Montreal have improved Distutils2, and the participants have had
fun and learned things, in line with their motto “For hacks and glory!”.
 Why don’t you come along for the next one and put your mark on a Python
release?

  The good folks at Radialpoint have graciously provided us with space
and free pizza. Come join us on Saturday, the 21st of April, from 12pm
to 7pm.  The address is: 2050 Bleury Street
 Suite 300
 Map: http://g.co/maps/cuaxc
 Registration: http://www.eventbrite.ca/event/3261945567
   (preferable but not required)

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


FrinzoO Themes | Download Premium WordPress Themes For Free

2012-04-11 Thread hazem dahab
FrinzoO Themes give you magento themes,magento extensions,joomla
templates,joomla extensions,wordpress theme,web templates,graphic

Visit us at http://www.frinzoo.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Framework for a beginner

2012-04-11 Thread Louis des Landes
A simpler version of Django or Pyramid is 'Flask'

It's doco is great and aimed at a reasonably entry level.
It's still quite powerful, but easier to set up to start with:

http://flask.pocoo.org/

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


Re: f python?

2012-04-11 Thread Tim Roberts
"WJ"  wrote:
>
>Slashes can work under windows, up to a point:

ALL Windows APIs accept forward slashes.  The only place they are not
accepted is command line commands that take options which can begin with
forward slash.

>Also, most languages I use under windows allow you to use
>slashes in paths:

All of them should do so.  They're just string being passed to CreateFile,
and CreateFile accepts forward slashes just fine.
-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


[Windows] drag-and-drop onto .py file in modern versions?

2012-04-11 Thread Karl Knechtel
Hello all,

Back when I had 2.6.x installed, I used to be able to drag a file onto a
.py file in order to open it with that script (rather, pass the name of the
file as `sys.argv[1]`). I did nothing special to make this work, as far as
I can recall; it was something that the installer set up automatically. I
am running Windows Vista.

Now that I have uninstalled 2.6.x, and have 2.7.2 and 3.2.2 installed, this
behaviour no longer works. The .py file is apparently not recognized by
Vista as a valid drop target; it does not highlight, and when I release the
mouse, the dragged file is simply moved to / reordered within the
containing folder.

I was able to find a registry hack that is supposed to re-enable this
behaviour:

http://mindlesstechnology.wordpress.com/2008/03/29/make-python-scripts-droppable-in-windows/

However, I tried this and it had no effect whatsoever.

Is there any way I can get the drag-and-drop behaviour back? Was it
deliberately disabled for some reason? It was exceptionally convenient for
several of my scripts, and now I have to make .bat wrappers for each one to
get the same convenience.

Aside: when I double-click a .py file, what determines which Python will
run it? Is it a matter of which appears first in the PATH, or do I have to
set something else in the registry? Will a shebang line override the
default on Windows? If so, how do I write a shebang line for a Windows path
- just "#!C:/Windows/Python32"?

-- 
~Zahlman {:>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: functions which take functions

2012-04-11 Thread Tim Roberts
Kiuhnm  wrote:
>
>That won't do. A good example is when you pass a function to re.sub, for 
>instance.

This is an odd request.

I often pass functions to functions in order to simulate a C switch
statement, such as in a language translator:

  commands = {
'add': doAdd,
'subtract' : doSubtract,
'multiply' : doMultiply,
'divide' : doDivide
  }

  nextCommand = parseCommandLine( line )
  invokeCommand( commands[NextCommand] )
-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-11 Thread Julien Phalip
Hi Michael,

Thanks again for your reply. I've tried using SMTP with TLS. And again it works 
with the VPN turned on but it still won't work with the VPN turned off. For 
some reason I don't understand, it simply won't instantiate the 
SMTP/SMTP_SSL/IMAP4/IMAP4_SSL objects at all and will hang forever if the VPN 
is turned off.

I'm really at loss there :)

Julien

On Apr 2, 2012, at 6:57 PM, Michael Hrivnak wrote:

> Your phone may be using TLS on the normal IMAP port (143).  Or, are
> you sure your phone is using IMAP and not active sync?
> 
> Michael
> 
> On Mon, Apr 2, 2012 at 6:25 PM, Julien  wrote:
>> Hi Michael,
>> 
>> Thanks for your reply. I did try port 993. I know that port generally
>> works for me, as I can access the Gmail IMAP/SMTP server using SSL. It
>> also works for that other Exchange server but only when the VPN is
>> turned on.
>> 
>> Somehow my iPhone works fine without a VPN, as long as it uses SSL. So
>> I'm really unsure why I can't achieve the same thing from my laptop
>> using imaplib.IMAP4_SSL() without the VPN turned on.
>> 
>> Thank you,
>> 
>> Julien
>> 
>> On Apr 2, 3:10 pm, Michael Hrivnak  wrote:
>>> That method uses the default port 993.  Can you connect to that port
>>> at all from your computer?  For example, try using a telnet client.
>>> 
>>> Michael
>>> 
>>> On Sat, Mar 31, 2012 at 1:39 AM, Julien  wrote:
 Hi,
>>> 
 I'm able to connect to an Exchange server via SMTP and IMAP from my
 iPhone using SSL and without using a VPN. So I would expect to be able
 to do the same from my computer using Python.
>>> 
 However, the following hangs and times out on my computer when I'm not
 connected to the VPN:
>>> 
>>> import imaplib
>>> imap = imaplib.IMAP4_SSL("my.server.address")
>>> 
 If I am connected to the VPN, then it works fine.
>>> 
 Do you know why it won't work with SSL and without the VPN? Am I
 missing something?
>>> 
 Thanks a lot,
>>> 
 Julien
 --
 http://mail.python.org/mailman/listinfo/python-list
>> 
>> --
>> http://mail.python.org/mailman/listinfo/python-list



smime.p7s
Description: S/MIME cryptographic signature
-- 
http://mail.python.org/mailman/listinfo/python-list