Re: Help with subclasses and classes

2016-07-02 Thread Terry Reedy
On 7/2/2016 8:58 PM, cadenmr...@gmail.com wrote: When i run the code I get this error : Traceback (most recent call last): File "C:/Python25/chapter2", line 18, in bank=InterestAccount(5,1000,0.5) NameError: name 'InterestAccount' is not defined I can't find the issue, any help? class B

Re: Meta decorator with parameters, defined in explicit functions

2016-07-02 Thread Lawrence D’Oliveiro
On Sunday, July 3, 2016 at 4:49:15 PM UTC+12, Ian wrote: > > On Sat, Jul 2, 2016 at 12:40 AM, Lawrence D’Oliveiro wrote: >> >> On Saturday, July 2, 2016 at 5:10:06 PM UTC+12, Ian wrote: >>> >>> You should use functools.wraps instead of clobbering the decorated >>> function's name and docstring: >>

Re: Namespaces are one honking great idea

2016-07-02 Thread Ethan Furman
On 07/02/2016 08:44 PM, Steven D'Aprano wrote: Try getting this behaviour from within a class: class Food(metaclass=Namespace): # (1) no special decorators required def spam(n): return ' '.join(['spam']*n) # (2) can call functions from inside the namespace breakf

Re: Find a file

2016-07-02 Thread tdsperth
Hi Thanks for your suggestions - I did get it to work with some os.path calls and using flask get files. Cheers Colin -- https://mail.python.org/mailman/listinfo/python-list

Re: Meta decorator with parameters, defined in explicit functions

2016-07-02 Thread Ian Kelly
On Sat, Jul 2, 2016 at 12:40 AM, Lawrence D’Oliveiro wrote: > On Saturday, July 2, 2016 at 5:10:06 PM UTC+12, Ian wrote: >> You should use functools.wraps instead of clobbering the decorated >> function's name and docstring: > > Where am I doing that? Using the implementation you posted: >>> @de

Making Classes Subclassable

2016-07-02 Thread Lawrence D’Oliveiro
Some of the classes in Qahirah, my Cairo binding I found handy to reuse elsewhere, for example in my binding for Pixman . Subclassing is easy, but then you need to ensure that operations inherited from the superclass return

Re: Namespaces are one honking great idea

2016-07-02 Thread Steven D'Aprano
On Sun, 3 Jul 2016 01:34 am, Kevin Conway wrote: > staticmethod isn't technically required to use a method through the class > (or subclasses), it simply provides the appropriate magic to allow it to > be called through instances. > > For example, the following code covers all described use cases

Re: Namespaces are one honking great idea

2016-07-02 Thread Steven D'Aprano
On Sat, 2 Jul 2016 11:50 am, Kevin Conway wrote: > I believe the namespace object you are referring to is exactly a class. Yes, a namespace is exactly like a class, minus inheritance, instantiation, the implied "is-a" relationship, and the whole Java "utility class" anti-pattern. In other words,

Re: Help with subclasses and classes

2016-07-02 Thread Bob Gailer
On Jul 2, 2016 9:00 PM, wrote: > > When i run the code I get this error : > Traceback (most recent call last): > File "C:/Python25/chapter2", line 18, in > bank=InterestAccount(5,1000,0.5) > NameError: name 'InterestAccount' is not defined > > I can't find the issue, any help? Following is

Re: Lost in descriptor land

2016-07-02 Thread Lawrence D’Oliveiro
On Saturday, July 2, 2016 at 11:31:02 PM UTC+12, Ankush Thakur wrote: > On Friday, July 1, 2016 at 9:03:44 AM UTC+5:30, Lawrence D’Oliveiro wrote: >> Every time I feel unsure, I go back to the horse’s mouth: here >>

Help with subclasses and classes

2016-07-02 Thread cadenmrice
When i run the code I get this error : Traceback (most recent call last): File "C:/Python25/chapter2", line 18, in bank=InterestAccount(5,1000,0.5) NameError: name 'InterestAccount' is not defined I can't find the issue, any help? class BankAccount: def __init__(self,numb,bal):

Re: Namespaces are one honking great idea

2016-07-02 Thread Ethan Furman
On 07/02/2016 08:34 AM, Kevin Conway wrote: For the proponents of namespace, what is deficient in the above example that necessitates a language change? Adding a new widget is not changing the language. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Lost in descriptor land

2016-07-02 Thread Ian Kelly
On Sat, Jul 2, 2016 at 5:32 AM, Ankush Thakur wrote: > On Friday, July 1, 2016 at 9:13:19 AM UTC+5:30, Lawrence D’Oliveiro wrote: >> >> > Shouldn't we be instead using self.celcius in, say, __init__() and then >> > everything will work fine? >> >> I guess it might. But this way, using descriptors,

Re: Starting Out and Need Help with Basics.

2016-07-02 Thread Chris Angelico
On Sun, Jul 3, 2016 at 7:13 AM, CHM Lyrics wrote: > I am in fifth year at secondary school (senior years in high school). We've > been doing basic programs in Python at school, but we're now on a 6 week > holiday (Summer Holidays). So I decided I would try and download Python and > learn a bit

Starting Out and Need Help with Basics.

