Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76510 > unrolled thread
| Started by | "ElChino" <elchino@cnn.cn> |
|---|---|
| First post | 2014-08-18 22:35 +0200 |
| Last post | 2014-08-21 21:42 +0200 |
| Articles | 20 on this page of 44 — 20 participants |
Back to article view | Back to comp.lang.python
'is not' or '!=' "ElChino" <elchino@cnn.cn> - 2014-08-18 22:35 +0200
Re: 'is not' or '!=' MRAB <python@mrabarnett.plus.com> - 2014-08-18 21:53 +0100
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-18 23:53 +0300
Re: 'is not' or '!=' "ElChino" <elchino@cnn.cn> - 2014-08-18 22:58 +0200
Re: 'is not' or '!=' Ethan Furman <ethan@stoneleaf.us> - 2014-08-18 14:42 -0700
Re: 'is not' or '!=' Ethan Furman <ethan@stoneleaf.us> - 2014-08-18 15:19 -0700
Re: 'is not' or '!=' Chris Kaynor <ckaynor@zindagigames.com> - 2014-08-18 15:04 -0700
Re: 'is not' or '!=' Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-08-19 11:49 +0200
Re: 'is not' or '!=' Martin S <shieldfire@gmail.com> - 2014-08-19 14:42 +0200
Re: 'is not' or '!=' Skip Montanaro <skip@pobox.com> - 2014-08-19 08:12 -0500
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-19 20:29 +0300
Re: 'is not' or '!=' Tim Chase <python.list@tim.thechases.com> - 2014-08-19 12:34 -0500
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-19 21:18 +0300
Re: 'is not' or '!=' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-20 04:26 +1000
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-19 21:52 +0300
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-20 00:00 +0300
Re: 'is not' or '!=' Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-19 16:21 -0600
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-20 02:02 +0300
Re: 'is not' or '!=' Rustom Mody <rustompmody@gmail.com> - 2014-08-20 22:03 -0700
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-21 08:56 +0300
Re: 'is not' or '!=' Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-19 20:05 +0100
Re: 'is not' or '!=' Terry Reedy <tjreedy@udel.edu> - 2014-08-19 18:23 -0400
Re: 'is not' or '!=' Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-19 10:42 -0600
Re: 'is not' or '!=' Marko Rauhamaa <marko@pacujo.net> - 2014-08-19 20:36 +0300
Re: 'is not' or '!=' Skip Montanaro <skip@pobox.com> - 2014-08-19 13:44 -0500
Re: 'is not' or '!=' alister <alister.nospam.ware@ntlworld.com> - 2014-08-19 09:35 +0000
Re: 'is not' or '!=' Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-08-19 11:53 +0200
Re: 'is not' or '!=' Rustom Mody <rustompmody@gmail.com> - 2014-08-18 19:29 -0700
Re: 'is not' or '!=' Steven D'Aprano <steve@pearwood.info> - 2014-08-19 08:36 +0000
Re: 'is not' or '!=' Chris Angelico <rosuav@gmail.com> - 2014-08-19 18:47 +1000
Re: 'is not' or '!=' Tim Chase <python.list@tim.thechases.com> - 2014-08-19 05:36 -0500
Re: 'is not' or '!=' Ben Finney <ben+python@benfinney.id.au> - 2014-08-20 09:24 +1000
Re: 'is not' or '!=' Rustom Mody <rustompmody@gmail.com> - 2014-08-19 21:01 -0700
Re: 'is not' or '!=' Steven D'Aprano <steve@pearwood.info> - 2014-08-20 04:59 +0000
Re: 'is not' or '!=' Rustom Mody <rustompmody@gmail.com> - 2014-08-19 22:25 -0700
Re: 'is not' or '!=' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-20 21:05 +1000
Re: 'is not' or '!=' Chris Angelico <rosuav@gmail.com> - 2014-08-20 21:17 +1000
Re: 'is not' or '!=' Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-08-21 20:31 +0200
Re: 'is not' or '!=' Tim Chase <python.list@tim.thechases.com> - 2014-08-20 06:26 -0500
Re: 'is not' or '!=' Chris Angelico <rosuav@gmail.com> - 2014-08-20 21:33 +1000
Re: 'is not' or '!=' Robert Kern <robert.kern@gmail.com> - 2014-08-20 12:40 +0100
Re: 'is not' or '!=' Rustom Mody <rustompmody@gmail.com> - 2014-08-20 05:01 -0700
Re: 'is not' or '!=' Dan Stromberg <drsalists@gmail.com> - 2014-08-21 12:24 -0700
Re: 'is not' or '!=' "ElChino" <elchino@cnn.cn> - 2014-08-21 21:42 +0200
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-08-19 20:05 +0100 |
| Message-ID | <mailman.13164.1408475128.18130.python-list@python.org> |
| In reply to | #76592 |
On 19/08/2014 19:26, Steven D'Aprano wrote: > Marko Rauhamaa wrote: > >> CPython implementation detail: This is the address of the object >> in memory. > > I really wish CPython didn't do that, or at least not admit to it. It does > nothing but confuse people. > I agree and would happily support your issue on the bug tracker to get it deleted from the docs :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-08-19 18:23 -0400 |
| Message-ID | <mailman.13171.1408487062.18130.python-list@python.org> |
| In reply to | #76592 |
On 8/19/2014 3:05 PM, Mark Lawrence wrote: > On 19/08/2014 19:26, Steven D'Aprano wrote: >> Marko Rauhamaa wrote: >> >>> CPython implementation detail: This is the address of the object >>> in memory. >> >> I really wish CPython didn't do that, or at least not admit to it. It >> does >> nothing but confuse people. >> > > I agree and would happily support your issue on the bug tracker to get > it deleted from the docs :) It was added to the docs because people noticed that CPython ids looked like addresses and assumed incorrectly that this is a language property. In other words, the point is not to say that CPython uses addresses - people already know or discover that, but to say that the addresses are *only* implementation detail. That said, I agree that it unfortunately *does* unnecessarily inform people who do not know that and probably confuses some who do not understand why they are being told something they don't need to know. We could discuss alternatives here. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-08-19 10:42 -0600 |
| Message-ID | <mailman.13154.1408466618.18130.python-list@python.org> |
| In reply to | #76513 |
On Tue, Aug 19, 2014 at 7:12 AM, Skip Montanaro <skip@pobox.com> wrote:
> The use of "is" or "is not" is the right thing to do when the object
> of the comparison is known to be a singleton. That is true for None.
> (I suspect it's true for True and False as well, though for historical
> and idiomatic reasons "x is True" is never used.) It would also be
> true if you created a sentinel object like this:
>
> SENTINEL = []
When I need to do this, I use:
SENTINEL = object()
It's still a singleton, and why should a sentinel be mutable?
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2014-08-19 20:36 +0300 |
| Message-ID | <871tsc7556.fsf@elektro.pacujo.net> |
| In reply to | #76576 |
Ian Kelly <ian.g.kelly@gmail.com>: > When I need to do this, I use: > > SENTINEL = object() > > It's still a singleton, and why should a sentinel be mutable? Private enums are often nicer in that they provide str() and repr(). Marko
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip@pobox.com> |
|---|---|
| Date | 2014-08-19 13:44 -0500 |
| Message-ID | <mailman.13162.1408473879.18130.python-list@python.org> |
| In reply to | #76513 |
On Tue, Aug 19, 2014 at 11:42 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > When I need to do this, I use: > > SENTINEL = object() > > It's still a singleton, and why should a sentinel be mutable? Old habits die hard, I guess. I've been using Python since long before object() existed. :-) Skip
[toc] | [prev] | [next] | [standalone]
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Date | 2014-08-19 09:35 +0000 |
| Message-ID | <iTEIv.3706$9I4.2004@fx35.am4> |
| In reply to | #76512 |
On Mon, 18 Aug 2014 23:53:49 +0300, Marko Rauhamaa wrote: > "ElChino" <elchino@cnn.cn>: > >> A newbie question to you; what is the difference between statements >> like: >> if x is not None: >> and if x != None: > > Do the following: take two $10 bills. Hold one bill in the left hand, > hold the other bill in the right hand. > > Now, the bill in the left hand "is not" the bill in the right hand. > However, the bill in the left hand "==" the bill in the right hand. > >> Without any context, which one should be preferred? >> IMHO, the latter is more readable. > > In almost all cases, both tests would result in the same behavior. > However, the "is not" test is conceptually the correct one since you > want to know if x is the one and only None object. You don't want to be > fooled by an imposter object that simply looks like the None object. > Frankly, I don't know of any other object that is "==" to the None > object except None itself, but such objects could possible exist. > > > Marko Depending on context you may 'Want' 0 to be equal to none however as far as python is concerned it is not. -- "Why must you tell me all your secrets when it's hard enough to love you knowing nothing?" -- Lloyd Cole and the Commotions
[toc] | [prev] | [next] | [standalone]
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Date | 2014-08-19 11:53 +0200 |
| Message-ID | <lsv6q5$ve0$1@r01.glglgl.de> |
| In reply to | #76512 |
Am 18.08.2014 22:53 schrieb Marko Rauhamaa:
> Frankly, I don't know of any other object that is "==" to the None
> object except None itself, but such objects could possible exist.
class ImitatingNone(object):
def __eq__(self, other):
return True # is equal to everything else
return other is None # is equal only to None
return not(other) # is equal to everything which is falsey
Pick one.
Thomas
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-08-18 19:29 -0700 |
| Message-ID | <23643064-3716-49cb-87b8-a8c42f39feef@googlegroups.com> |
| In reply to | #76510 |
On Tuesday, August 19, 2014 2:05:01 AM UTC+5:30, ElChino wrote: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: > Without any context, which one should be preferred? > IMHO, the latter is more readable. Here is Terry Reedy, a python-dev, from Mar 2, on this list on 'is' | The 'is' operator has three uses, two intended and one not. In | production code, 'is' tests that an object *is* a particular singular | object, such as None or a sentinel instance of class object². In test | code, 'is' can also be used to test details of a particular | implementation, such as pre-allocation of small ints. New python | programmers also use it to confuse themselves. which I would summarize by "if you are a beginner you dont want to deal with is"¹ As for Marko's dollar bill example: I find it very plausible and still more misleading because: 1. We write computer programs because we want to understand/manipulate something outside the computer -- 'reality' 2. The computer program never deals with that reality directly but at one or more removes -- it handles models eg. You go to a real-estate agent to buy an apartment and see two plaster of paris models is his office. Different cases may emerge: a. The models are for two different projects -- one on the North and one on the East side of town b. They are two facades of the same project OTOH the fact that there are two distinct plaster of paris objects in the agent's office is true but mostly irrelevant. ie if the agent says "These two ARE the same" he means they are different views of the same building. IOW python's use of the word 'is' is misleading and unfortunate ¹ "... is None" is an exception -- unfortunate in my view. Treat the 'is None' as atomic write it but and dont look inside! ² Same as case 3
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-08-19 08:36 +0000 |
| Message-ID | <53f30c89$0$11123$c3e8da3@news.astraweb.com> |
| In reply to | #76537 |
On Mon, 18 Aug 2014 19:29:11 -0700, Rustom Mody wrote: > On Tuesday, August 19, 2014 2:05:01 AM UTC+5:30, ElChino wrote: >> A newbie question to you; what is the difference between statements >> like: >> if x is not None: >> and >> if x != None: > >> Without any context, which one should be preferred? IMHO, the latter is >> more readable. > > Here is Terry Reedy, a python-dev, from Mar 2, on this list on 'is' > > | The 'is' operator has three uses, two intended and one not. In > | production code, 'is' tests that an object *is* a particular singular > | object, such as None or a sentinel instance of class object². In test > | code, 'is' can also be used to test details of a particular > | implementation, such as pre-allocation of small ints. New python > | programmers also use it to confuse themselves. Hah :-) You'll notice that use-case #2, testing implementation details, is just a special case of #1, testing that a value is a specific instance. > which I would summarize by "if you are a beginner you dont want to deal > with is"¹ In general, correct. Actually, even experts should hardly ever need to use `is`. And as you point out, "is None" is an exception. > As for Marko's dollar bill example: > I find it very plausible and still more misleading because: [...snip example of plaster-of-paris models...] > OTOH the fact that there are two distinct plaster of paris objects in > the agent's office is true but mostly irrelevant. ie if the agent says > "These two ARE the same" he means they are different views of the same > building. > IOW python's use of the word 'is' is misleading and unfortunate The English word "is" is the third-person singular simple present indicative form of "be", quoting Wiktionary: http://en.wiktionary.org/wiki/is#English The word "be" (is, was, been, will be, has been, etc.) has many different meanings and usage, including: - mathematical equality, "two times three is six"; - metaphorical equivalence, "he is a dumb ox"; - linking the subject to a count or measurement, "this building is 300 years old"; - to connect a noun to an adjective, "my shirt is wrinkled"; - to connect the subject noun to a noun or noun phrase, "she is a petty dictator"; - to indicate that the subject and object are the same, "Elizabeth Windsor[1] is the Queen of England"; and quite a few more. http://en.wiktionary.org/wiki/be#English There is no requirement that the word "is" can only be used in a programming language if it reflects all of these meanings. After all, we don't expect that the jargon terms "function", "object", "class", "method", "procedure" as used by programming languages have *precisely* the same meanings as used in plain English. A programming language is entitled to choose the meaning of its keywords, hopefully they would be familiar meanings not radically dissimilar from the normal plain English meaning (or whatever language the word is taken from). Hypertalk, and its descendants, use "is" as a synonym for equality, so that "x is 2" and "x = 2" mean exactly the same thing. Python, on the other hand, gives "is" a specific meaning: are the two operands the same instance? Although all men and women are equal, only one such person is Elizabeth II Queen of England. [1] It isn't clear or obvious what the Queen[2] would use as a surname on the unlikely event she needed one. Even the official website of the UK royal family is unclear as to what Elizabeth II would use as a surname since her marriage. Prior to her marriage, she used "Elizabeth Windsor" on those rare occasions that "Princess Elizabeth" or "Queen Elizabeth II" was not sufficient. Her children, should they need a surname, use Mountbatten-Windsor. Prince William and Harry used the surname "Wales" (for their father's title, Prince of Wales) upon joining the military. The whole thing is oh so very complicated. http://www.royal.gov.uk/ThecurrentRoyalFamily/TheRoyalFamilyname/Overview.aspx Why do I know so much about the British royal family??? [2] Of the UK, Australia, and a few other places, but not Denmark, or any other place with a Queen. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-08-19 18:47 +1000 |
| Message-ID | <mailman.13135.1408438071.18130.python-list@python.org> |
| In reply to | #76542 |
On Tue, Aug 19, 2014 at 6:36 PM, Steven D'Aprano <steve@pearwood.info> wrote: > Why do I know so much about the British royal family??? > > > [2] Of the UK, Australia, and a few other places, but not Denmark, or any > other place with a Queen. Possibly because British royalty is very well-defined, and can be used to explain other, even fictional, royalty. We can examine Arendelle and notice that, even though most Queens Consort would be addressed equivalently to a Queen Regnant, their Queen Consort is addressed equivalently to a princess. (She's addressed as Highness as she embarks on her last sea voyage.) Why do I know so much about the Arendelle royal family? Hmm. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2014-08-19 05:36 -0500 |
| Message-ID | <mailman.13141.1408444676.18130.python-list@python.org> |
| In reply to | #76542 |
On 2014-08-19 08:36, Steven D'Aprano wrote: > The English word "is" is the third-person singular simple present > indicative form of "be", Am I the only one who feels the urge to write if i am some_other_object: ... if we are some_other_object: ... if u are some_other_object: ... # though txtspk bothers me instead of using "is" for reasons of grammatical correctness? I've changed variable-names to avoid this on occasion. :-) -tkc
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2014-08-20 09:24 +1000 |
| Message-ID | <mailman.13180.1408490660.18130.python-list@python.org> |
| In reply to | #76542 |
Tim Chase <python.list@tim.thechases.com> writes: > Am I the only one who feels the urge to write > > if i am some_other_object: ... > if we are some_other_object: ... > if u are some_other_object: ... # though txtspk bothers me How often do you need to refer to an object with personal pronouns? I think for me the answer is “never”. Why not name the specific role the object is playing, rather than the indirectness of personal pronouns? So, in short: you may not be the only one, but I find it difficult to imagine why anyone would be motivated to do that. -- \ “When I was born I was so surprised I couldn't talk for a year | `\ and a half.” —Gracie Allen | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-08-19 21:01 -0700 |
| Message-ID | <49dc19e9-9dff-4304-a478-afff9cf316e9@googlegroups.com> |
| In reply to | #76623 |
On Wednesday, August 20, 2014 4:54:00 AM UTC+5:30, Ben Finney wrote: > Tim Chase writes: > > Am I the only one who feels the urge to write > > if i am some_other_object: ... > > if we are some_other_object: ... > > if u are some_other_object: ... # though txtspk bothers me > How often do you need to refer to an object with personal pronouns? I > think for me the answer is "never". Why not name the specific role the > object is playing, rather than the indirectness of personal pronouns? > So, in short: you may not be the only one, but I find it difficult to > imagine why anyone would be motivated to do that. If you've taught beginners its not so surprising -- Ive heard all kinds of - I go here - I try this again - I come back where that 'I' is some procedure/program-counter-ish notion and the listener is supposed to figure out what exactly the speaker is (currently) identifying with :-) Ive never heard 'we-s' and 'u-s' though I also (once!) had a student who started every single variable/function/filename with his name!!
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2014-08-20 04:59 +0000 |
| Message-ID | <53f42b21$0$29884$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #76632 |
On Tue, 19 Aug 2014 21:01:49 -0700, Rustom Mody wrote: > I also (once!) had a student who started every single > variable/function/filename with his name!! I recall somebody on the Python tutor mailing list doing that. They did so because their course instructor made it a requirement and failed anyone who didn't. No reason was given, according to the student, but I imagine that the instructor was trying to teach them "best practice" *cough* for multi- user projects, so you can identify who first created each function or variable. from guidosys import guidoversion; guidoprint(guidoversion)-ly yr's, -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-08-19 22:25 -0700 |
| Message-ID | <4f897281-dbf2-40d3-96ef-78c23f080e48@googlegroups.com> |
| In reply to | #76634 |
On Wednesday, August 20, 2014 10:29:13 AM UTC+5:30, Steven D'Aprano wrote: > On Tue, 19 Aug 2014 21:01:49 -0700, Rustom Mody wrote: > > I also (once!) had a student who started every single > > variable/function/filename with his name!! > I recall somebody on the Python tutor mailing list doing that. They did > so because their course instructor made it a requirement and failed > anyone who didn't. > No reason was given, according to the student, but I imagine that the > instructor was trying to teach them "best practice" *cough* for multi- > user projects, so you can identify who first created each function or > variable. It is interesting (and insidious) how technology shapes our thinking patterns. Before git, such tracking could be a headache. Things like git blame give an automated list 'blaming' each line on its perpetrator. Likewise when teaching (with) C it was immoral behaviour to not match malloc and free, file-open and close. Today the first is impossible and the second is unnecessary and wasteful
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-08-20 21:05 +1000 |
| Message-ID | <53f48107$0$29971$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #76636 |
Rustom Mody wrote: > It is interesting (and insidious) how technology shapes our thinking > patterns. Before git, Pardon me, but git did not invent revision control. There are dozens of revision control software applications, including: Mercurial: released April 2005 Git: released April 2005 GNU Bazaar: released March 2005 Subversion: 2000 Clearcase: 1992 CVS: 1990 Even venerable old cvs tracked authors. > such tracking could be a headache. Things like > git blame give an automated list 'blaming' each line on its > perpetrator. > > Likewise when teaching (with) C it was immoral behaviour to not match > malloc and free, file-open and close. > Today the first is impossible and the second is unnecessary and wasteful If you're talking about Python, in the second case you're mistaken. Although it is not *compulsory* to close files in Python, since the garbage collector will eventually do so for you, it is considered good practice to do so. Generally it is considered best to use a `with open(...) as f` block, and Python will automatically close the file as soon as the block is left, but manually calling f.close() is still an option. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-08-20 21:17 +1000 |
| Message-ID | <mailman.13197.1408533434.18130.python-list@python.org> |
| In reply to | #76652 |
On Wed, Aug 20, 2014 at 9:05 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Rustom Mody wrote: > >> It is interesting (and insidious) how technology shapes our thinking >> patterns. Before git, > > Pardon me, but git did not invent revision control. There are dozens of > revision control software applications, including: > > Mercurial: released April 2005 > Git: released April 2005 > GNU Bazaar: released March 2005 > Subversion: 2000 > Clearcase: 1992 > CVS: 1990 > > Even venerable old cvs tracked authors. That's true, but how easy is it to annotate a file with each line's author (or, at least, to figure out who wrote some particular line of code)? It's easy enough with 'git blame' or 'hg blame', and it wouldn't surprise me if bzr had a similar feature; but that's all the current generation of version control systems. I don't think cvs or svn offered that kind of feature. Sure it's possible in theory - the information is all there - but if you can't pull it up when you want it, it's not that helpful. Personally, I like to just edit the line of code (add a character or something), save the file, then pull up gitk and look at "Unstaged Changes", from which I can right-click and say "Show origin of this line". Much faster than a full 'git blame'. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Date | 2014-08-21 20:31 +0200 |
| Message-ID | <lt5dte$fpo$1@r01.glglgl.de> |
| In reply to | #76653 |
Am 20.08.2014 13:17 schrieb Chris Angelico:
> That's true, but how easy is it to annotate a file with each line's
> author (or, at least, to figure out who wrote some particular line of
> code)? It's easy enough with 'git blame' or 'hg blame', and it
> wouldn't surprise me if bzr had a similar feature; but that's all the
> current generation of version control systems. I don't think cvs or
> svn offered that kind of feature.
$ LANG=C svn help blame
blame (praise, annotate, ann): Output the content of specified files or
URLs with revision and author information in-line.
usage: blame TARGET[@REV]...
$ cvs help
Unknown command: `help'
CVS commands are:
add Add a new file/directory to the repository
admin Administration front end for rcs
annotate Show last revision where each line was modified
[...]
IMHO annotate does the same what blame does on other VCS.
Thomas
[toc] | [prev] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2014-08-20 06:26 -0500 |
| Message-ID | <mailman.13198.1408534103.18130.python-list@python.org> |
| In reply to | #76652 |
On 2014-08-20 21:17, Chris Angelico wrote: > That's true, but how easy is it to annotate a file with each line's > author (or, at least, to figure out who wrote some particular line > of code)? It's easy enough with 'git blame' or 'hg blame', and it > wouldn't surprise me if bzr had a similar feature; but that's all > the current generation of version control systems. I don't think > cvs or svn offered that kind of feature. Just for the record, at least SVN has "svn blame" which will annotate with the committer's name/id. I use it all the time at $DAYJOB. I've managed to avoid CVS, so I can't speak to that. -tkc
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-08-20 21:33 +1000 |
| Message-ID | <mailman.13199.1408534439.18130.python-list@python.org> |
| In reply to | #76652 |
On Wed, Aug 20, 2014 at 9:26 PM, Tim Chase <python.list@tim.thechases.com> wrote: > On 2014-08-20 21:17, Chris Angelico wrote: >> That's true, but how easy is it to annotate a file with each line's >> author (or, at least, to figure out who wrote some particular line >> of code)? It's easy enough with 'git blame' or 'hg blame', and it >> wouldn't surprise me if bzr had a similar feature; but that's all >> the current generation of version control systems. I don't think >> cvs or svn offered that kind of feature. > > Just for the record, at least SVN has "svn blame" which will annotate > with the committer's name/id. I use it all the time at $DAYJOB. I've > managed to avoid CVS, so I can't speak to that. > Ah, was not aware of that. But my usage of svn has been pretty minimal (just basic cloning of a repo and such; I think I started svn'ing one project at one point, got to maybe four revisions, and then the project stagnated for long enough that I met git), and my cvs even less so (I cloned exactly one repo, then ran into difficulties, asked on the mailing list about compiling the version from cvs, and after a few exchanges, someone said "Wait... when you say cvs, do you literally mean cvs? We moved to git a little while ago, that's now out of date" and I moved to git forthwith), so I have no experience with even slightly advanced tools. ChrisA
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.python
csiph-web