Error 0x80070570

2015-12-30 Thread ivanor toledo
Good evening! I am trying to install Python , however is me presenting Error 0x80070570 saying that the folder or file is corrupted or unreadable. is attached the log file with the aforementioned error , already realized some procedures did not work .. procedures such as error correction, defragmen

Re: Stupid Python tricks

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 04:02 pm, Rick Johnson wrote: > On Wednesday, December 30, 2015 at 9:51:48 PM UTC-6, Steven D'Aprano > wrote: >> Fifteen years later, and Tim Peters' Stupid Python Trick is still the >> undisputed champion! > > And should we be happy about that revelation, or sad? Yes! --

Re: raise None

2015-12-30 Thread Cameron Simpson
On 31Dec2015 16:12, Steven D'Aprano wrote: On Thu, 31 Dec 2015 03:03 pm, Cameron Simpson wrote: Steven D'Aprano (that's me) wrote this: Whereas if _validate does what it is supposed to do, and is working correctly, you will see: Traceback (most recent call last): File "spam", line 19, in this

Re: raise None

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 03:03 pm, Cameron Simpson wrote: [...] Steven D'Aprano (that's me) wrote this: >>Whereas if _validate does what it is supposed to do, and is working >>correctly, you will see: >> >>Traceback (most recent call last): >> File "spam", line 19, in this >> File "spam", line 29, in

Re: Stupid Python tricks

2015-12-30 Thread Rick Johnson
On Wednesday, December 30, 2015 at 9:51:48 PM UTC-6, Steven D'Aprano wrote: > Fifteen years later, and Tim Peters' Stupid Python Trick is still the > undisputed champion! And should we be happy about that revelation, or sad? -- https://mail.python.org/mailman/listinfo/python-list

Re: raise None

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 12:44 pm, Ben Finney wrote: > Steven D'Aprano writes: > >> Traceback (most recent call last): >> File "spam", line 19, in this >> File "spam", line 29, in that >> File "spam", line 39, in other >> File "spam", line 5, in _validate >> ThingyError: ... >> >> and the rea

Re: raise None

2015-12-30 Thread Cameron Simpson
On 31Dec2015 12:26, Steven D'Aprano wrote: On Thu, 31 Dec 2015 11:38 am, Chris Angelico wrote: [... functions calling common _validate function ...] But when the argument checking fails, the traceback shows the error occurring in _validate, not eggs or spam. (Naturally, since that is where the

Re: raise None

2015-12-30 Thread Terry Reedy
On 12/30/2015 7:09 PM, Steven D'Aprano wrote: I have a lot of functions that perform the same argument checking each time: def spam(a, b): if condition(a) or condition(b): raise TypeError if other_condition(a) or something_else(b): raise ValueError if whatever(a): raise SomethingE

Stupid Python tricks

2015-12-30 Thread Steven D'Aprano
Stolen^W Inspired from a post by Tim Peters back in 2001: https://mail.python.org/pipermail/python-dev/2001-January/011911.html Suppose you have a huge string, and you want to quote it. Here's the obvious way: mystring = "spam"*10 result = '"' + mystring + '"' But that potentially involve

Re: raise None

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 12:26 PM, Steven D'Aprano wrote: > Traceback (most recent call last): > File "spam", line 19, in this > File "spam", line 29, in that > File "spam", line 39, in other > ThingyError: ... > > > I think this is a win for debuggability. (Is that a word?) But it's a bit >

Re: raise None

2015-12-30 Thread Ben Finney
Steven D'Aprano writes: > Traceback (most recent call last): > File "spam", line 19, in this > File "spam", line 29, in that > File "spam", line 39, in other > File "spam", line 5, in _validate > ThingyError: ... > > and the reader has to understand the internal workings of _validate > su

Re: raise None

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 11:38 am, Chris Angelico wrote: > On Thu, Dec 31, 2015 at 11:09 AM, Steven D'Aprano > wrote: >> I have a lot of functions that perform the same argument checking each >> time: >> >> def spam(a, b): >> if condition(a) or condition(b): raise TypeError >> if other_conditi

Re: raise None

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 11:09 AM, Steven D'Aprano wrote: > I have a lot of functions that perform the same argument checking each time: > > def spam(a, b): > if condition(a) or condition(b): raise TypeError > if other_condition(a) or something_else(b): raise ValueError > if whatever(a)

Re: using __getitem()__ correctly

