Comments (9)
In scikit-hep/awkward@d125ad7, I changed:
function ak.fromnumpy → ak.from_numpy
function ak.fromiter → ak.from_iter
function ak.fromjson → ak.from_json
function ak.fromawkward0 → ak.from_awkward0
function ak.tonumpy → ak.to_numpy
function ak.tolist → ak.to_list
function ak.tojson → ak.to_json
function ak.tolayout → ak.to_layout
function ak.toawkward0 → ak.to_awkward0
function ak.validityerror → ak.validity_error
function ak.isvalid → ak.is_valid
function ak.withfield → ak.with_field
function ak.withname → ak.with_name
function ak.tomask → ak.mask
function ak.typeof → ak.type
parameter checkvalid → check_valid
parameter withname → with_name
parameter validwhen → valid_when
method numbatype → numba_type
method beginlist → begin_list
method endlist → end_list
method begintuple → begin_tuple
method endtuple → end_tuple
method beginrecord → begin_record
method endrecord → end_record
But I didn't change:
function ak.isna
function ak.notna
function ak.argcross
function ak.argchoose
method bytestring
from awkward-0.x.
FWIW Ivery much prefer to_X, from_X, etc. ;-).
from awkward-0.x.
It's not too late, although it's getting close. Once the documentation is written, there will be a higher barrier to changing names.
These particular examples don't have Awkward1 equivalents, so there's nothing to do here.
I used to snake_case everything, and there was also a period when I camelCased everything. Most recently, I was encouraged to snake_case only when the words are "really long," which is a subjective assessment. I do have a rough cut-off, based on how hard it is for me to read it. If something is going to be typed often, like a command, I try to pick words that are legible when joined—following what I see in the Python standard library. (The fact that the Python standard library does it is probably why PEP8 doesn't put down a hard rule.) Some examples include ak.withfield
and ak.withname
, ak.fromnumpy
, ak.fromiter
, ak.fromjson
, ak.tonumpy
, ak.tolist
, and ak.tojson
. On the other hand, there's ak.regularize_numpyarray
, which clearly needs the underscore. The ones that I feel can be joined without an underscore are part of a pattern: withX
, fromX
, or toX
, so that we train our eyes to that pattern. If it can't be expressed that way, it becomes a candidate for snake_case.
That was my thought process, anyway.
from awkward-0.x.
FWIW pandas uses snake even for from_X and to_X, e.g. https://pandas.pydata.org/pandas-docs/stable/reference/frame.html#serialization-io-conversion
from awkward-0.x.
It sounds like there's a strong consensus on this—I'll tighten my tolerance on acceptability of non-underscored names enough that words like "from", "to", and "with" require underscores and report back with a list of new names. This is about the latest that such a name-change can be done, since the code hasn't really reached users yet. I'll post the updated list of names today.
from awkward-0.x.
You can see the new names in the left-bar of https://awkward-array.readthedocs.io .
from awkward-0.x.
Did ak.withname
get missed? I'd also advocate for ak.linear_fit
instead of ak.linearfit
.
from awkward-0.x.
withname
got missed, but I noticed it in my current PR and fixed it: with_name
. I also found a few more instances of withfield → with_field
(as a parameter, rather than a function name).
I can do linear_fit
. I'll put it into my current PR.
from awkward-0.x.
It's now linear_fit
and mask_identity
: scikit-hep/awkward@43fe180 (or it will be when scikit-hep/awkward#195 is done).
from awkward-0.x.
Related Issues (20)
- dynamically created methods are confusing for users HOT 1
- Achieve masking HOT 8
- AssertionError when Table is part of a list HOT 5
- Potential bug with subsequent masking HOT 2
- Reduction of empty elements HOT 2
- TLorentzVectorArray yields different values depending on masking order HOT 4
- IndexError when masking empty jaggedArray made from offsets HOT 1
- TypeError when using array.mean(weights) HOT 2
- Cyclic array? HOT 1
- broken link in readme HOT 1
- Installing awkward-numba in usermode breaks awkward HOT 3
- Syntax warning due to comparison of literals using is in Python 3.8 HOT 1
- Inconsistent Filesizes with .awkd Files HOT 6
- Bug in string comparison in StringArray HOT 1
- mean, std fail on ChunkedArrays HOT 1
- AttributeError when trying to read a particular format of awkward array HOT 5
- JaggedArray.fromiter() functions fails for python lists HOT 2
- Small detail; broadcasting seems to work a little different to what is implied in the documentation. HOT 6
- Accumulate numpy arrays inside the loop 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 awkward-0.x.