Comments on: Recursion In Python https://pthree.org/2007/08/09/recursion-in-python/ Linux. GNU. Freedom. Mon, 09 Oct 2017 10:42:05 +0000 hourly 1 https://wordpress.org/?v=4.9-alpha-41547 By: Aaron https://pthree.org/2007/08/09/recursion-in-python/#comment-65960 Wed, 22 Aug 2007 05:02:17 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-65960 @Igor- I still don't understand what you mean my recursion limits in Python. Recursion is implemented on as well as the author deems. If you are meeting limits with your Python recursion, then you need to rethink your algorithm, or learn the language. I don't know what else to say about that.

]]>
By: Igor https://pthree.org/2007/08/09/recursion-in-python/#comment-65491 Sat, 18 Aug 2007 20:29:35 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-65491 Hi all, Aaron ask me what I mean with the Python recursion limitation well, I made some research and the results are very interesting you can see a comparison between Python and C# here(in my blog):

http://igordevlog.blogspot.com/2007/08/recursion-in-c-vs-recursion-in-python.html

Waiting for your comments.

]]>
By: martin https://pthree.org/2007/08/09/recursion-in-python/#comment-65097 Wed, 15 Aug 2007 07:29:00 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-65097 using chdir(dirent) ... chdir("..") will break on symlinks...
either do fancy fchdir things or pass a relative path down as parameter...

]]>
By: Jason https://pthree.org/2007/08/09/recursion-in-python/#comment-64797 Sat, 11 Aug 2007 21:59:24 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64797 Hmmm. Anonymous? Bah!
Aaron: That WPOpenID plugin has a race condition in it.

]]>
By: Anonymous https://pthree.org/2007/08/09/recursion-in-python/#comment-64796 Sat, 11 Aug 2007 21:58:56 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64796 @Igor:

You're completely and totally welcome to use curly braces when using ruby. Curly braces are totally understood, and valid.

]]>
By: George https://pthree.org/2007/08/09/recursion-in-python/#comment-64622 Fri, 10 Aug 2007 05:47:48 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64622 @Mircea: as a person learning how to code (at least learning how to do it well) i find examples like these useful even if they aren't fully error-checked. if someone is clueless enough to write important code without proper error-checking in the first place, not putting stuff like this out there on the internet is not going to deter them from doing so. That's like saying that "not publishing security exploits leads to more secure software". Just because something isn't published doesn't mean it doesn't exist.

]]>
By: Paddy3118 https://pthree.org/2007/08/09/recursion-in-python/#comment-64583 Thu, 09 Aug 2007 19:06:31 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64583 Comments on the comments:
1&2: oggfile.close is the function, oggfile.close() calls the function and closes the file.

4: open() and write() will raise exceptions when necessary leading to a meaningful traceback if not explicitly caught. It could be that not catching the exceptions is the intended behaviour.

- Paddy.

]]>
By: new back https://pthree.org/2007/08/09/recursion-in-python/#comment-64570 Thu, 09 Aug 2007 15:32:27 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64570 Vincent, in Ruby you don't "call methods". Instead both calling methods and using variables are sending messages to objects. In fact there is no difference between a method and variable. The normal way of calling class methods is just syntactic sugar. The way it works takes some time getting used to but it is definitely most of the time a feature. I would omit empty parenthesis simply not to have to type them 🙂

I don't want to start a language war myself either. I hate the begin..end on Ruby, it's the largest single flaw it has and plain stupid. I would like them to adopt the Python way actually.

]]>
By: Aaron https://pthree.org/2007/08/09/recursion-in-python/#comment-64569 Thu, 09 Aug 2007 15:20:53 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64569 @Igor- What do you mean "recursion in python have a very short limit"?

@Mircea- Thank you for your criticism. It has been duly noted.

@Vincent- Yes, the script was to teach myself Python. Of course, there is more than one way to solve an algorithm. This was my approach, obviously, not knowing about walk(). 🙂

]]>
By: Vincent https://pthree.org/2007/08/09/recursion-in-python/#comment-64566 Thu, 09 Aug 2007 14:49:06 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64566 @Aaron:
Not sure if the exercise was to translate a Perl script to Python, or simply to list the directory content recursively.
On the second case, module "os" offers the recursive method "walk()" (doc here).

@new back:
Not to start the flamewar, but I do not see calling methods without parenthesis a "feature", in Ruby or Perl, especially when reading someone else's code (damn self-proclaimed Perl guru coworkers)

]]>
By: Mircea https://pthree.org/2007/08/09/recursion-in-python/#comment-64564 Thu, 09 Aug 2007 14:48:30 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64564 is the lack of error checking after open() or write() reminiscent of C coding? 🙂
it's programs like this posted on the web that make computer science such a screwed up world. no offense.i noticed the lack of comments but that's no excuse for the lack of error checking. this is why we have exceptions. See http://www.faqs.org/docs/diveintopython/fileinfo_files.html for an example. Please remove (or fix) this script from the web, so poor coding perpetuates less. I understand that it was meant as a quick hack for personal use but in that case it should be treated as such and not posted on the web, or, if posted, it should have a big red flag saying "this is an example of bad coding, do not use it!". I hope you take this as constructive criticism not otherwise.

]]>
By: Igor https://pthree.org/2007/08/09/recursion-in-python/#comment-64561 Thu, 09 Aug 2007 14:23:08 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64561 @new back: END END END... thats why ruby sucks ;)... damn remains me Visual Basic :S

@Aaron: You know what will be cool that you use pure functional programming like in languages like Haskell... without for and variables.

btw, recursion in python have a very short limit, so, its better to use C or another stuff to do recursion, anyway for your purpose this script works very good.

]]>
By: Aaron https://pthree.org/2007/08/09/recursion-in-python/#comment-64558 Thu, 09 Aug 2007 14:04:29 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64558 @new back- Yes, it does support omitting empty parenthesis in this case.

]]>
By: new back https://pthree.org/2007/08/09/recursion-in-python/#comment-64556 Thu, 09 Aug 2007 13:53:57 +0000 http://www.pthree.org/2007/08/09/recursion-in-python/#comment-64556 Doesn't Python support omiting the empty parenthesis, like "oggFile.close"? I like that feature in Ruby, but then again Python has that thing with with space...

]]>