2015-12-30 Thread Ian Kelly
On Wed, Dec 30, 2015 at 3:54 PM, Charles T. Smith wrote: > On Wed, 30 Dec 2015 13:40:44 -0700, Ian Kelly wrote: > >> On Wed, Dec 30, 2015 at 9:58 AM, Charles T. Smith >>> The problem is that then triggers the __getitem__() method and I don't >>> know how to get to the attributes without triggering

Validation in Python (was: raise None)

2015-12-30 Thread Ben Finney
Steven D'Aprano writes: > I have a lot of functions that perform the same argument checking each > time: Not an answer to the question you ask, but: Have you tried the data validation library “voluptuous”? Voluptuous, despite the name, is a Python data validation library. It is primaril

Re: using __getitem()__ correctly

2015-12-30 Thread Ben Finney
Steven D'Aprano writes: > On Thu, 31 Dec 2015 10:13 am, Ben Finney wrote: > > > You may be familiar with other languages where the distinction > > between “attribute of an object” is not distinct from “item in a > > dictionary”. Python is not one of those languages; the distinction > > is real an

Re: raise None

2015-12-30 Thread Paul Rubin
Steven D'Aprano writes: > def _validate(a, b): > if condition(a) or condition(b): return TypeError > ... > Obviously this doesn't work now, since raise None is an error, but if it did > work, what do you think? Never occurred to me. But in some analogous situations I've caught the exception

raise None

2015-12-30 Thread Steven D'Aprano
I have a lot of functions that perform the same argument checking each time: def spam(a, b): if condition(a) or condition(b): raise TypeError if other_condition(a) or something_else(b): raise ValueError if whatever(a): raise SomethingError ... def eggs(a, b): if condition(a) o

Re: how to get names of attributes

2015-12-30 Thread Steven D'Aprano
On Wed, 30 Dec 2015 10:51 pm, Charles T. Smith wrote: > Hi, > > How can I get *all* the names of an object's attributes? In the most general case, you cannot. Classes can define a __getattr__ method (and a __getattribute__ method, for new-style classes only) which implement dynamic attributes

Re: using __getitem()__ correctly

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 10:13 am, Ben Finney wrote: > You may be familiar with other languages where the distinction between > “attribute of an object” is not distinct from “item in a dictionary”. > Python is not one of those languages; the distinction is real and > important. I'm not sure what dist

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Thu, 31 Dec 2015 10:13:53 +1100, Ben Finney wrote: > "Charles T. Smith" writes: > >> I don't understand this distinction between an "attribute" and a "dict >> item". > > When did you most recently work through the Python tutorial > https://docs.python.org/3/tutorial/>> You may want to work t

Re: using __getitem()__ correctly

2015-12-30 Thread Ben Finney
"Charles T. Smith" writes: > I don't understand this distinction between an "attribute" and a "dict > item". When did you most recently work through the Python tutorial https://docs.python.org/3/tutorial/>> You may want to work through it again, from start to finish and exercising each example,

Re: Newbie: How to convert a tuple of strings into a tuple of ints

2015-12-30 Thread otaksoftspamtrap
Thanks much - both solutions work well for me On Wednesday, December 30, 2015 at 2:57:50 PM UTC-8, Ben Finney wrote: > kierkega...@gmail.com writes: > > > How do I get from here > > > > t = ('1024', '1280') > > > > to > > > > t = (1024, 1280) > > Both of those are assignment statements, so I

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 22:54:44 +, Charles T. Smith wrote: > But I concede I must be doing something fundamentally wrong because this > assert is triggering: > def __getattr__ (self, name): > print "attrdict:av:__getattr__: entered for ", name > assert name not in self.keys(),

Re: Newbie: How to convert a tuple of strings into a tuple of ints

2015-12-30 Thread Ian Kelly
On Wed, Dec 30, 2015 at 3:46 PM, wrote: > How do I get from here > > t = ('1024', '1280') > > to > > t = (1024, 1280) Deja vu: https://mail.python.org/pipermail/python-list/2015-December/701017.html -- https://mail.python.org/mailman/listinfo/python-list

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 13:40:44 -0700, Ian Kelly wrote: > On Wed, Dec 30, 2015 at 9:58 AM, Charles T. Smith >> The problem is that then triggers the __getitem__() method and I don't >> know how to get to the attributes without triggering __getattr__(). >> >> It's the interplay of the two that's killi

Re: Newbie: How to convert a tuple of strings into a tuple of ints

2015-12-30 Thread Ben Finney
otaksoftspamt...@gmail.com writes: > How do I get from here > > t = ('1024', '1280') > > to > > t = (1024, 1280) Both of those are assignment statements, so I'm not sure what you mean by “get from … to”. To translate one assignment statement to a different assignment statement, re-write the stat

