Re: Python Silent Install

2015-02-25 Thread Tim Golden
[... re installing with ensurepip disabled ...]

On 24/02/2015 23:05, Albert-Jan Roskam wrote:
> Personally I find that Python is incomplete without pip and setuptools.

Of course; that's why the ensurepip was added to the installers. But
there are other ways of installing pip after the event. Including
simply: py -3 -m ensurepip

TJG

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


python 2 to python 3

2015-02-25 Thread Audrey McFarlane
I am using Wing101 v.5 and it is using Python2, but I want to make it use 
Python3 instead because  need Python3 for a uni lab.  How do I change it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compatibility Issues - Windows 8

2015-02-25 Thread blakemalc66
On Tuesday, February 24, 2015 at 2:57:08 PM UTC+11, Iris J Rosario wrote:
> Hello,
> 
>  
> 
> I've been having problems with running python IDLE on my Windows 8 tower. Can 
> you please let me know where I can rea up on how to correct it? Or which 
> version will work best on my computer?
> 
>  
> 
> Best Regards,
> 
> Iris J Rosario
> 
> ijro...@students.pccc.edu
> 
>  
> 
> "One can complain because rosebushes have thorns, or rejoice because thorn 
> bushes have roses." ~ Abraham Lincoln
> 
>  

Terry

I am downloading 3.4.3rc1 now and will install in the morning.

My task manager showed 2 pythonw.exe entries.

I tried executing from the win8.1 metro icon, and also from within the idlelib: 
idle.bat, idle.py and idle.pyw. All with the same result - no gui

Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python shell: Arrow keys not working in PuTTY

2015-02-25 Thread Ned Deily
In article <54ec1360$0$12978$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano  wrote:
> Ned Deily wrote:
> > With no --prefix= on ./configure, the default install location is to
> > /usr/local, so "make install" would install a link at
> > /usr/local/bin/python (or python3) and it would only overwrite your
> > system Python if the system Python happened to be installed in
> > /usr/local/bin/.
> Well, I'm not going to say you are wrong, but I can say that on Centos 5 
> systems (and presumably that includes Fedora and Red Hat of the equivalent 
> vintage), if you just run `make install` it overwrites the /usr/bin/python 
> hard link to /usr/bin/python2.4. I know because I've done it :-(

If you're using any current 2.7.x or 3.4.x source tarball (or dev repo) 
from python.org, it ain't gonna happen.  (I'm not going to go back and 
check all the previous releases but it's been that way for a long time, 
AFAIK.)  If you're using source modified by a distribution, like Centos, 
RH, or Fedora, all bets are off, of course.

-- 
 Ned Deily,
 n...@acm.org

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


Re: Bug in timsort!?

2015-02-25 Thread Paddy
On Wednesday, 25 February 2015 00:08:32 UTC, Chris Angelico  wrote:
> On Wed, Feb 25, 2015 at 10:50 AM, Skip Montanaro
>  wrote:
> > Even if/when we get to the point where machines can hold an array of
> > 2**49 elements, I suspect people won't be using straight Python to
> > wrangle them.
> 
<>
> 
> Would it be sufficient to stick a comment into the source saying "This
> may have problems with lists in excess of 2**49 elements", and leave
> it until that's actually likely to happen?
> 
> ChrisA

If we are given a proven fix with little downside then if we are to touch the 
source then we should MAKE THE FIX. To do otherwise would send the wrong signal 
to those that depend on the perceived integrity of the C-Python developers.
-- 
https://mail.python.org/mailman/listinfo/python-list


Configuring problems with GDAL in enthought Python Canopy

2015-02-25 Thread Leo Kris Palao
Hi ALL,

Just wanted to ask if somebody could guide me in installing GDAL in my
Python installed using Canopy. Could you give me some steps how to
successfully install this package? I got it running using my previous
Python Installation, but I removed it and used Canopy Python now.

btw: my python installation is located in:
C:\Users\lpalao\AppData\Local\Enthought\Canopy\User\Scripts\python.exe

Thanks in advance for the help.
-Leo
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Chris Angelico
On Wed, Feb 25, 2015 at 8:10 PM, Paddy  wrote:
> If we are given a proven fix *with little downside* then if we are to touch 
> the source then we should MAKE THE FIX.

(emphasis mine)

That's really the question, though. I'm in no position to evaluate the
patch and ascertain whether the fix does indeed have little or no
downside. But as the tracker issue proves, a greater mind than mine
has decided that it's to be applied, which means that, yes, it's worth
doing.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 2 to python 3

2015-02-25 Thread Steven D'Aprano
Audrey McFarlane wrote:

> I am using Wing101 v.5 and it is using Python2, but I want to make it use
> Python3 instead because  need Python3 for a uni lab.  How do I change it?


I'm afraid I don't use Wing so I can't give a good answer, but I googled and
found this:

http://stackoverflow.com/questions/25318792/how-do-i-configure-wing101-to-run-python-3-3

It's not very helpful, but it might point you in the right direction.

If you do work out the answer, please tell us, so that the next person who
asks can get an answer too.


-- 
Steven

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


Re: progress bar

2015-02-25 Thread Steven D'Aprano
Swapnil Pande wrote:

> i want to call another tkinter window after completing the progress bar
> an n e one help me

What does "call another tkinter window" mean?

I understand "call another function", but how do you call a window?

Perhaps it will help if you show us some code.



-- 
Steven

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


Re: strip bug?

2015-02-25 Thread Rustom Mody
On Wednesday, February 25, 2015 at 4:35:37 AM UTC+5:30, bay...@gmail.com wrote:
> >>> 'http://xthunder'.strip('http://')
> 'xthunder'
> >>> 'http://thunder'.strip('http://')
> 'under'
> >>>
> 
> I could understand backslash but forward slash?

Others have answered specifically.
However you probably want to look at urlparse
https://docs.python.org/2/library/urlparse.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Robert Kern

On 2015-02-24 22:45, Grant Edwards wrote:

On 2015-02-24, Roy Smith  wrote:


http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/


I don't get it.

 3.2 Corrected Python merge_collapse function

 merge_collapse(MergeState *ms)
 {
 struct s_slice *p = ms->pending;

 assert(ms);
 while (ms->n > 1) {
 Py_ssize_t n = ms->n - 2;
 if ( n > 0   && p[n-1].len <= p[n].len + p[n+1].len
 || (n-1 > 0 &&  p[n-2].len <= p[n].len + p[n-1].len)) {
 if (p[n-1].len < p[n+1].len)
 --n;
 if (merge_at(ms, n) < 0)
 return -1;
 }
 else if (p[n].len <= p[n+1].len) {
  if (merge_at(ms, n) < 0)
 return -1;
 }
 else
 break;
 }
 return 0;
 }

Or does "Python function" mean something else in this context?


"Corrected merge_collapse function [from the Python implementation of TimSort]" 
as opposed to the Java implementation which was also discussed.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: Design thought for callbacks

2015-02-25 Thread Cem Karan

On Feb 24, 2015, at 8:23 AM, Fabio Zadrozny  wrote:

