RE: Using the Python Interpreter as a Reference

2011-12-02 Thread Sells, Fred
=adventistcare@python.org] On Behalf Of Steven D'Aprano Sent: Thursday, December 01, 2011 7:43 PM To: python-list@python.org Subject: Re: Using the Python Interpreter as a Reference On Thu, 01 Dec 2011 10:03:53 -0800, DevPlayer wrote: [...] Well, that may be a little hyperbolic. But with 2 spaces you

Re: Using the Python Interpreter as a Reference

2011-12-02 Thread Devin Jeanpierre
In my opinion, if your code is indented four or more levels, you should start to think about refactorising your code; if you reach six levels, your code is probably a mess. Here's some code I encountered while grading assignments from first-year CS students: if 'not' in temp_holder:

Re: Using the Python Interpreter as a Reference

2011-12-01 Thread DevPlayer
On Nov 29, 3:04 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Tue, 29 Nov 2011 12:49:49 +1100, Chris Angelico wrote: On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer devpla...@gmail.com wrote: To me, I would think the interpreter finding the coder's intended indent wouldn't

Re: Using the Python Interpreter as a Reference

2011-12-01 Thread Steven D'Aprano
On Thu, 01 Dec 2011 10:03:53 -0800, DevPlayer wrote: [...] Well, that may be a little hyperbolic. But with 2 spaces you can encourage coders to get very deep, indentially, and still fit 80 chars. Why would you want to encourage coders to write deeply indented code? In my opinion, if your code

Re: Using the Python Interpreter as a Reference

2011-12-01 Thread Chris Angelico
On Fri, Dec 2, 2011 at 11:43 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Why would you want to encourage coders to write deeply indented code? In my opinion, if your code is indented four or more levels, you should start to think about refactorising your code; if you reach

Re: Using the Python Interpreter as a Reference

2011-11-29 Thread Steven D'Aprano
On Tue, 29 Nov 2011 12:49:49 +1100, Chris Angelico wrote: On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer devpla...@gmail.com wrote: To me, I would think the interpreter finding the coder's intended indent wouldn't be that hard. And just make the need for consistant spaces or tabs irrevelent

Re: Using the Python Interpreter as a Reference

2011-11-29 Thread Steven D'Aprano
On Tue, 29 Nov 2011 13:57:32 +1100, Chris Angelico wrote: I'm inclined toward an alternative: explicit recursion. Either a different syntax, or a special-case on the use of the function's own name, but whichever syntax you use, it compiles in a recurse opcode. That way, if name bindings

Re: Using the Python Interpreter as a Reference

