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

Option wanted to parse float numbers as symbols. #2

Closed
kazssym opened this issue Jul 6, 2013 · 13 comments
Closed

Option wanted to parse float numbers as symbols. #2

kazssym opened this issue Jul 6, 2013 · 13 comments

Comments

@kazssym
Copy link

kazssym commented Jul 6, 2013

I want an option to parse float numbers (or atoms that are looking so) as Symbols to distinguish 1.1, 1.10, 1.100 etc.

@kazssym
Copy link
Author

kazssym commented Jul 6, 2013

Something like this one: kazssym@3e57dcd

@tkf
Copy link
Collaborator

tkf commented Jul 6, 2013

I think float_to is better. Default float_to=None means to use the value of float(token). You can pass any callable including Symbol.

If you add some tests, doctest example and document I will pull the change.

@kazssym
Copy link
Author

kazssym commented Jul 6, 2013

I don't like the name as it could imply that it first parses a token as
float and then converts it to something.

@tkf
Copy link
Collaborator

tkf commented Jul 6, 2013

We are talking about parser. float_to should mean "float literal to", not "float value to". Converting to float value to something need not be done in parser as you can do it afterward. User will never lookup sexpdata document to convert float values.

@kazssym
Copy link
Author

kazssym commented Jul 6, 2013

I don't see it as a float literal either, but as a pair of integers
concatenated with a dot. So I would prefer a name that I could think as if
any float number is disabled in the S-expression. Sorry for the confusing
title.

If you don't like the idea, feel free to forget my request. I can just
copy and modify your code to suit my needs.

@tkf
Copy link
Collaborator

tkf commented Jul 6, 2013

You can use float_to to fit your need. It is easy to see that you are not parsing (or interpreting) float from load(..., float_to=Symbol). I don't understand why you don't like my idea. It is more extensible than yours.

I think forking is very bad idea. It took sometime for this project to mature (even though parsing sexp is easy). I wouldn't want to pay the price for the future merges if I were you.

@kazssym
Copy link
Author

kazssym commented Jul 7, 2013

I don't like forking either. But your suggestion is too complicated for my
needs and I'm not sure I can complete such a change in time as I'm still a
Python learner.

So for now, I will copy your code into my project with minimal
modifications (just removal of several lines). When I get enough skills in
Python later, I could be back to a more extensible approach.

Thank you for considering my request.
2013/07/07 3:47 "Takafumi Arakaki" notifications@github.com:

You can use float_to to fit your need. It is easy to see that you are not
parsing (or interpreting) float from load(..., float_to=Symbol). I don't
understand why you don't like my idea. It is more extensible than yours.

I think forking is very bad idea. It took sometime for this project to
mature (even though parsing sexp is easy). I wouldn't want to pay the price
for the future merges if I were you.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-20558882
.

@tkf
Copy link
Collaborator

tkf commented Jul 9, 2013

OK. Makes sense. I think I'll try to implement my suggestion at some point. I'll let you know when it happens.

Just curious. What kind of software are you developing using sexpdata?

@kazssym
Copy link
Author

kazssym commented Jul 13, 2013

Excuse my replying late. I'm working on a VCS repository converter from
PRCS to Mercurial. PRCS stores its version information in S-expressions
and I was looking for a parser.
2013/07/09 18:03 "Takafumi Arakaki" notifications@github.com:

OK. Makes sense. I think I'll try to implement my suggestion at some
point. I'll let you know when it happens.

Just curious. What kind of software are you developing using sexpdata?


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-20661552
.

@tkf
Copy link
Collaborator

tkf commented Jul 14, 2013

Nice. Good luck!

@tkf tkf closed this as completed Jul 14, 2013
@tkf
Copy link
Collaborator

tkf commented Jul 14, 2013

Actually let this open to track the issue :)

@tkf tkf reopened this Jul 14, 2013
@kazssym
Copy link
Author

kazssym commented Jul 17, 2013

It would be more general and extensible to have one such as numeric=[int, float]. If a user want complex numbers in addition, he can call with numeric=[int, float, complex]. numeric=None could be interpreted as numeric=[int, float].

@jd-boyd
Copy link
Owner

jd-boyd commented Jun 6, 2023

Given the age and that I'm not sure it really is in scope, I'm going to close this. Someone can bring it up again if they want.

@jd-boyd jd-boyd closed this as completed Jun 6, 2023
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

3 participants