> Hi Cem,
> 
> I didn't read the whole long thread, but I thought I'd point you to what I'm 
> using in PyVmMonitor (http://www.pyvmmonitor.com/) -- which may already cover 
> your use-case.
> 
> Take a look at the callback.py at 
> https://github.com/fabioz/pyvmmonitor-core/blob/master/pyvmmonitor_core/callback.py
> 
> And its related test (where you can see how to use it): 
> https://github.com/fabioz/pyvmmonitor-core/blob/master/_pyvmmonitor_core_tests/test_callback.py
>  (note that it falls back to a strong reference on simple functions -- i.e.: 
> usually top-level methods or methods created inside a scope -- but otherwise 
> uses weak references).

That looks like a better version of what I was thinking about originally.  
However, various people on the list have convinced me to stick with strong 
references everywhere.  I'm working out a possible API right now, once I have 
some code that I can use to illustrate what I'm thinking to everyone, I'll post 
it to the list.

Thank you for showing me your code though, it is clever!

Thanks,
Cem Karan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Design thought for callbacks

2015-02-25 Thread Cem Karan

On Feb 24, 2015, at 4:19 PM, Gregory Ewing  wrote:

> random...@fastmail.us wrote:
>> On Tue, Feb 24, 2015, at 00:20, Gregory Ewing wrote:
>>> This is why I suggested registering a listener object
>>> plus a method name instead of a callback. It avoids that
>>> reference cycle, because there is no long-lived callback
>>> object keeping a reference to the listener.
>> How does that help? Everywhere you would have had a reference to the
>> "callback object", you now have a reference to the listener object.
> 
> The point is that the library can keep a weak reference
> to the listener object, whereas it can't reliably keep
> a weak reference to a bound method.

I think I see what you're talking about now.  Does WeakMethod 
(https://docs.python.org/3/library/weakref.html#weakref.WeakMethod) solve this 
problem?  Note that I can force my users to use the latest stable version of 
python at all times, so WeakMethod IS available to me.

Thanks,
Cem Karan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden

On 24/02/15 22:34, Roy Smith wrote:

http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/



This is awful. It is broken for arrays longer than 2**49 elements. With 
8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't 
see how we can fix this in time.


Oh yes, and they mention that TimSort is used on billions of devices due 
to Android mobile phones. This is clearly very relevant for mobile 
phones. Next thing you know your litte Samsung Galaxy with more than 
4096 terabytes breaks down from a stack overflow in TimSort.



Sturla


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


Re: Bug in timsort!?

2015-02-25 Thread Jonas Wielicki
On 25.02.2015 14:58, Sturla Molden wrote:
> On 24/02/15 22:34, Roy Smith wrote:
>> http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
>>
>>
> […]
>
> Oh yes, and they mention that TimSort is used on billions of devices due
> to Android mobile phones. This is clearly very relevant for mobile
> phones. Next thing you know your litte Samsung Galaxy with more than
> 4096 terabytes breaks down from a stack overflow in TimSort.

The Java version of the bug is reproducible with just 67108864 elements,
if I read the article correctly.

jwi



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


Re: Bug in timsort!?

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 12:58 AM, Sturla Molden  wrote:
> This is awful. It is broken for arrays longer than 2**49 elements. With 8
> bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't see how
> we can fix this in time.

It's even worse than that. Unless you have a list of 2**49 references
to the same few objects, you're going to need to have some actual
content for each one. The absolute best you could do is to sort
integers, which would take 32 bytes each [1]; if you're sorting
strings, they'll be 90 bytes each, so the integers are our best bet.
So add another *five* powers of two to the RAM requirements.

Also, who has that many elements to sort, and wouldn't do better to
stick 'em into an indexed database of some description? I mean, good
to know that this'll be fixed, but it really isn't likely to come up
any time soon.

ChrisA

[1] Calculated using Python 3.5 amd64 Linux, your figures may vary.
Small integers (less than 2**30) take only 28 bytes, but that's
dwarfed by the rest of them taking 32.
-- 
https://mail.python.org/mailman/listinfo/python-list


mx as dependency tox throws GCC error

2015-02-25 Thread Albert-Jan Roskam
Hi,

If I pip install the mx package with "pip install egenix-mx-base", it works.
If I put that same pip install command under 'install_command' in my tox.ini it 
also works (see below)

However, if I specify the dependency under 'deps', I get an error. Any idea 
why? I read that 'install_command' is
still experimental and subject to change, so I would prefer to specify the 
package under 'deps'.
The error occurred when I called tox using 'tox -e py27', so it is not 
pypy-related.


[tox]
envlist = pypy,py27,py33,py34,docs
skipsdist = true

[testenv]
deps = 
   setuptools
 nose
 gocept.testing
 numpy
 cython
 # egenix-mx-base  # --> mx tox gcc: error: 
mx/DateTime/mxDateTime/mxDateTime.c: No such file or directory
install_command = 
   pip install egenix-mx-base {packages}



Thanks!

 
Regards,

Albert-Jan




~~

All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a 

fresh water system, and public health, what have the Romans ever done for us?

~~ 
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2015: Our first keynote speaker: Guido van Rossum

2015-02-25 Thread M.-A. Lemburg
We are pleased to announce our first keynote speaker for EuroPython 2015:

 Python’s creator: Guido van Rossum

Guido will give a keynote and a more technical talk about the new type
hinting proposal for Python 3.5 that’s currently being discussed as
PEP 483 (The Theory of Type Hints) and PEP 484 (Type Hints).

Enjoy,
-
EuroPython Society (EPS)
http://www.europython-society.org/

PS: We have more exciting news coming in the next few days.
Please watch our blog for updates: http://blog.europython.eu/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 2 to python 3

2015-02-25 Thread William Ray Wing

> On Feb 24, 2015, at 9:55 PM, Audrey McFarlane  wrote:
> 
> I am using Wing101 v.5 and it is using Python2, but I want to make it use 
> Python3 instead because  need Python3 for a uni lab.  How do I change it?
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Assuming you have Python3 installed on your system. The most straightforward 
way to make Wing use it is to go to the Project menu, select Project 
Properties, and under the Environment tab, Python Executable, click the custom 
button, then enter the path to the Python3 executable in the path window.

Have fun,
Bill

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


Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden

On 25/02/15 15:33, Chris Angelico wrote:


It's even worse than that. Unless you have a list of 2**49 references
to the same few objects, you're going to need to have some actual
content for each one. The absolute best you could do is to sort
integers, which would take 32 bytes each [1]; if you're sorting
strings, they'll be 90 bytes each, so the integers are our best bet.
So add another *five* powers of two to the RAM requirements.


In that case you also need to add the PyObject_HEAD overhead for each 
object. ;-)


Sturla

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


Re: Bug in timsort!?

2015-02-25 Thread alister
On Wed, 25 Feb 2015 14:58:31 +0100, Sturla Molden wrote:

> On 24/02/15 22:34, Roy Smith wrote:
>> http://envisage-project.eu/proving-android-java-and-python-sorting-
algorithm-is-broken-and-how-to-fix-it/
>>
>>
> This is awful. It is broken for arrays longer than 2**49 elements. With
> 8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't
> see how we can fix this in time.
> 
> Oh yes, and they mention that TimSort is used on billions of devices due
> to Android mobile phones. This is clearly very relevant for mobile
> phones. Next thing you know your litte Samsung Galaxy with more than
> 4096 terabytes breaks down from a stack overflow in TimSort.
> 
> 
> Sturla

the oh well it wont affect current devices attitude is a very poor 
attitude to big fixes.
if a bug is reported it should be resolved a quickly as practical sot hat 
it never does become a real world issue

much better to bolt the door BEFORE the horse bolts (even if the horse 
has not actually been borne yet)



-- 
1: No code table for op: ++post
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 2:05 AM, Sturla Molden  wrote:
> On 25/02/15 15:33, Chris Angelico wrote:
>
>> It's even worse than that. Unless you have a list of 2**49 references
>> to the same few objects, you're going to need to have some actual
>> content for each one. The absolute best you could do is to sort
>> integers, which would take 32 bytes each [1]; if you're sorting
>> strings, they'll be 90 bytes each, so the integers are our best bet.
>> So add another *five* powers of two to the RAM requirements.
>
>
> In that case you also need to add the PyObject_HEAD overhead for each
> object. ;-)

Not sure about that, because the figure of 32 bytes came from
sys.getsizeof(). So assuming there's no significant malloc overhead
(there shouldn't be any alignment padding, for instance), 32 bytes
ought to be it - pack 'em all in.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Zachary Ware
On Wed, Feb 25, 2015 at 9:03 AM, alister
 wrote:
> the oh well it wont affect current devices attitude is a very poor
> attitude to big fixes.
> if a bug is reported it should be resolved a quickly as practical sot hat
> it never does become a real world issue
>
> much better to bolt the door BEFORE the horse bolts (even if the horse
> has not actually been borne yet)

Just to be clear, this has already been fixed, and the fix will be
released in Python 2.7.10, 3.4.4, and 3.5.0.

-- 
Zach
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running Idle on Windows 8 (.1)

2015-02-25 Thread Ian Kelly
On Tue, Feb 24, 2015 at 6:29 PM, Terry Reedy  wrote:
> On 2/24/2015 3:13 PM, blakemal...@gmail.com wrote:
>
>> I too can not get idle to run on win 8.1 using python3.4.2 installed from
>> the python-3.4.2.amd64.msi.
>
>
> What experience have others had with Idle and Windows 8?
>
> The OP for
> https://stackoverflow.com/questions/28633690/python-installation-troubleshooting
>
> wrote in a comment "I am invoking it from a win8 startmenu program, so I
> tried to do it via the normal windows 8 interface and it works from there,"
>
> I do not know what 'normal windows 8 interface' means, but does it work for
> anyone else?
>
>> pythonw.exe appears in the task manager but no gui is displayed.
>
>
> pythonw.exe should appear *twice* in task manager.
> Please try 3.4.3rc1 and 3.5.0a1
> https://www.python.org/downloads/windows/
>
> If the Idle does not start correctly on Win 8, perhaps we could fix it
> before 3.4.3 final (which should be soon).

I just tried both of those (32-bit only) in a Windows 8.1 VM and had
no problems starting Idle.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Grant Edwards
On 2015-02-25, Robert Kern  wrote:
> On 2015-02-24 22:45, Grant Edwards wrote:
>> On 2015-02-24, Roy Smith  wrote:
>>
>>> http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
>>
>> I don't get it.
>>
>>  3.2 Corrected Python merge_collapse function

[C code elided]

>> Or does "Python function" mean something else in this context?
>
> "Corrected merge_collapse function [from the Python implementation of 
> TimSort]" 
> as opposed to the Java implementation which was also discussed.

Yes, I get it now. But, when I read "Python function" or "Python
implementation of " that _to_me_ refers to someting written in
_Python_.

If you're talking about _CPython_ code, then you say "CPython
function" or "CPython implementation of ".


