Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

period terminated integer not recognized as numeric #97

Closed
krey opened this issue Mar 22, 2019 · 9 comments
Closed

period terminated integer not recognized as numeric #97

krey opened this issue Mar 22, 2019 · 9 comments

Comments

@krey
Copy link

krey commented Mar 22, 2019

Version: e285b95

2019-03-22-070135

Maybe this isn't a real bug, but when coding, it's common to write a floating point integer ending with a full stop, e.g. 100. to be explicit about its type, or to deal with Python 2's default division, etc.

@martinRenou
Copy link
Contributor

martinRenou commented Mar 22, 2019

Mmh, just one thing first, why are you creating your cell like that:

Cell(value='', ..., type='numeric')

?
You're passing a string value but you expect type to be numeric, it's kind of weird no?
Maybe you would prefer to use the easy API:

from ipysheet import sheet, cell # Without the capital letters

s = sheet()
cell(0, 0, value=4.)
s

@martinRenou
Copy link
Contributor

Thinking about it, I think your Cell(value='', ..., type='numeric') should throw an error Python side

@krey
Copy link
Author

krey commented Mar 22, 2019

Thinking about it, I think your Cell(value='', ..., type='numeric') should throw an error Python side

So perhaps I should switch back to strings if I want to allow empty cells

@krey
Copy link
Author

krey commented Mar 22, 2019

Mmh, just one thing first, why are you creating your cell like that:

Cell(value='', ..., type='numeric')

?
You're passing a string value but you expect type to be numeric, it's kind of weird no?
Maybe you would prefer to use the easy API:

from ipysheet import sheet, cell # Without the capital letters

s = sheet()
cell(0, 0, value=4.)
s

Thanks Martin.

I'm familiar with the "easy" API, but I'm opposed to its matplotlib style "everything is a side-effect" philosophy.

@martinRenou
Copy link
Contributor

martinRenou commented Mar 22, 2019

I do not like side-effect programming like that too, but we gotta admit that it is pretty useful.

Anyway, I don't really get what you mean by "So perhaps I should switch back to strings if I want to allow empty cells". Cells will be empty if values are None, if that's what you are looking for:

s = ipysheet.sheet(rows=1, columns=4)
row = ipysheet.row(0, [0, None, 2, 3])
s

and this is the output:
row
This example is using the easy API but you can replicate the same behavior with Cell, using numeric type.

@martinRenou
Copy link
Contributor

Closing this one, feel free to open again if needed

@krey
Copy link
Author

krey commented Apr 5, 2019

@martinRenou Why close it?

The original issue (period terminated integer) still persists in 5065a59

@martinRenou
Copy link
Contributor

I closed it because it was an issue in your code, no? You were creating a 'numeric' cell given a string value.

I guess the link you just gave is wrong? It is not related to this issue

@martinRenou
Copy link
Contributor

Oh sorry, I get it.

Yeah, the issue you are talking about still stands. I guess this issue you already opened is clearer. We need to have an 'int' and a 'float' cell type. This could fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants