alternatives to making blocks like { } or other ??

P

Peter Hansen

Andrei said:
i do really suffer. i have to use Perl and i know that i have no chance
to convince my new boss (very smart guy) to switch to Python because of
braces.

Clearly your new boss is *not* very smart, or is insane.
No sane, intelligent person would reject Python *solely* because it
doesn't use braces. Maybe that plus some other reasons, but not as the
*only* reason...

-Peter
 
D

Duncan Booth

(e-mail address removed) (Andrei Smirnov) wrote in
Please, Python writers, do provide braces as compatibility mode.

Give the chance to the world!

The world seems to be switching to Python quite happily despite (or
possibly because of) the lack of braces.

If you must do this, then Python comes with a script to insert/remove #end
directives. See Tools/Scripts/pindent.py. Use "pindent.py -c" whenever your
boss wants to review the code, and "pindent.py -d" immediately afterwards.
 
G

Grant Edwards

Joke? On my previous job my boss included smthng like that to local
code standard. everybody were supposed to do that.

The man's a loon. Or maybe just dim. Probably both.

Or possibly just humor-impared and took a sarcastic Usenet
posting seriously...
 
R

Roy Smith

i do really suffer. i have to use Perl and i know that i have no chance
to convince my new boss (very smart guy) to switch to Python because of
braces. that means wasted time on debugging perl crap code and listening
about Perl 6 future might.

Please, Python writers, do provide braces as compatibility mode.

Asking for braces in Python is like trying to teach a pig to sing; it
won't work and it annoys the pig.

For better or worse, Python uses indentation for statement grouping.
There are more or less three ways to deal with this:

1) Decide you like the idea and use the language.

2) Decide you don't like the idea, but find enough else worthwhile in
the language that you get past your dislike of indentation and use the
language anyway.

3) Decide the indentation issue is so onerous to you that you can't get
past it and don't use the language.

Any of those are valid. Personally, I fall into camp #2, and think
people in camp #3 are being obstinate fools, but any of the above is
preferable to trying to get the language maintainers to add braces to
the language. It just ain't going to happen.

On the other hand, anybody is free to download the source code to the
system and modify it in any way they see fit. If people like it,
they'll adopt it. Lots of people have come up with variants, add-ons,
or outgrowths of the core language: Jython, NumPy, Prothon, Pyrex,
Psyco, Parrot, etc. Just in the last few days has yet another one
called Pythong been mentioned, although details are still a bit sketchy
on that :)
 
I

Isaac To

Andrei> Please, Python writers, do provide braces as compatibility mode.

Andrei> Give the chance to the world!

If you think that the designer who is proud of eliminating the braces in the
language is any easier to change than your boss, you're deadly mistaken
about the reasons why people are writing open-source software.

Regards,
Isaac.
 
T

Terry Reedy

Andrei Smirnov said:
Please, Python writers, do provide braces as compatibility mode.

The Python developers are all volunteers working on the parts of the
language they find interesting or at least tolerable. There plates are
completely full with a backlog of requested bugfixes and feature or module
additions. If *you* want something different (Braython?), you can get
together with the other brace advocates and either do it yourselves or hire
someone. The source code is available and the license permissive.

Terry J. Reedy
 
D

Duncan Booth

Just in the last few days has yet another one
called Pythong been mentioned, although details are still a bit sketchy
on that :)

Pythong with braces. What a mental image. :)
 
M

Mel Wilson

Please, Python writers, do provide braces as compatibility mode.

Give the chance to the world!

The idea is a serious violation of the "One obvious way
to do it" rule. The thread has already dealt with the
confusion created by two obvious ways to do it: when the
compiler uses {} and the humans use indentation.

The best solution would be for somebody to volunteer to
write a program that would take Python source, marked up
with block brackets (perhaps '##{' and '##}', perhaps not)
and create properly indented Python. If you volunteered for
this you could also throw in the facility to mark up
correctly indented Python source that you wanted to go on to
modify. I doubt the facility is going to show up in Python
any other way anytime soon. Python 13.0 maybe.

Regards. Mel.
 
V

Ville Vainio

Mel> The best solution would be for somebody to volunteer to
Mel> write a program that would take Python source, marked up
Mel> with block brackets (perhaps '##{' and '##}', perhaps not)
Mel> and create properly indented Python. If you volunteered for

It already exists in Python - it's the Tools/Scripts/pindent.py
script.

Here's the copy-pastage of the way code is written, for those who
don't care enough to check:

def foobar(a, b):
if a == b:
a = a+1
elif a < b:
b = b-1
if b > a: a = a-1
# end if
else:
print 'oops!'
# end if
# end def foobar
 
J

JanC

(e-mail address removed) (Tim Williams) schreef:
But at least there, I can turn on paren-match mode in emacs and see
what code is in the block. If it's indented inconsistenly, then I can
fix how it looks, but I'm not changing the logic with whitespace.

In Scintilla-based editors like SciTE you (can) get a hint of the block
structure as a by-product of the folding support.
An example screenshot: <http://scintilla.sf.net/SciTEImage.html>

Maybe something similar is possible in emacs?
 
A

Andrei Smirnov

Peter Hansen said:
Clearly your new boss is *not* very smart, or is insane.

there are many smart people who are not familiar with any aspect of
this
discussion (and other way around). so, don't make judgement based on
preferences.
No sane, intelligent person would reject Python *solely* because it
doesn't use braces. Maybe that plus some other reasons, but not as the
*only* reason...

sure it is not only reason. as usual the only reason: there are
a lot of code we wrote on perl and ...

well, there is such thing as initial impression. and python initial
impression
for (smart or stupid) guy who was using C for years is like swap brake
and gas
pedal in the car. why should anybody do this? the real fact is that
C-look is everywhere and it is affecting decision-making process in
this way.

BTW, people using computer languages not only for full-time job
(like myself till recently) or to build stupid websites but also to do
some usefull things :)

i took me about two days to get used to python indentation. and it is
actually
not very hard to convince your friend to do it. but things
are very different in any industry and when you interacting with your
boss.

i will be surprised if this arguments will convince anybody here but i
need
some relief before i get back to perl (that's part of my job).

Andrei
 
V

Ville Vainio

Andrei> there are many smart people who are not familiar with any
Andrei> aspect of this discussion (and other way around). so,
Andrei> don't make judgement based on preferences.

He's probably not stupid, just prejudiced. Many people in tech
are. You just need persistence in convincing, and you may need to
demonstrate how productive/readable Python is. Never give up - even
the most stubborn will see that Python absolutely kills Perl, given
enough exposure. Just write something and show him the code. Make it
brief and elegant. The indentation issue will fall by the wayside.

Andrei> well, there is such thing as initial impression. and
Andrei> python initial impression for (smart or stupid) guy who
Andrei> was using C for years is like swap brake and gas pedal in
Andrei> the car. why should anybody do this? the real fact is that
Andrei> C-look is everywhere and it is affecting decision-making
Andrei> process in this way.

It might very well be affecting the decision making process, but so
should you. It's not necessary to sit silently while other people make
the decisions - programmers should complain loudly when the decisions
made are stupid, especially if they concern them.

Andrei> not very hard to convince your friend to do it. but things
Andrei> are very different in any industry and when you
Andrei> interacting with your boss.

The boss is a person like anyone else, with a pair of ears and at
least half a brain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top