-- 
Grant Edwards   grant.b.edwardsYow! I hope the
  at   ``Eurythmics'' practice
  gmail.combirth control ...
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.4.3 is now available

2015-02-25 Thread Larry Hastings



On behalf of the Python development community and the Python 3.4 release 
team, I'm pleased to announce the availability of Python 3.4.3.   Python 
3.4.3 has many bugfixes and other small improvements over 3.4.2.


You can find it here:

   https://www.python.org/downloads/release/python-343/


The release slipped by two or three days, depending on what time zone 
you're in.  This is my fault--I apologize for the inconvenience.


Cheers,


//arry/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Peter Otten
Sturla Molden wrote:

> On 24/02/15 22:34, Roy Smith wrote:
>> http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
>>
> 
> This is awful. It is broken for arrays longer than 2**49 elements. With
> 8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't
> see how we can fix this in time.
> 
> Oh yes, and they mention that TimSort is used on billions of devices due
> to Android mobile phones. This is clearly very relevant for mobile
> phones. Next thing you know your litte Samsung Galaxy with more than
> 4096 terabytes breaks down from a stack overflow in TimSort.

Yeah, I'm looking forward to see comparable bugs being closed as "cannot 
reproduce" by some of the jokers. I suppose that you all had a note 
scribbled on the margin of your copy of Arithmetica that this cannot happen 
with arrays of lengths seen in practice until 2038 or so.

These guys found a bug that is subtler than what most of us have dealt with 
in a widely used piece of code originally developed by one of the smarter 
members of the python "community".

I bow my head to them and say thank you.

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


Issue with VTK quadratic Python Program

2015-02-25 Thread Shalini Ravishankar
Hello Everyone,

I am new to VTK. I m trying to create a quadratic function with interactive 
slider.  But the output is not as expected. Can someone tell em what I am doing 
wrong here ?



# First, we need to import vtk package in order to access VTK 
classes/functions. 
import vtk 

# create a data source...an implicit function. 
# F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y 
+ a8*z + a9
# F(x,y,z) = 1*x^2 + 0.5*y^2 + 0.2*z^2 + 0*x*y + 0*y*z + 0.1*x*z + 0.2*x + 0*y 
+ 0*z + 0

quadric = vtk.vtkQuadric() 
quadric.SetCoefficients(1, 0.5, 0.2, 0, 0, 0.1, 0.2, 0, 0, 0) 


def vtkSliderCallback2(obj, event):
sliderRepres = obj.GetRepresentation()
pos = sliderRepres.GetValue()
print "Position ",pos
isosurface.SetValue(0, pos)

# create a filter...a sampling function, which samples an implicit function 
over the x-y-z range 
# although this object is not called "filter" it takes an input and do 
something to/with it 
# and produce an output. 
sample = vtk.vtkSampleFunction() 
sample.SetSampleDimensions(100, 100, 100) 
sample.SetImplicitFunction(quadric) 



outline = vtk.vtkOutlineFilter() 
outline.SetInput( sample.GetOutput() ) 
outlineMapper = vtk.vtkPolyDataMapper() 
outlineMapper.SetInput( outline.GetOutput() )
outlineActor = vtk.vtkActor() 
outlineActor.SetMapper( outlineMapper ) 
outlineActor.GetProperty().SetColor(0.0,0.0,1.0)

# create another filter...computing a contour of an input data. 
isosurface = vtk.vtkContourFilter() 
isosurface.SetInputConnection(sample.GetOutputPort()) 
isosurface.GenerateValues(15, 0.0, 4.2) 

# create a mapper, which mapps data to visualizable data structure. 
contMapper = vtk.vtkPolyDataMapper() 
contMapper.SetInputConnection(isosurface.GetOutputPort()) 
contMapper.SetScalarRange(0.0, 1.2) 

# create an actor, which can be displayed. 
contActor = vtk.vtkActor() 
contActor.SetMapper(contMapper) 



# create a window with a renderer. 
ren = vtk.vtkRenderer() 
renWin = vtk.vtkRenderWindow() 
renWin.AddRenderer(ren) 
iren = vtk.vtkRenderWindowInteractor() 
iren.SetRenderWindow(renWin) 
ren.SetBackground(0.95, 0.95, 1.0)
ren.AddActor(contActor) 
renWin.SetSize( 500, 500 ) 


SliderRepres = vtk.vtkSliderRepresentation2D()
min = 0 #ImageViewer.GetSliceMin()
max = 256 #ImageViewer.GetSliceMax()
SliderRepres.SetMinimumValue(min)
SliderRepres.SetMaximumValue(max)
SliderRepres.SetValue((min + max) / 2)
SliderRepres.SetTitleText("Slider")
SliderRepres.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()
SliderRepres.GetPoint1Coordinate().SetValue(0.2, 0.9)
SliderRepres.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()
SliderRepres.GetPoint2Coordinate().SetValue(0.8, 0.9)

SliderRepres.SetSliderLength(0.02)
SliderRepres.SetSliderWidth(0.03)
SliderRepres.SetEndCapLength(0.01)
SliderRepres.SetEndCapWidth(0.03)
SliderRepres.SetTubeWidth(0.005)
SliderRepres.SetLabelFormat("%3.0lf")
SliderRepres.SetTitleHeight(0.02)
SliderRepres.SetLabelHeight(0.02)

SliderWidget = vtk.vtkSliderWidget()
SliderWidget.SetInteractor(iren)
SliderWidget.SetRepresentation(SliderRepres)
SliderWidget.KeyPressActivationOff()
SliderWidget.SetAnimationModeToAnimate()
SliderWidget.SetEnabled(True)
SliderWidget.AddObserver("EndInteractionEvent", vtkSliderCallback2)

# this causes the pipeline to "execute"
renWin.Render() 

# initialize and start the interactor 
iren.Initialize() 
iren.Start() 




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


Re: progress bar

2015-02-25 Thread Denis McMahon
On Tue, 24 Feb 2015 23:42:42 -0800, Swapnil Pande wrote:

> i want to call another tkinter window after completing the progress bar
> an n e one help me

Try shouting "Oi, Window!"

Or show us the code that isn't working (just the bit that isn't working) 
and explain what it should be doing and what actually happens. Also 
please tell us what you tried to fix it.

For example, you have a problem communicating between output windows 
after displaying a progress bar, so your example code should:

(a) draw two windows
(b) display a progress bar in one window
(c) Make some sort of call to the second window after the progress bar 
completes.

We only need to see that code. We don't need to see the rest of the code.

If my description of what I expect your example code to do doesn't make 
sense to you, then perhaps it's because your original problem description 
doesn't make sense to me. ;)

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are threads bad? - was: Future of Pypy?

2015-02-25 Thread Mark Lawrence

On 25/02/2015 06:02, Ian Kelly wrote:


Is the name of that database program "Microsoft Access" perchance?



Are you referring to the GUI, the underlying database engine, both, or what?

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Silent Install

2015-02-25 Thread Mark Lawrence

On 25/02/2015 08:26, Tim Golden wrote:

[... re installing with ensurepip disabled ...]

On 24/02/2015 23:05, Albert-Jan Roskam wrote:

Personally I find that Python is incomplete without pip and setuptools.


Of course; that's why the ensurepip was added to the installers. But
there are other ways of installing pip after the event. Including
simply: py -3 -m ensurepip

TJG



18 characters, why do the core devs have to make everything so verbose? :)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden

On 25/02/15 17:04, Peter Otten wrote:


These guys found a bug that is subtler than what most of us have dealt with
in a widely used piece of code originally developed by one of the smarter
members of the python "community".

I bow my head to them and say thank you.


I am not joking about that. It is more the hype this gets that indicates 
TimSort is already broken today, and even on your cell phone.



Sturla

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


Re: Python Silent Install

2015-02-25 Thread Tim Golden
On 25/02/2015 16:40, Mark Lawrence wrote:
> On 25/02/2015 08:26, Tim Golden wrote:
>> [... re installing with ensurepip disabled ...]
>>
>> On 24/02/2015 23:05, Albert-Jan Roskam wrote:
>>> Personally I find that Python is incomplete without pip and setuptools.
>>
>> Of course; that's why the ensurepip was added to the installers. But
>> there are other ways of installing pip after the event. Including
>> simply: py -3 -m ensurepip
>>
>> TJG
>>
> 
> 18 characters, why do the core devs have to make everything so verbose? :)
> 

Well of course I was being a bit wordy there. This should be enough:

py -mensurepip

(assuming that this is your first install and/or that you haven't messed
around with your py-loader config).

TJG
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Mark Lawrence

On 25/02/2015 13:58, Sturla Molden wrote:

On 24/02/15 22:34, Roy Smith wrote:

http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/




This is awful. It is broken for arrays longer than 2**49 elements. With
8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't
see how we can fix this in time.

Oh yes, and they mention that TimSort is used on billions of devices due
to Android mobile phones. This is clearly very relevant for mobile
phones. Next thing you know your litte Samsung Galaxy with more than
4096 terabytes breaks down from a stack overflow in TimSort.


