OT: Python (was Re: vi in /bin)

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

OT: Python (was Re: vi in /bin)

ropers
2009/12/19 Henning Brauer <[hidden email]>:
> any excuse to not know python is a good and valid one. any.

If you have the time, I'd love to hear you elaborate. So far most
people whose opinion I value have only said good things about Python.
You're the first person whose opinion I respect to go against that.

regards,
--ropers

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Darrin Chandler
On Sat, Dec 19, 2009 at 01:54:54PM +0100, ropers wrote:
> 2009/12/19 Henning Brauer <[hidden email]>:
> > any excuse to not know python is a good and valid one. any.
>
> If you have the time, I'd love to hear you elaborate. So far most
> people whose opinion I value have only said good things about Python.
> You're the first person whose opinion I respect to go against that.

You just need to talk to more people, then. Lots of people don't like
Python. Same for Perl, Ruby, or anything else. I've heard several devs
say they don't like Python but I have yet to hear any of them actually
give a reason. Ask them why they don't like C++ and you get a big list
of everything that's wrong with it. Ask about Python and you get "it
sucks" or "it's awful" or something. So I think it's just a matter of
taste.

Or maybe Henning has actual reasons. I haven't heard him talk about
Python before so I don't know. Henning?

--
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[hidden email]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Martin Schröder
In reply to this post by ropers
2009/12/19 ropers <[hidden email]>:
> 2009/12/19 Henning Brauer <[hidden email]>:
>> any excuse to not know python is a good and valid one. any.
>
> If you have the time, I'd love to hear you elaborate. So far most

It's religion. The python followers say the same about perl. :-)

Best
   Martin

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Claudio Jeker
In reply to this post by Darrin Chandler
On Sat, Dec 19, 2009 at 06:17:50AM -0700, Darrin Chandler wrote:

> On Sat, Dec 19, 2009 at 01:54:54PM +0100, ropers wrote:
> > 2009/12/19 Henning Brauer <[hidden email]>:
> > > any excuse to not know python is a good and valid one. any.
> >
> > If you have the time, I'd love to hear you elaborate. So far most
> > people whose opinion I value have only said good things about Python.
> > You're the first person whose opinion I respect to go against that.
>
> You just need to talk to more people, then. Lots of people don't like
> Python. Same for Perl, Ruby, or anything else. I've heard several devs
> say they don't like Python but I have yet to hear any of them actually
> give a reason. Ask them why they don't like C++ and you get a big list
> of everything that's wrong with it. Ask about Python and you get "it
> sucks" or "it's awful" or something. So I think it's just a matter of
> taste.
>
> Or maybe Henning has actual reasons. I haven't heard him talk about
> Python before so I don't know. Henning?
>

Ugh, a programming language where you can't copy paste from xterm to xterm
without fucking up the program is just way to much pain to work on.
The indenting of code is an optical help but should not change the
behaviour of the program. For me it is important to be able to write code
with style(9) in mind (and I think most other BSD developpers think
similar because our code all looks similar).

--
:wq Claudio

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Darrin Chandler
On Sat, Dec 19, 2009 at 02:38:20PM +0100, Claudio Jeker wrote:

> On Sat, Dec 19, 2009 at 06:17:50AM -0700, Darrin Chandler wrote:
> > On Sat, Dec 19, 2009 at 01:54:54PM +0100, ropers wrote:
> > > 2009/12/19 Henning Brauer <[hidden email]>:
> > > > any excuse to not know python is a good and valid one. any.
> > >
> > > If you have the time, I'd love to hear you elaborate. So far most
> > > people whose opinion I value have only said good things about Python.
> > > You're the first person whose opinion I respect to go against that.
> >
> > You just need to talk to more people, then. Lots of people don't like
> > Python. Same for Perl, Ruby, or anything else. I've heard several devs
> > say they don't like Python but I have yet to hear any of them actually
> > give a reason. Ask them why they don't like C++ and you get a big list
> > of everything that's wrong with it. Ask about Python and you get "it
> > sucks" or "it's awful" or something. So I think it's just a matter of
> > taste.
> >
> > Or maybe Henning has actual reasons. I haven't heard him talk about
> > Python before so I don't know. Henning?
> >
>
> Ugh, a programming language where you can't copy paste from xterm to xterm
> without fucking up the program is just way to much pain to work on.
> The indenting of code is an optical help but should not change the
> behaviour of the program. For me it is important to be able to write code
> with style(9) in mind (and I think most other BSD developpers think
> similar because our code all looks similar).

