C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Creating collection classes in IronPython


Posted Date: 30 May 2007    Resource Type: Articles    Category: .NET Framework

Posted By: Sunil Pottumuttu       Member Level: Silver
Rating:     Points: 10




C# creates collections in using IEnumerator,IEnumerable interfaces. The same approch can be followed in Ironpython by importing System.Collections namespace. Here i am following classic CPython approch. So i am not using any .NET Name spaces





C# creates collections in using IEnumerator,IEnumerable interfaces. The same approch can be followed in Ironpython by #importing System.Collections namespace. Here i am following classic CPython approch. So i am not using any .NET Name #spaces



Generating Fibnocci series


class fibnum:

def __init__(self):
self.fn2 = 1 #
self.fn1 = 1 #

def next(self):
# next() is the heart of any iterator
# note the use of the following tuple to not only save lines of
# code but also to insure that only the old values of self.fn1 and
# self.fn2 are used in assigning the new values
(self.fn1,self.fn2,oldfn2) = (self.fn1+self.fn2,self.fn1,self.fn2)
return oldfn2

def __iter__(self):
return self


def main():
f = fibnum()

for i in f:
print i
if i > 20: break

if __name__ == "__main__":
main()






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
IEnumerator  .  IEnumerable  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: About BizTalk Server 2006
Previous Resource: framework 3.0
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween masks

Contact Us    Privacy Policy    Terms Of Use