Sturla




When I were a lad we only had one bit of data, and we were only able to 
utilise half of that.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Bug in timsort!?

2015-02-25 Thread Chris Kaynor
On Wed, Feb 25, 2015 at 8:44 AM, Sturla Molden  wrote:
>
> On 25/02/15 17:04, Peter Otten wrote:
>
>> These guys found a bug that is subtler than what most of us have dealt with
>> in a widely used piece of code originally developed by one of the smarter
>> members of the python "community".
>>
>> I bow my head to them and say thank you.
>
>
> I am not joking about that. It is more the hype this gets that indicates 
> TimSort is already broken today, and even on your cell phone.

While the CPython implementation was only broken for arrays of length
larger than 2**49, aka, practically not broken, the Java
implementation (such as used on Android phones) was broken with arrays
of length > 67,108,864 at the time the post was made. While still very
large, an array of 67 million elements is well within the realm of
possibility today. The Java fixes (so far) have only extended the
number out, rather than actually fix the underlying problem - the
CPython fixes that were committed implement the full proven fix, so
CPython should now be able to handle infinite length arrays (once we
can build computers with that much storage...).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Mark Lawrence

On 25/02/2015 16:04, Peter Otten wrote:

Sturla Molden wrote:


On 24/02/15 22:34, Roy Smith wrote:

http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/



This is awful. It is broken for arrays longer than 2**49 elements. With
8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't
see how we can fix this in time.

Oh yes, and they mention that TimSort is used on billions of devices due
to Android mobile phones. This is clearly very relevant for mobile
phones. Next thing you know your litte Samsung Galaxy with more than
4096 terabytes breaks down from a stack overflow in TimSort.


Yeah, I'm looking forward to see comparable bugs being closed as "cannot
reproduce" by some of the jokers. I suppose that you all had a note
scribbled on the margin of your copy of Arithmetica that this cannot happen
with arrays of lengths seen in practice until 2038 or so.

These guys found a bug that is subtler than what most of us have dealt with
in a widely used piece of code originally developed by one of the smarter
members of the python "community".

I bow my head to them and say thank you.



Reading the bug report http://bugs.python.org/issue23515, specifically 
msg236586, it looks as if the proposed fix was wrong and one of the 
smarter members of the python community fixed it.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Are threads bad? - was: Future of Pypy?

2015-02-25 Thread Ian Kelly
On Wed, Feb 25, 2015 at 9:37 AM, Mark Lawrence  wrote:
> On 25/02/2015 06:02, Ian Kelly wrote:
>>
>>
>> Is the name of that database program "Microsoft Access" perchance?
>>
>
> Are you referring to the GUI, the underlying database engine, both, or what?

The engine. In theory it supports concurrent access. In practice, it
seems that access is frequently blocked by locks generated by some
other user who was working on it hours ago and is now out of the
office. Not to mention the times when the lock file gets so badly
corrupted that the resolution is to just delete it.

I haven't used it in some time though, so maybe it's gotten better.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are threads bad? - was: Future of Pypy?

2015-02-25 Thread Mark Lawrence

On 25/02/2015 17:00, Ian Kelly wrote:

On Wed, Feb 25, 2015 at 9:37 AM, Mark Lawrence  wrote:

On 25/02/2015 06:02, Ian Kelly wrote:



Is the name of that database program "Microsoft Access" perchance?



Are you referring to the GUI, the underlying database engine, both, or what?


The engine. In theory it supports concurrent access. In practice, it
seems that access is frequently blocked by locks generated by some
other user who was working on it hours ago and is now out of the
office. Not to mention the times when the lock file gets so badly
corrupted that the resolution is to just delete it.

I haven't used it in some time though, so maybe it's gotten better.



IIRC the underlying JET engine was replaced by SQL Server years ago. 
Maybe not the best technlogy in the world, but you'd be hard pushed to 
do worse than JET :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Bug in timsort!?

2015-02-25 Thread Peter Otten
Mark Lawrence wrote:

> Reading the bug report http://bugs.python.org/issue23515, specifically
> msg236586, it looks as if the proposed fix was wrong and one of the
> smarter members of the python community fixed it.

If I understand that correctly Benjamin's modifications don't affect the 
functionality of the patch. 


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


Re: Are threads bad? - was: Future of Pypy?

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 4:16 AM, Mark Lawrence  wrote:
> IIRC the underlying JET engine was replaced by SQL Server years ago. Maybe
> not the best technlogy in the world, but you'd be hard pushed to do worse
> than JET :)

The way I understood it, MS Access could connect to a variety of
database backends (SQL Server, or anything that uses ODBC, or whatever
else), but the only inbuilt engine - and therefore the one that you
get by default if you aren't running some other server - was MS Jet.
If they're incorporating SQL Server into MS Office, that would make it
huge... wait, I'm not sure we could tell the difference. But still,
that'd be a whopping great slab of database engine. It'd be like
Python incorporating PostgreSQL. I've at times said that the Python
stdlib ought to include a Postgres *client* (on par with psycopg2),
but not the full *server* :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 3:56 AM, Chris Kaynor  wrote:
> so
> CPython should now be able to handle infinite length arrays (once we
> can build computers with that much storage...).

Don't we have a Turing Machine buildbot?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Mario Figueiredo
On Wed, 25 Feb 2015 17:04:10 +0100, Peter Otten <__pete...@web.de>
wrote:
>
>These guys found a bug that is subtler than what most of us have dealt with 
>in a widely used piece of code originally developed by one of the smarter 
>members of the python "community".
>
>I bow my head to them and say thank you.

And also presented a solution.

Thank you for a little of sanity and common sense in this discussion.
TYhe levcel of smugness by some of the posters surely can't be a
representation of the python community.

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


Python Captive Portal???

2015-02-25 Thread Alan Williams
I was wondering if anyone has experimented with python, memcache and maybe 
squid to write a simple captive portal managed by a linux box?

Concept:

Control Center - Linux box running Ubuntu 14.04 w/2 nic's and dhcp-server 
running on it.

NIC's are setup eth0(192.168.0.2), eth1(10.10.10.2).

eth0 is the gateway to public internet(connected to DSL Modem)

eth1 is serving dhcp addresses to guests through AP's.

AP's have static 10. addresses outside of dhcp pool.

Guest connect to network and request a webpage.

All guests must accept user agreement only(click through page.) and are 
redirected to their original requested page.

Allowed ports are 443 & 80.

using python/memcache to manage sessions and redirect to splash page???

Is this possible?

What am I missing?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Mario Figueiredo
On Wed, 25 Feb 2015 17:44:04 +0100, Sturla Molden
 wrote:


>I am not joking about that. It is more the hype this gets that indicates 
>TimSort is already broken today, and even on your cell phone.
>

But it IS broken.The only hype I'm witnessing is this fantasy created
by some that there's a hype around this issue.

The team that found the bug produce a non sensationalist  and
comprehensive report. So it couldn't be them. The other perople
discussing the issue are software developers who already know the
scope pof this bug from the very beginning of this thread.

So I'm not seeing the hype. What I'm seeing is this apparent attempt
at reductio ad absurdum to disqualify this bug.
-- 
https://mail.python.org/mailman/listinfo/python-list


no patch for Python 3.4.2 ?

2015-02-25 Thread Blaxton
Hi
I don't see any file named patch* in Python 3.4.2 source file.does this mean 
there is no patch available for this release ?

Thanks
DB-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Sturla Molden

On 25/02/15 18:22, Mario Figueiredo wrote:


And also presented a solution.


Which also was incorrect :-D

But now Benjamin Peterson has finally fixed it, it appears:

http://bugs.python.org/issue23515



Sturla


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


Re: Bug in timsort!?

2015-02-25 Thread Jonas Wielicki
On 25.02.2015 19:41, Sturla Molden wrote:
> On 25/02/15 18:22, Mario Figueiredo wrote:
> 
>> And also presented a solution.
> 
> Which also was incorrect :-D
> 
> But now Benjamin Peterson has finally fixed it, it appears:
> 
> http://bugs.python.org/issue23515

It would be too great if anyone replying to a discussion read the mails
before posting ...

https://mail.python.org/pipermail/python-list/2015-February/699420.html

I support that view, the changes do not change behaviour and merely
cosmetic, if I understand that statement correctly

regards,
jwi



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


Re: Bug in timsort!?

2015-02-25 Thread Ian Kelly
On Wed, Feb 25, 2015 at 10:21 AM, Peter Otten <__pete...@web.de> wrote:
> Mark Lawrence wrote:
>
>> Reading the bug report http://bugs.python.org/issue23515, specifically
>> msg236586, it looks as if the proposed fix was wrong and one of the
>> smarter members of the python community fixed it.
>
> If I understand that correctly Benjamin's modifications don't affect the
> functionality of the patch.

Yeah, just looks like some changes for code clarity to me.

Py_ssize_t is signed, so the n-1 > 0 test wouldn't break on n = 0. The
other changes are pure formatting.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Mark Lawrence