I have often done copy/paste with Python code between xterms. Of course
you must fix indenting. If you naively copy/paste C you will also have
issues of syntax and meaning, but if you are so used to looking at C
code that the meaning in the new context is immediately obvious without
thinking then you will not notice. Instead you just fix/adjust it in
place and move on.

Some people will never like indent having meaning. But there is value in
having an 'else' that *looks* like it belongs with an 'if' actually
belong to that 'if', *because* it looks like it does. You don't ever
have to like Python, but indenting to make blocks is perfectly
cromulent. It's not a deficiency, it's just different.

--
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[hidden email]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Ted Unangst-2
In reply to this post by ropers
The rules for scoping are utterly fucked.

On Dec 19, 2009, at 7:54 AM, ropers <[hidden email]> wrote:

> 2009/12/19 Henning Brauer <[hidden email]>:
>> any excuse to not know python is a good and valid one. any.
>
> If you have the time, I'd love to hear you elaborate. So far most
> people whose opinion I value have only said good things about Python.
> You're the first person whose opinion I respect to go against that.
>
> regards,
> --ropers

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Ted Unangst-2
In reply to this post by Darrin Chandler
It's very hard to fix the indenting when you're copying code from a  
web forum/email archive/whatnot that mangled it. Been there done that.  
Pythons behavior in this regard makes it very aggravating to work with  
as a newcomer, and for many people who are a little suspicious of the  
whole whitespace thing, when your first taste of the language is hours  
spent fixing the whitespace, you aren't inclined to use it any more  
than necessary.

On Dec 19, 2009, at 9:21 AM, Darrin Chandler  
<[hidden email]> wrote:

> On Sat, Dec 19, 2009 at 02:38:20PM +0100, Claudio Jeker wrote:
>> On Sat, Dec 19, 2009 at 06:17:50AM -0700, Darrin Chandler wrote:
>>> On Sat, Dec 19, 2009 at 01:54:54PM +0100, ropers wrote:
>>>> 2009/12/19 Henning Brauer <[hidden email]>:
>>>>> any excuse to not know python is a good and valid one. any.
>>>>
>>>> If you have the time, I'd love to hear you elaborate. So far most
>>>> people whose opinion I value have only said good things about  
>>>> Python.
>>>> You're the first person whose opinion I respect to go against that.
>>>
>>> You just need to talk to more people, then. Lots of people don't  
>>> like
>>> Python. Same for Perl, Ruby, or anything else. I've heard several  
>>> devs
>>> say they don't like Python but I have yet to hear any of them  
>>> actually
>>> give a reason. Ask them why they don't like C++ and you get a big  
>>> list
>>> of everything that's wrong with it. Ask about Python and you get "it
>>> sucks" or "it's awful" or something. So I think it's just a matter  
>>> of
>>> taste.
>>>
>>> Or maybe Henning has actual reasons. I haven't heard him talk about
>>> Python before so I don't know. Henning?
>>>
>>
>> Ugh, a programming language where you can't copy paste from xterm  
>> to xterm
>> without fucking up the program is just way to much pain to work on.
>> The indenting of code is an optical help but should not change the
>> behaviour of the program. For me it is important to be able to  
>> write code
>> with style(9) in mind (and I think most other BSD developpers think
>> similar because our code all looks similar).
>
> I have often done copy/paste with Python code between xterms. Of  
> course
> you must fix indenting. If you naively copy/paste C you will also have
> issues of syntax and meaning, but if you are so used to looking at C
> code that the meaning in the new context is immediately obvious  
> without
> thinking then you will not notice. Instead you just fix/adjust it in
> place and move on.
>
> Some people will never like indent having meaning. But there is  
> value in
> having an 'else' that *looks* like it belongs with an 'if' actually
> belong to that 'if', *because* it looks like it does. You don't ever
> have to like Python, but indenting to make blocks is perfectly
> cromulent. It's not a deficiency, it's just different.
>
> --
> Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
> [hidden email]   |  http://phxbug.org/      |  http://metabug.org/
> http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG  
> Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Darrin Chandler
On Sat, Dec 19, 2009 at 10:03:00AM -0500, Ted Unangst wrote:
> It's very hard to fix the indenting when you're copying code from a
> web forum/email archive/whatnot that mangled it. Been there done
> that. Pythons behavior in this regard makes it very aggravating to
> work with as a newcomer, and for many people who are a little
> suspicious of the whole whitespace thing, when your first taste of
> the language is hours spent fixing the whitespace, you aren't
> inclined to use it any more than necessary.

