0

I encountered the following in an online Python course:

import matplotlib.pyplot as plt
help(plt.hist)

hist(x, bins=None, range=None, density=None,
weights=None, cumulative=False, bottom=None,
histtype='bar', align='mid', orientation='vertical',
rwidth=None, log=False, color=None, label=None,
stacked=False, normed=None, hold=None, data=None,
**kwargs)

Plot a histogram.

Compute and draw the histogram of *x*. The return value
is a tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*,
...], *bins*, [*patches0*, *patches1*,...]) if the input
contains multiple data.

There are plenty of webpages explaining an asterisk prefix, but Main question: Is straddling with asterisks just an indication of bolding or italicizing the argument name?

On a related note, I use to think of annotations straddling some code as "adornment". However, I haven't been able to clearly corroborate this with web searches. What little I found seems to indicate that adornment refers to adding code to code in a more complicated ways than simple straddling. Secondary question: What is the commonly accepted definition of adornment?

1
  • 2
    I guess it's italic
    – iBug
    Commented Dec 29, 2018 at 13:49

2 Answers 2

2

That is markdown markup language. *text* is text, and **bold** is bold.

This is a popular reference for how to use markdown. It doesn't produce any styling in the console, but it implies emphasis.

Edit: For your second question, a quick Google search revealed:

a thing that adorns or decorates, an ornament.

So basically, just a decoration. You could consider a comment a sort of decoration in your code, I guess, although when talking about comments, I would just use their traditional name to avoid confusion.

1
  • Thank you!. Regarding "adornment", I mostly found the common meaning. In the context of source coding, it seems to mean more than simply straddlng a snippet of source code with additional annotation/delimiters, but indications of its meaning are rare. As an adapted term, maybe there just hasn't been a precise meaning that has been put forth. Commented Dec 29, 2018 at 17:56
2

Is straddling with asterisks just an indication of bolding or italicizing the argument name?

Yes, it is. Using asterisk (*) to surround a word is a common convention for italicisation / emphasis. Including, at the time of writing, the StackOverflow text editor. This is not valid Python syntax.

The only part of the documentation extracted via help where asterisks are important is the function definition:

hist(..., **kwargs)

See What does ** (double star/asterisk) and * (star/asterisk) do for parameters? for an explanation of what asterisks mean in this context.

"Adornment" as far as I'm aware is not a Python concept.

1
  • Thanks, jpp. The use of asterisk for text emphasis was probably meant for something other than DataCamp's online coding window. There, the asterisks are simply displayed as part of the text. As for adornment, I thought it was a general concept in the coding world. Commented Dec 29, 2018 at 17:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.