On 25/02/2015 17:22, Mario Figueiredo wrote:

On Wed, 25 Feb 2015 17:04:10 +0100, Peter Otten <__pete...@web.de>
wrote:


These guys found a bug that is subtler than what most of us have dealt with
in a widely used piece of code originally developed by one of the smarter
members of the python "community".

I bow my head to them and say thank you.


And also presented a solution.

Thank you for a little of sanity and common sense in this discussion.
TYhe levcel of smugness by some of the posters surely can't be a
representation of the python community.



I don't believe that any technical community with exactly 4,750 open 
issues on its bug tracker regards itself as smug.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: no patch for Python 3.4.2 ?

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 5:19 AM, Blaxton
 wrote:
> I don't see any file named patch* in Python 3.4.2 source file.
> does this mean there is no patch available for this release ?

Not sure what you mean. Are you looking for a single massive patch
which updates your 3.4.1 source code to 3.4.2? Or are you looking for
a patch which updates your binary? The first isn't necessary; you
simply get all the sources for 3.4.2, and that way, you don't have to
worry about exactly _what_ you're upgrading from. The second is
virtually impossible, because we can't know what your binary is. It's
much safer to compile fresh from source.

If you're using a package manager to install Python, try to use the
package manager to upgrade, too. That's the cleanest way to get the
latest - if it's possible. If it isn't, building from source is
usually the best option on Linux; on Windows, you'll probably find
that it's easier to download the .msi installer and use that.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Python Worst Practices

2015-02-25 Thread Mark Lawrence

http://www.slideshare.net/pydanny/python-worst-practices

Any that should be added to this list?  Any that be removed as not that bad?

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python Worst Practices

2015-02-25 Thread Michiel Overtoom

On Feb 25, 2015, at 21:45, Mark Lawrence wrote:

> http://www.slideshare.net/pydanny/python-worst-practices

I agree with you that Python lambdas have little use beyond the most trivial 
use cases.

For the non-trivial cases, I like to define a named function which does the 
job. And also provides documentation, just by virtue of being named (and having 
a docstring).

I also tend to do this in JavaScript code, which also can benefit from this.

Greetings,

-- 
"You can't actually make computers run faster, you can only make them do less." 
- RiderOfGiraffes

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


Re: Bug in timsort!?

2015-02-25 Thread Terry Reedy

On 2/25/2015 10:23 AM, Zachary Ware wrote:


Just to be clear, this has already been fixed, and the fix will be
released in Python 2.7.10, 3.4.4, and 3.5.0.


I think the important effect of the fix is to encourage automatic code 
verification both by the group that found this bug and by and others. 
Future verifier developers can check their code by trying to verify the 
fixed code.


The C half of the CPython code base has been improved by responding to 
issues raised by the Coverity checker.  I hope we can get free code 
reviews both of C and Python code from others.


--
Terry Jan Reedy

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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 7:45 AM, Mark Lawrence  wrote:
> http://www.slideshare.net/pydanny/python-worst-practices
>
> Any that should be added to this list?  Any that be removed as not that bad?

Remove the complaint about id. It's an extremely useful variable name,
and you hardly ever need the function. The only reason to avoid it is
so you get an immediate NameError if you haven't assigned to id, and
the alternative is pretty easily debuggable. I agree that "zip" can
easily be replaced with "zip_code" or "postal_code"; the need to avoid
"object" is almost completely unnecessary for me as I'd always
abbreviate it to "obj" anyway, but it doesn't hurt to say it.

(Flipping the booleans makes no sense to me. When would 0 mean true
and 1 mean false? Isn't it much more likely that, for instance, 0
means success and nonzero means error (and maybe there's just one
error state, so 1 means failure)?)

I'd take the one about properties a bit further. Try to avoid using
settable properties *at all*, until you've proven that you absolutely
do need them. Just let the calling code directly mutate your
attributes!

I'd also strengthen the point about "except: pass". He says "Arguably
better to not have this in your code". I don't think there's any
"arguably" about it - silently swallowing *any* exception is just
wrong. (Incidentally, the advent of chained exceptions may mean that
some of the code can be simplified - no need to explicitly retain the
previous exception when raising a custom one.)

But I take issue with the general ban on lambda. He's showing an
atrocious use of lambda:

1) Assigning a lambda function to a simple name is pointless. If
you're not making use of the fact that lambda is an expression, use
def.
2) If you need to fiddle around with dunder methods to do what you
want, then you definitely shouldn't be doing this as a lambda
function. You're fighting against the language by wrapping your logic
up until it can be an expression, only to ignore the value of that
expression.
3) And if you need a nested function call to implement a local
variable, because your dunder method calling is getting ridiculously
long, then duh, use def!

I could come up with an equally atrocious mis-use of list
comprehensions. Does that mean that a list comp is "Python worst
practice", and we should unroll them all into assignment, loop,
append? No. Certainly not. [1] It just proves that the feature can be
misused.

Hah. Talking about old-style classes. Okay, here's another Python best
practice: Use Python 3 if you can. :) But if you can't, then I
definitely agree that you should subclass object, put parens around
your print arguments, use "as" when capturing exceptions, all those
little things that will make your code that bit more 2/3 compatible
without making it any worse Py2 code.

Additional Python worst practice, although I don't see it all that
often: Creating classes for anything and everything. In a lot of
cases, Python code works just fine at top-level (eg module-level
functions), and those levels of indirection don't make the code any
easier to read.

ChrisA

[1] Sooo. Off we go to the Gaiety, for that's the place for me! [2]
[2] But you probably don't know that song, and I can't find it on
Youtube. "Johnny at the Gaiety", by George Grossmith, back in the late
19th century.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread MRAB

On 2015-02-25 20:45, Mark Lawrence wrote:

http://www.slideshare.net/pydanny/python-worst-practices

Any that should be added to this list?  Any that be removed as not that bad?


We don't have numeric ZIP codes in the UK, but the entire world has
numeric telephone numbers, so that might be a better example of numbers
that aren't really numbers.

Numeric dates can be ambiguous: dd/mm/ or mm/dd/? The ISO
standard is clearer: -mm-dd.

Handling text: "Unicode sandwich".

UTF-8 is better than legacy encodings.

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


Re: Python Worst Practices

2015-02-25 Thread Joel Goldstick
On Wed, Feb 25, 2015 at 4:28 PM, MRAB  wrote:
> On 2015-02-25 20:45, Mark Lawrence wrote:
>>
>> http://www.slideshare.net/pydanny/python-worst-practices
>>
>> Any that should be added to this list?  Any that be removed as not that
>> bad?
>>
> We don't have numeric ZIP codes in the UK, but the entire world has
> numeric telephone numbers, so that might be a better example of numbers
> that aren't really numbers.

US zip codes get messed up with ints because many have a leading zero.
I use strings
>
> Numeric dates can be ambiguous: dd/mm/ or mm/dd/? The ISO
> standard is clearer: -mm-dd.
>
> Handling text: "Unicode sandwich".
>
> UTF-8 is better than legacy encodings.
>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Grant Edwards
On 2015-02-25, MRAB  wrote:
> On 2015-02-25 20:45, Mark Lawrence wrote:
>> http://www.slideshare.net/pydanny/python-worst-practices
>>
>> Any that should be added to this list?  Any that be removed as not that bad?
>
> We don't have numeric ZIP codes in the UK, but the entire world has
> numeric telephone numbers,

That's probably true now, but hasn't always been the case (at least in
the US). If you're dealing with historical data, you might need to
include the city and exchange name in addition to the 4/5-digit line
number.  In _most_ multi-exchange service areas, those exchange names
have always mapped to a 2-digit number, but I believe there were
exceptions.

When I were a wee kid in the 60's my phone number was "Cedar 2 ". By then everybody had all-numeric dialing and
"Cedar" translated to "23", but it was still common to see phone
numbers printed using the exchange names.

> so that might be a better example of numbers that aren't really
> numbers.

-- 
Grant Edwards   grant.b.edwardsYow! Am I elected yet?
  at   
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Steven D'Aprano
Sturla Molden wrote:

> On 25/02/15 17:04, Peter Otten wrote:
> 
>> These guys found a bug that is subtler than what most of us have dealt
>> with in a widely used piece of code originally developed by one of the
>> smarter members of the python "community".
>>
>> I bow my head to them and say thank you.
> 
> I am not joking about that. It is more the hype this gets that indicates
> TimSort is already broken today, and even on your cell phone.

TimSort is an algorithm, and it is not broken. The algorithm is correct.

Any specific implementation of that algorithm may or may not be correct. As
Zachary has pointed out, the implementation used in CPython has already
been fixed, for versions 2.7.10, 3.4.4, and 3.5.0, and is now correct (as
far as anyone can tell).

Other implementations -- including Java and Android phones -- are not our
responsibility or concern, except so far as they may effect Jython or other
Python code.



-- 
Steven

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


Re: Python Worst Practices

2015-02-25 Thread MRAB

