Skip to content

SimpleSequenceGenerator accepts starting sequence when object is created#121

Open
nikoladsp wants to merge 1 commit intopython-smpplib:masterfrom
nikoladsp:master
Open

SimpleSequenceGenerator accepts starting sequence when object is created#121
nikoladsp wants to merge 1 commit intopython-smpplib:masterfrom
nikoladsp:master

Conversation

@nikoladsp
Copy link

SimpleSequenceGenerator accepts starting sequence when object is created (default is MIN_SEQUENCE) .Test file also created

Signed-off-by: Nikola Radovanovic nikoladsp@gmail.com

…eated.Test file also created

Signed-off-by: Nikola Radovanovic <nikoladsp@gmail.com>
@code-of-kpp
Copy link
Member

Don't you think this kind of behavior is actually somewhat misleading? I think It would be better to raise

@nikoladsp
Copy link
Author

It depends on usage. For example, I am storing sequence in the DB and want to continue where I left off, since using sequence to "mark" received messages and remove them from the DB. "Ring" kind of update is suitable for this usage, or at least I think so.

Kindest regards

@code-of-kpp
Copy link
Member

Yes, probably you are right about the most common use case here, but the code allows for example ridiculously large or negative numbers to be slightly ignored and replaced with default value.
@eigenein what do you think?

@eigenein
Copy link
Collaborator

Hiya!

I'm not in favour of silently changing a parameter value, this is usually makes debugging harder.

I'd rather go for one of these:

  • raise ValueError, and then user is able to catch it and instantiate the generator with default minimum
  • Make a dedicated ring sequence generator, shouldn't be that much code

@nikoladsp
Copy link
Author

Hi,
thanks. Will do both.

Well be in touch.

Cheers

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

Successfully merging this pull request may close these issues.

3 participants