# Newbie questions coming from Python/C++

**URL:** <https://discourse.julialang.org/t/newbie-questions-coming-from-python-c/43512>\
**Category:** New to Julia\
**Created:** [July 22, 2020, 7:33pm UTC](https://discourse.julialang.org/t/newbie-questions-coming-from-python-c/43512 "2020-07-22T19:33:57Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![paulmelis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paulmelis/32/35063_2.png) [@paulmelis](https://discourse.julialang.org/u/paulmelis)\
**Post date:** [July 23, 2020, 2:58pm UTC](https://discourse.julialang.org/t/newbie-questions-coming-from-python-c/43512/21 "2020-07-23T14:58:32Z")

</div>

> [@stevengj](#):
>
> > [@paulmelis](#):
> >
> > So it would seem that you manually need to `export` every method you want to make available as public interface for the class?
> 
> Note also that in many cases a large fraction of the methods you want to make available are actually extensions of functions defined in `Base` (or other modules), in which case you don’t need to export them (the caller is already using `Base` ).
> 
> So, for example, if you define a new numeric type and define methods for `Base.+` , `Base.sqrt` , `Base.show` , `Base./` , etcetera, you don’t need to export these.

Well, I would say that that is a very “numeric computing oriented” position. I know that’s the focus of Julia, but I’m currently exploring it as an intermediate between Python and C++ (as high-level as the former, as fast as the latter) and I suspect others approach Julia that way as well. So I might potentially use it for all kinds of things, not necessarily numeric computing (e.g. text processing, web apps, visualization).

> [@stevengj](#):
>
> But yes, you need to explicitly export _new_ generic functions `foo` (i.e., new function _names_ , not just new methods of existing functions) that you define, unless you want callers to access them via `MyModule.foo` .

Again, this might be my different approach in using Julia, as I’m currently (as a first step) doing OO-style programming, where you have a set of structs each with their own specific methods of which only a subset needs to be accessible outside the module. The methods are usually not really applicable to other types of structs. Overcoming this with the `MyModule.foo(obj, ...)` style is a bit suboptimal, having a form that suggests an object-oriented method call (which is impossible in Julia, I know) but still having to pass the actual object as first parameter.

I can actually at this point foresee that I might draw the conclusion that Julia is not a good fit for when you really want to do OO-style programming, but with higher (potential) performance than Python while not wanting to use C++.

Edit: After reading [Julia OOP example](https://discourse.julialang.org/t/julia-oop-example/27568) I’d say OO-style here doesn’t necessary mean using inheritance and such, but working with a set of interrelated objects each with their own methods and performing operations on those objects. I hardly use inheritance in practice.

---

_[View the full topic](https://discourse.julialang.org/t/newbie-questions-coming-from-python-c/43512)._