I agree that copy/paste from the web would be challenging for newcomers.
Pastes from the web do horrible things to indenting. If you aren't
comfortable with Python it'd be a huge pain.

--
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[hidden email]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Floor Terra
In reply to this post by Claudio Jeker
On Sat, Dec 19, 2009 at 2:38 PM, Claudio Jeker <[hidden email]> wrote:
> Ugh, a programming language where you can't copy paste from xterm to xterm
> without fucking up the program is just way to much pain to work on.

I agree that copy/paste is a big problem in Python.
But in my experience copy/paste of code in any language is dangerous.
If you want to re-use code, write a function.



--
Floor Terra <[hidden email]>
www: http://brobding.mine.nu/

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Henning Brauer
* Floor Terra <[hidden email]> [2009-12-19 16:47]:
> But in my experience copy/paste of code in any language is dangerous.

[ ] you have ever seriously used C

heck, even perl.

--
Henning Brauer, [hidden email], [hidden email]
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Floor Terra
On Sat, Dec 19, 2009 at 6:08 PM, Henning Brauer <[hidden email]> wrote:
> * Floor Terra <[hidden email]> [2009-12-19 16:47]:
>> But in my experience copy/paste of code in any language is dangerous.
>
> [ ] you have ever seriously used C
>
> heck, even perl.
>

In my experience (mostly python and c), code that has been pasted has
a higher bug density.

This is because most of the copy/paste goes like this:
1) Write some loop
2) Need similar loop
3) copy/paste old loop
4) Modify pasted loop (but forget one tiny change)
5) New loop has bug

It's worse with Python because of the indentation (tabs vs. spaces),
but as a general rule I would say never copy/paste code.

--
Floor Terra <[hidden email]>
www: http://brobding.mine.nu/

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Jonathan Schleifer-3
Floor Terra <[hidden email]> wrote:

> This is because most of the copy/paste goes like this:
> 1) Write some loop
> 2) Need similar loop
> 3) copy/paste old loop
> 4) Modify pasted loop (but forget one tiny change)
> 5) New loop has bug

This is why I never just copy code, but type it. While you type, you
also think about whether it makes sense to just copy the code and you
will notice if you have to adjust something. Saved me quite a few times
and doesn't take too long if you copy only short code. And long code
should never be copied anyway.

--
Jonathan

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Jonathan Schleifer-3
In reply to this post by Darrin Chandler
Darrin Chandler <[hidden email]> wrote:

> I agree that copy/paste from the web would be challenging for
> newcomers. Pastes from the web do horrible things to indenting. If
> you aren't comfortable with Python it'd be a huge pain.

Well, enforced whitespaces are a double-edges sword: While enforcing
newcomes to indent their code correctly and thus getting them used to
the right style and avoiding bad behaviour, it is really a pain in the
ass for testing. If you are just going to test something, you often
have to reindent code. Luckily, vim can do that for you, but still,
it's rather annoying that I have to reformat the code then.

--
Jonathan

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Henning Brauer
In reply to this post by Floor Terra
* Floor Terra <[hidden email]> [2009-12-19 19:10]:

> On Sat, Dec 19, 2009 at 6:08 PM, Henning Brauer <[hidden email]> wrote:
> > * Floor Terra <[hidden email]> [2009-12-19 16:47]:
> >> But in my experience copy/paste of code in any language is dangerous.
> >
> > [ ] you have ever seriously used C
> >
> > heck, even perl.
> >
>
> In my experience (mostly python and c), code that has been pasted has
> a higher bug density.
>
> This is because most of the copy/paste goes like this:
> 1) Write some loop
> 2) Need similar loop
> 3) copy/paste old loop
> 4) Modify pasted loop (but forget one tiny change)
> 5) New loop has bug
>
> It's worse with Python because of the indentation (tabs vs. spaces),
> but as a general rule I would say never copy/paste code.