Re: Newbie: How to convert a tuple of strings into a tuple of ints

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 9:46 AM, wrote: > How do I get from here > > t = ('1024', '1280') > > to > > t = (1024, 1280) > > > Thanks for all help! t = (int(t[0]), int(t[1])) If the situation is more general than that, post your actual code and we can help out more. Working with a single line isn'

Newbie: How to convert a tuple of strings into a tuple of ints

2015-12-30 Thread otaksoftspamtrap
How do I get from here t = ('1024', '1280') to t = (1024, 1280) Thanks for all help! -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess check_output

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 8:02 AM, Cameron Simpson wrote: > On 30Dec2015 21:14, Carlos Barera wrote: >> >> Trying to run a specific command (ibstat) installed in /usr/sbin on an >> Ubuntu 15.04 machine, using subprocess.check_output and getting "/bin/sh: >> /usr/sbin/ibstat: No such file or direct

Re: how to get names of attributes

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 4:04 AM, Random832 wrote: > On Wed, Dec 30, 2015, at 07:50, Chris Angelico wrote: >> I believe that's true, yes. The meaning of "by default" there is that >> "class X: pass" will make an old-style class. All built-in types are >> now new-style classes. > > To be clear, AFAI

Re: subprocess check_output

2015-12-30 Thread Cameron Simpson
On 30Dec2015 21:14, Carlos Barera wrote: Trying to run a specific command (ibstat) installed in /usr/sbin on an Ubuntu 15.04 machine, using subprocess.check_output and getting "/bin/sh: /usr/sbin/ibstat: No such file or directory" I tried the following: - running the command providing full pat

Re: EOFError: marshal data too short -- causes?

2015-12-30 Thread Glenn Linderman
On 12/29/2015 1:00 PM, Terry Reedy wrote: I updated to 2.7.11, 3.4.4, and 3.5.1 a couple of weeks ago, so the timestamps are all fresh. So I don't know what happened with 3.4.3 timestamps from last April and whether Windows itself touches the files. I just tried importing a few and Python did

Re: EOFError: marshal data too short -- causes?

2015-12-30 Thread Glenn Linderman
On 12/29/2015 5:56 AM, D'Arcy J.M. Cain wrote: On Tue, 29 Dec 2015 00:01:00 -0800 Glenn Linderman wrote: OK, so I actually renamed it instead of zapping it. Them, actually, Really, just zap them. They are object code. Even if you zap a perfectly good .pyc file a perfectly good one will be r

Re: using __getitem()__ correctly

