Name: Anonymous 2010-12-18 22:15
ITT: Name one thing about a language that annoys you most, and how it could be made better in your opinion (with code examples).
I'll start with... Python. Pretty awesome language in general, but the whole forced intendation ruins it for me, so why not just use braces instead of whitespace?
Anyway, old python:
new, stylish, brace'd python:
I really hope someone forks the python codebase someday and adds braces, and removes that fucking whitespace bullshit...
anyway, now it's your turn!
I'll start with... Python. Pretty awesome language in general, but the whole forced intendation ruins it for me, so why not just use braces instead of whitespace?
Anyway, old python:
import string
def poopy(data):
ret = {}
i = 0
while i < len(data):
if data[i] == '+' or data[i] == '-':
if data[i].isdigit():
i = i + 1
temp = "%d" % data[i]
ret[len(ret)] = temp
while i < len(data) and data[i].isdigit():
ret[len(ret) - 1] += data.at[i]
i = i + 1
else:
i = i + 1
temp = "%s" % data[i]
ret[len(ret)] = temp
elif data[i].isdigit():
ret[len(ret)] = ""
while (i < len(data)) and data[i].isdigit():
ret[len(ret)-1] = data[i]
i = i + 1
elif data[i].isalpha():
ret[len(ret)] = ""
while i < len(data) and data[i].isalpha():
ret[len(ret)-1] += data[i]
i = i + 1
elif data[i] in string.whitespace:
i = i + 1
else:
temp = "%c" % data[i]
ret[len(ret)] = temp
i = i + 1
return retnew, stylish, brace'd python:
import string
def poopy(data)
{
ret = {}
i = 0
while i < len(data)
{
if data[i] == '+' or data[i] == '-'
{
if data[i].isdigit()
{
i = i + 1
temp = "%d" % data[i]
ret[len(ret)] = temp
while i < len(data) and data[i].isdigit()
{
ret[len(ret) - 1] += data.at[i]
i = i + 1
}
}
else
{
i = i + 1
temp = "%s" % data[i]
ret[len(ret)] = temp
}
}
elif data[i].isdigit()
{
ret[len(ret)] = ""
while (i < len(data)) and data[i].isdigit()
{
ret[len(ret)-1] = data[i]
i = i + 1
}
}
elif data[i].isalpha()
{
ret[len(ret)] = ""
while i < len(data) and data[i].isalpha()
{
ret[len(ret)-1] += data[i]
i = i + 1
}
}
elif data[i] in string.whitespace
{
i = i + 1
}
else
{
temp = "%c" % data[i]
ret[len(ret)] = temp
i = i + 1
}
}
return ret
}I really hope someone forks the python codebase someday and adds braces, and removes that fucking whitespace bullshit...
anyway, now it's your turn!