Top-rated recipes tagged "difference" Code RecipesList comparison, difference and more using set & frozenset (Python) 2012-11-01T10:30:58-07:00Scott S-Allen <p style="color: grey"> Python recipe 578310 by <a href="/recipes/users/4181178/">Scott S-Allen</a> (<a href="/recipes/tags/compare/">compare</a>, <a href="/recipes/tags/contain/">contain</a>, <a href="/recipes/tags/difference/">difference</a>, <a href="/recipes/tags/lambda/">lambda</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/remove/">remove</a>, <a href="/recipes/tags/set/">set</a>, <a href="/recipes/tags/union/">union</a>). </p> <p>Python has a powerful suite of tools for comparing lists by way of sets and frozensets. Here are a few examples and conveniences that many newcomers, even a few seasoned developers, are unaware.</p> A script evaluating PSNR metric of two YUV420 frames (Python) 2011-04-08T07:26:45-07:00Denis Gorodetskiy <p style="color: grey"> Python recipe 577645 by <a href="/recipes/users/4177587/">Denis Gorodetskiy</a> (<a href="/recipes/tags/comparison/">comparison</a>, <a href="/recipes/tags/difference/">difference</a>, <a href="/recipes/tags/frame/">frame</a>, <a href="/recipes/tags/metric/">metric</a>, <a href="/recipes/tags/psnr/">psnr</a>, <a href="/recipes/tags/video/">video</a>, <a href="/recipes/tags/yuv/">yuv</a>). Revision 2. </p> <p>A script evaluating PSNR metric of two YUV420 frames <strong>usage: filename1.yuv filename2.yuv frame_width frame_height</strong></p> <p>Alternatively if filename1 contains width and height in the form <strong>file-1200x1600.yuv</strong>, the script will extract width and height of a frame from the filename. Then usage even simplier: <strong> filename1-1200x1600.yuv filename2.yuv</strong></p> Diff Two Dictionaries (Python) 2009-02-05T08:35:07-08:00Michael Shepanski <p style="color: grey"> Python recipe 576644 by <a href="/recipes/users/4169100/">Michael Shepanski</a> (<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/diff/">diff</a>, <a href="/recipes/tags/difference/">difference</a>). </p> <p>Diff two dictionaries returning just the differences. If an item is not found, it is represented by the string "&lt;KEYNOTFOUND&gt;". If there is a better way, please share. :)</p>