2015-12-30 Thread Ian Kelly
On Wed, Dec 30, 2015 at 9:58 AM, Charles T. Smith wrote: > On Wed, 30 Dec 2015 08:35:57 -0700, Ian Kelly wrote: > >> On Dec 30, 2015 7:46 AM, "Charles T. Smith" >> wrote: >>> As is so often the case, in composing my answer to your question, I >>> discovered a number of problems in my class (e.g.

subprocess check_output

2015-12-30 Thread Carlos Barera
Hi, Trying to run a specific command (ibstat) installed in /usr/sbin on an Ubuntu 15.04 machine, using subprocess.check_output and getting "/bin/sh: /usr/sbin/ibstat: No such file or directory" I tried the following: - running the command providing full path - running with executable=bash - runn

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-30 Thread Joel Goldstick
On Wed, Dec 30, 2015 at 3:06 PM, Joel Goldstick wrote: > > > On Wed, Dec 30, 2015 at 1:21 PM, Won Chang wrote: > >> >> i have these task which i believe i have done well to some level >> >> Create a function get_algorithm_result to implement the algorithm below >> >> 1- Get a list of numbers L1,

Re: PEAK-Rules package.

2015-12-30 Thread Joel Goldstick
On Wed, Dec 30, 2015 at 8:24 AM, Radhika Grover wrote: > Hi, > > I don't see any package available under > https://pypi.python.org/simple/PEAK-Rules/. Could you please let me know > if it has seen a change recently. > > I need PEAK-Rules>=0.5a1.dev-r2600 using easy_install default behavior. > Any

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-30 Thread Joel Goldstick
On Wed, Dec 30, 2015 at 1:21 PM, Won Chang wrote: > > i have these task which i believe i have done well to some level > > Create a function get_algorithm_result to implement the algorithm below > > 1- Get a list of numbers L1, L2, L3LN as argument 2- Assume L1 is the > largest, Largest = L1

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-30 Thread Won Chang
i have these task which i believe i have done well to some level Create a function get_algorithm_result to implement the algorithm below 1- Get a list of numbers L1, L2, L3LN as argument 2- Assume L1 is the largest, Largest = L1 3- Take next number Li from the list and do the following 4-

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 08:35:57 -0700, Ian Kelly wrote: > On Dec 30, 2015 7:46 AM, "Charles T. Smith" > wrote: >> As is so often the case, in composing my answer to your question, I >> discovered a number of problems in my class (e.g. I was calling >> __getitem__() myself!), but I'm puzzled now how

Re: how to get names of attributes

2015-12-30 Thread Random832
On Wed, Dec 30, 2015, at 07:50, Chris Angelico wrote: > I believe that's true, yes. The meaning of "by default" there is that > "class X: pass" will make an old-style class. All built-in types are > now new-style classes. To be clear, AFAIK, built-in types were never old-style classes - prior to t

Re: using __getitem()__ correctly

2015-12-30 Thread Ian Kelly
On Dec 30, 2015 7:46 AM, "Charles T. Smith" wrote: > As is so often the case, in composing my answer to your question, I discovered > a number of problems in my class (e.g. I was calling __getitem__() myself!), > but > I'm puzzled now how to proceed. I thought the way you avoid triggering > __g

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 14:10:14 +, Mark Lawrence wrote: > On 30/12/2015 11:51, Charles T. Smith wrote: >> Hi, >> >> Does anyone know *why* the __members__ method was deprecated, to be >> replaced by dir(), which doesn't tell the truth (if only it took an >> optional parameter to say: "be truthful

Re: using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
On Thu, 31 Dec 2015 00:11:24 +1100, Chris Angelico wrote: > On Wed, Dec 30, 2015 at 11:57 PM, Charles T. Smith > wrote: >> Hello, >> >> I thought __getitem__() was invoked when an object is postfixed with an >> expression in brackets: >> >> - abc[n] >> >> and __getattr__() was invoked when an o

Re: Is it safe to assume floats always have a 53-bit mantissa?

2015-12-30 Thread Terry Reedy
On 12/30/2015 8:18 AM, Steven D'Aprano wrote: We know that Python floats are equivalent to C doubles, Yes which are 64-bit IEEE-754 floating point numbers. I believe that this was not true on all systems when Python was first released. Not all 64-bit floats divided them the same way. I b

Re: how to get names of attributes

2015-12-30 Thread Chris Angelico
On Thu, Dec 31, 2015 at 12:31 AM, Charles T. Smith wrote: > Okay, thank you. I'm trying to understand your program. > > Unfortunately, I haven't gotten the same output you had, using python 2.6 > or 2.7. Maybe I haven't been able to restore the indentation correctly > after having been filtered

Re: Is it safe to assume floats always have a 53-bit mantissa?

2015-12-30 Thread Marko Rauhamaa
Steven D'Aprano : > Nevertheless, it's well known (in the sense that "everybody knows") > that Python floats are equivalent to C 64-bit IEEE-754 doubles. How > safe is that assumption? You'd need to have it in writing, wouldn't you? The only spec I know of promises no such thing: Floating po

Re: how to get names of attributes

2015-12-30 Thread Mark Lawrence
On 30/12/2015 13:31, Charles T. Smith wrote: I wonder what the difference is between vars() and items() Not much. From https://docs.python.org/3/library/functions.html#vars vars([object]) Return the __dict__ attribute for a module, class, instance, or any other object with a __dict__

Re: how to get names of attributes

2015-12-30 Thread Mark Lawrence
On 30/12/2015 11:51, Charles T. Smith wrote: Hi, Does anyone know *why* the __members__ method was deprecated, to be replaced by dir(), which doesn't tell the truth (if only it took an optional parameter to say: "be truthful") https://bugs.python.org/issue456420 https://bugs.python.org/issue44

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 23:50:03 +1100, Chris Angelico wrote: > On Wed, Dec 30, 2015 at 11:40 PM, Charles T. Smith > wrote: >> Oh! >> >> Although the referenced doc says: >> >> "For compatibility reasons, classes are still old-style by default." >> >> is it true that dictionaries are by default alw

PEAK-Rules package.

2015-12-30 Thread Radhika Grover
Hi, I don't see any package available under https://pypi.python.org/simple/PEAK-Rules/. Could you please let me know if it has seen a change recently. I need PEAK-Rules>=0.5a1.dev-r2600 using easy_install default behavior. Any help is appreciated. Thanks in advance! - Radhika -- https://mail

Is it safe to assume floats always have a 53-bit mantissa?

2015-12-30 Thread Steven D'Aprano
We know that Python floats are equivalent to C doubles, which are 64-bit IEEE-754 floating point numbers. Well, actually, C doubles are not strictly defined. The only promise the C standard makes is that double is no smaller than float. (That's C float, not Python float.) And of course, not all Py

Re: using __getitem()__ correctly

2015-12-30 Thread Chris Angelico
On Wed, Dec 30, 2015 at 11:57 PM, Charles T. Smith wrote: > Hello, > > I thought __getitem__() was invoked when an object is postfixed with an > expression in brackets: > > - abc[n] > > and __getattr__() was invoked when an object is postfixed with an dot: > > - abc.member That would be norma

using __getitem()__ correctly

2015-12-30 Thread Charles T. Smith
Hello, I thought __getitem__() was invoked when an object is postfixed with an expression in brackets: - abc[n] and __getattr__() was invoked when an object is postfixed with an dot: - abc.member but my __getitem__ is being invoked at this time, where there's no subscript (going into a s

Re: (Execution) Termination bit, Alternation bit.

2015-12-30 Thread Steven D'Aprano
On Wed, 30 Dec 2015 03:07 pm, Rustom Mody wrote: > By some coincidence was just reading: > from http://www.wordyard.com/2006/10/18/dijkstra-humble/ > > which has the following curious extract. > [Yeah its outlandish] > > -- > I consider the absolute wo

Re: how to get names of attributes

2015-12-30 Thread Chris Angelico
On Wed, Dec 30, 2015 at 11:40 PM, Charles T. Smith wrote: > Oh! > > Although the referenced doc says: > > "For compatibility reasons, classes are still old-style by default." > > is it true that dictionaries are by default always new-style objects? > > (PDB)c6 = { "abc" : 123, "def" : 456} > >

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 11:51:19 +, Charles T. Smith wrote: > Hi, > > How can I get *all* the names of an object's attributes? I have legacy > code with mixed new style classes and old style classes and I need to > write methods which deal with both. That's the immediate problem, but > I'm alwa

Re: how to get names of attributes

2015-12-30 Thread Chris Angelico
On Wed, Dec 30, 2015 at 11:16 PM, Charles T. Smith wrote: > I'm glad I discovered __mro__(), but how can I do the same thing for old- > style classes? You should be able to track through __bases__ and use vars() at every level: >>> class X: pass ... >>> class Y(X): pass ... >>> class Z(Y): pass

Re: how to get names of attributes

2015-12-30 Thread Charles T. Smith
On Wed, 30 Dec 2015 11:51:19 +, Charles T. Smith wrote: > Hi, > > How can I get *all* the names of an object's attributes? I have legacy > code with mixed new style classes and old style classes and I need to > write methods which deal with both. That's the immediate problem, but > I'm alwa

Re: how to get names of attributes

2015-12-30 Thread Chris Angelico
On Wed, Dec 30, 2015 at 10:51 PM, Charles T. Smith wrote: > Does anyone know *why* the __members__ method was deprecated, to be > replaced by dir(), which doesn't tell the truth (if only it took an > optional parameter to say: "be truthful") Does vars() help here? It works on old-style and new-st

how to get names of attributes

2015-12-30 Thread Charles T. Smith
Hi, How can I get *all* the names of an object's attributes? I have legacy code with mixed new style classes and old style classes and I need to write methods which deal with both. That's the immediate problem, but I'm always running into the need to understand how objects are linked, in par

Re: Path problems when I am in bash

2015-12-30 Thread xeon Mailinglist
On Wednesday, December 30, 2015 at 2:30:40 AM UTC, Karim wrote: > On 30/12/2015 00:21, xeon Mailinglist wrote: > > I have my source code inside the directory `medusa`, and my unit tests > > inside `tests` dir. Both dirs are inside `medusa-2.0` dir. Here is my file > > structure [1]. > > > > When

Re: [Twisted-Python] Twisted 15.4 was the last release to support Python 2.6; or: a HawkOwl Can't Words Situation

2015-12-30 Thread anatoly techtonik
Is it possible to fix the documentation? https://twistedmatrix.com/trac/browser/tags/releases/twisted-15.5.0/NEWS?format=raw On Mon, Dec 7, 2015 at 4:06 PM, Amber "Hawkie" Brown wrote: > Hi everyone! > > It's been brought to my attention that I misworded something in the release > notes and it s