# Why not adopt "Python Style" indentation for Ruby?

**URL:** <https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682>\
**Category:** ruby-talk\
**Created:** [18 May 2007 07:25 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682 "2007-05-18T07:25:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Dew](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@Chris\_Dew](https://rubytalk.org/u/Chris_Dew)\
**Post date:** [18 May 2007 07:25 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/1 "2007-05-18T07:25:03Z")

</div>

As far as I can see, the 'end' keyword is 'repeating yourself' when  
used with properly indented code.

class Foo

&nbsp;&nbsp;def bar(value)  
&nbsp;&nbsp;&nbsp;&nbsp;if value \< 7  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
&nbsp;&nbsp;&nbsp;&nbsp;else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"  
&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;end

&nbsp;&nbsp;def foobar  
&nbsp;&nbsp;&nbsp;&nbsp;puts "foobar"  
&nbsp;&nbsp;end

end

could be

class Foo

&nbsp;&nbsp;def bar(value)  
&nbsp;&nbsp;&nbsp;&nbsp;if value \< 7  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
&nbsp;&nbsp;&nbsp;&nbsp;else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"

&nbsp;&nbsp;def foobar  
&nbsp;&nbsp;&nbsp;&nbsp;puts "foobar"

with no reduction in meaning, yet 25% fewer lines of code.

What are the reasons why this isn't used/implemented/liked? It would  
be a small change to the interpreter. Enabling meaningful indentation  
would only make 'end' optional, not invalid; backwards compatibility  
wouldn't be a problem.

(I use both Ruby and Python. I think indentation is one of the few  
\*language\* features where Python leads Ruby.)

If this post generates a positive response, I'll make a patch for Ruby  
1.9.

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [18 May 2007 07:38 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/2 "2007-05-18T07:38:05Z")

</div>

Hi,

> What are the reasons why this isn't used/implemented/liked?

Python style block by indentation is an interesting idea, but it works  
badly with

&nbsp;&nbsp;\* tab/space mixture  
&nbsp;&nbsp;\* templates, e.g. eRuby  
&nbsp;&nbsp;\* expression with code chunk, e.g lambdas and blocks

So I'd rather be conservative here.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

> **···**
>
> In message "Re: Why not adopt "Python Style" indentation for Ruby?" on Fri, 18 May 2007 16:25:03 +0900, Chris Dew \<cmsdew@googlemail.com\> writes:

---

<div class="post-metadata">

**Author:** ![Julian\_Leviston](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@Julian\_Leviston](https://rubytalk.org/u/Julian_Leviston)\
**Post date:** [18 May 2007 09:07 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/3 "2007-05-18T09:07:22Z")

</div>

Actually,

Isn't end repeating yourself full stop?

Do we really need it?

Julian.

> **···**
>
> On Fri, 18 May 2007 16:25:03 +0900 Chris Dew \<cmsdew@googlemail.com\> wrote:
> 
> > As far as I can see, the 'end' keyword is 'repeating yourself' when  
> > used with properly indented code.
> > 
> > class Foo
> > 
> > def bar(value)  
> > &nbsp;&nbsp;&nbsp;if value \< 7  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
> > &nbsp;&nbsp;&nbsp;else  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"  
> > &nbsp;&nbsp;&nbsp;end  
> > end
> > 
> > def foobar  
> > &nbsp;&nbsp;&nbsp;puts "foobar"  
> > end
> > 
> > end
> > 
> > could be
> > 
> > class Foo
> > 
> > def bar(value)  
> > &nbsp;&nbsp;&nbsp;if value \< 7  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
> > &nbsp;&nbsp;&nbsp;else  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"
> > 
> > def foobar  
> > &nbsp;&nbsp;&nbsp;puts "foobar"
> > 
> > with no reduction in meaning, yet 25% fewer lines of code.
> > 
> > What are the reasons why this isn't used/implemented/liked? It would  
> > be a small change to the interpreter. Enabling meaningful indentation  
> > would only make 'end' optional, not invalid; backwards compatibility  
> > wouldn't be a problem.
> > 
> > (I use both Ruby and Python. I think indentation is one of the few  
> > \*language\* features where Python leads Ruby.)
> > 
> > If this post generates a positive response, I'll make a patch for Ruby  
> > 1.9.

---

<div class="post-metadata">

**Author:** ![Daniel\_Martin](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@Daniel\_Martin](https://rubytalk.org/u/Daniel_Martin)\
**Post date:** [18 May 2007 13:01 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/4 "2007-05-18T13:01:13Z")

</div>

Chris Dew \<cmsdew@googlemail.com\> writes:

> As far as I can see, the 'end' keyword is 'repeating yourself' when  
> used with properly indented code.

Note that the Haskell folks have managed to evolve a language in which  
python-like spacing can be used to mark the extent of discrete code  
chunks, but so can traditional braces.

This is more then kind of thing I'd like to see in Ruby: having it  
allow the compact python notation, but not require it. (So that,  
e.g., code generators would still be easy to write)

I think anyone serious about adding indentation-as-syntax to Ruby  
should take a very close look at how Haskell manages to allow it  
without requiring it.

> **···**
>
> --  
> s=%q( Daniel Martin -- martin@snowplow.org  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "s=%q(#{s})",s.to\_a.last )  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "s=%q(#{s})",s.to\_a.last

---

<div class="post-metadata">

**Author:** ![Ryan\_Leavengood](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Ryan\_Leavengood](https://rubytalk.org/u/Ryan_Leavengood)\
**Post date:** [18 May 2007 14:03 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/5 "2007-05-18T14:03:32Z")

</div>

This is a very subjective thing. A lot of people don't use Python  
because they don't like this feature.

In my case I like the symmetry that Ruby's matching end provides. I  
find it makes the code easier to read and maintain. I've written and  
maintained some Python code that "trails off into nowhere" with a long  
series of indentations. I find this "stairway" code rather painful to  
work with.

But if it is possible to add this feature to Ruby without breaking  
anything, it could be interesting. It would certainly draw a few  
Pythonists to check out Ruby.

Ryan

> **···**
>
> On 5/18/07, Chris Dew \<cmsdew@googlemail.com\> wrote:
> 
> > What are the reasons why this isn't used/implemented/liked? It would  
> > be a small change to the interpreter. Enabling meaningful indentation  
> > would only make 'end' optional, not invalid; backwards compatibility  
> > wouldn't be a problem.
> > 
> > (I use both Ruby and Python. I think indentation is one of the few  
> > \*language\* features where Python leads Ruby.)

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Nadasi-Don1](https://avatars.discourse-cdn.com/v4/letter/w/958977/32.png) [@Wolfgang\_Nadasi-Don1](https://rubytalk.org/u/Wolfgang_Nadasi-Don1)\
**Post date:** [18 May 2007 18:13 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/6 "2007-05-18T18:13:08Z")

</div>

Chris Dew wrote:

> As far as I can see, the 'end' keyword is 'repeating yourself' when  
> used with properly indented code.
> 
> class Foo
> 
> &nbsp;&nbsp;def bar(value)  
> &nbsp;&nbsp;&nbsp;&nbsp;if value \< 7  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
> &nbsp;&nbsp;&nbsp;&nbsp;else  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"  
> &nbsp;&nbsp;&nbsp;&nbsp;end  
> &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;def foobar  
> &nbsp;&nbsp;&nbsp;&nbsp;puts "foobar"  
> &nbsp;&nbsp;end
> 
> end
> 
> could be
> 
> class Foo
> 
> &nbsp;&nbsp;def bar(value)  
> &nbsp;&nbsp;&nbsp;&nbsp;if value \< 7  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "hello"  
> &nbsp;&nbsp;&nbsp;&nbsp;else  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "world"
> 
> &nbsp;&nbsp;def foobar  
> &nbsp;&nbsp;&nbsp;&nbsp;puts "foobar"

The is one big disadvantage in Python's syntax. Things like...

def bar(value); (value\<7) ? (puts "hello") : (puts "world"); end

...are not possible in Python - and they are useful for the typical  
one-to-three-liners in support areas, where Ruby still has the chance to  
replace Perl - a chance that Python never had.

I know that my example has nothing to do with documentation oriented  
software development, but this is not necessary for a broad range of  
small ad-hoc tools.

Wolfgang Nádasi-Donner

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Enrique\_Comba\_Riepe1](https://avatars.discourse-cdn.com/v4/letter/e/f4b2a3/32.png) [@Enrique\_Comba\_Riepe1](https://rubytalk.org/u/Enrique_Comba_Riepe1)\
**Post date:** [18 May 2007 18:19 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/7 "2007-05-18T18:19:44Z")

</div>

> with no reduction in meaning, yet 25% fewer lines of code.
> 
> What are the reasons why this isn't used/implemented/liked? It would  
> be a small change to the interpreter. Enabling meaningful indentation  
> would only make 'end' optional, not invalid; backwards compatibility  
> wouldn't be a problem.
> 
> (I use both Ruby and Python. I think indentation is one of the few  
> \*language\* features where Python leads Ruby.)

Here my 5 cents...

Gentlemen, if you want to code Python style, go ahead, program in Python.

I mean every language has it's pros an cons. I come from a Java world (11 years of Java) and I am not asking that Ruby should be Java like. That is absolute nonsense.

Ruby is like Ruby, so, if you like it (as I do) take it, if you don't... there are lots of different programming languages out there you can choose from, or like Mats, go ahead and develop your own (you will notice it's actually not that easy to do it right...)

Cheers,

Enrique Comba Riepenhausen

---

<div class="post-metadata">

**Author:** ![Brendan](https://avatars.discourse-cdn.com/v4/letter/b/50afbb/32.png) [@Brendan](https://rubytalk.org/u/Brendan)\
**Post date:** [19 May 2007 15:05 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/8 "2007-05-19T15:05:06Z")

</div>

I personally prefer that 'end' be in place, so that all ruby code is  
readable. I personally believe there may be something wrong with a  
syntax which sacrifices explicit readability (for everyone, not just  
python programmers) for increased typing speed and the illusory gain  
of 'fewer LOC'. This was one of the major reasons which convinced me  
to use ruby instead of python.

> **···**
>
> On May 18, 4:23 am, Chris Dew \<cms...@googlemail.com\> wrote:
> 
> > ...  
> > with no reduction in meaning, yet 25% fewer lines of code.
> > 
> > What are the reasons why this isn't used/implemented/liked? It would  
> > be a small change to the interpreter. Enabling meaningful indentation  
> > would only make 'end' optional, not invalid; backwards compatibility  
> > wouldn't be a problem.
> > 
> > (I use both Ruby and Python. I think indentation is one of the few  
> > \*language\* features where Python leads Ruby.)

---

<div class="post-metadata">

**Author:** ![Neil\_Wilson](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@Neil\_Wilson](https://rubytalk.org/u/Neil_Wilson)\
**Post date:** [20 May 2007 16:55 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/9 "2007-05-20T16:55:03Z")

</div>

> As far as I can see, the 'end' keyword is 'repeating yourself' when  
> used with properly indented code.

Maybe it is maybe it isn't. Personally I'm an 'end' man. I like my  
blocks.

It would be easier if you learnt to type, or used editor macros.

> (I use both Ruby and Python. I think indentation is one of the few  
> \*language\* features where Python leads Ruby.
> 
> If this post generates a positive response, I'll make a patch for Ruby  
> 1.9.

Nope, leave the language as it is. I like it unaltered thank you very  
much.

However I've never understood why there has to be 'one true syntax'  
for any computer language. As long as the syntax generates the same  
ASTs in the interpreter I can't see why you couldn't choose the syntax  
you prefer - whether that is whitespace indentation, or the symbolic  
mush of the 'C' derived languages.

> **···**
>
> On May 18, 8:23 am, Chris Dew \<cms...@googlemail.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Jinjing\_Wang](https://avatars.discourse-cdn.com/v4/letter/j/f6c823/32.png) [@Jinjing\_Wang](https://rubytalk.org/u/Jinjing_Wang)\
**Post date:** [16 June 2007 04:19 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/10 "2007-06-16T04:19:41Z")

</div>

I love indentations too..

Check out my project for Ruby space convention 😕

[http://lazibi.rubyforge.org](http://lazibi.rubyforge.org)

It's code generation.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [29 July 2013 06:39 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/11 "2013-07-29T06:39:02Z")

</div>

Why not go coffeescript style and create a preprocessor gem that  
compiles indent-aware ruby into ruby? Shouldn't be too big effort.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [30 November 2013 10:38 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/12 "2013-11-30T10:38:43Z")

</div>

What I dislike about indent is that you need to satisfy the parser in  
order to make the program run.

It's like an additional control element, like ';'.

I do not think a language should care about indentation.

With that having said, I concur with the initial statement - "end" does  
not give me, as a programmer, meaningful information. I only have to use  
it to satisfy the ruby parser - in python, you can omit that, but you  
(a) must then indent properly (which is, again, to satisfy the parser)  
and (b) you have to use the strange ':', which is annoying.

What I would love to have, however, would be a per-file option that  
would allow me to omit end for a given .rb file. Just like shebang or  
encoding lines could be used.

I could then write specific classes in a single .rb file (one class per  
file) and they would be more readable too.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Michal\_hramrach\_Such](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@Michal\_hramrach\_Such](https://rubytalk.org/u/Michal_hramrach_Such)\
**Post date:** [18 May 2007 09:04 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/13 "2007-05-18T09:04:58Z")

</div>

\* clipboards, email, pastebins, and other places where the code is not  
preserved literally

Thanks

Michal

> **···**
>
> On 18/05/07, Yukihiro Matsumoto \<matz@ruby-lang.org\> wrote:
> 
> > Hi,
> > 
> > In message "Re: Why not adopt "Python Style" indentation for Ruby?" \> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew \<cmsdew@googlemail.com\> writes:
> > 
> > \>What are the reasons why this isn't used/implemented/liked?
> > 
> > Python style block by indentation is an interesting idea, but it works  
> > badly with
> > 
> > &nbsp;&nbsp;\* tab/space mixture  
> > &nbsp;&nbsp;\* templates, e.g. eRuby  
> > &nbsp;&nbsp;\* expression with code chunk, e.g lambdas and blocks

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [18 May 2007 13:36 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/14 "2007-05-18T13:36:58Z")

</div>

Hi,

> **···**
>
> In message "Re: Why not adopt "Python Style" indentation for Ruby?" on Fri, 18 May 2007 22:01:13 +0900, Daniel Martin \<martin@snowplow.org\> writes:
> 
> > Note that the Haskell folks have managed to evolve a language in which  
> > python-like spacing can be used to mark the extent of discrete code  
> > chunks, but so can traditional braces.
> 
> I admit Haskell syntax is much better than Python's. But I am not yet  
> sure if it can be applied to Ruby.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![S.Volkov](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@S.Volkov](https://rubytalk.org/u/S.Volkov)\
**Post date:** [18 May 2007 14:15 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/15 "2007-05-18T14:15:05Z")

</div>

"Yukihiro Matsumoto" \<matz@ruby-lang.org\> wrote in message  
news:1179473895.694681.23173.nullmailer@x31.netlab.jp...

> Hi,
> 
> \>What are the reasons why this isn't used/implemented/liked?
> 
> Python style block by indentation is an interesting idea, but it works  
> badly with
> 
> \* tab/space mixture  
> \* templates, e.g. eRuby  
> \* expression with code chunk, e.g lambdas and blocks
> 
> So I'd rather be conservative here.
> 
> matz.

imho: indentation should not define semantic;  
suggestion: make 'end' optional if code block contains only one statement;

BRs  
Sergey Volkov

> **···**
>
> > In message "Re: Why not adopt "Python Style" indentation for Ruby?" \> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew \<cmsdew@googlemail.com\> \> writes:

---

<div class="post-metadata">

**Author:** ![Jaroslaw\_Zabiello1](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jaroslaw\_Zabiello1](https://rubytalk.org/u/Jaroslaw_Zabiello1)\
**Post date:** [18 May 2007 15:15 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/16 "2007-05-18T15:15:05Z")

</div>

> Python style block by indentation is an interesting idea, but it works  
> badly with
> 
> &nbsp;&nbsp;\* tab/space mixture

Tabs are against PEP8 which recomends space usage only.

> &nbsp;&nbsp;\* templates, e.g. eRuby

eRuby is crap if you compare it with Haml template  
[http://haml.hamptoncatlin.com/\](http://haml.hamptoncatlin.com/%5C).

It is interesting how they use indendation and how clean it can be. And  
finally... they are written in Ruby and for Ruby users! 🙂

What do you think about OPTIONAL block indendation in Ruby?

> **···**
>
> Dnia Fri, 18 May 2007 16:38:05 +0900, Yukihiro Matsumoto napisał(a):
> 
> --  
> Jarosław Zabiełło  
> [http://blog.zabiello.com](http://blog.zabiello.com)

---

<div class="post-metadata">

**Author:** ![Chad\_Perrin1](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Chad\_Perrin1](https://rubytalk.org/u/Chad_Perrin1)\
**Post date:** [19 May 2007 18:02 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/17 "2007-05-19T18:02:30Z")

</div>

I, personally, don't have an argument on principle like that for my own  
preferences in this matter. I just like the fact that an "end" makes it  
look more complete to me. Reading Python code always makes me feel like  
my eyes are just going to trail off the right-hand edge of the page  
because the "shape" of the code never brings me back to the leftmost  
edge, the way code "should".

When I look at Python code, and ponder the way it does things so  
differently from Ruby regarding delimiters and indentation (the same  
thing in Python), it seems to me that Python was created for people who  
write code in a particular mindset, and it's not a mindset I share when  
I'm writing code. I guess maybe some people, when writing code, think  
in footnote hierarchies, while others (like me) think in nested scopes.

That's just an off-the-cuff hypothesis.

> **···**
>
> On Sun, May 20, 2007 at 12:05:06AM +0900, Brendan wrote:
> 
> > On May 18, 4:23 am, Chris Dew \<cms...@googlemail.com\> wrote:  
> > \> ...  
> > \> with no reduction in meaning, yet 25% fewer lines of code.  
> > \>  
> > \> What are the reasons why this isn't used/implemented/liked? It would  
> > \> be a small change to the interpreter. Enabling meaningful indentation  
> > \> would only make 'end' optional, not invalid; backwards compatibility  
> > \> wouldn't be a problem.  
> > \>  
> > \> (I use both Ruby and Python. I think indentation is one of the few  
> > \> \*language\* features where Python leads Ruby.)
> > 
> > I personally prefer that 'end' be in place, so that all ruby code is  
> > readable. I personally believe there may be something wrong with a  
> > syntax which sacrifices explicit readability (for everyone, not just  
> > python programmers) for increased typing speed and the illusory gain  
> > of 'fewer LOC'. This was one of the major reasons which convinced me  
> > to use ruby instead of python.
> 
> --  
> CCD CopyWrite Chad Perrin [[http://ccd.apotheon.org](http://ccd.apotheon.org) ]  
> Larry Wall: "A script is what you give the actors. A program is what you  
> give the audience."

---

<div class="post-metadata">

**Author:** ![Brad\_Phelan1](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@Brad\_Phelan1](https://rubytalk.org/u/Brad_Phelan1)\
**Post date:** [18 June 2007 07:50 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/18 "2007-06-18T07:50:02Z")

</div>

> Jinjing Wang wrote:  
> I love indentations too..
> 
> Check out my project for Ruby space convention 😕
> 
> [http://lazibi.rubyforge.org](http://lazibi.rubyforge.org)
> 
> It's code generation.

You don't need to do code generation, at least in the way you have done it. I posted a solution way back up this thread that does not require the creation of intermediate files to load.

In foo.rb

require 'pyrb.rb'  
\_\_END\_\_

def foo:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1,2,3,4].each do |i|:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts i  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1,2,3,4].each do |j|:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts i  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if i == 2 :  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "foo"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "bar"

foo

See

[http://xtargets.com/snippets/posts/show/68](http://xtargets.com/snippets/posts/show/68)

for the details.

> **···**
>
> --  
> Brad Phelan  
> [http://xtargets.com](http://xtargets.com)

---

<div class="post-metadata">

**Author:** ![Henry\_Maddocks1](https://avatars.discourse-cdn.com/v4/letter/h/ba9def/32.png) [@Henry\_Maddocks1](https://rubytalk.org/u/Henry_Maddocks1)\
**Post date:** [29 July 2013 07:55 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/19 "2013-07-29T07:55:28Z")

</div>

Here's one for you...

[https://github.com/jamesotron/Rubby](https://github.com/jamesotron/Rubby)

Henry

> **···**
>
> On 29/07/2013, at 6:39 PM, "Juha K." \<lists@ruby-forum.com\> wrote:
> 
> > Why not go coffeescript style and create a preprocessor gem that  
> > compiles indent-aware ruby into ruby? Shouldn't be too big effort.

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [29 July 2013 09:48 UTC](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682/20 "2013-07-29T09:48:50Z")

</div>

Perhaps because we'd hate it? Otherwise we'd already be coding in python.

> **···**
>
> On Jul 28, 2013, at 23:39 , Juha K. \<lists@ruby-forum.com\> wrote:
> 
> > Why not go coffeescript style and create a preprocessor gem that  
> > compiles indent-aware ruby into ruby? Shouldn't be too big effort.

[Next page](https://rubytalk.org/t/why-not-adopt-python-style-indentation-for-ruby/37682.md?page=2)
