Re: Error : 0x80070570 file or directory is corrupted or unavailable

2016-02-01 Thread Oscar Benjamin
On 31 January 2016 at 07:26, archi dsouza  wrote:
> I was trying to install Python.exe in windows 8.1. But got error mention in
> subject line. find attached log file.

This particular error message has been reported here before:

https://mail.python.org/pipermail/python-list/2015-September/697456.html

It's not clear to me whether it is a Python problem or a disk problem or what.

What version are you trying to install? Is it Python 3.5?

Does it work if you try to install Python 3.4 instead? If so then this
may be a bug in Python 3.5 on Windows and it needs to be reported so
it can be fixed.

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


Re: ts.plot() pandas: No plot!

2016-02-01 Thread Jason Swails
On Sun, Jan 31, 2016 at 9:08 PM, Paulo da Silva <
p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote:

> Às 01:43 de 01-02-2016, Mark Lawrence escreveu:
> > On 01/02/2016 00:46, Paulo da Silva wrote:
> ...
>
> >>
> >
> > Is it as simple as adding a call to ts.show() ?
> >
> Thanks for the clue!
> Not so simple however.
> Needed to do
> import matplotlib.pyplot as plt
> plt.show()
>

​What you saw ts.plot() return was the matplotlib artists (the things that
will be drawn on whatever "canvas" is provided -- either saved to an image
or drawn to a GUI widget).  So whenever you see this kind of return value,
you know you need to call the matplotlib.pyplot.show function in order to
generate a canvas widget (with whatever backend you choose) and draw it.

If you want to do this kind of interactive plotting (reminiscent, I've
heard, of Matlab), I would highly recommend checking out IPython.  You can
use IPython's notebook or qtconsole and embed plots from matplotlib
directly in the viewer.  For example, try this:

ipython qtconsole

This opens up a window, then use the magic command "%matplotlib inline" to
have all plots sent directly to the ipython console you are typing commands
in.  I've found that kind of workflow quite convenient for directly
interacting with data.

HTH,
Jason
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Heap Implementation

2016-02-01 Thread Sven R. Kunze

On 31.01.2016 05:59, srinivas devaki wrote:

@Sven
actually you are not sweeping at all, as i remember from my last post
what i meant by sweeping is periodically deleting the elements which
were marked as popped items.


Exactly.

Maybe I didn't express myself well. Would you prefer the sweeping 
approach in terms of efficiency over how I implemented xheap currently?


Without running some benchmarks, I have absolutely no feeling which 
approach is faster/more memory efficient etc.



kudos on that __setitem__ technique,
instead of using references to the items like in HeapDict, it is
brilliant of you to simply use __setitem__


Thanks. :)


On Sun, Jan 31, 2016 at 4:17 AM, Sven R. Kunze  wrote:

Hi again,

as the topic of the old thread actually was fully discussed, I dare to open
a new one.

I finally managed to finish my heap implementation. You can find it at
https://pypi.python.org/pypi/xheap + https://github.com/srkunze/xheap.

I described my motivations and design decisions at
http://srkunze.blogspot.com/2016/01/fast-object-oriented-heap-implementation.html

@Cem
You've been worried about a C implementation. I can assure you that I did
not intend to rewrite the incredibly fast and well-tested heapq
implementation. I just re-used it.

I would really be grateful for your feedback as you have first-hand
experience with heaps.

@srinivas
You might want to have a look at the removal implementation. Do you think it
would be wiser/faster to switch for the sweeping approach?

I plan to publish some benchmarks to compare heapq and xheap.

@all
What's the best/standardized tool in Python to perform benchmarking? Right
now, I use a self-made combo of unittest.TestCase and time.time + proper
formatting.

Best,
Sven


PS: fixing some weird typos and added missing part.


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


Re: x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-02-01 Thread Vincent Davis
On Sat, Jan 30, 2016 at 9:58 PM, Veek. M  wrote:

> Is there some other nice way to wrap this stuff up?
> I can't do:
> try:
>  x=
>  y=
>  z=
> except:
>

I happend to


