On 26/08/24 23:00, Dan Sommers via Python-list wrote:
On 2024-08-26 at 20:42:32 +1200,
dn via Python-list wrote:
and if we really want to go over-board:
RIGHT_JUSTIFIED = ">"
THOUSANDS_SEPARATOR = ","
s_format = F"{RIGHT_JUSTIFIED}{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}"
or (better) because r
On 2024-08-26 at 20:42:32 +1200,
dn via Python-list wrote:
> and if we really want to go over-board:
>
> >>> RIGHT_JUSTIFIED = ">"
> >>> THOUSANDS_SEPARATOR = ","
> >>> s_format = F"{RIGHT_JUSTIFIED}{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}"
>
> or (better) because right-justification is the default
On 26/08/24 03:12, Gilmeh Serda via Python-list wrote:
Subject explains it, or ask.
This is a bloody mess:
s = "123456789" # arrives as str
f"{f'{int(s):,}': >20}"
' 123,456,789'
With recent improvements to the expressions within F-strings, we can
separate the string from the form
On Sun, 25 Aug 2024 15:12:20 GMT Gilmeh Serda via Python-list wrote:
>Subject explains it, or ask.
>
>This is a bloody mess:
>
s = "123456789" # arrives as str
f"{f'{int(s):,}': >20}"
>' 123,456,789'
>
f"{s:>20}"
--
https://mail.python.org/mailman/listinfo/python-list
On 2024-08-25 16:12, Gilmeh Serda via Python-list wrote:
Subject explains it, or ask.
This is a bloody mess:
s = "123456789" # arrives as str
f"{f'{int(s):,}': >20}"
' 123,456,789'
You don't need to format twice; you can combine them:
>>> s = "123456789"
>>> f'{int(s): >20,}'
'
On Sun, 25 Aug 2024 15:12:20 GMT Gilmeh Serda via Python-list wrote:
>Subject explains it, or ask.
>
>This is a bloody mess:
>
s = "123456789" # arrives as str
f"{f'{int(s):,}': >20}"
>' 123,456,789'
>
Oops.. forgot comma
f"{int(s):>20,}"
--
https://mail.python.org/mailman/li
On Sun, Aug 27, 2023, at 17:19, Rob Cliffe via Python-list wrote:
> I understand that this is an error: I'm telling the f-string to expect
> an integer when in fact I'm giving it a Decimal.
> And indeed f"{x:3}" gives ' 42' whether x is an int or a Decim
at string
I understand that this is an error: I'm telling the f-string to expect
an integer when in fact I'm giving it a Decimal.
And indeed f"{x:3}" gives ' 42' whether x is an int or a Decimal.
However, to my mind it is not the format string that is invalid, but th
Roel Schroeven wrote:
Op 6/06/2023 om 16:08 schreef Chris Angelico:
On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote:
>
> The following f-string does not parse and gives syntax error on 3.11.3:
>
> f'thruput/{"user" if opt.return else "cell"} vs. elevation\
Op 6/06/2023 om 16:48 schreef Chris Angelico via Python-list:
On Wed, 7 Jun 2023 at 00:42, Roel Schroeven wrote:
> (Recently there has been an effort to provide clearer and more useful
> error messages; this seems to be a case where there is still room for
> improvement: "SyntaxError: invalid sy
On Wed, 7 Jun 2023 at 00:42, Roel Schroeven wrote:
> (Recently there has been an effort to provide clearer and more useful
> error messages; this seems to be a case where there is still room for
> improvement: "SyntaxError: invalid syntax" doesn't immediately remind me
> of that fact that 'return'
Op 6/06/2023 om 16:41 schreef Roel Schroeven:
'return' being a keyowrd is definitely going to be the problem.
*keyword
--
"Don't Panic."
-- Douglas Adams, The Hitchhiker's Guide to the Galaxy
--
https://mail.python.org/mailman/listinfo/python-list
Op 6/06/2023 om 16:08 schreef Chris Angelico:
On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote:
>
> The following f-string does not parse and gives syntax error on 3.11.3:
>
> f'thruput/{"user" if opt.return else "cell"} vs. elevation\n'
>
> Howe
On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote:
>
> The following f-string does not parse and gives syntax error on 3.11.3:
>
> f'thruput/{"user" if opt.return else "cell"} vs. elevation\n'
>
> However this expression, which is similar does par
The following f-string does not parse and gives syntax error on 3.11.3:
f'thruput/{"user" if opt.return else "cell"} vs. elevation\n'
However this expression, which is similar does parse correctly:
f'thruput/{"user" if True else "c
On Wed, 8 Feb 2023 at 05:30, Stefan Ram wrote:
>
> Rob Cliffe writes:
> >Does that mean that it is not possible to have a (built-in) function
> >that would construct and return a dictionary of all available variables
> >and their values? If it were possible, it could be useful, and there
> >woul
On Wed, 8 Feb 2023 at 02:12, Rob Cliffe wrote:
>
> [re-sending this to both the list and to Chris, as a prior send to the
> list only was bounced back]
> On 31/01/2023 22:33, Chris Angelico wrote:
> >
> >> Thanks for clarifying.
> >> Hm. So 'x' is neither in locals() nor in globals(). Which star
[re-sending this to both the list and to Chris, as a prior send to the
list only was bounced back]
On 31/01/2023 22:33, Chris Angelico wrote:
Thanks for clarifying.
Hm. So 'x' is neither in locals() nor in globals(). Which starts me
wondering (to go off on a tangent): Should there be a nonlo
On Wed, 1 Feb 2023 at 09:14, Rob Cliffe via Python-list
wrote:
> With great respect, Chris, isn't it for the OP (or anyone else) to
> decide - having been warned of the various drawbacks and limitations -
> to decide if it's a terrible idea *for him*? He's entitled to decide
> that it's just what
.
Sometimes, forceful language is required in order to get people to
listen.
If it's addressed to me: How about if I wanted a program (a learning
tool) to allow the user to play with f-strings?
I.e. to type in a string, and then see what the result would be if it
had been an f-string?
I su
a generic Python mechanism that
> allows for exactly what f-strings do: execute arbitrary Python snippets of
> code
That exists. Use eval (or exec).
> and format them in one go.
Include an f-string in the code you eval.
> In other words, I want to be able to do things like that, given a
On 1/29/2023 6:09 AM, Christian Gollwitzer wrote:
Am 28.01.23 um 02:56 schrieb Thomas Passin:
On 1/27/2023 5:10 PM, Christian Gollwitzer wrote:
Am 27.01.23 um 21:43 schrieb Johannes Bauer:
I don't understand why you fully ignore literally the FIRST example
I gave in my original post and angril
exactly what f-strings do: execute arbitrary Python snippets
of code and format them in one go. In other words, I want to be able to
do things like that, given an *arbitrary* dictionary x and a string s
(which has the only restriction that its content needs to be vald
f-string gramma
Am 28.01.23 um 02:56 schrieb Thomas Passin:
On 1/27/2023 5:10 PM, Christian Gollwitzer wrote:
Am 27.01.23 um 21:43 schrieb Johannes Bauer:
I don't understand why you fully ignore literally the FIRST example I
gave in my original post and angrily claim that you solution works
when it does not:
I'm trying to give you the favor of
honest feedback, which is that you sound like an utter bully. If you
don't care, that is totally fine by me.
They're not different things, because what you asked for is NOT
POSSIBLE without the caveats that I gave. It is *fundamentally not
possi
On 2023-01-29 15:47:47 +1100, Chris Angelico wrote:
> On Sun, 29 Jan 2023 at 14:36, Stefan Ram wrote:
> > (This message was written for Usenet. If you read it in a
> > mailing list or the Web, it has been stolen from Usenet.)
>
> I'm curious as to the copyright protections available to you, b
about what quotation is used inside the
string, as long as it could successfully evaluate using the f-string
grammar.
Stop with the rock management already and explain (briefly if
possible) what you are up to.
I have a string. I want to evaluate it as if it were an f-string. I.e.,
there *ar
On Sun, 29 Jan 2023 at 14:36, Stefan Ram wrote:
>
> Johannes Bauer writes:
> >I have a string. I want to evaluate it as if it were an f-string. I.e.,
> >there *are* obviously restrictions that apply (namely, the syntax and
> >semantics of f-strings), but that'
hat your question is
fine, it's awesome, and yes, wouldn't it be nice if magic were a
thing.
> Exactly. This is precisely what I want to avoid. Essentially, proper
> quotation of such a string requires to write a fully fledged f-string
> parser, in which case the whole problem solve
On Sun, 29 Jan 2023 at 11:53, Johannes Bauer wrote:
> I don't want to have to care about what quotation is used inside the
> string, as long as it could successfully evaluate using the f-string
> grammar.
>
Not possible. An f-string can contain other f-strings, and it is
entirel
Am 27.01.23 um 23:10 schrieb Christian Gollwitzer:
Am 27.01.23 um 21:43 schrieb Johannes Bauer:
I don't understand why you fully ignore literally the FIRST example I
gave in my original post and angrily claim that you solution works
when it does not:
x = { "y": "z" }
s = "-> {x['y']}"
print(s
Here, solve it for this string:
eval_me = ' f"""{f\'\'\'{f"{f\'{1+2}\'}"}\'\'\'}""" '
F-strings can be nested, remember.
Exactly. This is precisely what I want to avoid. Essentially, proper
quotation of such a st
eval("f'" + s + "'")
"works" if there are no apostrophes used. And just like
eval("f\"" + s + "\"")
"works" if there are no quotation marks used.
I don't want to have to care about what quotation is used inside the
On 2023-01-27 21:31:05 +0100, Johannes Bauer wrote:
> > But if you really REALLY know what you're doing, just use eval()
> > directly.
>
> I do, actually, but I hate it. Not because of the security issue, not
> because of namespaces, but because it does not reliably work:
>
> >>> s = "{\"x\" * 4}
> This. Does. Not. Work.
>
> I want to pass a single variable as a dictionary and access its members
> inside the expression.
You can do that (see other responses), but you can't have arbitrary
Python expressions inside a format string.
It works with f-strings because f-strings a
On 2023-01-27 20:56:49 -0500, Thomas Passin wrote:
> On 1/27/2023 5:10 PM, Christian Gollwitzer wrote:
> > Am 27.01.23 um 21:43 schrieb Johannes Bauer:
> > > x = { "y": "z" }
> > > s = "-> {x['y']}"
> > > print(s.format(x = x))
> > > Traceback (most recent call last):
> > > File "", line 1, in
oking the
existing f-string with the placeholder built-in, rather than trying to
evaluate an F♯ ???
Of course many situations may not have as much of a possible work-around.
But as so many have noted, we never got a really good explanation of what
the OP really wants to do. There have been replies tha
On 1/27/2023 5:10 PM, Christian Gollwitzer wrote:
Am 27.01.23 um 21:43 schrieb Johannes Bauer:
I don't understand why you fully ignore literally the FIRST example I
gave in my original post and angrily claim that you solution works
when it does not:
x = { "y": "z" }
s = "-> {x['y']}"
print(s.
g"
https://stackoverflow.com/questions/47339121/how-do-i-convert-a-string-into-an-f-string
def effify(non_f_str: str):
return eval(f'f"""{non_f_str}"""')
print(effify(s)) # prints as expected: "-> z"
Great.
s = '""&
Am 27.01.23 um 21:43 schrieb Johannes Bauer:
I don't understand why you fully ignore literally the FIRST example I
gave in my original post and angrily claim that you solution works when
it does not:
x = { "y": "z" }
s = "-> {x['y']}"
print(s.format(x = x))
Traceback (most recent call last):
hat "it" is, so it's hard to write a function
that's any better than the ones we've seen. Using eval() to construct
an f-string and then parse it is TERRIBLE because:
1) It still doesn't work in general, and thus has caveats like "you
can't use this type of q
Am 23.01.23 um 17:43 schrieb Stefan Ram:
Johannes Bauer writes:
x = { "y": "z" }
s = "-> {x['y']}"
print(s.format(x = x))
x = { "y": "z" }
def s( x ): return '-> ' + x[ 'y' ]
print( s( x = x ))
Except this is not at all what I asked for. The string "s" in my example
is just that, an exampl
Am 25.01.23 um 20:38 schrieb Thomas Passin:
x = { "y": "z" }
s = "-> {target}"
print(s.format(target = x['y']))
Stack overflow to the rescue:
No.
Search phrase: "python evaluate string as fstring"
https://stackoverflow.com/question
full power of an f-string, then you're asking
for the full power of eval(),
Exactly.
and that means all the security
implications thereof,
Precisely, as I had stated myself.
not to mention the difficulties of namespacing.
Not an issue in my case.
Have you considered using the va
rote:
Maybe, rather than asking for a way to treat a string as code, ask for
what you ACTUALLY need, and we can help?
ChrisA
Fair enough, Chris, but still ISTM that it is reasonable to ask (perhaps
for a different use-case) whether there is a way of evaluating a string
at runtime as if it were a
language is required in order to get people to
listen.
> If it's addressed to me: How about if I wanted a program (a learning
> tool) to allow the user to play with f-strings?
> I.e. to type in a string, and then see what the result would be if it
> had been an f-string?
> I suspect
asking for a way to treat a string as code, ask for
what you ACTUALLY need, and we can help?
ChrisA
Fair enough, Chris, but still ISTM that it is reasonable to ask (perhaps
for a different use-case) whether there is a way of evaluating a string
at runtime as if it were an f-string. We encourage
ris, but still ISTM that it is reasonable to ask (perhaps
> for a different use-case) whether there is a way of evaluating a string
> at runtime as if it were an f-string. We encourage people to ask
> questions on this list, even though the answer will not always be what
> they're hoping
On 23/01/2023 18:02, Chris Angelico wrote:
On Tue, 24 Jan 2023 at 04:56, Johannes Bauer wrote:
Hi there,
is there an easy way to evaluate a string stored in a variable as if it
were an f-string at runtime?
...
This is supposedly for security reasons. However, when trying to emulate
this
On 25/01/2023 19:38, Thomas Passin wrote:
Stack overflow to the rescue:
Search phrase: "python evaluate string as fstring"
https://stackoverflow.com/questions/47339121/how-do-i-convert-a-string-into-an-f-string
def effify(non_f_str: str):
return eval(f'f""
On 1/25/2023 1:26 PM, Antoon Pardon wrote:
Op 23/01/2023 om 17:24 schreef Johannes Bauer:
Hi there,
is there an easy way to evaluate a string stored in a variable as if
it were an f-string at runtime?
I.e., what I want is to be able to do this:
x = { "y": "z" }
print(f
Op 23/01/2023 om 17:24 schreef Johannes Bauer:
Hi there,
is there an easy way to evaluate a string stored in a variable as if
it were an f-string at runtime?
I.e., what I want is to be able to do this:
x = { "y": "z" }
print(f"-> {x['y']}")
This p
On Tue, 24 Jan 2023 at 04:56, Johannes Bauer wrote:
>
> Hi there,
>
> is there an easy way to evaluate a string stored in a variable as if it
> were an f-string at runtime?
>
> ...
>
> This is supposedly for security reasons. However, when trying to emulate
> this be
Hi there,
is there an easy way to evaluate a string stored in a variable as if it
were an f-string at runtime?
I.e., what I want is to be able to do this:
x = { "y": "z" }
print(f"-> {x['y']}")
This prints "-> z", as expected. But cons
On 25May2022 00:13, Kevin M. Wilson wrote:
>Cameron, I have a misunderstanding here, the 'f-string' is used when
>the str() is not...isn't it!
No, f-strings (format strings) are just a convenient way to embed values
in a string. The result is a string.
In days of yore
> # future_value += monthly_interest_amount
> # display the result
> print(f"Year = ", years + f"Future value = \n", future_value)
>
>When joining a string with a number, use an f-string otherwise, code a
>str() because a implicit convert of an int to str causes a
>
thly_interest_rate
># future_value += monthly_interest_amount
># display the result
>print(f"Year = ", years + f"Future value = \n", future_value)When joining
> a string with a number, use an f-string otherwise, code a str() because a
> implicit convert of an int to
; future_value = round(future_value, 2)
> # monthly_interest_amount = future_value * monthly_interest_rate
> # future_value += monthly_interest_amount
> # display the result
> print(f"Year = ", years + f"Future value = \n", future_value)When
> joining a s
+= monthly_interest_amount
# display the result
print(f"Year = ", years + f"Future value = \n", future_value)When joining a
string with a number, use an f-string otherwise, code a str() because a implicit convert of an int
to str causes a TypeError!Well...WTF! Am I no
;Year = ", years + f"Future value = \n", future_value)When joining a
string with a number, use an f-string otherwise, code a str() because a
implicit convert of an int to str causes a TypeError!Well...WTF! Am I not using
the f-string function correctly...in the above line of cod
Hi.
Try this:
f"foo {','.join([f'{a} {b}' for a,b in list(zip(l1,l2))])} bar"
09.02.2022 21:13, Paulo da Silva пишет:
Às 02:17 de 09/02/22, Paulo da Silva escreveu:
Hi!
Let's say I have two lists of equal length but with a variable number
of elements. For ex.:
l1=['a','b','c']
l2=['j','k'
Às 02:17 de 09/02/22, Paulo da Silva escreveu:
Hi!
Let's say I have two lists of equal length but with a variable number of
elements. For ex.:
l1=['a','b','c']
l2=['j','k','l']
I want to build a string like this
"foo a j, b k, c l bar"
Is it possible to achieve this with f strings or any ot
l list of things that want to be done (and natural ways to
perform them)
1. pair items in the lists (using list comprehension),
2. format the pairs (using an f-string),
3. separate the pairs with commas (using join), and
4. incorporate surrounding "foo" "bar" text. (using an f-st
Paulo da Silva wrote:
Hi!
Let's say I have two lists of equal length but with a variable number of
elements. For ex.:
l1=['a','b','c']
l2=['j','k','l']
I want to build a string like this
"foo a j, b k, c l bar"
Is it possible to achieve this with f strings or any other
simple/efficient way
Hi!
Let's say I have two lists of equal length but with a variable number of
elements. For ex.:
l1=['a','b','c']
l2=['j','k','l']
I want to build a string like this
"foo a j, b k, c l bar"
Is it possible to achieve this with f strings or any other
simple/efficient way?
Thanks for any help
more can be done to guide
them to the right place.
On Wed, Feb 20, 2019 at 8:34 AM Caridad Díaz Rivero <
caridad.diaz.riv...@gmail.com> wrote:
> Hi,
> I don´t have too much experience using the official python documentation,
> and I was looking about f-string and I didn´t find an
Hi,
I don´t have too much experience using the official python documentation,
and I was looking about f-string and I didn´t find anythings in
/3/library/string.html <https://docs.python.org/3/library/string.html> and
I find it in 3/reference/lexical_analysis.html#f-strings
Ken Kundert writes:
> Lele,
> I am using Python3.6. d has to be an object of mydict.
My bad, sorry, I completely missed the premise :-|.
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@m
, template)
return ', '.join(template.format(v, k=k, v=v) for k, v in
self.items())
d = mydict(bob='239-8402', ted='371-8567', carol='891-5810',
alice='552-2219')
print('Using format():')
print('Email: {0:{{k}}: {{v}}}
On 2018-05-14 20:24, Lele Gaifax wrote:
Ken Kundert writes:
Lele,
I'm afraid I was unclear. The ... in the code snippet was intended
to imply that these lines were appended to the end of the original code,
where d was defined.
Ok, but then I get a different behaviour:
Python 3.6.5
Ken Kundert writes:
> Lele,
> I'm afraid I was unclear. The ... in the code snippet was intended
> to imply that these lines were appended to the end of the original code,
> where d was defined.
Ok, but then I get a different behaviour:
Python 3.6.5 (default, May 11 2018, 13:30:17)
Lele,
I'm afraid I was unclear. The ... in the code snippet was intended
to imply that these lines were appended to the end of the original code,
where d was defined.
-Ken
On 05/14/2018 12:30 AM, Lele Gaifax wrote:
> Ken Kundert writes:
>
>> I tried adding k and v to the local namespace:
>>
print('Template:', template)
>> return ', '.join(template.format(v, k=k, v=v) for k, v in
>> self.items())
>>
>>
>> d = mydict(bob='239-8402', ted='371-8567', carol='891-5810',
>> alice=
Ken Kundert writes:
> I tried adding k and v to the local namespace:
>
> ...
> k = 6
> v = 9
> print(f'Email: {d:{{k}} {{v}}}')
>
> I still got:
>
> NameError: name 'k' is not defined
This is not what I get:
Python 3.6.5 (default, May 11 2018, 13:30:17)
[GCC 7.3.0]
specification in the f-string documentation does not
allow, and so it should be a syntax error. But it does not generate a
syntax error. So the question becomes, how does it interpret {{k}} and
{{v}} in the format spec. I was expecting it to treat the double braces
as escaped braces, and that is what the
'239-8402', ted='371-8567', carol='891-5810',
alice='552-2219')
print('Using format():')
print('Email: {0:{{k}}: {{v}}}'.format(d))
print()
print('Using f-string:')
print(f'Email: {d:{{k}} {{v}}}
, template)
return ', '.join(template.format(v, k=k, v=v) for k, v in
self.items())
d = mydict(bob='239-8402', ted='371-8567', carol='891-5810',
alice='552-2219')
print('Using format():')
print('Email: {0:{
, template)
return ', '.join(template.format(v, k=k, v=v) for k, v in
self.items())
d = mydict(bob='239-8402', ted='371-8567', carol='891-5810',
alice='552-2219')
print('Using format():')
print('Email: {0:{{k}}: {{v}}}
On Fri, 23 Mar 2018 10:39:05 -0600, Malcolm Greene wrote:
>> Perhaps it doesn't need to be said, but just to be sure: don't use eval
>> if you don't trust the people writing the configuration file. They can
>> do nearly unlimited damage to your environment. They are writing code
>> that you are
On 3/23/18 12:39 PM, Malcolm Greene wrote:
Perhaps it doesn't need to be said, but just to be sure: don't use eval if you
don't trust the people writing the configuration file. They can do nearly
unlimited damage to your environment. They are writing code that you are
running.
Of course! Sc
> Perhaps it doesn't need to be said, but just to be sure: don't use eval if
> you don't trust the people writing the configuration file. They can do nearly
> unlimited damage to your environment. They are writing code that you are
> running.
Of course! Script and config file are running in a
On 3/23/18 4:30 AM, Malcolm Greene wrote:
Looking for advice on how to expand f-string literal strings whose
values I'm reading from a configuration file vs hard coding into
my script as statements. I'm using f-strings as a very simple
template language.
I'm currently usin
On Fri, Mar 23, 2018 at 7:37 PM, Malcolm Greene wrote:
> My original post reformatted for text mode:
>
> Looking for advice on how to expand f-string literal strings whose values I'm
> reading from a configuration file vs hard coding into
> my script as statements. I'm
My original post reformatted for text mode:
Looking for advice on how to expand f-string literal strings whose values I'm
reading from a configuration file vs hard coding into
my script as statements. I'm using f-strings as a very simple template language.
I'm currently usin
Looking for advice on how to expand f-string literal strings whose
values I'm reading from a configuration file vs hard coding into
my script as statements. I'm using f-strings as a very simple
template language.
I'm currently using the following technique to expand these f-stri
On Tue, Dec 5, 2017 at 6:37 PM, Ned Batchelder wrote:
> On 12/5/17 7:16 PM, Steve D'Aprano wrote:
>> compile('f"{spam} {eggs}"', '', 'single')
>
> $ python3.6
> Python 3.6.3 (default, Octâ 4 2017, 06:03:25)
> [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
> Typ
On Wed, 6 Dec 2017 11:54 am, John Pote wrote:
[...]
> Ran above test file and got,
> >>python36 compiletest.py
> at 0x02120E40, file "", line 1>
>
>
> SPAM scrambled
Thanks everyone, that's what I wanted to see.
--
Steve
â £Cheer up,â Ø they said, â £things could be worse.â Ø So I ch
m and eggs as.
>>
>> ChrisA
>> *ducking for cover*
>
> Possibly duck eggs :-)
>
>
> I was thinking of responding to your comment on Python-Ideas that said there
> is no way to represent an unevaluated f-string in Python, but then I decided
> that even for me t
;>> What does compile('f"{spam} {eggs}"', '', 'single') return?
[...]
> I think Steve just wanted to see what we'd all define spam and eggs as.
>
> ChrisA
> *ducking for cover*
Possibly duck eggs :-)
I was thinking of responding t
On 06/12/2017 00:16, Steve D'Aprano wrote:
> Anyone got a handy copy of Python 3.6 available to test something for me?
>
> What does compile('f"{spam} {eggs}"', '', 'single') return?
>
> What does eval()'ing the above compiled object do? If necessary, you may have
> to define spam and eggs first.
On 12/5/17 7:16 PM, Steve D'Aprano wrote:
> compile('f"{spam} {eggs}"', '', 'single')
$ python3.6
Python 3.6.3 (default, Octâ 4 2017, 06:03:25)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
On 2017-12-06 00:16, Steve D'Aprano wrote:
> Anyone got a handy copy of Python 3.6 available to test something for me?
>
> What does compile('f"{spam} {eggs}"', '', 'single') return?
>
> What does eval()'ing the above compiled object do? If necessary, you may have
> to define spam and eggs first.
>
On Wed, Dec 6, 2017 at 11:54 AM, John Pote wrote:
>
> On 06/12/2017 00:16, Steve D'Aprano wrote:
>>
>> Anyone got a handy copy of Python 3.6 available to test something for me?
>>
>> What does compile('f"{spam} {eggs}"', '', 'single') return?
>>
>> What does eval()'ing the above compiled object do
On Wed, Dec 6, 2017 at 11:16 AM, Steve D'Aprano
wrote:
> Anyone got a handy copy of Python 3.6 available to test something for me?
>
> What does compile('f"{spam} {eggs}"', '', 'single') return?
>
> What does eval()'ing the above compiled object do? If necessary, you may have
> to define spam and
Anyone got a handy copy of Python 3.6 available to test something for me?
What does compile('f"{spam} {eggs}"', '', 'single') return?
What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.
Thanks in advance.
--
Steve
â £Cheer up,â Ø they s
m and eggs as.
>>
>> ChrisA
>> *ducking for cover*
>
> Possibly duck eggs :-)
>
>
> I was thinking of responding to your comment on Python-Ideas that said there
> is no way to represent an unevaluated f-string in Python, but then I decided
> that even for me
;>> What does compile('f"{spam} {eggs}"', '', 'single') return?
[...]
> I think Steve just wanted to see what we'd all define spam and eggs as.
>
> ChrisA
> *ducking for cover*
Possibly duck eggs :-)
I was thinking of responding
On Wed, 6 Dec 2017 11:54 am, John Pote wrote:
[...]
> Ran above test file and got,
> >>python36 compiletest.py
> at 0x02120E40, file "", line 1>
>
>
> SPAM scrambled
Thanks everyone, that's what I wanted to see.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered
On Wed, Dec 6, 2017 at 11:54 AM, John Pote wrote:
>
> On 06/12/2017 00:16, Steve D'Aprano wrote:
>>
>> Anyone got a handy copy of Python 3.6 available to test something for me?
>>
>> What does compile('f"{spam} {eggs}"', '', 'single') return?
>>
>> What does eval()'ing the above compiled object do
On 06/12/2017 00:16, Steve D'Aprano wrote:
Anyone got a handy copy of Python 3.6 available to test something for me?
What does compile('f"{spam} {eggs}"', '', 'single') return?
What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.
Thanks
1 - 100 of 104 matches
Mail list logo