Re: Python packages listed in PyPI

2016-07-20 Thread Ben Finney
(Please don't top-post; instead, interleave your responses and trim material you're not responding to.) Rayne via Python-list writes: > Thanks! One more question: Does "pip install" require Internet to > work? Yes, ‘pip’ resolves the dependencies, download the files, and installs them. > Or ar

Re: Python packages listed in PyPI

2016-07-20 Thread Steven D'Aprano
On Thursday 21 July 2016 16:28, Rayne wrote: > Thanks! One more question: Does "pip install" require Internet to work? Yes, you must have internet access. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Python packages listed in PyPI

2016-07-20 Thread Ben Finney
Rayne via Python-list writes: > May I know if the Python packages listed on the PyPI page > (https://pypi.python.org/pypi) are OS-independent? There is a Trove classifier, “Operating System”, which allows the package maintainer to declare one or more specific operating systems. For example, a p

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Steven D'Aprano
On Thursday 21 July 2016 15:28, Rustom Mody wrote: > On Wednesday, July 20, 2016 at 11:13:05 AM UTC+5:30, Steven D'Aprano wrote: >> On Tuesday 19 July 2016 14:58, Rustom Mody wrote: >> >> > So I again ask: You say «"Never compare floats for equality" is a >> > pernicious myth» >> >> It is the wo

Re: Python packages listed in PyPI

2016-07-20 Thread Rayne via Python-list
Thanks! One more question: Does "pip install" require Internet to work? Or are all implementations already contained in the packages and so do not require additional downloads? From: Pete Forman To: python-list@python.org Sent: Thursday, July 21, 2016 2:19 PM Subject: Re: Python packa

Re: Python packages listed in PyPI

2016-07-20 Thread Pete Forman
Rayne writes: > May I know if the Python packages listed on the PyPI page > (https://pypi.python.org/pypi) are OS-independent? That is, do I > download and install the same package on both Windows and Linux The simple answer is yes. pip install will find the appropriate implementation for your O

Python packages listed in PyPI

2016-07-20 Thread Rayne via Python-list
Hi, May I know if the Python packages listed on the PyPI page (https://pypi.python.org/pypi) are OS-independent? That is, do I download and install the same package on both Windows and Linux systems? Thank you. Regards,Rayne -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Thursday, July 21, 2016 at 11:05:28 AM UTC+5:30, Chris Angelico wrote: > On Thu, Jul 21, 2016 at 3:28 PM, Rustom Mody wrote: > > ε is spelt ⎕ct (Comparison Tolerance) > > And of course == is spelt = > > spelt is spelled spelled. Unless, of course, you mean the wheat variety. Love it! Though n

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Wednesday, July 20, 2016 at 8:29:25 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico : > > > On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: > >> 2. Floating-point numbers are *imperfect approximations* of real > >> numbers. Even when real numbers are derived exactly, > >>

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 3:28 PM, Rustom Mody wrote: > ε is spelt ⎕ct (Comparison Tolerance) > And of course == is spelt = spelt is spelled spelled. Unless, of course, you mean the wheat variety. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Wednesday, July 20, 2016 at 11:13:05 AM UTC+5:30, Steven D'Aprano wrote: > On Tuesday 19 July 2016 14:58, Rustom Mody wrote: > > > So I again ask: You say «"Never compare floats for equality" is a pernicious > > myth» > > It is the word *never* which makes it superstition. If people said "Take

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 11:24 pm, alister wrote: > One of my biggest questions since the Brexit vote is can we g back to > using imperial weights & measures (please). I suppose you might as well -- there's no more empire, no more jobs or houses, and once the financial traders leave London there'll be

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Thu, 21 Jul 2016 08:11 am, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: >> >> Lawrence D’Oliveiro wrote: >> >>> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >>> pylint can detect candidates for accidental attrib

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 8:11 AM, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: >> >> Lawrence D’Oliveiro wrote: >> >>> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >>> pylint can detect candidates for accidental attri

Re: can't add variables to instances of built-in classes

2016-07-20 Thread breamoreboy
On Wednesday, July 20, 2016 at 10:48:23 PM UTC+1, Lawrence D’Oliveiro wrote: > On Thursday, July 21, 2016 at 12:11:09 AM UTC+12, Steven D'Aprano wrote: > > > [long irrelevant rant deleted] > > Just because I pointed out what a load of nonsense you were spouting about > __slots__, by giving a cou

Re: reversed(enumerate(x))

2016-07-20 Thread Michael Selik
> On Jul 20, 2016, at 12:42 PM, Ian Kelly wrote: > >for i, n in reversed(enumerate(x)): pass > > fails with "TypeError: argument to reversed() must be a sequence". So make it a sequence: for i, n in reversed(list(enumerate(x))): pass If ``x`` is very large, you can use your zip/range

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Gregory Ewing
Random832 wrote: Well, your amp hours will be shittier with a lower voltage. Define "shittier". An incandescent flashlight (which consumes less power at lower voltage) will last longer, but won't be as bright. If it's still acceptably bright, that's not worse. I think the point is that the ce

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: > > Lawrence D’Oliveiro wrote: > >> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >> >>> pylint can detect candidates for accidental attribute creation: >> >> And __slots__ will prevent them outright. >

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Thursday, July 21, 2016 at 12:11:09 AM UTC+12, Steven D'Aprano wrote: > [long irrelevant rant deleted] Just because I pointed out what a load of nonsense you were spouting about __slots__, by giving a counterexample of their usefulness? Man, your pride must be hurt... -- https://mail.python

apache not ale to execute a vbscript with python

2016-07-20 Thread vineeth menneni
Hi, I am trying to call a external vbscript through subprocess.call() it works fine with my local, but when i try to test apache says that no such file or directory. The problem here is that the vbscript should generate a .xlsx file and it is not being created. So apache gives a warning no suc

Re: reversed(enumerate(x))

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 5:13 AM, Steven D'Aprano wrote: > On Thu, 21 Jul 2016 03:46 am, Chris Angelico wrote: > >> On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: >>> I had occasion to write something like this: >>> >>> for i, n in reversed(enumerate(x)): pass >>> >>> Of course this fails w

Re: reversed(enumerate(x))

2016-07-20 Thread Random832
On Wed, Jul 20, 2016, at 13:42, Ian Kelly wrote: > I had occasion to write something like this: > > for i, n in reversed(enumerate(x)): pass > > How would you write this? I'd write my own version of enumerate with a step argument, and call enumerate(reversed(x), start=len(x), step=-1) -- ht

Re: reversed(enumerate(x))

2016-07-20 Thread Steven D'Aprano
On Thu, 21 Jul 2016 03:46 am, Chris Angelico wrote: > On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: >> I had occasion to write something like this: >> >> for i, n in reversed(enumerate(x)): pass >> >> Of course this fails with "TypeError: argument to reversed() must be a >> sequence". I e

Re: reversed(enumerate(x))

2016-07-20 Thread Brendan Abel
You could create your own generator that wraps enumerate def reverse_enumerate(iterable): for i, val in enumerate(reversed(iterable)): yield len(iterable) - 1 - i, val for i, val in reverse_enumerate(x): ... On Wed, Jul 20, 2016 at 10:42 AM, Ian Kelly wrote: > I had occasion to

Re: reversed(enumerate(x))

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: > I had occasion to write something like this: > > for i, n in reversed(enumerate(x)): pass > > Of course this fails with "TypeError: argument to reversed() must be a > sequence". I ended up using this instead: > > for i, n in zip(reversed(

reversed(enumerate(x))

2016-07-20 Thread Ian Kelly
I had occasion to write something like this: for i, n in reversed(enumerate(x)): pass Of course this fails with "TypeError: argument to reversed() must be a sequence". I ended up using this instead: for i, n in zip(reversed(range(len(x))), reversed(x)): pass This works but is extraordin

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: >> 2. Floating-point numbers are *imperfect approximations* of real >> numbers. Even when real numbers are derived exactly, >> floating-point operations may introduce "lossy compression >> artifacts" that have

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Chris Angelico
On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: > 2. Floating-point numbers are *imperfect approximations* of real > numbers. Even when real numbers are derived exactly, floating-point > operations may introduce "lossy compression artifacts" that have to > be compensated for i

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Random832
On Wed, Jul 20, 2016, at 03:16, Marko Rauhamaa wrote: > Random832 : > > Typically their capacity is labeled in amp-hours. > > Did you really see that labeled on the (nonrechargeable AA) battery? Sorry, I must have imagined that. Anyway, my point was that the reality is too complicated to easily a

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Steven D'Aprano : > I am not a good computer scientist. But Bruce Dawson *is* a good > computer scientist: > > https://randomascii.wordpress.com/2014/01/27/theres-only-four-billion-f > loatsso-test-them-all/ > > Quote: > > Conventional wisdom says that you should never compare two floats >

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread alister
On Wed, 20 Jul 2016 02:09:58 +0300, Marko Rauhamaa wrote: > Ian Kelly : > >> Ah, the machinations that users of imperial units have to endure. > > Europeans often mistakenly believe that Americans haven't yet adopted > the SI units. They have: > > - the length of a ski is measured in centimete

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 05:09 pm, Antoon Pardon wrote: > Op 20-07-16 om 07:42 schreef Steven D'Aprano: >> Floating point maths is hard, thinking carefully about what you are doing >> and whether it is appropriate to use == or a fuzzy almost-equal >> comparison, or if equality is the right way at all.

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 06:50 pm, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > >> pylint can detect candidates for accidental attribute creation: > > And __slots__ will prevent them outright. As well as those added intentionally. Sometimes I

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Peter Otten
Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > >> pylint can detect candidates for accidental attribute creation: > > And __slots__ will prevent them outright. And attributes added intentionally. -- https://mail.python.org/mailman/listinfo/

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Tuesday, July 19, 2016 at 9:48:15 AM UTC+12, I wrote: > When you have lots of read/write properties, I find __slots__ to be a good > idea. Let me amend that. When you have *any* read/write properties, I find __slots__ to be a good idea. -- https://mail.python.org/mailman/listinfo/python-list

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > pylint can detect candidates for accidental attribute creation: And __slots__ will prevent them outright. -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Antoon Pardon : > But why perforem integer arithmetics in floats, Conceptual and practical simplificity. > isn't that a waste of time too? Probably not, especially compared with the overhead of boxing. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Peter Otten
Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 6:19:45 PM UTC+12, Chris Angelico wrote: >> >> On Wed, Jul 20, 2016 at 9:58 AM, Lawrence D’Oliveiro wrote: >>> >>> On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream...@gmail.com >>> wrote: On Tuesday, July 19, 2016 at 3:54

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Wednesday 20 July 2016 16:45, Lawrence D’Oliveiro wrote: > I was trying something like > > ctx.dashes = ((0.1, 0.03, 0.03, 0.03), 0) > > and wondering why it wasn’t working... And so are we. Since you've already solved the problem, maybe you could enlighten us? T

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Marko Rauhamaa
Random832 : > On Tue, Jul 19, 2016, at 18:17, Marko Rauhamaa wrote: >> I'd love it if batteries were priced per joule, or even per >> kilowatt-hour. > > Typically their capacity is labeled in amp-hours. Did you really see that labeled on the (nonrechargeable AA) battery? > You have to know your

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Antoon Pardon
Op 20-07-16 om 07:42 schreef Steven D'Aprano: > Floating point maths is hard, thinking carefully about what you are doing and > whether it is appropriate to use == or a fuzzy almost-equal comparison, or if > equality is the right way at all. > > "But thinking is hard, can't you just tell me the a