Comments (2)
I found several usages:
For example, bit_length
python calc.py 1 # output: 2
python calc.py 1 bit_length # output: 2
python calc.py 12 # output: 24
python calc.py 12 bit_length # output: 5
python calc.py 123 # output: 246
python calc.py 123 bit_length # output: 8
python calc.py 1234 # output: 2468
python calc.py 1234 bit_length # output: 12
But, I don't how bit_length
works. The result seems not true.
Similarly, we can use other commands
# is_integer: it seems useful
python calc.py 12.2 # output: 24.4
python calc.py 12.2 is_integer # output: False
python calc.py 12.5 # output: 25.0
python calc.py 12.5 is_integer # output: True
# as_integer_ratio: I don't understand
python calc.py 12.2 as_integer_ratio # output: [3433994715870003, 140737488355328]
python calc.py 12.5 as_integer_ratio # output: [25, 1]
# bit_count: I don't understand
python calc.py 12.2 bit_count # throw error
python calc.py 12.2 bit_count 2 # throw error
python calc.py 12.2 bit_count "sdf" # throw error
python calc.py 12.2 bit_count --help # works. It shows the help about some commands: as_integer_ratio, conjugate,hex, is_integer
Then, I use python calc.py 12.2 bit_count --help
to check help information
NAME
calc.py 12.2
SYNOPSIS
calc.py 12.2 COMMAND | VALUE
COMMANDS
COMMAND is one of the following:
as_integer_ratio
Return a pair of integers, whose ratio is exactly equal to the original float.
conjugate
Return self, the complex conjugate of any float.
fromhex
Create a floating-point number from a hexadecimal string.
hex
Return a hexadecimal representation of a floating-point number.
is_integer
Return True if the float is an integer.
VALUES
VALUE is one of the following:
imag
real
OK, It told me I can use as_integer_ratio
, conjugate
,hex
, and is_integer
However, there seems be some issues.
python calc.py 12.2 hex # output: 0x1.8666666666666p+4
python calc.py 12.5 hex # output: 0x1.9000000000000p+4
python calc.py 5 hex # throw error! why?
from python-fire.
Outputs with different data types have different available commands.
For example, you can see different commands help with the commands below.
python calc.py 1 --help
python calc.py 1.1 --help
python calc.py "abc" --help
python calc.py abc --help
from python-fire.
Related Issues (20)
- [feature request] support multiple dialects for boolean parameters HOT 3
- [feature request] Exclude function (kw)args from synopsis, arguments and flags in help output
- guide sample code is entered incorrectly HOT 2
- Version flag alongside other commands HOT 3
- Remove test requirement on mock HOT 4
- Is it possible to pass arg via code and kwargs by cli (sys.argv) ? HOT 1
- cli for function created on the fly HOT 1
- ERROR: Could not consume arg: >> HOT 1
- AttributeError: 'module' object has no attribute 'PY34' HOT 1
- How to set the number of args at least one? HOT 1
- Python 2.7 no longer available in GitHub Actions by default HOT 1
- Unexpected printing (+paging) when using inspect HOT 3
- Cannot parse list of strings containing `is` HOT 5
- Gracias
- unable to install fire HOT 4
- Android 14 HOT 1
- How to use the avialable command "S.xx", such as S.count HOT 2
- How to pass '2e9672320848' as a str value? HOT 1
- Optional type args are mistyped in help HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-fire.