<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Tue Jun 18, 2013 7:46 am by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Tue Jun 18, 2013 7:46 am</pubDate>
  <lastBuildDate>Tue Jun 18, 2013 7:46 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>More Python Goodies... ;o)</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102125#102125</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=58561'&gt;Bazza&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Oct 12, 2011 8:27 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      As many of you guys know I am forever hacking which is why......&lt;br /&gt;
&lt;br /&gt;
I've been quiet-ish for a while because I've been uploading stuff to:-&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://code.activestate.com/recipes/langs/python/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://code.activestate.com/recipes/langs/python/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Well I have been experimenting on Backwards Compatibility and this&lt;br /&gt;
latest incarnation is being uploaded to LXF first before I decide to release&lt;br /&gt;
to the above site...&lt;br /&gt;
&lt;br /&gt;
Inside the code are the previous uploads to the above URL pretaining&lt;br /&gt;
to Backwards Compatibility...&lt;br /&gt;
&lt;br /&gt;
Enjoy finding simple solutions to often very difficult probleems...&lt;br /&gt;
(Watch out for wordwrapping etc...)&lt;br /&gt;
&lt;br /&gt;
Bazza...&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;# compatibility5.py&lt;br /&gt;
#&lt;br /&gt;
# Backwards compatibility for text mode Python 1.4.0 to 3.2.2...&lt;br /&gt;
# Some simple things that work for all these versions on the&lt;br /&gt;
# classic AMIGA, E-UAE, PCLinuxOS 2009, Debian 6.0.0, Windows XP and&lt;br /&gt;
# Vista and WinUAE. Note, classic AMIGAs and derivatives only reach&lt;br /&gt;
# Python version 2.4.6. AROS goes to version 2.5.2.&lt;br /&gt;
# Python versions checked against, 1.4.0, 2.0.1, 2.4.2, 2.5.2, 2.6.1&lt;br /&gt;
# 2.6.6, 2.7.2, 3.0.1, 3.1.3 and 3.2.2.&lt;br /&gt;
# Versions 1.4.0 to 2.7.2 have these already so running this code just&lt;br /&gt;
# imports &amp;quot;sys&amp;quot; only and therefore no harm is done...&lt;br /&gt;
#&lt;br /&gt;
# &amp;#40;C&amp;#41;2011, B.Walker, G0LCU. Initially issued to LXF as Public Domain.&lt;br /&gt;
# You may do with the code as you please.&lt;br /&gt;
#&lt;br /&gt;
# These are to go along with these pointers...&lt;br /&gt;
# http&amp;#58;//code.activestate.com/recipes/577836-raw_input-for-all-versions-of-python/?in=lang-python&lt;br /&gt;
# http&amp;#58;//code.activestate.com/recipes/577868-backwards-compatibility/?in=lang-python&lt;br /&gt;
# http&amp;#58;//code.activestate.com/recipes/577872-bacwards-compatibility-part-2/?in=lang-python&lt;br /&gt;
# http&amp;#58;//code.activestate.com/recipes/577884-backwards-compatibility-part-3/?in=lang-python&lt;br /&gt;
# http&amp;#58;//code.activestate.com/recipes/577903-backwards-compatibility-part-4/?in=lang-python&lt;br /&gt;
# ===================================================================&lt;br /&gt;
# Single old functions to make Python backwards compatible... ;o&amp;#41;&lt;br /&gt;
# These are a little &amp;quot;tongue in cheek&amp;quot; but enjoy...&lt;br /&gt;
# To add to an existing Python 3.x.x run, type&amp;#58;-&lt;br /&gt;
#&lt;br /&gt;
# &amp;gt;&amp;gt;&amp;gt; exec&amp;#40;open&amp;#40;'/path/to/file/compatibility5.py'&amp;#41;.read&amp;#40;&amp;#41;&amp;#41;&amp;lt;RETURN/ENTER&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# And away you go...&lt;br /&gt;
import sys&lt;br /&gt;
if sys.version&amp;#91;0&amp;#93;==&amp;quot;3&amp;quot;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# The line &amp;quot;raw_input=input&amp;quot; is already in the first URL...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# IMPORTANT NOTE&amp;#58;- If you use, for versions 1.4.0 to 2.7.2,&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# input=raw_input then that _removes_ the genuine &amp;quot;input&amp;#40;&amp;#41;&amp;quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# function from the __builtins__ until Python is re-run.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# THUS you are then forced to add the &amp;quot;eval&amp;#40;&amp;#41;&amp;quot; function if you&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# require the original &amp;quot;input&amp;#40;&amp;#41;&amp;quot; functionality... Good eh! ;o&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;raw_input=input&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# &amp;quot;xrange&amp;#40;&amp;#41;&amp;quot; is back...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;xrange=range&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# These functions, deleted from Version 3.x.x, are now back too...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;def execfile&amp;#40;STRING_some_path_and_file, globals=&amp;#123;&amp;#125;, locals=&amp;#123;&amp;#125;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;exec&amp;#40;open&amp;#40;STRING_some_path_and_file&amp;#41;.read&amp;#40;&amp;#41;&amp;#41; in globals, locals&lt;br /&gt;
&amp;nbsp; &amp;nbsp;def reload&amp;#40;some_module&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;import imp&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;imp.reload&amp;#40;some_module&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return&amp;#40;some_module&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;def coerce&amp;#40;x,y&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if str&amp;#40;type&amp;#40;x&amp;#41;&amp;#41;==&amp;quot;&amp;lt;class 'float'&amp;gt;&amp;quot; or str&amp;#40;type&amp;#40;y&amp;#41;&amp;#41;==&amp;quot;&amp;lt;class 'float'&amp;gt;&amp;quot;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;x=float&amp;#40;x&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;y=float&amp;#40;y&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;else&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;x=int&amp;#40;x&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;y=int&amp;#40;y&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return&amp;#40;x,y&amp;#41;&lt;br /&gt;
# ===================================================================&lt;br /&gt;
# There will be more to follow...&lt;br /&gt;
# Enjoy finding simple solutions to often very difficult problems... ;o&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
It's all over to you lot now... ;o)</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102125#102125</comments>
                                        <author>Bazza</author>
                                        <pubDate>Wed Oct 12, 2011 8:27 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102125#102125</guid>
                                      </item></channel></rss>