Re: [Python-Dev] To 3.0.2 or not to 3.0.2?
Le Wednesday 18 February 2009 20:48:17 Benjamin Peterson, vous avez écrit : > On Wed, Feb 18, 2009 at 9:30 AM, Guido van Rossum wrote: > > This prompts a wild idea -- perhaps the framework of 2to3 could be > > reused to create a new linter? > > The 2to3 syntax tree is probably two low-level for that. It's good for > simple isolated transformations like print, but not so much for the > larger scale analysis that a lint tool would require. In addition, > we'd have to write some sort of symtable analyzer. High level AST is > much nicer to work with that. FYI, we (logilab) are curently working on providing a compatibility layer between _ast and compiler to get pylint working on py3k, py >= 2.6 and py <= 2.5. There are some tree structure incompatibility between them which makes the thing not trivial but I hope we'll get somewhere soon. Of course any help is welcome :) -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services Python et calcul scientifique: http://www.logilab.fr/science ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] BLOBs in Pg
On 09 avril 14:05, Steve Holden wrote: > Oleg Broytmann wrote: > > On Thu, Apr 09, 2009 at 01:14:21PM -0400, Tony Nelson wrote: > >> I use MySQL, but sort of intend to learn PostgreSQL. I didn't know that > >> PostgreSQL has no real support for BLOBs. > > > >I think it has - BYTEA data type. > > > But the Python DB adapters appears to require some fairly hairy escaping > of the data to make it usable with the cursor execute() method. IMHO you > shouldn't have to escape data that is passed for insertion via a > parameterized query. can't you simply use dbmodule.Binary to do the job? -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework:http://www.cubicweb.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] python3k : imp.find_module raises SyntaxError
On 25 novembre 11:22, Ron Adam wrote: > On 11/25/2010 08:30 AM, Emile Anclin wrote: > > > >hello, > > > >working on Pylint, we have a lot of voluntary corrupted files to test > >Pylint behavior; for instance > > > >$ cat /home/emile/var/pylint/test/input/func_unknown_encoding.py > ># -*- coding: IBO-8859-1 -*- > >""" check correct unknown encoding declaration > >""" > > > >__revision__ = '' > > > > > >and we try to find that module : > >find_module('func_unknown_encoding', None). But python3 raises SyntaxError > >in that case ; it didn't raise SyntaxError on python2 nor does so on our > >func_nonascii_noencoding and func_wrong_encoding modules (with obvious > >names) > > > >Python 3.2a2 (r32a2:84522, Sep 14 2010, 15:22:36) > >[GCC 4.3.4] on linux2 > >Type "help", "copyright", "credits" or "license" for more information. > >>>>from imp import find_module > >>>>find_module('func_unknown_encoding', None) > >Traceback (most recent call last): > > File "", line 1, in > >SyntaxError: encoding problem: with BOM > > I don't think there is a clear reason by design. Also try importing > the same modules directly and noting the differences in the errors > you get. IMO the point is that we can consider as a bug the fact that find_module tries to somewhat read the content of the file, no? Though it seems to only doing this for encoding detection or like since find_module doesn't choke on a module containing another kind of syntax error. So the question is, should we deal with this in pylint/astng, or can we expect this to be fixed at some point? -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework:http://www.cubicweb.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] python3k : imp.find_module raises SyntaxError
On 29 novembre 14:21, Ron Adam wrote: > On 11/29/2010 01:22 PM, Brett Cannon wrote: > >Considering these semantics changed between Python 2 and 3 w/o a > >discernable benefit (I would consider it a negative as finding a > >module should not be impacted by syntactic correctness; the full act > >of importing should be the only thing that cares about that), I would > >consider it a bug that should be filed. > > The output of imp.find_module() returns an open file io object, and > it's output feeds directly into to imp.load_module(). > > >>> imp.find_module('pydoc') > (<_io.TextIOWrapper name=4 encoding='utf-8'>, > '/usr/local/lib/python3.2/pydoc.py', ('.py', 'U', 1)) > > So I think the imp.find_module() is suppose to be used when you *do* > want to do the full act of importing and not for just finding out if > or where module xyz exists. in python 2, find_module was usable for such usage, and this is a needed api for a tool like pylint. Is there another way to do so with python 3? -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework:http://www.cubicweb.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-3000] Warning for 2.6 and greater
sorry this is actually more an answer to Raymond's email but I accendidentally delete it some I'm replying there. On Wednesday 10 January à 20:42, Thomas Wouters wrote: > On 1/10/07, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > <"Anthony Baxter"> > > Comments? What else should get warnings? > > It is my strong preference that we not go down this path. > Instead, the 2.6 vs 3.0 difference analysis should go in an > external lint utility. > > The Py2.x series may live-on for some time and should do so > as if Py3.x did not exist. Burdening the 2.x code with loads > of warnings will only clutter the source code and make maintenance > more difficult. There may also be some performance impact. > > We should resolve that Py2.6 remain as clean as possible > and that Py3.0 be kept in its own world. Forging a new > blade does not have to entail dulling the trusty old blade. Just notice that pylint is already warning for some py3k deprecation such as input(), <> and so on. It would be pretty easy to add warnings for the missing stuff provided a complete list of changes. Even better, pylint sorts its messages between various categories, and it would be as easy to get a py3k migration category so users can launch pylint to get only migration related messages (or filter them out as well). IMO that could be acheive in a couple of hours without anymore work involved. -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services Python et calcul scientifique: http://www.logilab.fr/science ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] status of absolute_import w/ python 2.7
Hi there, the documentation state that absolute_import feature is the default behaviour with python 2.7, though it seems that it behave differently with the __future__ import : $ cat package/__init__.py import subpackage $ python2.7 Python 2.7.1+ (default, Apr 20 2011, 22:33:39) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import package >>> $ cat package/__init__.py from __future__ import absolute_import import subpackage $ python2.7 Python 2.7.1+ (default, Apr 20 2011, 22:33:39) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import package Traceback (most recent call last): File "", line 1, in File "package/__init__.py", line 23, in import subpackage ImportError: No module named subpackage Maybe the doc should be fixed ? -- Sylvain Thénault LOGILAB, Paris (France) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework:http://www.cubicweb.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 8 pylintrc?
On Sunday 23 April à 14:59, [EMAIL PROTECTED] wrote: > I had the possibly stupid idea today of running the stdlib through pylint. > Has anybody written a pylintrc file that attempts to reflect the > recommendations of PEP 8 the extent possible? default pylint configuration should not be that far from PEP8. I would be actually interested about what you think is not conformant, or even which test are missing for a better "PEP8 compliance test". -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] gettext.py bug #1448060
Hi there, while playing with gettext catalog handling of a complex application, I've hit bug #1448060. This bug seems serious to me since gettext.py is not able to handle some .po files generated by msgcat/msgmerge due to lines like "#-#-#-#-# fr.po (2.0) #-#-#-#-#\n" in the metadata. I've posted a patch (#1475523) for this and assigned it to Martin Von Loewis since he was the core developper who has made some followup on the original bug. Could someone (Martin or someone else) quick review this patch ? I really need a fix for this, so if anyone feels my patch is not correct, and explain why and what should be done, I can rework on it. regards, -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] gettext.py bug #1448060
On Tuesday 25 April à 01:24, "Martin v. Löwis" wrote: > Sylvain Thénault wrote: > > I've posted a patch (#1475523) for this and assigned it to Martin Von > > Loewis since he was the core developper who has made some followup on > > the original bug. Could someone (Martin or someone else) quick review > > this patch ? I really need a fix for this, so if anyone feels my > > patch is not correct, and explain why and what should be done, I can > > rework on it. > > If you need quick patch, you should just go ahead and use it > (unreviewed). It will take several more months until either Python 2.4.4 > or Python 2.5 is released. yep, that's what I intend to do anyway... But I wish to contribute the fix back so I can drop the overriden module asap (even if asap means in a few months in that case), and I would feel better if the patch was validated and checked in. But you're right that it doesn't have to be done so quickly since I'll be stuck with my own patched module until an official python release. -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com