# Shape() & beginswith()

**URL:** <https://discourse.julialang.org/t/shape-beginswith/4315>\
**Category:** Internals & Design\
**Created:** [June 16, 2017, 8:39pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315 "2017-06-16T20:39:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [June 16, 2017, 8:39pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315/1 "2017-06-16T20:39:22Z")

</div>

i’d like to propose two syntax changes, which i wonder whether have been discussed before. i don’t really hold any realistic hope that the proposed changes will be made due to the entrenched usage of the existing syntax, nevertheless here goes…

first, the mere fact there is `sizeof`, which needs a preposition as suffix to distinguish it from `size`, is an indication that a better choice could be made. why does julia not adopt python’s `shape` for our current `size`, and then repurpose `size` to mean the current `sizeof`? that would be a lot easier to remember.

second, julia used to have `beginswith`, to match `endswith`, but [9578](https://github.com/JuliaLang/julia/issues/9578) changed it to `startswith`, which happens to match python. despite having a `begin` block that terminates in an `end` folks thought it was “inconsistent” with `seekstart` and `start`. as a native english speaker, i disagree-- to me, the opposite of `start` is `finish`, and that of `begin` is `end`. anyone else agree?

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [June 16, 2017, 9:43pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315/2 "2017-06-16T21:43:20Z")

</div>

👎 to `shape` - size is more intuitive for me. (Also, Plots exports `Shape`, which may not matter, but just illustrates that `shape` is a word that is also really useful for actual geometry).  
Agree with `beginswith` FWIW

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [June 16, 2017, 10:01pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315/3 "2017-06-16T22:01:23Z")

</div>

to finish the second thought-- how about using `prefix` for the current `startswith` and `suffix` for `endswith`? much shorter to boot.

---

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [June 17, 2017, 6:15am UTC](https://discourse.julialang.org/t/shape-beginswith/4315/4 "2017-06-17T06:15:18Z")

</div>

I am not a native English speaker, so I checked Google for the number of hits when searching for the exact phrases “words that begin/start/end/finish with x”. Here’s the data:

“words that start with x” - About 1.330.000 results  
“words that begin with x” - About 90.000 results  
“words that end with x” - About 200.000 results  
“words that finish with x” - 6 results

(I only tried the letter “x”, but I suspect other letters would give similar results.)

Even though start-end might not feel like a natural pair, it seems to be the most common choice of words when people talk about what letter a word begins or finishes with.

(As to the `sizeof` function, it is mostly needed when doing low-level stuff, like calling C functions, or manually allocating memory. I would say it makes sense to use the same name as in C since the anyone who uses `sizeof` will likely know C already.)

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [June 19, 2017, 8:53pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315/5 "2017-06-19T20:53:48Z")

</div>

re. `shape` to replace `size`… more reason to make this change is that we already have `reshape`. or perhaps folks think the latter should be renamed to `resize` for consistency?

---

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [June 19, 2017, 9:18pm UTC](https://discourse.julialang.org/t/shape-beginswith/4315/6 "2017-06-19T21:18:20Z")

</div>

I actually like the idea of replacing `size` with `shape`, but that’s at least partially because I’ve used numpy for a long time, and that’s what’s used there. I find it more intuitive, but I suspect that how people feel about these things depends mostly on their background.

Cheers,  
Kevin
