On 25 April 2017 at 11:08, Erik wrote:
> Hi. I suspect that this may have been discussed to death at some point in
> the past, but I've done some searching and I didn't come up with much.
Hi Erik,
Offering more concise ways of writing more powerful class definitions
is
On 26 April 2017 at 02:56, Guido van Rossum wrote:
> In the end I agree with the OP that we should fix this. I don't see a reason
> to require a PEP or require updating whatever PEP described this behavior
> originally -- PEPs generally describe what should be done to a
*cough* I'll just drop this here a sec *cough*:
https://code.activestate.com/recipes/580790-auto-assign-self-attributes-in-__init__-using-pep-/
On Thu, Apr 27, 2017 at 10:24 AM, Nick Coghlan wrote:
> On 25 April 2017 at 11:08, Erik wrote:
>> Hi. I
On 26.04.2017 23:50, Mark Lawrence via Python-ideas wrote:
On 26/04/2017 21:50, Chris Angelico wrote:
On Thu, Apr 27, 2017 at 6:24 AM, Erik wrote:
The background is that what I find myself doing a lot of for private
projects is importing data from databases into a
On 13.04.2017 20:20, Steven D'Aprano wrote:
- And finally, I fail to see how having to type an extra four characters
is a "convenience".
Just for the sake of completeness:
Re-usage of names is always a convenience. Developers can use a string
variable to access dynamically both the real
On Wed, Apr 26, 2017 at 11:29:19PM +0100, Erik wrote:
> But, if we're going to bikeshed and there is some weight behind the idea
> that this "papercut" should be addressed, then given my previous
> comparisons with importing, what about having 'import' as an operator:
>
> def __init__(self, a,
On Wed, Apr 26, 2017 at 03:54:22PM -0400, Jerry Hill wrote:
> On Tue, Apr 25, 2017 at 8:05 PM, Ryan Gonzalez wrote:
> > def ___init__(self, self.attr):
>
> I'm not a python developer, I'm just a developer that uses python.
> That said, I really like this form. It eliminates
On Wed, Apr 26, 2017 at 08:52:46PM -0400, Juancarlo AƱez wrote:
> In my experience, what Python is lacking is a way to declare attributes
> outside of the constructor. Take a look at how it's done in C#, Swisft, or
> Go.
Since you apparently already know how they do it, how about telling us
(1)
On Wed, Apr 26, 2017 at 08:02:39AM -0400, tritium-l...@sdamon.com wrote:
> > self.__dict__.update(kwargs)
>
> Touching __dict__ feels dirty to me.
Indeed. The right way is:
vars(self).update(kwargs)
although that doesn't work if self is written to use __slots__ instead
of having a
On 27/04/17 23:43, Steven D'Aprano wrote:
On Wed, Apr 26, 2017 at 11:29:19PM +0100, Erik wrote:
def __init__(self, a, b, c):
self import a, b
self.foo = c * 100
[snarky]
If we're going to randomly choose arbitrary keywords with no connection
to the operation being performed,
The
On Fri, Apr 28, 2017 at 2:06 PM, Steven D'Aprano wrote:
> On Fri, Apr 28, 2017 at 09:54:55AM +1000, Chris Angelico wrote:
>> On Fri, Apr 28, 2017 at 9:21 AM, Steven D'Aprano wrote:
>> > What happens if you use this syntax in a top-level function rather
On Fri, Apr 28, 2017 at 09:54:55AM +1000, Chris Angelico wrote:
> On Fri, Apr 28, 2017 at 9:21 AM, Steven D'Aprano wrote:
> > What happens if you use this syntax in a top-level function rather
> > than a method? (Or a static method?)
> >
> > def function(x, y, x.attr):
> >
12 matches
Mail list logo