Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Functional programming Date: Wed, 05 Mar 2014 14:11:56 +0200 Organization: A noiseless patient Spider Lines: 31 Message-ID: <87vbvsrgj7.fsf@elektro.pacujo.net> References: <4c7dbc57-eef9-4582-aecd-aac13a39b45f@googlegroups.com> <3b54a279-03a1-4a81-a428-ecad6eb16036@googlegroups.com> <216bb5f4-32c4-4f86-a9f4-1b0dd37a2a81@googlegroups.com> <0129a5b9-b85f-4ad5-b5e2-bfb2a48041d5@googlegroups.com> <5314bb96$0$29985$c3e8da3$5496439d@news.astraweb.com> <5315661c$0$2923$c3e8da3$76491128@news.astraweb.com> <53159540$0$2923$c3e8da3$76491128@news.astraweb.com> <5315eec0$0$29985$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="22600"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bbShLaK50CbO3P3aFtwng" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:sEHb0hlryubL6cQ8njf9Y5AZj5w= sha1:yKkMYDFDZPhx6PhJ4Pdxn8ShG3c= Xref: csiph.com comp.lang.python:67836 Chris Angelico : > C++ has something very like this, with the 'auto' keyword. It's not > particularly useful for the examples you give, but can be much more so > when you have templates, iterators, and so on - where the exact type > declaration might be a couple dozen characters of pure syntactic salt, > since you're initializing it to some function's return value. Java has a widely practiced ideal that you should not tie variables to class types but instead stick to interface types. Thus, you want to declare: List li = new LinkedList(); Thing is, though, you can't automatically guess this. After all, you might be after: Iterable li = new LinkedList(); or maybe: Collection li = new LinkedList(); This principle doesn't concern only collections. A well-designed application should specify interfaces for pretty much all classes to separate design blocks and APIs from implementations du jour. (Again, something that has no relevance for Python users.) Marko