473,379 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code)

Hello python-list,

As I Understood, semantic may be next:

def qwerty(a,a.i,b,b.i,f.j):
pass

Would work like:

def qwerty(anonymous1,anonymous2,anonymous3,anonymous4 ,anonymous5):
(a,a.i,b,b.i,f.j)=(anonymous1,anonymous2,anonymous 3,anonymous4,anonymous5)
del anonymous1
del anonymous2
del anonymous3
del anonymous4
del anonymous5

If so then I like it, because it more explicit than anything other
and it is working right now. I just tryed:
class Stub: .... pass def qwer(a1,a2,a3,a4,a5): .... (a,a.i,b,b.i,f['i'])=(a1,a2,a3,a4,a5)
.... del a1
.... del a2
.... del a3
.... del a4
.... del a5
.... print (a,a.i,b,b.i,f['i']) f={}
qwer(Stub(),1,Stub(),2,3)

(<__main__.Stub instance at 0x00C49530>, 1, <__main__.Stub instance at 0x00C498C8>, 2, 3)

So there are not too much for implement.
Another question - named arguments. How I can assign to them?
May be so:
f={}
def qwerty(a,a.i,f['i']):
print (a,a.i,f['i'])
qwerty(f['i']=3,a=Stub(),a.i=4) - ?

and for __init__:
class MyClass:
def __init__(self,self.i,self.j,self.k):
pass

MyObject = MyClass(self.i=1,self.j=2,self.k=3)

?

or may be there can be an aliase syntax?

class MyClass:
def __init__(self, self.i by i,self.j by j, self.k by k):
pass

MyObject = MyClass(i=1,j=2,k=3)

--
Sokolov Yura
fa****@intercable.ru
Jul 31 '05 #1
0 864

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: mike420 | last post by:
Tayss wrote: > > app = wxPySimpleApp() > frame = MainWindow(None, -1, "A window") > frame.Show(True) > app.MainLoop() > Why do you need a macro for that? Why don't you just write
36
by: Gonçalo Rodrigues | last post by:
I've lost the original thread on my news reader so I'm opening a new one. First, i like the name ireverse, much better then inreverse (eek!). Just a simple comment/question: - Why a builtin...
16
by: Michele Simionato | last post by:
I have read with interest the recent thread about closures. The funny thing is that the authors are arguing one against the other but I actually agree with all of them and I have a proposal that...
31
by: Brian Sabbey | last post by:
Here is a pre-PEP for what I call "suite-based keyword arguments". The mechanism described here is intended to act as a complement to thunks. Please let me know what you think. Suite-Based...
15
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html...
18
by: Ralf W. Grosse-Kunstleve | last post by:
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object):...
108
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
26
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.