Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9501 > unrolled thread
| Started by | Inside <fancheyujian@gmail.com> |
|---|---|
| First post | 2011-07-14 19:58 -0700 |
| Last post | 2011-07-15 00:29 -0700 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.python
Re: list(),tuple() should not place at "Built-in functions" in documentation Inside <fancheyujian@gmail.com> - 2011-07-14 19:58 -0700
Re: list(),tuple() should not place at "Built-in functions" in documentation Ben Finney <ben+python@benfinney.id.au> - 2011-07-15 13:47 +1000
Re: list(),tuple() should not place at "Built-in functions" in documentation "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 00:27 -0700
Re: list(),tuple() should not place at "Built-in functions" in documentation "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 00:29 -0700
| From | Inside <fancheyujian@gmail.com> |
|---|---|
| Date | 2011-07-14 19:58 -0700 |
| Subject | Re: list(),tuple() should not place at "Built-in functions" in documentation |
| Message-ID | <1a116129-bf90-47eb-bdd4-eb0ab82080c8@glegroupsg2000goo.googlegroups.com> |
Hey guy,thx for you feedback first. But I can't follow your opinion.Why?because of the list & tuple are placed at built-in function,so before I type 'list' unintentionally on the pyshell and it show me "<type 'list'>", I never know that the name 'list' is a type,I used to consider it's a function to produce 'list' type. so,after I figure out this matter,I have to change all my code "assert isinstance(someobj, (type([]), type((0, ))))" to "assert isinstance(someobj, (list, tuple))",that's not a funny job. I hope that I can stay in the Python abstract layer to solve problem(although go to the C API is OK but I don't want to),I'm going to trust what the doc telling me,so I hope the doc is exact enough.And the doc in the distribution maybe the most popular one. @Steven D'Aprano,yes they can be used as function,but they aren't function and shouldn't confuse newcomers by this.
[toc] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2011-07-15 13:47 +1000 |
| Message-ID | <87ei1sb3x9.fsf@benfinney.id.au> |
| In reply to | #9501 |
Inside <fancheyujian@gmail.com> writes: > But I can't follow your opinion.Why?because of the list & tuple are > placed at built-in function,so before I type 'list' unintentionally on > the pyshell and it show me "<type 'list'>", I never know that the name > 'list' is a type,I used to consider it's a function to produce 'list' > type. That's the kind of fundamental knowledge that one gains by working through the Python tutorial <URL:http://docs.python.org/tutorial/>. The library reference is not the place for teaching that information. > so,after I figure out this matter,I have to change all my code "assert > isinstance(someobj, (type([]), type((0, ))))" to "assert > isinstance(someobj, (list, tuple))",that's not a funny job. If you think you need to do such assertions, that's a code smell; it's rare to need that kind of assertion and should only be done with good reason since it breaks polymorphism. Why are you doing it? > I hope that I can stay in the Python abstract layer to solve > problem(although go to the C API is OK but I don't want to),I'm going > to trust what the doc telling me,so I hope the doc is exact enough.And > the doc in the distribution maybe the most popular one. Including the tutorial, so now you have your homework to do :-) > @Steven D'Aprano,yes they can be used as function,but they aren't > function and shouldn't confuse newcomers by this. Agreed; however, it seems reasonable people can disagree on how much that matters. I think it should be fixed, but not enough to push for it. -- \ “Leave nothing to chance. Overlook nothing. Combine | `\ contradictory observations. Allow yourself enough time.” | _o__) —Hippocrates | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> |
|---|---|
| Date | 2011-07-15 00:27 -0700 |
| Message-ID | <0931c21b-54c2-4c31-9eed-9d084168a2f2@o4g2000vbv.googlegroups.com> |
| In reply to | #9501 |
On Jul 15, 4:58 am, Inside <fancheyuj...@gmail.com> wrote: > Hey guy,thx for you feedback first. > > But I can't follow your opinion.Why?because of the list & tuple are placed at built-in function,so before I type 'list' unintentionally on the pyshell and it show me "<type 'list'>", I never know that the name 'list' is a type,I used to consider it's a function to produce 'list' type. > > so,after I figure out this matter,I have to change all my code "assert isinstance(someobj, (type([]), type((0, ))))" to "assert isinstance(someobj, (list, tuple))",that's not a funny job. Are you sure you need such assertions in your code ?
[toc] | [prev] | [next] | [standalone]
| From | "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> |
|---|---|
| Date | 2011-07-15 00:29 -0700 |
| Message-ID | <47b67c4c-6171-42d6-85f3-c4ed61ade8ad@f35g2000vbr.googlegroups.com> |
| In reply to | #9513 |
On Jul 15, 9:27 am, "bruno.desthuilli...@gmail.com" <bruno.desthuilli...@gmail.com> wrote: > On Jul 15, 4:58 am, Inside <fancheyuj...@gmail.com> wrote: > > > Hey guy,thx for you feedback first. > > > But I can't follow your opinion.Why?because of the list & tuple are placed at built-in function,so before I type 'list' unintentionally on the pyshell and it show me "<type 'list'>", I never know that the name 'list' is a type,I used to consider it's a function to produce 'list' type. > > > so,after I figure out this matter,I have to change all my code "assert isinstance(someobj, (type([]), type((0, ))))" to "assert isinstance(someobj, (list, tuple))",that's not a funny job. > > Are you sure you need such assertions in your code ? Sorry, Ben already mentionned this. Need more coffee obviously :-/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web