On Wed, Mar 5, 2014 at 6:49 AM, Marko Rauhamaa <ma...@pacujo.net> wrote: > public ConnectionPool(int maxConnections, String url) throws SQLException { > try { > super(() -> { > try { > return DriverManager.getConnection(url); > } catch ( SQLException ex ) { > throw new WrappedSqlException(ex); > } > }, maxConnections); > } catch (WrappedSqlException wse) { > throw wse.getSqlException(); > } > } > > ===JAVA END============================================================= > > ===PYTHON BEGIN========================================================= > > def __init__(self, max_connections, url): > super().__init__(lambda: DriverManager.get_connection(url), > max_connections)
You're not doing the same thing, though. The Java rigmarole is to ensure that an SQLException thrown in getConnection will propagate up, despite (presumably) something inside the equivalent of super().__init__ that swallows SQLExceptions. Of course it looks tidier when you don't do the messy bit. ChrisA -- https://mail.python.org/mailman/listinfo/python-list