<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>JetBrains Developer Community: Message List - Support Python 2 and 3 single codebase</title>
    <link>http://devnet.jetbrains.com/community/python?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Wed, 30 May 2012 15:50:11 GMT</pubDate>
    <generator>Clearspace 2.5.16 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2012-05-30T15:50:11Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Support Python 2 and 3 single codebase</title>
      <link>http://devnet.jetbrains.com/message/5460630?tstart=0#5460630</link>
      <description>&lt;!-- [DocumentBodyStart:bffc6c28-ca57-4da4-9041-9b5ec35504c5] --&gt;&lt;div class='jive-rendered-content'&gt;&lt;p&gt;I was not aware about the configuration setting that you mentioned. Thanks for the tip. However does not seem to help in this case. For example with a Python 3 interpreter configured, I get the following introspection (shown as comments in the code)&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;if sys.version &amp;lt; '3':&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&amp;#160;&amp;#160;&amp;#160; string_types = basestring&amp;#160; # &amp;lt;----- "basestring type is not available in py3"&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160; from io import open&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160; from StringIO import StringIO # &amp;lt;----- "Unresolved reference 'StringIO'&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160; _tokenize = lambda input: tokenize.generate_tokens(StringIO(input).readline)&lt;br/&gt;else:&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160; string_types = str&lt;br/&gt;&amp;#160;&amp;#160;&amp;#160; _tokenize = lambda input: tokenize.tokenize(BytesIO(input.encode('utf-8')).readline)&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hernan&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:bffc6c28-ca57-4da4-9041-9b5ec35504c5] --&gt;</description>
      <pubDate>Wed, 30 May 2012 15:50:11 GMT</pubDate>
      <author>devnet@jetbrains.com</author>
      <guid>http://devnet.jetbrains.com/message/5460630?tstart=0#5460630</guid>
      <dc:date>2012-05-30T15:50:11Z</dc:date>
      <clearspace:dateToText>11 months, 3 weeks ago</clearspace:dateToText>
    </item>
    <item>
      <title>Re: Support Python 2 and 3 single codebase</title>
      <link>http://devnet.jetbrains.com/message/5460624?tstart=0#5460624</link>
      <description>&lt;!-- [DocumentBodyStart:6823f6d3-2c49-4094-a84e-850c0f32baa9] --&gt;&lt;div class='jive-rendered-content'&gt;&lt;p&gt;What issues exactly are incorrectly highlighted by PyCharm?&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;You can configure PyCharm's code compatiblility inspection to tell it that your codebase must be compatible with both Python 2 and Python 3.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:6823f6d3-2c49-4094-a84e-850c0f32baa9] --&gt;</description>
      <pubDate>Wed, 30 May 2012 15:29:48 GMT</pubDate>
      <author>yole@jetbrains.com</author>
      <guid>http://devnet.jetbrains.com/message/5460624?tstart=0#5460624</guid>
      <dc:date>2012-05-30T15:29:48Z</dc:date>
      <clearspace:dateToText>11 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
    </item>
    <item>
      <title>Support Python 2 and 3 single codebase</title>
      <link>http://devnet.jetbrains.com/message/5460527?tstart=0#5460527</link>
      <description>&lt;!-- [DocumentBodyStart:55f6bbdd-8c3f-43cd-b410-969f236e67e6] --&gt;&lt;div class='jive-rendered-content'&gt;&lt;p&gt;Many of us are currently migrating our projects from Python 2 to Python 3. While using 2to3 is the suggested possibility, many of us are finding that using a single if statement to define a only few things is enough in many simple projects. This is particularly useful when iterating between coding and testing as avoids the use of 2to3.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It would be nice if Pycharm introspection supports from this type of programming without wrongly labling an error. For this purpose Pycharm would need to understand this construct (or something similar):&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;if sys.version &amp;lt; '3':&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&amp;#160;&amp;#160; # version 2 code&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;else:&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;&amp;#160;&amp;#160; # version 3 code&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hernan&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:55f6bbdd-8c3f-43cd-b410-969f236e67e6] --&gt;</description>
      <pubDate>Tue, 29 May 2012 17:03:40 GMT</pubDate>
      <author>devnet@jetbrains.com</author>
      <guid>http://devnet.jetbrains.com/message/5460527?tstart=0#5460527</guid>
      <dc:date>2012-05-29T17:03:40Z</dc:date>
      <clearspace:dateToText>11 months, 3 weeks ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
    </item>
  </channel>
</rss>

