Giter Site home page Giter Site logo

Comments (5)

dbieber avatar dbieber commented on June 15, 2024

Good catch. As a workaround for the moment, put quotes around "is".

python example.py --hello '[this,"is",nice]'
['this', 'is', 'nice']

from python-fire.

DavidKatz-il avatar DavidKatz-il commented on June 15, 2024

This behavior comes from the ast.parse here

from python-fire.

ajitg25 avatar ajitg25 commented on June 15, 2024

I am trying to understand the issue here @dbieber.
When I am trying to get the elements from the list
for example

import fire
def main(hello: list[str]):
    for i in hello:
        print(i)
fire.Fire(main)

The output is:

[
t
h
i
s
,
i
s
,
n
i
c
e
]

isnt it should be like:

this
is
nice

I want to fix this issue so it will be helpful is you could explain a bit.

from python-fire.

rentruewang avatar rentruewang commented on June 15, 2024

@ajitg25
My guess is because fire would try to convert "2.5" in the command line to 2.5 by calling python's built in eval during parsing. Therefore, keywords not in quotes would cause SyntaxError probably for eval. This is a good behavior for numbers like 2.5, not so much for "is". That is why I raised the issue.

from python-fire.

ajitg25 avatar ajitg25 commented on June 15, 2024

Please assign this issue to me.

from python-fire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.