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-02 Thread Sells, Fred
thon-list-bounces+frsells=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 lit

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 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 six levels, > your code is probab

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 cod

Re: Using the Python Interpreter as a Reference

2011-12-01 Thread DevPlayer
On Nov 29, 3:04 am, Steven D'Aprano wrote: > On Tue, 29 Nov 2011 12:49:49 +1100, Chris Angelico wrote: > > On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer 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 consis

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

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 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 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 reforma

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 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 early-on. all and an

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:57 pm, Steven D'Aprano 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 part of their signature lead to ca

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 8:49 pm, Chris Angelico wrote: > On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer 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 ind

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 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 order to support t

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 5:24 pm, Steven D'Aprano 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 > > wrote: > [...] > >>> Lambdas and functions are the same thing in my language, so no need > >>> for a special keyword. > > >> That does not fol

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Chris Angelico
On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer 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 my text editors

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: -- http://mail.python.org/m

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread DevPlayer
On Nov 27, 6:55 pm, Steven D'Aprano 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 and many implementations have don

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

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 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 block, def > also requires a name. Usin

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 > 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 are the same thing in >>

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 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 Java, it has > bee

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 3:40 pm, Gregory Ewing 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 won't do. > Pytho

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 28, 2:32 pm, Ian Kelly wrote: > On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano > > 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 |] > > >

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
On 2011-11-28, Gregory Ewing 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 Python's lambdas a

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 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 stat

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 them

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Neil Cerutti
On 2011-11-28, Ian Kelly 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 expression > context. Wh

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 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 intuit what that means? > > Is

Re: Using the Python Interpreter as a Reference

2011-11-28 Thread Travis Parks
On Nov 27, 6:55 pm, Steven D'Aprano 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 and many implementations have don

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 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 state of the cell. And yet anyt

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 Colin Higwell
On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote: > On Nov 26, 1:53 pm, Rick Johnson wrote: >> On Nov 20, 6:46 pm, Travis Parks 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

Re: Using the Python Interpreter as a Reference

2011-11-27 Thread Travis Parks
On Nov 26, 1:53 pm, Rick Johnson wrote: > On Nov 20, 6:46 pm, Travis Parks 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, s

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Rick Johnson
On Nov 26, 1:34 pm, Chris Angelico wrote: > On Sun, Nov 27, 2011 at 5:53 AM, Rick Johnson > > 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

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 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? I recommend demandin

Re: Using the Python Interpreter as a Reference

2011-11-26 Thread Rick Johnson
On Nov 20, 6:46 pm, Travis Parks 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 blocks, I hope you mea

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 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

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 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 Python, I > was wondering if th

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 javascript

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread rusi
On Nov 21, 5:46 am, Travis Parks 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 blocks, lambdas, non-lo

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 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 interpreter - whateve

Re: Using the Python Interpreter as a Reference

2011-11-25 Thread Travis Parks
On Nov 22, 1:37 pm, Alan Meyer 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 small.  Th

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 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 to use this language above o

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 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 to use this langu

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 Dan Stromberg
On Sun, Nov 20, 2011 at 4:46 PM, Travis Parks 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 blocks, la

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 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 blocks, lambdas, non