2011-11-29 Thread Dave Angel
On 11/29/2011 03:12 AM, Steven D'Aprano wrote: On Tue, 29 Nov 2011 13:57:32 +1100, Chris Angelico wrote: I'm inclined toward an alternative: explicit recursion. Either a different syntax, or a special-case on the use of the function's own name, but whichever syntax you use, it compiles in a

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 27, 6:55 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: Personally, I find a lot of good things in Python. I thinking tabs are out-of-date. Even the MAKE community wishes that the need for tabs would go away

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Ian Kelly
On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: My language combines generators and collection initializers, instead of creating a whole new syntax for comprehensions. [| for i in 0..10: for j in 0.10: yield return i * j |] Are we supposed to

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
On 2011-11-28, Ian Kelly ian.g.ke...@gmail.com wrote: I think the implication is that Unit has only one syntax for creating functions, which is lambda-style. In any case, why does Python require a special keyword? def is only used in a statement context, and lambda is only used in an

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Gregory Ewing
Travis Parks wrote: I thinking tabs are out-of-date. Even the MAKE community wishes that the need for tabs would go away The situation with make is a bit different, because it *requires* tabs in certain places -- spaces won't do. Python lets you choose which to use as long as you don't mix

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Gregory Ewing
Neil Cerutti wrote: I've always held with the anti-functional style conspiracy interpretation of Python's lambda expressions. They were added but grudgingingly, made weak on purpose to discourage their use. Seems to me that Python's lambdas are about as powerful as they can be given the

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Alemu mihretu
Hello all, My python runs and crashes after another run. I am getting errors like Microsoft Visual C++ Runtime Library program c:\Python27\pythonw.exe This application has requested the Runtime to terminate it in an usuak way. Please contact the application's support team for more information.

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
On 2011-11-28, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Neil Cerutti wrote: I've always held with the anti-functional style conspiracy interpretation of Python's lambda expressions. They were added but grudgingingly, made weak on purpose to discourage their use. Seems to me that

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 2:32 pm, Ian Kelly ian.g.ke...@gmail.com wrote: On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: My language combines generators and collection initializers, instead of creating a whole new syntax for comprehensions. [| for i in

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 3:40 pm, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Travis Parks wrote: I thinking tabs are out-of-date. Even the MAKE community wishes that the need for tabs would go away The situation with make is a bit different, because it *requires* tabs in certain places -- spaces

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Chris Angelico
On Tue, Nov 29, 2011 at 8:29 AM, Travis Parks jehugalea...@gmail.com wrote: Languages that don't support exceptions as part of their signature lead to capturing generic Exception all throughout code. It is one of those features I wish .NET had. At the same time, with my limited experience with

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2011 12:32:59 -0700, Ian Kelly wrote: On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: [...] Lambdas and functions are the same thing in my language, so no need for a special keyword. That does not follow. Lambdas and def functions

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Chris Angelico
On Tue, Nov 29, 2011 at 9:24 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Because the syntax is completely different. One is a statement, and stands alone, the other is an expression. Even putting aside the fact that lambda's body is an expression, and a def's body is a

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote: Exception handling is one of those subjects few understand and fewer can implement properly in modern code. Languages that don't support exceptions as part of their signature lead to capturing generic Exception all throughout code. It is

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread DevPlayer
On Nov 27, 6:55 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: Personally, I find a lot of good things in Python. I thinking tabs are out-of-date. Even the MAKE community wishes that the need for tabs would go away

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread DevPlayer
I do not understand why the interpreter preprocesses each logical line of source code using something as simple as this: correction: I do not understand why the interpreter - does not- preprocess each logical line of source code using something as simple as this: --

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Chris Angelico
On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer devpla...@gmail.com wrote: To me, I would think the interpreter finding the coder's intended indent wouldn't be that hard. And just make the need for consistant spaces or tabs irrevelent simply by reformatting the indent as expected. Pretty much all

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:24 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 28 Nov 2011 12:32:59 -0700, Ian Kelly wrote: On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: [...] Lambdas and functions are the same thing in my language,

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Chris Angelico
On Tue, Nov 29, 2011 at 1:42 PM, Travis Parks jehugalea...@gmail.com wrote: A good example I have run into is recursion. When a local function calls itself, the name of the function may not be part of scope (non- local). Languages that support tail-end recursion optimization can't optimize. In

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 8:49 pm, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer devpla...@gmail.com wrote: To me, I would think the interpreter finding the coder's intended indent wouldn't be that hard. And just make the need for consistant spaces or tabs irrevelent

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:57 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote: Exception handling is one of those subjects few understand and fewer can implement properly in modern code. Languages that don't support exceptions as

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Ian Kelly
On Mon, Nov 28, 2011 at 7:42 PM, Travis Parks jehugalea...@gmail.com wrote: I find that interesting. I also find it interesting that the common functional methods (all, any, map, filter) are basically built into Python core language. That is unusual for most imperative programming languages

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Travis Parks
On Nov 26, 1:53 pm, Rick Johnson rantingrickjohn...@gmail.com wrote: On Nov 20, 6:46 pm, Travis Parks jehugalea...@gmail.com wrote: Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Colin Higwell
On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: On Nov 26, 1:53 pm, Rick Johnson rantingrickjohn...@gmail.com wrote: On Nov 20, 6:46 pm, Travis Parks jehugalea...@gmail.com wrote: Hello: I am currently working on designing a new programming language. It is a compiled language,

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Steven D'Aprano
On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: Personally, I find a lot of good things in Python. I thinking tabs are out-of-date. Even the MAKE community wishes that the need for tabs would go away and many implementations have done just that. Tabs have every theoretical advantage

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Chris Angelico
On Mon, Nov 28, 2011 at 10:55 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What does it mean to say that a language is small? A Turing Machine is a pretty small language, with only a few instructions: step forward, step backwards, erase a cell, write a cell, branch on the

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Matt Joiner
http://pyjs.org/ On Sat, Nov 26, 2011 at 3:22 PM, Sells, Fred fred.se...@adventistcare.org wrote: I'm looking at a variation on this theme.  I currently use Flex/ActionScript for client side work, but there is pressure to move toward HTML5+Javascript and or iOS.  Since I'm an old hand at

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Alec Taylor
Consider implementing OOP, reflection and implement in HLA or C =] On Mon, Nov 21, 2011 at 11:46 AM, Travis Parks jehugalea...@gmail.com wrote: Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference.

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Rick Johnson
On Nov 20, 6:46 pm, Travis Parks jehugalea...@gmail.com wrote: Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation for code

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Chris Angelico
On Sun, Nov 27, 2011 at 5:53 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: I hope you meant to say *forced* indention for code blocks! Forced being the key word here. What about tabs over spaces, have you decided the worth of one over the other or are you going to repeat Guido's folly?

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Rick Johnson
On Nov 26, 1:34 pm, Chris Angelico ros...@gmail.com wrote: On Sun, Nov 27, 2011 at 5:53 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: I hope you meant to say *forced* indention for code blocks! Forced being the key word here. What about tabs over spaces, have you decided the worth

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread Travis Parks
On Nov 22, 1:37 pm, Alan Meyer amey...@yahoo.com wrote: On 11/20/2011 7:46 PM, Travis Parks wrote: Hello: I am currently working on designing a new programming language. ... I have great respect for people who take on projects like this. Your chances of popularizing the language are

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread Chris Angelico
On Fri, Nov 25, 2011 at 9:55 PM, Travis Parks jehugalea...@gmail.com wrote: I have been thinking about compiling into a language like C++ or C instead of assembler for my first time through. Yep, or any other language you feel like using as an intermediate. Or alternatively, just start with an

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread rusi
On Nov 21, 5:46 am, Travis Parks jehugalea...@gmail.com wrote: Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation for code