boo hoo.

there are very valid uses of copied code, or extremely similiar code
(copy & paste and change a few things). we have that many times in the
tree.

the enforced indentation is completely nuts. i purposefully indent
extremely incorrectly when adding debug code that i intend to remove
again, to spot it faster. just one example, there are many more.

python doesn't solve a problem. perl's been there already.

oh, and the 80s sed, i use it a lot. as well as shell scripts.

--
Henning Brauer, [hidden email], [hidden email]
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Darrin Chandler
In reply to this post by Jonathan Schleifer-3
On Sat, Dec 19, 2009 at 07:29:00PM +0100, Jonathan Schleifer wrote:

> Darrin Chandler <[hidden email]> wrote:
>
> > I agree that copy/paste from the web would be challenging for
> > newcomers. Pastes from the web do horrible things to indenting. If
> > you aren't comfortable with Python it'd be a huge pain.
>
> Well, enforced whitespaces are a double-edges sword: While enforcing
> newcomes to indent their code correctly and thus getting them used to
> the right style and avoiding bad behaviour, it is really a pain in the
> ass for testing. If you are just going to test something, you often
> have to reindent code. Luckily, vim can do that for you, but still,
> it's rather annoying that I have to reformat the code then.

You're doing testing wrong and the wrongness has nothing to do with
python. ;-)

--
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[hidden email]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Jonathan Schleifer-3
Darrin Chandler <[hidden email]> wrote:

> You're doing testing wrong and the wrongness has nothing to do with
> python. ;-)

Erm, since when is it wrong to change code for testing, to make sure it
even works under strange circumstances? oO

--
Jonathan

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Darrin Chandler
On Sat, Dec 19, 2009 at 08:32:08PM +0100, Jonathan Schleifer wrote:
> Darrin Chandler <[hidden email]> wrote:
>
> > You're doing testing wrong and the wrongness has nothing to do with
> > python. ;-)
>
> Erm, since when is it wrong to change code for testing, to make sure it
> even works under strange circumstances? oO

When you can write your code to remain testable. If you've changed code,
then you're only testing test code instead of production code. If you
change it back for production, did you change it back correctly? Better
to call the same code from both production and testing.

Yes, I have used your approach. I only use that approach when I must.

--
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[hidden email]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Nick Guenther
In reply to this post by Claudio Jeker
and just to add to the pyre...

On Sat, Dec 19, 2009 at 8:38 AM, Claudio Jeker <[hidden email]> wrote:
>
> Ugh, a programming language where you can't copy paste from xterm to xterm
> without fucking up the program is just way to much pain to work on.


>On Sat, Dec 19, 2009 at 10:03 AM, Ted Unangst <[hidden email]> wrote:
> for many people who are a little suspicious of the whole
> whitespace thing, when your first taste of the language is hours spent
> fixing the whitespace, you aren't inclined to use it any more than
> necessary.

Your losses then. Python isn't so much a language of recipes, it's a
language of ideas.

On Sat, Dec 19, 2009 at 2:06 PM, Henning Brauer <[hidden email]> wrote:

> * Floor Terra <[hidden email]> [2009-12-19 19:10]:
>>
>> In my experience (mostly python and c), code that has been pasted has
>> a higher bug density.
>>
>> It's worse with Python because of the indentation (tabs vs. spaces),
>> but as a general rule I would say never copy/paste code.
>
> boo hoo.
>
> there are very valid uses of copied code, or extremely similiar code
> (copy & paste and change a few things). we have that many times in the
> tree.

Python is about thinking about what you're doing. It's one of those
languages that forces you to work on a higher level (not that there
aren't lots of places where python is used as a scripting
language--that code tends to come out badly, but that's because it's
written just to get the job done).

Ideal code is abstracted code, what possible use does repeating
yourself in the tree have? I know drivers have to declare a common set
of globals and make some macro calls and various entry-points are
found by sticking to a naming scheme, but that's trivia, hardly enough
to justify "valid uses for copied code". Anytime I find myself wanting
to copy some code it's always meant I've stumbled over an abstraction
I haven't made yet, so what in the world is src/ doing that -requires-
copied code?

