Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106799 > unrolled thread
| Started by | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| First post | 2016-04-10 18:51 -0400 |
| Last post | 2016-04-11 17:50 +1000 |
| Articles | 20 on this page of 68 — 20 participants |
Back to article view | Back to comp.lang.python
Most probably a stupid question, but I still want to ask Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 18:51 -0400
Re: Most probably a stupid question, but I still want to ask Chris Angelico <rosuav@gmail.com> - 2016-04-11 08:58 +1000
Re: Most probably a stupid question, but I still want to ask Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 09:04 +1000
Re: Most probably a stupid question, but I still want to ask Stephen Hansen <me+python@ixokai.io> - 2016-04-10 16:30 -0700
Re: Most probably a stupid question, but I still want to ask Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 20:17 -0400
Re: Most probably a stupid question, but I still want to ask Stephen Hansen <me+python@ixokai.io> - 2016-04-10 17:32 -0700
Re: Most probably a stupid question, but I still want to ask Terry Reedy <tjreedy@udel.edu> - 2016-04-10 21:45 -0400
Re: Most probably a stupid question, but I still want to ask Marko Rauhamaa <marko@pacujo.net> - 2016-04-11 08:41 +0300
one-element tuples [Was: Most probably a stupid question, but I still want to ask] Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 20:13 -0400
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Stephen Hansen <me+python@ixokai.io> - 2016-04-10 17:19 -0700
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Stephen Hansen <me+python@ixokai.io> - 2016-04-10 17:18 -0700
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Chris Angelico <rosuav@gmail.com> - 2016-04-11 10:20 +1000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 20:22 -0400
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Stephen Hansen <me+python@ixokai.io> - 2016-04-10 17:28 -0700
Re: one-element tuples Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 10:31 +1000
Re: one-element tuples Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 20:48 -0400
Re: one-element tuples Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 10:56 +1000
Re: one-element tuples Grant Edwards <invalid@invalid.invalid> - 2016-04-11 14:10 +0000
Re: one-element tuples Fillmore <fillmore_remove@hotmail.com> - 2016-04-11 10:11 -0400
Re: one-element tuples Grant Edwards <invalid@invalid.invalid> - 2016-04-11 14:26 +0000
Re: one-element tuples Ned Batchelder <ned@nedbatchelder.com> - 2016-04-10 18:00 -0700
Re: one-element tuples Stephen Hansen <me+python@ixokai.io> - 2016-04-10 18:07 -0700
Re: one-element tuples "Martin A. Brown" <martin@linux-ip.net> - 2016-04-10 18:08 -0700
Re: one-element tuples Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 23:19 -0400
Re: one-element tuples Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-11 09:57 +0300
Re: one-element tuples Larry Hudson <orgnut@yahoo.com> - 2016-04-11 23:01 -0700
Re: one-element tuples Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 11:36 +1000
Re: one-element tuples Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 22:57 -0400
Re: one-element tuples Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 14:10 +1000
Re: one-element tuples Fillmore <fillmore_remove@hotmail.com> - 2016-04-11 00:43 -0400
Re: one-element tuples Stephen Hansen <me+python@ixokai.io> - 2016-04-10 21:54 -0700
Re: one-element tuples Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 15:40 +1000
Re: one-element tuples Rustom Mody <rustompmody@gmail.com> - 2016-04-10 22:07 -0700
Re: one-element tuples BartC <bc@freeuk.com> - 2016-04-11 12:15 +0100
Re: one-element tuples Marko Rauhamaa <marko@pacujo.net> - 2016-04-11 15:12 +0300
Re: one-element tuples Grant Edwards <invalid@invalid.invalid> - 2016-04-11 14:12 +0000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 10:30 +1000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] MRAB <python@mrabarnett.plus.com> - 2016-04-11 01:33 +0100
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Dan Sommers <dan@tombstonezero.net> - 2016-04-11 02:22 +0000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Chris Angelico <rosuav@gmail.com> - 2016-04-11 12:34 +1000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Chris Angelico <rosuav@gmail.com> - 2016-04-11 10:38 +1000
Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask]) Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 10:45 +1000
Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask]) Chris Angelico <rosuav@gmail.com> - 2016-04-11 10:50 +1000
Re: Parens do create a tuple Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 10:57 +1000
Re: Parens do create a tuple Chris Angelico <rosuav@gmail.com> - 2016-04-11 11:04 +1000
Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask]) Stephen Hansen <me@ixokai.io> - 2016-04-10 18:03 -0700
Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask]) Tim Chase <python.list@tim.thechases.com> - 2016-04-10 19:52 -0500
Re: Parens do create a tuple Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 11:41 +1000
Re: Parens do create a tuple Steven D'Aprano <steve@pearwood.info> - 2016-04-11 12:32 +1000
Re: Parens do create a tuple Random832 <random832@fastmail.com> - 2016-04-10 22:51 -0400
Re: Parens do create a tuple Steven D'Aprano <steve@pearwood.info> - 2016-04-11 14:08 +1000
Re: Parens do create a tuple Random832 <random832@fastmail.com> - 2016-04-11 01:27 -0400
Re: Parens do create a tuple Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-11 18:01 +1000
Re: Parens do create a tuple Random832 <random832@fastmail.com> - 2016-04-11 09:42 -0400
Re: Parens do create a tuple Chris Angelico <rosuav@gmail.com> - 2016-04-11 13:02 +1000
Re: Parens do create a tuple Ben Finney <ben+python@benfinney.id.au> - 2016-04-11 14:08 +1000
Re: Parens do create a tuple Chris Angelico <rosuav@gmail.com> - 2016-04-11 11:51 +1000
Re: Parens do create a tuple Steven D'Aprano <steve@pearwood.info> - 2016-04-11 12:57 +1000
Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] Tim Chase <python.list@tim.thechases.com> - 2016-04-10 19:46 -0500
Re: Most probably a stupid question, but I still want to ask Steven D'Aprano <steve@pearwood.info> - 2016-04-11 11:50 +1000
Re: Most probably a stupid question, but I still want to ask Fillmore <fillmore_remove@hotmail.com> - 2016-04-10 22:48 -0400
Re: Most probably a stupid question, but I still want to ask Steven D'Aprano <steve@pearwood.info> - 2016-04-11 13:54 +1000
Re: Most probably a stupid question, but I still want to ask Fillmore <fillmore_remove@hotmail.com> - 2016-04-11 00:03 -0400
Re: Most probably a stupid question, but I still want to ask Stephen Hansen <me+python@ixokai.io> - 2016-04-10 21:46 -0700
Re: Most probably a stupid question, but I still want to ask Rustom Mody <rustompmody@gmail.com> - 2016-04-10 22:18 -0700
Re: Most probably a stupid question, but I still want to ask Stephen Hansen <me+python@ixokai.io> - 2016-04-10 22:42 -0700
Re: Most probably a stupid question, but I still want to ask Rustom Mody <rustompmody@gmail.com> - 2016-04-10 23:57 -0700
Re: Most probably a stupid question, but I still want to ask Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-11 17:50 +1000
Page 1 of 4 [1] 2 3 4 Next page →
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-10 18:51 -0400 |
| Subject | Most probably a stupid question, but I still want to ask |
| Message-ID | <neelcl$mer$1@gioia.aioe.org> |
let's look at this:
$ python3.4
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> line1 = '"String1" | bla'
>>> parts1 = line1.split(" | ")
>>> parts1
['"String1"', 'bla']
>>> tokens1 = eval(parts1[0])
>>> tokens1
'String1'
>>> tokens1[0]
'S'
and now this
>>> line2 = '"String1","String2" | bla'
>>> parts2 = line2.split(" | ")
>>> tokens2 = eval(parts2[0])
>>> tokens2
('String1', 'String2')
>>> tokens2[0]
'String1'
>>> type(tokens1)
<class 'str'>
>>> type(tokens2)
<class 'tuple'>
>>>
the question is: at which point did the language designers decide to betray the
"path of least surprise" principle and create a 'discontinuity' in the language?
Open to the idea that I am getting something fundamentally wrong. I'm new to Python...
Thanks
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-04-11 08:58 +1000 |
| Message-ID | <mailman.15.1460329087.6211.python-list@python.org> |
| In reply to | #106799 |
On Mon, Apr 11, 2016 at 8:51 AM, Fillmore <fillmore_remove@hotmail.com> wrote: > the question is: at which point did the language designers decide to betray > the > "path of least surprise" principle and create a 'discontinuity' in the > language? > Open to the idea that I am getting something fundamentally wrong. I'm new to > Python... Can you please simplify your example and show what the discontinuity is you're referring to? You keep messing with eval and split and stuff, and then looking at the types of things. Which part are you surprised at? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2016-04-11 09:04 +1000 |
| Message-ID | <mailman.16.1460329485.6211.python-list@python.org> |
| In reply to | #106799 |
Fillmore <fillmore_remove@hotmail.com> writes: > let's look at this: Can you set a “Subject” field that pertains to the actual question? As is, it doesn't help know what you want to discuss. > the question is: at which point did the language designers decide to > betray the "path of least surprise" principle and create a > 'discontinuity' in the language? This, also, doesn't help us know what the question is. Please describe what you expect that code to do, and if possible what it is that surprises you about its behaviour. -- \ “Repetition leads to boredom, boredom to horrifying mistakes, | `\ horrifying mistakes to God-I-wish-I-was-still-bored, and it | _o__) goes downhill from there.” —Will Larson, 2008-11-04 | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Date | 2016-04-10 16:30 -0700 |
| Message-ID | <mailman.17.1460331027.6211.python-list@python.org> |
| In reply to | #106799 |
On Sun, Apr 10, 2016, at 03:51 PM, Fillmore wrote:
>
> let's look at this:
>
> $ python3.4
> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC 4.8.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> line1 = '"String1" | bla'
> >>> parts1 = line1.split(" | ")
> >>> parts1
> ['"String1"', 'bla']
> >>> tokens1 = eval(parts1[0])
> >>> tokens1
> 'String1'
> >>> tokens1[0]
> 'S'
>
> and now this
>
> >>> line2 = '"String1","String2" | bla'
> >>> parts2 = line2.split(" | ")
> >>> tokens2 = eval(parts2[0])
I *THINK* what you're asking is why this returns a tuple, where in the
first eval you got a string. The answer is because commas create tuples
(not parens), so:
"String1", "String2"
is a tuple expression. Whereas:
"String1"
is a string expression.
> the question is: at which point did the language designers decide to
> betray the
> "path of least surprise" principle and create a 'discontinuity' in the
> language?
There's nothing inconsistent or surprising going on besides you doing
something vaguely weird and not really expressing what you find
surprising.
--Stephen
m e @ i x o k a i . i o
[toc] | [prev] | [next] | [standalone]
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-10 20:17 -0400 |
| Message-ID | <neeqf8$sac$1@gioia.aioe.org> |
| In reply to | #106802 |
On 04/10/2016 07:30 PM, Stephen Hansen wrote: > There's nothing inconsistent or surprising going on besides you doing > something vaguely weird and not really expressing what you find > surprising. well, I was getting some surprising results for some of my data, so I can guarantee that I was surprised! apparently my 'discontinuity' is mappable to the fact that there's no such thing as one-element tuples in Python, and attempts to create one will result in a string (i.e. an object of a different kind!)...
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Date | 2016-04-10 17:32 -0700 |
| Message-ID | <mailman.2.1460334765.13861.python-list@python.org> |
| In reply to | #106804 |
On Sun, Apr 10, 2016, at 05:17 PM, Fillmore wrote: > On 04/10/2016 07:30 PM, Stephen Hansen wrote: > > > There's nothing inconsistent or surprising going on besides you doing > > something vaguely weird and not really expressing what you find > > surprising. > > well, I was getting some surprising results for some of my data, so I can > guarantee that I was surprised! The point is you are not saying *what* is surprising. Nothing in your example code looks the least bit surprising to me, but I've been using Python for ages. If you're surprised by something, say *what* surprises you at the very least. But to repeat what I said that you didn't quote: the thing you need to understand is that parentheses do not create tuples, commas do. Parentheses only group things together. --Stephen m e @ i x o k a i . i o
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2016-04-10 21:45 -0400 |
| Message-ID | <mailman.11.1460339153.15650.python-list@python.org> |
| In reply to | #106804 |
On 4/10/2016 8:17 PM, Fillmore wrote: > apparently my 'discontinuity' is mappable to the fact that there's no such > thing as one-element tuples in Python, and attempts to create one will > result in a string (i.e. an object of a different kind!)... Please work through the tutorial before posting wrong information about the basics of Python. >>> t = 1, >>> t (1,) -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-04-11 08:41 +0300 |
| Message-ID | <87d1pwbt23.fsf@elektro.pacujo.net> |
| In reply to | #106831 |
Terry Reedy <tjreedy@udel.edu>: > On 4/10/2016 8:17 PM, Fillmore wrote: > >> apparently my 'discontinuity' is mappable to the fact that there's no >> such thing as one-element tuples in Python, and attempts to create >> one will result in a string (i.e. an object of a different kind!)... > > Please work through the tutorial before posting wrong information > about the basics of Python. > >>>> t = 1, >>>> t > (1,) However, in some languages, one-dimensional vectors/tuples and scalars are treated as equivalent (at least APL and Scheme). Marko
[toc] | [prev] | [next] | [standalone]
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-10 20:13 -0400 |
| Subject | one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <neeq6v$ruk$1@gioia.aioe.org> |
| In reply to | #106799 |
Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works
I guess that the answer to my question is: there is no such thing as a one-element tuple,
and Python will automatically convert a one-element tuple to a string... hence the
behavior I observed is explained...
>>> a = ('hello','bonjour')
>>> b = ('hello')
>>> b
'hello'
>>> a
('hello', 'bonjour')
>>>
Did I get this right this time?
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Date | 2016-04-10 17:19 -0700 |
| Subject | Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <mailman.1.1460334030.13375.python-list@python.org> |
| In reply to | #106803 |
On Sun, Apr 10, 2016, at 05:18 PM, Stephen Hansen wrote: > The parens are optional, I always put them in because: > >>> b = "hello", Ahem, "because its easy to miss the trailing comma" is what I meant to say here.
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Date | 2016-04-10 17:18 -0700 |
| Subject | Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <mailman.0.1460334030.13375.python-list@python.org> |
| In reply to | #106803 |
On Sun, Apr 10, 2016, at 05:13 PM, Fillmore wrote:
> I guess that the answer to my question is: there is no such thing as a
> one-element tuple,
> and Python will automatically convert a one-element tuple to a string...
> hence the
> behavior I observed is explained...
>
> >>> a = ('hello','bonjour')
> >>> b = ('hello')
> >>> b
> 'hello'
> >>> a
> ('hello', 'bonjour')
> >>>
>
>
> Did I get this right this time?
No, you didn't. Your mistake is again -- parens don't make tuples,
commas do.
A one element tuple is:
>>> b = ("hello,)
The parens are optional, I always put them in because:
>>> b = "hello",
The parens group an expression, they don't make a type.
--
Stephen Hansen
m e @ i x o k a i . i o
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2016-04-11 10:20 +1000 |
| Subject | Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <mailman.2.1460334041.13375.python-list@python.org> |
| In reply to | #106803 |
On Mon, Apr 11, 2016 at 10:13 AM, Fillmore <fillmore_remove@hotmail.com> wrote:
> Sorry guys. It was not my intention to piss off anyone...just trying to
> understand how the languare works
>
> I guess that the answer to my question is: there is no such thing as a
> one-element tuple,
> and Python will automatically convert a one-element tuple to a string...
> hence the
> behavior I observed is explained...
>
>>>> a = ('hello','bonjour')
>>>> b = ('hello')
>>>> b
> 'hello'
>>>> a
> ('hello', 'bonjour')
>>>>
>
>
> Did I get this right this time?
Okay, now you're asking a question in a reasonable way, so we can answer :)
The thing you're confused at is that it's not the parentheses that
create a tuple. Parentheses merely group.
>>> 'hello', 'bonjour'
('hello', 'bonjour')
>>> 'hello',
('hello',)
One-element tuples are perfectly possible, but you MUST have a comma,
so you have one at the end. The trailing comma is perfectly legal (and
ignored) on larger tuples.
>>> 'hello', 'bonjour',
('hello', 'bonjour')
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-10 20:22 -0400 |
| Subject | Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <neeqnl$sac$2@gioia.aioe.org> |
| In reply to | #106803 |
On 04/10/2016 08:13 PM, Fillmore wrote:
>
> Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works
>
> I guess that the answer to my question is: there is no such thing as a one-element tuple,
> and Python will automatically convert a one-element tuple to a string... hence the
> behavior I observed is explained...
>
> >>> a = ('hello','bonjour')
> >>> b = ('hello')
> >>> b
> 'hello'
> >>> a
> ('hello', 'bonjour')
> >>>
Hold on a sec! it turns up that there is such thing as single-element tuples in python:
>>> c = ('hello',)
>>> c
('hello',)
>>> c[0]
'hello'
>>> c[1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: tuple index out of range
>>>
So, my original question makes sense. Why was a discontinuation point introduced by the language designer?
[toc] | [prev] | [next] | [standalone]
| From | Stephen Hansen <me+python@ixokai.io> |
|---|---|
| Date | 2016-04-10 17:28 -0700 |
| Subject | Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask] |
| Message-ID | <mailman.0.1460334523.13861.python-list@python.org> |
| In reply to | #106808 |
On Sun, Apr 10, 2016, at 05:22 PM, Fillmore wrote:
> Hold on a sec! it turns up that there is such thing as single-element
> tuples in python:
>
> >>> c = ('hello',)
> >>> c
> ('hello',)
> >>> c[0]
> 'hello'
> >>> c[1]
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> IndexError: tuple index out of range
> >>>
>
> So, my original question makes sense. Why was a discontinuation point
> introduced by the language designer?
What discontinuation point?
You keep masterfully managing to *not explain what you're asking*. What
is surprising to you?
--S
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2016-04-11 10:31 +1000 |
| Subject | Re: one-element tuples |
| Message-ID | <mailman.4.1460334906.13861.python-list@python.org> |
| In reply to | #106808 |
Fillmore <fillmore_remove@hotmail.com> writes: > So, my original question makes sense. Why was a discontinuation point > introduced by the language designer? Can you describe explicitly what that “discontinuation point” is? I'm not seeing it. -- \ “People are very open-minded about new things, as long as | `\ they're exactly like the old ones.” —Charles F. Kettering | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-10 20:48 -0400 |
| Subject | Re: one-element tuples |
| Message-ID | <nees92$u4t$1@gioia.aioe.org> |
| In reply to | #106813 |
On 04/10/2016 08:31 PM, Ben Finney wrote: > Can you describe explicitly what that “discontinuation point” is? I'm > not seeing it. Here you go: >>> a = '"string1"' >>> b = '"string1","string2"' >>> c = '"string1","string2","string3"' >>> ea = eval(a) >>> eb = eval(b) >>> ec = eval(c) >>> type(ea) <class 'str'> <--- HERE !!!! >>> type(eb) <class 'tuple'> >>> type(ec) <class 'tuple'> I can tell you that it exists because it bit me in the butt today... and mind you, I am not saying that this is wrong. I'm just saying that it surprised me.
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2016-04-11 10:56 +1000 |
| Subject | Re: one-element tuples |
| Message-ID | <mailman.2.1460336194.15650.python-list@python.org> |
| In reply to | #106816 |
Fillmore <fillmore_remove@hotmail.com> writes: > Here you go: > > >>> a = '"string1"' > >>> b = '"string1","string2"' > >>> c = '"string1","string2","string3"' > >>> ea = eval(a) > >>> eb = eval(b) > >>> ec = eval(c) > >>> type(ea) > <class 'str'> <--- HERE !!!! > >>> type(eb) > <class 'tuple'> > >>> type(ec) > <class 'tuple'> > > I can tell you that it exists because it bit me in the butt today... > > and mind you, I am not saying that this is wrong. I'm just saying that > it surprised me. What behaviour did you expect instead? That's still unclear. Can you show the fictional session that would result from the behaviour you expect? -- \ “Education is learning what you didn't even know you didn't | `\ know.” —Daniel J. Boorstin, historian, 1914–2004 | _o__) | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2016-04-11 14:10 +0000 |
| Subject | Re: one-element tuples |
| Message-ID | <negb84$9ff$1@reader1.panix.com> |
| In reply to | #106818 |
On 2016-04-11, Ben Finney <ben+python@benfinney.id.au> wrote:
> Fillmore <fillmore_remove@hotmail.com> writes:
>>
>> I can tell you that it exists because it bit me in the butt today...
>>
>> and mind you, I am not saying that this is wrong. I'm just saying that
>> it surprised me.
>
> What behaviour did you expect instead? That's still unclear.
I must admit this is one of the best trolls I've seen in a while...
--
Grant Edwards grant.b.edwards Yow! GOOD-NIGHT, everybody
at ... Now I have to go
gmail.com administer FIRST-AID to my
pet LEISURE SUIT!!
[toc] | [prev] | [next] | [standalone]
| From | Fillmore <fillmore_remove@hotmail.com> |
|---|---|
| Date | 2016-04-11 10:11 -0400 |
| Subject | Re: one-element tuples |
| Message-ID | <negba4$1cp0$1@gioia.aioe.org> |
| In reply to | #106878 |
On 04/11/2016 10:10 AM, Grant Edwards wrote: >> What behaviour did you expect instead? That's still unclear. > > I must admit this is one of the best trolls I've seen in a while... > shall I take it as a compliment?
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2016-04-11 14:26 +0000 |
| Subject | Re: one-element tuples |
| Message-ID | <negc6c$lr0$2@reader1.panix.com> |
| In reply to | #106879 |
On 2016-04-11, Fillmore <fillmore_remove@hotmail.com> wrote:
> On 04/11/2016 10:10 AM, Grant Edwards wrote:
>
>>> What behaviour did you expect instead? That's still unclear.
>>
>> I must admit this is one of the best trolls I've seen in a while...
>
> shall I take it as a compliment?
That depends on your intent, so only you really know the answer.
--
Grant Edwards grant.b.edwards Yow! I hope something GOOD
at came in the mail today so
gmail.com I have a REASON to live!!
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.python
csiph-web