Have just been doing the something
similar. You can put x,y,x in a list and loop over it. In my case a dict
was better.
See the example here.
https://github.com/vincentdavis/USAC_data/blob/master/tools.py#L24

Vincent Davis
720-301-3003
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Heap Implementation

2016-02-01 Thread Sven R. Kunze

On 31.01.2016 02:48, Steven D'Aprano wrote:

On Sunday 31 January 2016 09:47, Sven R. Kunze wrote:


@all
What's the best/standardized tool in Python to perform benchmarking?

timeit

Thanks, Steven.

Maybe, I am doing it wrong but I get some weird results:

>>> min(timeit.Timer('for _ in range(1): heappop(h)', 'from heapq 
import heappop; h=list(range(1000))').repeat(10, 1)), 
min(timeit.Timer('for _ in range(1): h.pop()', 'from xheap import 
Heap; h=Heap(range(1000))').repeat(10, 1))

(0.01726761805314, 0.01615345600021101)

>>> min(timeit.Timer('for _ in range(10): heappop(h)', 'from heapq 
import heappop; h=list(range(1000))').repeat(10, 1)), 
min(timeit.Timer('for _ in range(10): h.pop()', 'from xheap import 
Heap; h=Heap(range(1000))').repeat(10, 1))

(0.12321608699949138, 0.1304205129002)

>>> min(timeit.Timer('for _ in range(1): heappop(h)', 'from heapq 
import heappop; h=list(range(100))').repeat(10, 1)), 
min(timeit.Timer('for _ in range(1): h.pop()', 'from xheap import 
Heap; h=Heap(range(100))').repeat(10, 1))

(0.010081621999233903, 0.008791901999757101)

>>> min(timeit.Timer('for _ in range(100): heappop(h)', 'from heapq 
import heappop; h=list(range(1000))').repeat(10, 1)), 
min(timeit.Timer('for _ in range(100): h.pop()', 'from xheap import 
Heap; h=Heap(range(1000))').repeat(10, 1))

(0.6218949679996513, 0.7172151949998806)


How can it be that my wrapper is sometimes faster and sometimes slower 
than heapq? I wouldn't mind slower, but faster*?



Best,
Sven


* that behavior is reproducible also for other combos and other machines.
--
https://mail.python.org/mailman/listinfo/python-list


Python Calculator

2016-02-01 Thread Ryan Young
I am new to Python but have known Java for a few years now. With python, so
far, so good! I created a simple calculator to calculate the total cost of
a meal. My variables were tip tax total and order. I am confused about how
to put in a new 'order' because when i reset the order variable to a
different number it still calculates the original value. I have sent you a
picture to help you understand my problem. Thank you so much!

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


Re: Python Calculator

2016-02-01 Thread Zachary Ware
Hi Ryan,

On Mon, Feb 1, 2016 at 1:30 PM, Ryan Young  wrote:
> I am new to Python but have known Java for a few years now. With python, so
> far, so good! I created a simple calculator to calculate the total cost of
> a meal. My variables were tip tax total and order. I am confused about how
> to put in a new 'order' because when i reset the order variable to a
> different number it still calculates the original value. I have sent you a
> picture to help you understand my problem. Thank you so much!

Your picture didn't come through.  This is a text-based mailing list
gated to a Usenet group, many participants wouldn't receive an
attached picture no matter how you tried to do it.  Instead, just copy
and paste the code you're running and the exact output you get into
the body of a message, making sure that the formatting (especially
indentation, which is significant in Python) is kept by your email
client.  The simplest step towards ensuring good formatting is to send
your message in plain text mode (rather than HTML).

With your code in hand, I'm sure someone here will be able to explain
what's going on :)

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


Re: ts.plot() pandas: No plot!

2016-02-01 Thread Paulo da Silva
Às 14:18 de 01-02-2016, Jason Swails escreveu:
> On Sun, Jan 31, 2016 at 9:08 PM, Paulo da Silva <
> p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote:
> 
>> Às 01:43 de 01-02-2016, Mark Lawrence escreveu:
>>> On 01/02/2016 00:46, Paulo da Silva wrote:
...

> 
> ​What you saw ts.plot() return was the matplotlib artists (the things that
> will be drawn on whatever "canvas" is provided -- either saved to an image
> or drawn to a GUI widget).  So whenever you see this kind of return value,
> you know you need to call the matplotlib.pyplot.show function in order to
> generate a canvas widget (with whatever backend you choose) and draw it.
> 
> If you want to do this kind of interactive plotting (reminiscent, I've
> heard, of Matlab), I would highly recommend checking out IPython.  You can
> use IPython's notebook or qtconsole and embed plots from matplotlib
> directly in the viewer.  For example, try this:
> 
> ipython qtconsole
> 
> This opens up a window, then use the magic command "%matplotlib inline" to
> have all plots sent directly to the ipython console you are typing commands
> in.  I've found that kind of workflow quite convenient for directly
> interacting with data.
Thank you Jason.
This can be very usefull.

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


Sr Python Developer job opening- SA, TX

2016-02-01 Thread nathanladuca
Let me know if interested...

Day to Day: 
- Write and execute automated test scripts using a pre-defined framework
- Writes positive and negative smoke and regression test scripts to test 
product functionality and integration with dependencies
- Tests API's, user interfaces, web services and/or web applications
- Writes performance, load, and stress tests utilizing a pre-defined framework
- Participates in code reviews
- Low to mid level of contribution to Openstack test suites, as applicable
- Collaborates with other quality and development engineers to build, evolve, 
and maintain a scalable continuous build and deployment pipeline


Required Skills:
- Must know and work with Python
- Must possess the ability to understand new concepts quickly, and apply them 
accurately through an evolving, dynamic environment
- Strong knowledge of protocols, networking, and systems
- Demonstrated intermediate knowledge of Unix shell scripting
- Intermediate knowledge of a UI automation tool such as Selenium, QTP, or Silk
- Experience working within an agile development process (Scrum, XP, Kanban, 
etc.) from the test design, test automation, and execution perspective
Required Skills (continued):
- Ability to analyze and translate requirements and development stories into 
test scripts

Preferred Skills: 
- Strong understanding of software/testing methodologies such as TDD
- Experience working in Cloud computing
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Heap Implementation

2016-02-01 Thread srinivas devaki
On Feb 1, 2016 10:54 PM, "Sven R. Kunze"  wrote:
>
> Maybe I didn't express myself well. Would you prefer the sweeping
approach in terms of efficiency over how I implemented xheap currently?
>

complexity wise your approach is the best one of all that I have seen till
now

> Without running some benchmarks, I have absolutely no feeling which
approach is faster/more memory efficient etc.
>

this is obviously memory efficient but I don't know whether this approach
would be faster than previous approaches, with previous approaches there is
no call back into Python code from C code for comparison.
but this should be faster than HeapDict as HeapDict is directly using its
own methods for heappush, heappop etc

PS: if you have time, could you please review my pull request.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Calculator

2016-02-01 Thread Steven D'Aprano
Hi Ryan, and welcome!

On Tuesday 02 February 2016 06:30, Ryan Young wrote:

> I am new to Python but have known Java for a few years now. With python,
> so far, so good! I created a simple calculator to calculate the total cost
> of a meal. My variables were tip tax total and order. I am confused about
> how to put in a new 'order' because when i reset the order variable to a
> different number it still calculates the original value. I have sent you a
> picture to help you understand my problem. Thank you so much!

I don't know what they taught you about Java programming, but Python 
programming involves typing text into a text editor or IDE, not editing 
pictures with Photoshop. So if you have a problem, the best way to get a 
solution is to post *code*, not pictures. Copy and paste the code, don't 
retype it from memory.

For the best results, please read this:

http://www.sscce.org/

before re-sending.



Thanks, and good luck,



-- 
Steve

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


Re: Heap Implementation

2016-02-01 Thread Steven D'Aprano
On Tuesday 02 February 2016 06:32, Sven R. Kunze wrote:

> On 31.01.2016 02:48, Steven D'Aprano wrote:
>> On Sunday 31 January 2016 09:47, Sven R. Kunze wrote:
>>
>>> @all
>>> What's the best/standardized tool in Python to perform benchmarking?
>> timeit
> Thanks, Steven.
> 
> Maybe, I am doing it wrong but I get some weird results:

You need to understand that in any modern desktop, server or laptop computer 
(embedded devices may be different) there is *constantly* a large amount of 
processing going on in the background. Your OS is constantly responding to 
network events, managing memory, skipping from one process to another, 
scheduling tasks; your anti-virus and other background programs are working; 
your window environment is watching the mouse, etc. So each time you run a 
test, it comes down to pure dumb luck how many other programs are busy at 
the same time. (You can, sometimes, influence that by quitting all other 
applications, unplugging the network cable, and keeping your hands off the 
keyboard and mouse while the test is running. But who does that?)

All that adds noise to the measured times. It's not unusual for timings to 
differ by a factor of ten from one run to the next. The speed will also 
differ depending on processor cache misses, and many other factors that are 
effectively impossible to predict with any certainty. This makes timing 
measurements on modern systems an inherently noisy process.

In effect, each measurement you take is made up of two components:

* the actual time that the code would take if it had exclusive 
  access to the machine with no other programs running, call it t;

* and the noise added by the system, call it Δt.

It is impossible to measure t alone, you always get t+Δt. The aim in timing 
is to reduce the effect of the noise as much as possible.

The way to do this with timeit is:

- don't run extraneous code as part of your test (just measure what 
  you care about, with as little scaffolding around it);

- run that code snippet as many times as you can bear in a loop, 
  *but* let timeit manage the loop; don't try doing it by hand;

- only care about "best of N", where N is as large a number as you 
  can stand;

- averages, standard deviation, and other statistics are pretty 
  much useless here, the only statistic that you care about is
  the minimum.


Out of those four guidelines, you missed three of them:

(1) Your test code includes scaffolding, the "for _ in range..." loop. 
You're timing how expensive it is to build a range object and loop over it.

(2) You picked a tiny number for the number of loops: ten. Timeit defaults 
to one million, which is good for *really* fast and tiny snippets.

I normally reduce that to 1, but run a larger number of trials. If the 
timing from each trial is too small, I increase the number of loops, and if 
it takes too long (I am impatient) I decrease it, but never below 100.

(3) You then use the repeat() method to calculate the "best of one", which 
is pretty much pointless. There is a timeit() method for "best of one", if 
that's ever useful.

I normally run 5 or 7 trials, and report only the best (smallest).


Here's your code:

>  >>> min(timeit.Timer('for _ in range(1): heappop(h)', 'from heapq
> import heappop; h=list(range(1000))').repeat(10, 1)),
> min(timeit.Timer('for _ in range(1): h.pop()', 'from xheap import
> Heap; h=Heap(range(1000))').repeat(10, 1))
> (0.01726761805314, 0.01615345600021101)


Your code would be easier to read and understand if it were split over 
multiple lines. This is not Perl and there's no advantage to one-liners.

Pulling your code apart and re-writing it in a way which I feel is more 
understandable:

t1 = Timer(
'for _ in range(1): heappop(h)',  # code being tested
'from heapq import heappop; h=list(range(1000))'  # setup
)

t2 = Timer(
'for _ in range(1): h.pop()',
'from xheap import Heap; h=Heap(range(1000))'
)

min(t1.repeat(10, 1))
min(t2.repeat(10, 1))


Something like this will probably be less noisy:

setup = """
from heapq import heappop
from xheap import Heap
a = list(range(1000))
h = Heap(a)
"""

t1 = Timer("heappop(a)", setup)
t2 = Timer("h.pop()", setup)

# print best of 7 trials, where each trial runs the code snippet 1 times
print(min(t1.repeat(1, 7)))
print(min(t2.repeat(1, 7)))


The times printed will be in seconds per 1 runs; divide it by 10 to get 
the time in *milliseconds* per run.

Note that this will *not* eliminate all noise or variation from one timing 
test to the other, but it will (I hope!) reduce it. If you're still seeing a 
lot of variation, try turning the garbage collector off and quitting as many 
other applications as possible.

If anyone else can suggest any other techniques for reducing noise, I'd love 
to hear about them.

Also note that times generated by timeit with one version of Python may not 
be measuring the same thing as those using a different