On 2015-02-25 22:59, Joel Goldstick wrote:
> On Wed, Feb 25, 2015 at 4:28 PM, MRAB  wrote:
> > On 2015-02-25 20:45, Mark Lawrence wrote:
> >>
> >> http://www.slideshare.net/pydanny/python-worst-practices
> >>
> >> Any that should be added to this list?  Any that be removed as not 
that

> >> bad?
> >>
> > We don't have numeric ZIP codes in the UK, but the entire world has
> > numeric telephone numbers, so that might be a better example of numbers
> > that aren't really numbers.
>
> US zip codes get messed up with ints because many have a leading zero.
> I use strings

Telephone numbers can also start with zero.

> >
> > Numeric dates can be ambiguous: dd/mm/ or mm/dd/? The ISO
> > standard is clearer: -mm-dd.
> >
> > Handling text: "Unicode sandwich".
> >
> > UTF-8 is better than legacy encodings.
> >

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


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Mark Lawrence  writes:

> http://www.slideshare.net/pydanny/python-worst-practices

Slideshare requires runing untrusted code in my browser, just to view
the slides.

Can someone direct us to a URL where the document can be downloaded
anonymously for offline viewing?

-- 
 \ “What is needed is not the will to believe but the will to find |
  `\   out, which is the exact opposite.” —Bertrand Russell, _Free |
_o__)   Thought and Official Propaganda_, 1928 |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Chris Angelico  writes:

> (Flipping the booleans makes no sense to me. When would 0 mean true
> and 1 mean false? Isn't it much more likely that, for instance, 0
> means success and nonzero means error (and maybe there's just one
> error state, so 1 means failure)?)

You've answered your question, I believe. In some contexts – such as
Unix shell – 0 ⇒ success ⇒ true, and non-0 ⇒ failure ⇒ false.

The Unix commands ‘true’ and ‘false’ follow that convention
https://en.wikipedia.org/wiki/True_and_false_%28commands%29>.

-- 
 \   “Know what I hate most? Rhetorical questions.” —Henry N. Camp |
  `\   |
_o__)  |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Steven D'Aprano
Mark Lawrence wrote:

> http://www.slideshare.net/pydanny/python-worst-practices
> 
> Any that should be added to this list?  Any that be removed as not that
> bad?


I have no idea about Python worst practices, but I think using some sort of
Powerpoint slide is surely one of the worst practices in general. In my
browser, I see the title "Python Worst Practices". There's a Next Slide
button, but clicking it does nothing.

Down below, there is what appears to be a transcript, but it is full of
extraneous and unnecessary fluff (nearly every line has a leading "Daniel
Greenfeld @pydanny") and the formatting is destroyed.


Worst practices:

- Using assert for error checking, instead of explicit tests.

- Overuse of regexes. If the only tool you have is the regex 
  hammer, everything looks like a nail.

- Underuse of regexes: failing to use a regex when one is called 
  for is not quite as bad as the regex hammer, but still.

- Python is not Java.

http://dirtsimple.org/2004/12/python-is-not-java.html‎
http://dirtsimple.org/2004/12/java-is-not-python-either.html


Most worst practices are independent of the language. Regardless of whether
they are writing Python, C or Ocaml, too many programmers make these deadly
programming sins:

- Too much coupling. Possibly the Mother Of All Sins, many other
  sins are variations of this: spaghetti code, ravioli code, global 
  variables, etc.

- Premature optimization. Which usually means, optimizing without
  measurement. If you just *assume* this code is "faster", chances
  are excellent that it is actually slower.

- Overuse of 1-character or excessively generic variable names.

- The other extreme: extremely_long_variable_names_for_no_good_reason.

- Variable names (including functions and classes!) that aren't
  self-explanatory.

- Misusing Hungarian notation. Or failing to use it when appropriate.

http://www.joelonsoftware.com/articles/Wrong.html

- Violating the Rule of Demeter: don't talk to the dog's leg, talk to 
  the dog. Or another way to put it: don't let the paper boy reach
  into your pocket for money.


And very possibly the worst practice of all:

- Failing to understand when it is, and isn't, appropriate to break
  the rules and do what would otherwise be a bad practice.





-- 
Steven

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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 10:48 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> (Flipping the booleans makes no sense to me. When would 0 mean true
>> and 1 mean false? Isn't it much more likely that, for instance, 0
>> means success and nonzero means error (and maybe there's just one
>> error state, so 1 means failure)?)
>
> You've answered your question, I believe. In some contexts – such as
> Unix shell – 0 ⇒ success ⇒ true, and non-0 ⇒ failure ⇒ false.
>
> The Unix commands ‘true’ and ‘false’ follow that convention
> https://en.wikipedia.org/wiki/True_and_false_%28commands%29>.

Yes, but my point is: You shouldn't need to rebind those names (or
have names "true" and "false" for 0 and 1). Instead, use "success" and
"failure". That is to say: The function doesn't return a boolean for
whether it did something or not, it returns an error code (or 0 if no
error). I agree with the presentation, but have never seen code that
does this; it's like saying "Python worst practice: Defining your
integer constants using Shakespeare syntax. Python best practice:
Defining your integer constants as decimal or hexadecimal digits.", in
that nobody would ever do the worst-practice side of it. But maybe
I've lived a sheltered life...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in timsort!?

2015-02-25 Thread Roy Smith
In article ,
 Sturla Molden  wrote:

> On 24/02/15 22:34, Roy Smith wrote:
> > http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm
> > -is-broken-and-how-to-fix-it/
> >
> 
> This is awful. It is broken for arrays longer than 2**49 elements. With 
> 8 bytes per PyObject* pointer this is >4096 terabytes of RAM. I don't 
> see how we can fix this in time.
> 
> Oh yes, and they mention that TimSort is used on billions of devices due 
> to Android mobile phones. This is clearly very relevant for mobile 
> phones. Next thing you know your litte Samsung Galaxy with more than 
> 4096 terabytes breaks down from a stack overflow in TimSort.

Keep in mind that the phone I cary around today has more memory (and 
probably more CPU) than the biggest supercomputers that existed when I 
was in college.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Chris Angelico  writes:

> On Thu, Feb 26, 2015 at 10:48 AM, Ben Finney  
> wrote:
> > Chris Angelico  writes:
> >
> >> (Flipping the booleans makes no sense to me. When would 0 mean true
> >> and 1 mean false? […])
> >
> > The Unix commands ‘true’ and ‘false’ follow that convention
> > https://en.wikipedia.org/wiki/True_and_false_%28commands%29>.
>
> Yes, but my point is: You shouldn't need to rebind those names (or
> have names "true" and "false" for 0 and 1).

That's not what you asked, though. You asked “When would 0 mean true and
1 mean false?” My answer: in all Unix shell contexts.

> Instead, use "success" and "failure".

You'd better borrow the time machine and tell the creators of Unix. The
meme is already established for decades now.

-- 
 \   “Firmness in decision is often merely a form of stupidity. It |
  `\indicates an inability to think the same thing out twice.” |
_o__)—Henry L. Mencken |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 10:54 AM, Steven D'Aprano
 wrote:
> - Violating the Rule of Demeter: don't talk to the dog's leg, talk to
>   the dog. Or another way to put it: don't let the paper boy reach
>   into your pocket for money.

I'd call that code smell, rather than an automatic worst practice. Suppose this:

class Shelf:
def __init__(self):
self.items = [] # Empty shelf

bookshelf = Shelf()
bookshelf.items.append(book)

To enforce Demeter, you'd have to add a bunch of methods to the Shelf
whose sole purpose is to pass word along to the items list. Sure, it
makes some design sense to say "Add this book to the shelf" rather
than "Add this book to the items on the shelf", but all those lines of
code are potential bugs, and if you have to reimplement huge slabs of
functionality, that too is code smell. So there are times when it's
correct to reach into another object.

But the times to use two dots are much rarer than the times to use one
dot (the paper boy shouldn't reach into your pocket for money, but
ThinkGeek has your credit card number on file so you can order more
conveniently), and I can't think of any example off-hand where you
would want more than three dots.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 11:11 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> On Thu, Feb 26, 2015 at 10:48 AM, Ben Finney  
>> wrote:
>> > Chris Angelico  writes:
>> >
>> >> (Flipping the booleans makes no sense to me. When would 0 mean true
>> >> and 1 mean false? […])
>> >
>> > The Unix commands ‘true’ and ‘false’ follow that convention
>> > https://en.wikipedia.org/wiki/True_and_false_%28commands%29>.
>>
>> Yes, but my point is: You shouldn't need to rebind those names (or
>> have names "true" and "false" for 0 and 1).
>
> That's not what you asked, though. You asked “When would 0 mean true and
> 1 mean false?” My answer: in all Unix shell contexts.

My bad. I was talking in a context of Python programming, specifically
with APIs where you would use some kind of true/false flag as either a
function parameter or a return value. There are plenty of contexts
where you want a success/failure response, but you can name your
constants "success" and "failure" for that, rather than "true" and
"false".

>> Instead, use "success" and "failure".
>
> You'd better borrow the time machine and tell the creators of Unix. The
> meme is already established for decades now.

IMO the whole system of boolean logic in shell scripts is a massive
pile of hacks. In its purest sense, you have "do this, and if it
succeeds, do that":

cp source destination && rm source

which makes reasonable sense with an "and" operator - do this, and do
this - and the converse makes similar sense with an "or" operator:

cp source destination || echo Oopsie

On the assumption that a nonzero return code from cp means it didn't
copy the file, this reads as "copy the file or emit that message",
which is exactly right. Nice. But that's stretching the notion of
"and" and "or" a little, to the point where booleans and comparisons
stop making so much sense:

[ -f /usr/local/bin/python ] || sudo make install

Is that a success/failure, or is it an if-then? Kinda neither, kinda
both, kinda one built on the other built on the other.

cp source destination || true

Now this makes no sense outside of its very specific purpose. "Or
true"? When would you use that? What it *actually* means is "attempt
this copy, and if it fails, pretend it succeeded" (presumably because
you have something aborting on error, like "set -e"). It's not boolean
logic, and it's not really an alternate command for the failure case.

The sh and bash system of logic works, there's no doubt about it. It
takes "practicality beats purity" a very long way, and makes something
where a fairly simple construct ("||" just means "if nonzero error
code, execute this, otherwise don't") can do three or four
barely-related jobs, which makes the language more compact. But none
of this means that Python should, in any way, imitate it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Chris Angelico  writes:

> IMO the whole system of boolean logic in shell scripts is a massive
> pile of hacks.

Agreed. It bears all the hallmarks of a system which has been extended
to become a complete programming language only with extreme reluctance
on its part.

I continue to be impressed by how capable and powerful Unix shell is as
a full programming language. Especially it is sorely missed on other
OSes which lack a capable shell.

But it could never be called “elegant”.

> The sh and bash system of logic works, there's no doubt about it. […]
> But none of this means that Python should, in any way, imitate it.

Quite so.

-- 
 \ “Airports are ugly. Some are very ugly. Some attain a degree of |
  `\ugliness that can only be the result of a special effort.” |
