Re: [Tutor] Functional Programming in Python

2015-04-04 Thread Steven D'Aprano
On Sat, Apr 04, 2015 at 09:53:28PM -0400, WolfRage wrote: > > So I was surprised I did not get more feedback on my abused coroutine, > maybe that is good or bad, not sure. Perhaps people didn't understand it. Or see it :-) > Any ways I am on to trying to make that coroutine act more like the >

Re: [Tutor] Functional Programming in Python

2015-04-04 Thread Dave Angel
On 04/04/2015 09:53 PM, WolfRage wrote: (Pointing to the different classes. Since C++ has virtual methods but Python does not?) I'd say that all methods in Python are virtual, except for those which are classmethod or staticmethod. -- DaveA _

Re: [Tutor] Functional Programming in Python

2015-04-04 Thread Steven D'Aprano
On Thu, Apr 02, 2015 at 12:18:28PM -0400, WolfRage wrote: > These are just some questions that I have regarding the topic of > Functional Programming. I am working towards a more functional approach > to programming but acknowledge that it is far from Functional, > especially since this is mostl

Re: [Tutor] Functional Programming in Python

2015-04-04 Thread WolfRage
So I was surprised I did not get more feedback on my abused coroutine, maybe that is good or bad, not sure. Any ways I am on to trying to make that coroutine act more like the State Pattern from Gang of Four. And well reading this: http://gameprogrammingpatterns.com/state.html I am not sure ho

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Steven D'Aprano
On Thu, Apr 02, 2015 at 11:52:40AM -0700, Danny Yoo wrote: > >> What are your thoughts on Functional in Python? > >> Currently I am re-writing functions to reduce their side effects. > >> I am also removing the state from objects and putting it into a closure > >> type function. > > > > That doesn'

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Steven D'Aprano
On Thu, Apr 02, 2015 at 03:36:17PM -0400, WolfRage wrote: > On 04/02/2015 02:07 PM, Steven D'Aprano wrote: > > >>What are the best practices to create more Functional Python? > > > >Best practices: > > > >* Don't force your code to use one style exclusively. Use the most > > natural style for th

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Tim Johnson
* WolfRage [150402 11:45]: > On 04/02/2015 03:08 PM, Tim Johnson wrote: > > > You have already received valuable replies from two advanced > > python experts. > > If you are looking for a book (available digitally for kindle) > > I would recommend > > Guide To: Functional Python & Compr

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread WolfRage
On 04/02/2015 03:08 PM, Tim Johnson wrote: You have already received valuable replies from two advanced python experts. If you are looking for a book (available digitally for kindle) I would recommend Guide To: Functional Python & Comprehension Constructs by Matt Harrison Tha

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread WolfRage
On 04/02/2015 02:52 PM, Danny Yoo wrote: This is not to say that closures are bad. It's just to point out that just because functional programs use closures quite a lot, doesn't automatically mean closures are the most appropriate tool for everything. If there are parts of the language that al

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread WolfRage
On 04/02/2015 02:07 PM, Steven D'Aprano wrote: What are the best practices to create more Functional Python? Best practices: * Don't force your code to use one style exclusively. Use the most natural style for the task. Python makes it easy to mix functional, procedural, imperative and

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread WolfRage
On 04/02/2015 01:07 PM, Alan Gauld wrote: I'm not sure what you mean is impossible? The specific issues you are having or the general FP paradigm? I mean achieving truely functional code, atleast to the extent of some of the things that I have read. But in general I do not need nor want any of

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Tim Johnson
* WolfRage [150402 08:25]: > These are just some questions that I have regarding the topic of > Functional Programming. I am working towards a more functional approach > to programming but acknowledge that it is far from Functional, > especially since this is mostly impossible in Python. > Ques

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Danny Yoo
>> What are your thoughts on Functional in Python? >> Currently I am re-writing functions to reduce their side effects. >> I am also removing the state from objects and putting it into a closure >> type function. > > That doesn't remove state, it just moves it to a different place. > > However, enc

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Steven D'Aprano
On Thu, Apr 02, 2015 at 12:18:28PM -0400, WolfRage wrote: > These are just some questions that I have regarding the topic of > Functional Programming. I am working towards a more functional approach > to programming but acknowledge that it is far from Functional, > especially since this is most

Re: [Tutor] Functional Programming in Python

2015-04-02 Thread Alan Gauld
On 02/04/15 17:18, WolfRage wrote: to programming but acknowledge that it is far from Functional, especially since this is mostly impossible in Python. I'm not sure what you mean is impossible? The specific issues you are having or the general FP paradigm? Python has fairly good support for F