2016-07-02 Thread CHM Lyrics
I am in fifth year at secondary school (senior years in high school). We've been doing basic programs in Python at school, but we're now on a 6 week holiday (Summer Holidays). So I decided I would try and download Python and learn a bit more while I'm not doing anything. I have now downloaded it

Re: subprocess startup error

2016-07-02 Thread matej123cekk
try to download pywin (i think that pywin will working ok) url to download https://sourceforge.net/projects/pywin32/files/pywin32/ -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess startup error

2016-07-02 Thread Terry Reedy
On 7/1/2016 11:43 PM, Veek. M wrote: Shweta Dinnimani wrote: hi hello, I'm begineer to python programming.. I had installed python 3.5.1 version on my windows 7 system. I was fine earlier and now when i was trying the programs on string i'm facing the subprocess startup error. IDLE is not conn

Re: Namespaces are one honking great idea

2016-07-02 Thread Kevin Conway
> staticmethod isn't technically required to use a method through the class (or subclasses), it simply provides the appropriate magic to allow it to be called through instances. For example, the following code covers all described use cases of the proposed namespace. Methods are invoked without cr

Re: Which one is the best XML-parser?

2016-07-02 Thread Stefan Behnel
Random832 schrieb am 24.06.2016 um 15:09: > On Fri, Jun 24, 2016, at 02:39, dieter wrote: >> You want an incremental parser if the XML documents are so huge that >> you must process them incrementally rather than have a data structure >> representing the whole document (in memory). Incremental pars

Re: Descriptor: class name precedence over instance name

2016-07-02 Thread Ian Kelly
On Sat, Jul 2, 2016 at 3:34 AM, Veek. M wrote: > So essentially from what Ian said: > data_descriptor_in_instance -> instance_attribute -> non- > data_descriptor_in_instance -->__mro__ > > is how the search takes place. Correct? Close, but I would write it as: data_descriptor_in_class_including_m

[ANN] aioxmpp 0.6 released

2016-07-02 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Dear subscribers, I am pleased to announce the release of aioxmpp 0.6. The current release can be obtained from GitHub [1] (check out the v0.6.0 tag or the master branch) or PyPI [2]. The HTML documentation can be found at [3]. Examples can be fou

Re: Lost in descriptor land

2016-07-02 Thread Ankush Thakur
On Friday, July 1, 2016 at 9:13:19 AM UTC+5:30, Lawrence D’Oliveiro wrote: > > > Shouldn't we be instead using self.celcius in, say, __init__() and then > > everything will work fine? > > I guess it might. But this way, using descriptors, all the setup is done once > at class definition, rather

Re: Lost in descriptor land

2016-07-02 Thread Ankush Thakur
On Friday, July 1, 2016 at 9:03:44 AM UTC+5:30, Lawrence D’Oliveiro wrote: > Every time I feel unsure, I go back to the horse’s mouth: here > > is GvR himself with all the details on “new-style” classes, including

Re: Lost in descriptor land

2016-07-02 Thread Ankush Thakur
On Friday, July 1, 2016 at 7:07:09 AM UTC+5:30, Ian wrote: > First of all, do you understand what descriptors are? This is a fairly > advanced Python concept. For a general tutorial, I would point you to > https://docs.python.org/3/howto/descriptor.html I understand what descriptors try to accomp

Re: Getting back into PyQt and not loving it.

2016-07-02 Thread Sibylle Koczian
Am 27.06.2016 um 22:14 schrieb codewiz...@gmail.com: On Sunday, June 26, 2016 at 5:45:18 PM UTC-4, Michael Torrie wrote: Qt's a fantastic toolkit, and the most mature of any of them, and the most portable, but man the bindings are not Pythonic at all. Enaml feels pretty Pythonic to me: https

Re: Descriptor: class name precedence over instance name

2016-07-02 Thread Veek. M
Ben Finney wrote: > "Veek. M" writes: > >> Trying to make sense of this para: > > At the risk of being ruse, I am trying to make sense of some > paragraphs in the messages you write here. Could you take a little > more time to write clearly, as a way of communicating in this forum? > >> Is he

Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions

2016-07-02 Thread Ben Finney
dieter writes: > Ben Finney writes: > > ... Rather, the motivation was that a complex thing, with many > > moving parts, has an unexplained implementation: a nested set of > > functions without names to explain their part in the pattern. > > In a previous reply, I have tried to explain (apparent

Re: JAR files into python

2016-07-02 Thread dieter
Joaquin Alzola writes: > ... > The error that it throws is the following one (which is logical because I do > not load the jar files): > py4j.protocol.Py4JJavaError: An error occurred while calling o29.load. > : java.lang.ClassNotFoundException: Failed to find data source: > org.apache.spark.sql

Re: super and mix-in class: how exactly is the search order altered?

2016-07-02 Thread dieter
"Veek. M" writes: > ... > I'm reading this article: > https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ > > He's trying to explain the purpose of a 'mix-in class' and he says > > We did not alter the source code for LoggingDict. Instead we built a > subclass whose only logi

Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions

2016-07-02 Thread dieter
Ben Finney writes: > ... > Rather, the motivation was that a complex thing, with many moving parts, > has an unexplained implementation: a nested set of functions without > names to explain their part in the pattern. In a previous reply, I have tried to explain (apparently without success) that t