_o__)   —Douglas Adams, _The Long Dark Tea-Time of the Soul_, 1988 |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Mark Lawrence

On 25/02/2015 20:45, Mark Lawrence wrote:

http://www.slideshare.net/pydanny/python-worst-practices

Any that should be added to this list?  Any that be removed as not that
bad?



Throwing in my own, how about built-in functions should not use "object" 
as the one and only argument, and a keyword argument at that.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
I've been working with machine learning for a while.  Many of the standard 
packages (e.g., scikit-learn) have fitting algorithms which run in single 
threads.  These algorithms are not themselves parallelized.  Perhaps, due to 
their unique mathematical requirements, they cannot be paralleized.  

When one is investigating several potential models of one's data with various 
settings for free parameters, it is still sometimes possible to speed things 
up.  On a modern machine, one can use Python's multiprocessing.Pool to run 
separate instances of scikit-learn fits.  I am currently using ten of the 
twelve 3.3 GHz CPU cores on my machine to do just that.  And I can still browse 
the web with no observable lag.  :^)

Still, I'm waiting hours for jobs to finish.  Support vector regression fitting 
is hard.

What I would REALLY like to do is to take advantage of my GPU.  My NVidia 
graphics card has 1152 cores and a 1.0 GHz clock.  I wouldn't mind borrowing a 
few hundred of those GPU cores at a time, and see what they can do.  In theory, 
I calculate that I can speed up the job by another five-fold.

The trick is that each process would need to run some PYTHON code, not CUDA or 
OpenCL.  The child process code isn't particularly fancy.  (I should, for 
example, be able to switch that portion of my code to static typing.)

What is the most effective way to accomplish this task?

I came across a reference to a package called "Urutu" which may be what I need, 
however it doesn't look like it is widely supported.

I would love it if the Python developers themselves added the ability to spawn 
GPU processes to the Multiprocessing module!

Thanks for any advice and comments.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Michael Torrie
On 02/25/2015 04:45 PM, Ben Finney wrote:
> Mark Lawrence  writes:
> 
>> http://www.slideshare.net/pydanny/python-worst-practices
> 
> Slideshare requires runing untrusted code in my browser, just to view
> the slides.
> 
> Can someone direct us to a URL where the document can be downloaded
> anonymously for offline viewing?

Ahh, so you're referring to the Javascript?

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


Re: Python Worst Practices

2015-02-25 Thread Steven D'Aprano
Mark Lawrence wrote:

> On 25/02/2015 20:45, Mark Lawrence wrote:
>> http://www.slideshare.net/pydanny/python-worst-practices
>>
>> Any that should be added to this list?  Any that be removed as not that
>> bad?
>>
> 
> Throwing in my own, how about built-in functions should not use "object"
> as the one and only argument, and a keyword argument at that.


Which built-in function is that?


-- 
Steve

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


Re: Parallelization of Python on GPU?

2015-02-25 Thread Ethan Furman
On 02/25/2015 06:35 PM, John Ladasky wrote:
> What I would REALLY like to do is to take advantage of my GPU.  My NVidia 
> graphics
> card has 1152 cores and a 1.0 GHz clock.  I wouldn't mind borrowing a few 
> hundred
> of those GPU cores at a time, and see what they can do.  In theory, I 
> calculate
> that I can speed up the job by another five-fold.

Only free for academic use:

  https://developer.nvidia.com/how-to-cuda-python


unsure, but looks like free to use:

  http://mathema.tician.de/software/pycuda/


and, of course, the StackOverflow question:

  http://stackoverflow.com/q/5957554/208880

--
~Ethan~



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


Re: Parallelization of Python on GPU?

2015-02-25 Thread Steven D'Aprano
John Ladasky wrote:


> What I would REALLY like to do is to take advantage of my GPU.

I can't help you with that, but I would like to point out that GPUs 
typically don't support IEE-754 maths, which means that while they are 
likely significantly faster, they're also likely significantly less 
accurate. Any any two different brands/models of GPU are likely to give 
different results. (Possibly not *very* different, but considering the mess 
that floating point maths was prior to IEEE-754, possibly *very* different.)

Personally, I wouldn't trust GPU floating point for serious work. Maybe for 
quick and dirty exploration of the data, but I'd then want to repeat any 
calculations using the main CPU before using the numbers anywhere :-)



-- 
Steve

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


Re: Python Worst Practices

2015-02-25 Thread Dave Angel

On 02/25/2015 08:44 PM, Mark Lawrence wrote:

On 25/02/2015 20:45, Mark Lawrence wrote:

http://www.slideshare.net/pydanny/python-worst-practices

Any that should be added to this list?  Any that be removed as not that
bad?



Throwing in my own, how about built-in functions should not use "object"
as the one and only argument, and a keyword argument at that.



def marry(object = False)...


if anybody has any cause to object, let him speak now...

--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list


Re: Parallelization of Python on GPU?

2015-02-25 Thread Ethan Furman
Oh, and this one:

  http://www.cs.toronto.edu/~tijmen/gnumpy.html

--
~Ethan~



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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 2:05 PM, Dave Angel  wrote:
> On 02/25/2015 08:44 PM, Mark Lawrence wrote:
>>
>> On 25/02/2015 20:45, Mark Lawrence wrote:
>>>
>>> http://www.slideshare.net/pydanny/python-worst-practices
>>>
>>> Any that should be added to this list?  Any that be removed as not that
>>> bad?
>>>
>>
>> Throwing in my own, how about built-in functions should not use "object"
>> as the one and only argument, and a keyword argument at that.
>>
>
> def marry(object = False)...
>
>
> if anybody has any cause to object, let him speak now...

Python.

Python is what bwings us togethar, today.

And def, twue def, will make your argument into a keyword argument
that will fowwow you forevah and evah. So tweasure your keyword
arguments...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
On Wednesday, February 25, 2015 at 7:03:23 PM UTC-8, Steven D'Aprano wrote:

> I would like to point out that GPUs 
> typically don't support IEE-754 maths, which means that while they are 
> likely significantly faster, they're also likely significantly less 
> accurate.

Historically, that has been true.  According to this document...

https://developer.nvidia.com/sites/default/files/akamai/cuda/files/NVIDIA-CUDA-Floating-Point.pdf

...NVidia's GPU cards which implement "compute capability" versions 2.0 and 
higher are IEEE-754 compliant, both for single- and double-precision floating 
point operations.

The current "compute capability" version is 5.2, so there are several 
generations of GPU hardware out there by now which should give satisfactory 
floating-point results.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Michael Torrie  writes:

> On 02/25/2015 04:45 PM, Ben Finney wrote:
> > Can someone direct us to a URL where the document can be downloaded
> > anonymously for offline viewing?
>
> Ahh, so you're referring to the Javascript?

I'm referring to the fact that a presentation document at Slideshare is
not viewable nor downloadable, unless I identify myself or run a browser
app.

Both of which have no technical justification; a PDF presentation
document would do just as well and avoid those problems.

