astropy/astropy — pull request #2892 by amras1 (2014-08-25 17:43:19+00:00)
Title: Made `_guess` avoid a couple cases in which Tables are instantiated and then ignored

It occurred to me that, in addition to adding a weakref to `Table` and thinking about @taldcroft's ideas in #2881, one immediate way to avoid overhead in io.ascii guessing is to avoid creating a `Table` if it will later be thrown out. For example, `_apply_include_exclude_names` checks to see if column names are valid *after* the `Table` is instantiated, so I moved the validation code to a method `check_column_names` which is called after header reading. Also, the issue in #2877 involved a check in `_guess` to see if `len(dat.colnames) <= 1`, which can also be moved to the reading code before a `Table` is created. Not sure if adding an attribute `guessing` to `BaseReader` is the right way to go about it, but anyway I'm curious to see what others think.