Comments (4)
Adding slots is a bit of a challenge here. for each property we set a "private" counterpart of it. So for a property timestamp
we have a _timestamp
that gets set to None
in the constructor. Then the setter for timestamp also assigns to that internal property. So we would need to add both _timestamp
and timestamp
to the __slots__
tuple.
@oberstet is that desirable/expected ?
from cfxdb.
Good question! In a way, the general question actually is:
How to combine
- (writable) properties
- slots
- type hints
in Python, and if that is useful / desirable in the first place. Let's first find the answer to that ..
from cfxdb.
Is the point of the _timestamp
with @property
versions to enforce "it must be of type X" when setting..? (e.g. here
cfxdb/cfxdb/eventstore/event.py
Line 41 in edf5603
from cfxdb.
the reason to have both _attribute
and @property
is so that _attribute
is lazily caching the actual value from the DB as a python native type (on first access)
rgd the specific domain of walltime/timestamps (the example you linked): this has evolved in xbr db classes to:
that is, accessing offers[txn, offer_oid].timestamp
returns a native np.datetime64
python object that will be stored in object._timestamp
upon first access.
there have been a handful reason why it has evolved into that (could expand if of interest) .. the example you linked is not xbr, but from event store (wamp event persistency), and this predates the xbr stuff where "timestamp" has evolved. another example is UUID - also #38
from cfxdb.
Related Issues (20)
- Refactor DB classes into modules HOT 2
- Travis CI reports “Expected - Waiting for status to be reported” HOT 6
- Refactor tests to individual file
- DB schema: fix actor types
- tid + signature for all on-chain object tables HOT 1
- Database schema classes HOT 1
- Database classes: cover roundtrip fbs+cbor and copy fbs+cbor HOT 3
- Split up XBR DB HOT 2
- Document standard DB types HOT 1
- Complete cluster DB schema HOT 1
- Expand master DB schema HOT 2
- Migrate master tables to flatbuffers
- Add UserRole.SUPERUSER
- close_balance in a channel should return uint256 HOT 3
- Add schema tables parse function
- Complete XBR API schema
- CI: datetime roundtrip tests 1h off HOT 1
- autoapi linking broken for RTD
- Depend on argon2-cffi, not argon2 HOT 1
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 cfxdb.