When directing people to view one's presentation document, please make
sure the document is available via a simple download, not a needless
user-registration process.

-- 
 \   “Philosophy is questions that may never be answered. Religion |
  `\  is answers that may never be questioned.” —anonymous |
_o__)  |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 3:08 PM, Ben Finney  wrote:
> Both of which have no technical justification; a PDF presentation
> document would do just as well and avoid those problems.

Probably doesn't even need PDF. The slides are approximately as
complex as those in Ned Batchelder's "Pragmatic Unicode" presentation,
which is represented entirely in text. Maybe there's some slight
additional complications, but not many.

I'd really like to see a lot more presentations done in pure text.
Scrap the graphics, scrap the fancy transitions, they aren't helping
you make your case anyway. Just give me the content. Tell me what
you're saying. I don't care about the fluff.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Chris Angelico  writes:

> I'd really like to see a lot more presentations done in pure text.

Maybe so. My request at the moment, though, is not for people to change
what's on their slides; rather, if they want people to retrieve them,
the slides should be downloadable easily (i.e. without a web app,
without a registration to some specific site).

-- 
 \ “I thought I'd begin by reading a poem by Shakespeare, but then |
  `\ I thought ‘Why should I? He never reads any of mine.’” —Spike |
_o__) Milligan |
Ben Finney

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


Re: Python Worst Practices

2015-02-25 Thread Chris Angelico
On Thu, Feb 26, 2015 at 3:44 PM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> I'd really like to see a lot more presentations done in pure text.
>
> Maybe so. My request at the moment, though, is not for people to change
> what's on their slides; rather, if they want people to retrieve them,
> the slides should be downloadable easily (i.e. without a web app,
> without a registration to some specific site).

Yeah, my "really like to see" is more about decisions made when the
slides are created. For this, PDF or PNG images would probably be the
most convenient.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Michael Torrie
On 02/25/2015 09:08 PM, Ben Finney wrote:
> Michael Torrie  writes:
> 
>> On 02/25/2015 04:45 PM, Ben Finney wrote:
>>> Can someone direct us to a URL where the document can be downloaded
>>> anonymously for offline viewing?
>>
>> Ahh, so you're referring to the Javascript?
> 
> I'm referring to the fact that a presentation document at Slideshare is
> not viewable nor downloadable, unless I identify myself or run a browser
> app.

I'm curious. What browser app are you referring to here?  Seems like the
presentation is pure html5 with a bit a javascript.  Is this what you
mean?  I didn't require any special apps to view the slideshow.  I
certainly didn't "identify" myself any more than I would for any other
web site (exposing my IP address).  Anyway just trying to understand
exactly what you mean.  I'm not sure if you're a noscript person, or if
I've missed something.

I agree about the PDF and offline viewing.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ian Kelly
On Wed, Feb 25, 2015 at 1:45 PM, Mark Lawrence  wrote:
> http://www.slideshare.net/pydanny/python-worst-practices
>
> Any that should be added to this list?  Any that be removed as not that bad?

Using XML for configuration is a good example of a worst practice, but
using Python instead isn't best practice. There are good arguments
that a configuration language shouldn't be Turing-complete. See for
instance this blog post: http://taint.org/2011/02/18/001527a.html

The problem with XML is just that it's not very human-readable; it
doesn't need all the extra power of Python. This may be something
that's hard to appreciate until you've actually experienced an outage
because somebody checked in a configuration change that parsed and
passed tests but nonetheless was invalid due to configuration that
couldn't be evaluated until runtime. A better choice for configuration
would be something that is both easily readable and *simple* such as
JSON or YAML, or an appropriate DSL.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Ben Finney
Michael Torrie  writes:

> I'm curious. What browser app are you referring to here?  Seems like the
> presentation is pure html5 with a bit a javascript.  Is this what you
> mean?

Yes. This is a document we're talking about, with many pages. I don't
want to sit navigating in my browser to read it, when it's certainly in
a form that could just be presented for download and viewed in a program
of my choice, while offline.

> I certainly didn't "identify" myself any more than I would for any
> other web site (exposing my IP address).

Try downloading the document, without registering or logging in –
neither of which should be needed for a document supposedly for public
view.

-- 
 \ “I went to a museum where all the artwork was done by children. |
  `\   They had all the paintings up on refrigerators.” —Steven Wright |
_o__)  |
Ben Finney

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


Re: Design thought for callbacks

2015-02-25 Thread Gregory Ewing

Cem Karan wrote:

I think I see what you're talking about now.  Does WeakMethod
(https://docs.python.org/3/library/weakref.html#weakref.WeakMethod) solve
this problem?


Yes, that looks like it would work.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Worst Practices

2015-02-25 Thread Michael Torrie
On 02/25/2015 10:21 PM, Ben Finney wrote:
>  document we're talking about, with many pages. I don't
> want to sit navigating in my browser to read it, when it's certainly in
> a form that could just be presented for download and viewed in a program
> of my choice, while offline.
> 
>> > I certainly didn't "identify" myself any more than I would for any
>> > other web site (exposing my IP address).
> Try downloading the document, without registering or logging in –
> neither of which should be needed for a document supposedly for public
> view.

Okay I understand. Yes I agree with you about the download completely.

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


Re: Bug in timsort!?

2015-02-25 Thread Ian Kelly
On Wed, Feb 25, 2015 at 4:13 PM, Steven D'Aprano
 wrote:
> TimSort is an algorithm, and it is not broken. The algorithm is correct.

The algorithm asserted an invariant but failed to actually establish
it. That sounds broken to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parallelization of Python on GPU?

2015-02-25 Thread John Ladasky
Thanks for the various links, Ethan.  I have encountered PyCUDA before, but not 
the other options.

So far, I'm not seeing code examples which appear to do what I would like, 
which is simply to farm out one Python process to one GPU core.  The examples 
all appear to parallelize array operations.  I know, that's the easier way to 
break up a task.

I may have to bite the bullet and learn how to use this:

http://mklab.iti.gr/project/GPU-LIBSVM

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


Re: Bug in timsort!?

2015-02-25 Thread Serhiy Storchaka

On 25.02.15 18:56, Chris Kaynor wrote:

While the CPython implementation was only broken for arrays of length
larger than 2**49, aka, practically not broken, the Java
implementation (such as used on Android phones) was broken with arrays
of length > 67,108,864 at the time the post was made. While still very
large, an array of 67 million elements is well within the realm of
possibility today. The Java fixes (so far) have only extended the
number out, rather than actually fix the underlying problem - the
CPython fixes that were committed implement the full proven fix, so
CPython should now be able to handle infinite length arrays (once we
can build computers with that much storage...).


No, it is limited to arrays with length < about 2**64.


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


GDAL Installation in Enthought Python Distribution

2015-02-25 Thread Leo Kris Palao
Hi Python Users,

Would like to request how to install GDAL in my Enthought Python
Distribution (64-bit). I am having some problems making GDAL work. Or can
you point me into a blog that describes how to set up GDAL in Enthought
Python Distribution.

Thanks for any help.
-Leo
-- 
https://mail.python.org/mailman/listinfo/python-list


mod_python.publisher issue on ARM 64 bit machine

2015-02-25 Thread amito2in
Hi,

We are using the following configurations on ARM 64 bit machine

Apache Version:- 2.4.10
Python Version:- 2.7.4
Mod_Python:- 3.5.0

And we are observing the following error in mod_python.publisher while running 
our application

Mod_python error: "PythonHandler mod_python.publisher"
Traceback (most recent call last):
  File "/usr/bin/lib/python2.7/site-packages/mod_python/apache.py", line 421, 
in HandlerDispatch
result = obj(req)
  File "/usr/bin/lib/python2.7/site-packages/mod_python/publisher.py", line 
128, in handler
path,module_name =  os.path.split(req.filename)
  File "/usr/bin/lib/python2.7/posixpath.py", line 92, in split
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

However, mod_python.testhandler is working fine and its output is showing 
mod_python.publisher as available.

mod_python.publisher available  Yes
mod_python.psp availableYes
 
I came across the following link wherein it has suggested to make "_server" and 
"_interpreter" as public. I tried but it didn't work.
http://osdir.com/ml/apache.mod-python.devel/2006-03/msg00250.html/


Do we have to use any particular version of Apache or Python on ARM 64 bit 
server or are we missing on any step in our current set-up? Please suggest 

Note:- We also tried with another version of mod_python(i.e. 3.4.1) 


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


Python STEP file color and module issue.

2015-02-25 Thread Shiladittya Chakraborty
In the latest version of pythonOCC-0.16.0-win32-py34 its supporting WEBGGL 
that's a great one but its showing only one color and also its does not have 
all the module when I am going to compare this pythonOCC-0.16.0-win32-py34 with 
pythonOCC-0.4.win32-py2.6. 
So my questions are -
1) How to get the remaining module?
2) Is it possible to STEP file read with exact color? 
-- Right now step file reading is possible with only one color. 
-- Is it possible to showing exact color using STEPCAFControl this module?
-- 
https://mail.python.org/mailman/listinfo/python-list