-Nick

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Ryan Flannery
On Sat, Dec 19, 2009 at 2:51 PM, Nick Guenther <[hidden email]> wrote:

> Python is about thinking about what you're doing. It's one of those
> languages that forces you to work on a higher level (not that there
> aren't lots of places where python is used as a scripting
> language--that code tends to come out badly, but that's because it's
> written just to get the job done).
>
> Ideal code is abstracted code, what possible use does repeating
> yourself in the tree have? I know drivers have to declare a common set
> of globals and make some macro calls and various entry-points are
> found by sticking to a naming scheme, but that's trivia, hardly enough
> to justify "valid uses for copied code". Anytime I find myself wanting
> to copy some code it's always meant I've stumbled over an abstraction
> I haven't made yet, so what in the world is src/ doing that -requires-
> copied code?

I must disagree here... there's nothing about *any* programming
language [1] that forces one to work on a higher level.  That's up to
the programmer.  I've seen even the simplest tasks, or ones that
scream for a nice, simple abstraction, done horribly (if at all) in
any language, including python.  My experience grading countless
programs from freshman-senior students, which are increasingly written
in python, show it's not the programming language... it's the
programmer.

Good design + good coding practices + tons-o-work  forces one to think
more and come up with a better design, not the language.

-ryan

[1] except of course for Haskell, the ONE TRUE GOD of proper programming :P

Reply | Threaded
Open this post in threaded view
|

Re: OT: Python (was Re: vi in /bin)

Claudio Jeker
In reply to this post by Nick Guenther
On Sat, Dec 19, 2009 at 02:51:32PM -0500, Nick Guenther wrote:

> and just to add to the pyre...
>
> On Sat, Dec 19, 2009 at 8:38 AM, Claudio Jeker <[hidden email]> wrote:
> >
> > Ugh, a programming language where you can't copy paste from xterm to xterm
> > without fucking up the program is just way to much pain to work on.
>
>
> >On Sat, Dec 19, 2009 at 10:03 AM, Ted Unangst <[hidden email]> wrote:
> > for many people who are a little suspicious of the whole
> > whitespace thing, when your first taste of the language is hours spent
> > fixing the whitespace, you aren't inclined to use it any more than
> > necessary.
>
> Your losses then. Python isn't so much a language of recipes, it's a
> language of ideas.
>

Python is a bit like mother russia, it is thinking for you.

> On Sat, Dec 19, 2009 at 2:06 PM, Henning Brauer <[hidden email]> wrote:
> > * Floor Terra <[hidden email]> [2009-12-19 19:10]:
> >>
> >> In my experience (mostly python and c), code that has been pasted has
> >> a higher bug density.
> >>
> >> It's worse with Python because of the indentation (tabs vs. spaces),
> >> but as a general rule I would say never copy/paste code.
> >
> > boo hoo.
> >
> > there are very valid uses of copied code, or extremely similiar code
> > (copy & paste and change a few things). we have that many times in the
> > tree.
>
> Python is about thinking about what you're doing. It's one of those
> languages that forces you to work on a higher level (not that there
> aren't lots of places where python is used as a scripting
> language--that code tends to come out badly, but that's because it's
> written just to get the job done).
>

Yeah, we C-programmers are just mastrubating monkeys poking the typewrite
till it produces compiling code. If you don't think about what your doing
you get the crap code you see everywhere and it is not depending on the
language used.

> Ideal code is abstracted code, what possible use does repeating
> yourself in the tree have? I know drivers have to declare a common set
> of globals and make some macro calls and various entry-points are
> found by sticking to a naming scheme, but that's trivia, hardly enough
> to justify "valid uses for copied code". Anytime I find myself wanting
> to copy some code it's always meant I've stumbled over an abstraction
> I haven't made yet, so what in the world is src/ doing that -requires-
> copied code?
>

Code abstraction is nice until you have to update a vendor driver or some
other highly abstracted nightmare. Been there, done that, got the
nightmares. Sometimes it is far better to copy a few lines instead of
abstracting an interface until it is unusable.

No programming language will redeem people from thinking and designing
their projects correctly.

--
:wq Claudio

12