RE: Using the Python Interpreter as a Reference

2011-11-25 Thread Sells, Fred
I'm looking at a variation on this theme. I currently use Flex/ActionScript for client side work, but there is pressure to move toward HTML5+Javascript and or iOS. Since I'm an old hand at Python, I was wondering if there is a way to use it to model client side logic, then generate the

Re: Using the Python Interpreter as a Reference

2011-11-22 Thread Alan Meyer
On 11/20/2011 7:46 PM, Travis Parks wrote: Hello: I am currently working on designing a new programming language. ... I have great respect for people who take on projects like this. Your chances of popularizing the language are small. There must be thousands of projects like this for every

Re: Using the Python Interpreter as a Reference

2011-11-21 Thread Travis Parks
On Nov 21, 12:44 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: What's your language's special feature? I like to keep track of languages using a slug - a simple one-sentence (or less) statement of when it's right

Using the Python Interpreter as a Reference

2011-11-20 Thread Travis Parks
Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation for code blocks, lambdas, non-locals and my language will partially support dynamic

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 11:46 AM, Travis Parks jehugalea...@gmail.com wrote: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation for code

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Dan Stromberg
On Sun, Nov 20, 2011 at 4:46 PM, Travis Parks jehugalea...@gmail.comwrote: Hello: I am currently working on designing a new programming language. It is a compiled language, but I still want to use Python as a reference. Python has a lot of similarities to my language, such as indentation

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Steven D'Aprano
On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: What's your language's special feature? I like to keep track of languages using a slug - a simple one-sentence (or less) statement of when it's right to use this language above others. For example, Python is optimized for 'rapid

Re: Using the Python Interpreter as a Reference

2011-11-20 Thread Chris Angelico
On Mon, Nov 21, 2011 at 4:44 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 21 Nov 2011 13:33:21 +1100, Chris Angelico wrote: What's your language's special feature? I like to keep track of languages using a slug - a simple one-sentence (or less) statement of when