Open diceroll123 opened 2 years ago
For the code given,
def cube(t: float) -> float: return t * t * t
The suggested replacement ends up being
def cube(t: float) -> float: return t**2 * t
This could probably somewhat easily be scaled to work for any amount of exponents to get return t**3 for this case, I'd assume!
return t**3
v0.12.1
Version: 1.68.1 (Universal) Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630 Date: 2022-06-14T12:52:13.188Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 21.6.0
Hi @diceroll123 ,
Thanks a lot, that's an excellent point. :+1: We'll look into it and see whether and how we can make the square-identity refactoring more flexible.
square-identity
Issue description or question
For the code given,
The suggested replacement ends up being
This could probably somewhat easily be scaled to work for any amount of exponents to get
return t**3
for this case, I'd assume!Sourcery Version
v0.12.1
Code editor or IDE name and version
Version: 1.68.1 (Universal) Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630 Date: 2022-06-14T12:52:13.188Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 21.6.0