Code Sample, a copy-pastable example if possible

import pandas as pd
df = pd.DataFrame({'a': [1, '2']})
df.to_hdf('tmp.h5', 'key', format='table')

Problem description

I wonder if there is a reason why the exception message contains a line break:

TypeError: Cannot serialize the column [a] because
its data contents are [mixed-integer] object dtype

The line breaks are explicitly introduced in module pandas/io/pytables.py:

raise TypeError(
    "Cannot serialize the column [%s] because\n"
    "its data contents are [%s] object dtype"
    % (item, inferred_type)
)

It should be noted that besides this message, there are many others exception massages with line breaks in this module.

I make this question because I am logging the output and I think it would be better to have an event log per line.

Expected Output

TypeError: Cannot serialize the column [a] because its data contents are [mixed-integer] object dtype

Output of pd.show_versions()

commit: None python: 3.5.1.final.0 python-bits: 64 OS: Linux OS-release: 3.13.0-107-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: ca_ES.UTF-8 pandas: 0.18.0 nose: 1.3.7 pip: 8.1.1 setuptools: 20.3 Cython: 0.23.4 numpy: 1.10.4 scipy: 0.17.0 statsmodels: 0.6.1 xarray: None IPython: 4.1.2 sphinx: 1.3.5 patsy: 0.4.0 dateutil: 2.5.1 pytz: 2016.2 blosc: None bottleneck: 1.0.0 tables: 3.2.2 numexpr: 2.5 matplotlib: 1.5.1 openpyxl: 2.3.2 xlrd: 0.9.4 xlwt: 1.0.0 xlsxwriter: 0.8.4 lxml: 3.6.0 bs4: 4.4.1 html5lib: None httplib2: None apiclient: None sqlalchemy: 1.0.12 pymysql: None psycopg2: None jinja2: 2.8 boto: 2.39.0

Comment From: jreback

well line breaks make things easier to read

Comment From: jreback

certainly willing to take a patch to make this particular one a 1-liner if that is more readable. Though in general multi-lines is fine.

Comment From: albertvillanova

In a logfile, normally every line corresponds to one event message. Multi-line log messages create great difficulty in the usage of logfiles for monitoring purposes. Nevertheless, if the priority for Pandas is human readability then no fix is nedeed.