<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alireza Savand on Medium]]></title>
        <description><![CDATA[Stories by Alireza Savand on Medium]]></description>
        <link>https://medium.com/@Alir3z4?source=rss-7daf53925c96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BYRq098L7Xrk5qV2eNUlKg.jpeg</url>
            <title>Stories by Alireza Savand on Medium</title>
            <link>https://medium.com/@Alir3z4?source=rss-7daf53925c96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:26:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Alir3z4/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Use Django or end up building a Django]]></title>
            <link>https://medium.com/hackernoon/use-django-or-end-up-building-a-django-6cce65eb7255?source=rss-7daf53925c96------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cce65eb7255</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Alireza Savand]]></dc:creator>
            <pubDate>Sat, 17 Dec 2016 22:41:48 GMT</pubDate>
            <atom:updated>2017-07-14T19:39:57.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nC94XZXcbKJQVF1vhj30nQ.png" /><figcaption>Django makes it easier to build better Web apps more quickly and with less code.</figcaption></figure><p>No matter if you’re a beginner or Professional web developer, use Django Python web framework for your web project otherwise you’ll end up building and assembling a Django all together and you will learn that in a hard way.</p><p>Well that’s not completely true, if you’re sure that your project will never ever requires things that Django offers all together, then feel free to use something lightweight.</p><p>Many developers either beginners or advanced ones, struggle to pick up a right framework to work with. Some like the simplicity of Flask that gives them a lot of freedom so they can choose what so ever they want to.</p><p>That’s the problem right there, you have to choose, decide, maintain, glue and assemble tons of libraries to get your project working and keep doing this in as long as your application exists.</p><p>In this article I’m going to set Flask as a small lightweight framework against heavy unchained Django and talk through the example by comparing them for the scenario.</p><h3>Blogging Application</h3><p>Now, creating a Blog in Web Frameworks in like a Hello World program, this is how we compare them most of the time without going into wild details.</p><p>Let’s see how to build a Blog application, a Blog web application usually has:</p><ul><li>Entry</li><li>Commenting</li><li>Admin panel</li><li>Authentication (Sessions, Cookies, Password Encryption, Login, Logout, etc…)</li><li>Atom or RSS Feed</li><li>Sitemap</li><li>Pagination</li><li>Static Pages</li><li>Form handling</li><li>Template Engine</li><li>Searching</li><li>Database (I love an ORM feature)</li><li>Unit Testing</li></ul><p>Those are the basic of many kind of web applications.</p><h3>Flask</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ou6FFJJD3zhcIUU8wBZqIw.png" /><figcaption>Web development, one drop at a time</figcaption></figure><p>Flask doesn’t have anything to do with your Database, has no idea what a database is, it comes with a nice way of URL routing to your views/controllers and return the HTTP response which can contain a HTML template with Jinja as the engine. That’s it.</p><p>The rest of the cycle is on the developer.</p><p>Here’s what you need to start a simple Blog web application. The below is a list of things you need to assemble to get up and running:</p><ul><li>A database extension so you can write and define your User and Entry model.</li><li>You may want to add another thing called ORM to make your life easier.</li><li>If you don’t need to get dirty along the way, think about a database migration tool as well, so you won’t end up writing raw SQL to alter database tables.</li><li>Authentication ext, flask has bunch of good ones. Take one that works with your database layer as well and has good sense of sessions and cookies handling.</li><li>Your database layer would be good to have some pagination helpers as well, if not, no worries you can always write it yourself and do the optimizations and keep it sane with your database layer of choice.</li><li>Sitemap.xml generation, you wanna be indexed in search engines right ?</li><li>RSS or Atom Feed. It’s a Blog app, what’s the point if you don’t have one.</li><li>Static/Flat pages. You should be able change them from your admin panel.</li><li>Oh, you need an Admin panel.</li><li>Your admin panel should work pretty well with all of the extensions or important parts of your application, such as database layer, Authentication, Static/Pages Pages.</li><li>Forms, Forms, Forms! Form plays a big part in web, find a really good and flexible extension to work with.</li><li>Searching is another important layer, would be great to have a simple Full Text Support for you blog, otherwise a simple one would do as well, but be careful to not create a dummy or useless search functionality, otherwise it would damage rather than be useful.</li><li>Commenting, either find an extension or in many cases write your own.</li><li>Unit Testing is really important, you might roll your own or find a great Flask ext to get it working with all of the above components nicely or try it make it in that way.</li></ul><p>Again, please note that all the extensions you find in many cases need to work together nicely and you to have assemble them in that way, otherwise bad things might happen and you don’t want to witness such things. Remember, you can use your time to add more features and do other awesome things in your life rather than doing tons of time consuming work that could be handled much efficiently with other tools.</p><p>Now, let’s see how we can make this happens with Django.</p><h3>Django</h3><p>You only need Django, that’s it, have a nice day.</p><p>Yes, move on, nothing left to do.</p><h3>Plug in &amp; Play</h3><p>Both Flask and Django have nice ready made Blog web applications by the community in a very good shape. Django has Zinnia and Flask has Flask-Blogging. (Zinnia is much mature and feature complete.)</p><p>In this post I tried to show how one would implement such simple and basic thing.</p><h3>So …?</h3><p>It’s not about Django vs Flask or which one is the winner. Tools get built for a purpose and in many cases tools don’t wanna replace each other and they shouldn’t be looked at in that way.</p><p>Any web framework has its own area of work and capabilities, you as the developer or designer of the system should wisely decide to choose the right tool for the job.</p><p>Flask is minimal, you can create big projects with it for sure, but you realy need to glue tons of other tiny applications together, this means more maintenance and work. More work, more work and more work. You have to find the good ones, or solid ones. Each part is developed separately. If any of the part breaks other parts might start bleeding as well. If any of the third party library got abandoned or a certain bug fix is not released, then you have to deal with the issue.</p><p>This issue is there if you pick the wrong tool for the job and build bloking blocks upon each other.</p><p>Django on other hand has most of the things you need for many kind of web applications and covers them very well.</p><p>If your project is a small one page app that doesn’t need much complexity, for sure Flask rocks here. I use Flask when I have tiny and small web application that have only one tiny purpose to serve and done. On the other hand Django is my choice when complexity is higher, database is important, forms are required, admin panel is a must and integrity between my application parts has to be solid as possible. Not only with my application but other third party applications follow the same rule in Django ecosystem.</p><h3>Beginners and Advanced Developers</h3><p>In many cases Beginners start with micro-frameworks when others have recommended them such thing. Mainly because it’s simple to get starting with or easier to understand the “Quick Start” page of their documentation.</p><p>If a beginner wants to build a simple blogging web application, choosing a micro-framework would be a huge mistake due to above reasons that I mentioned. It adds tons of complicated processes for them, confusion after confusion and in many cases people would give up and look somewhere else. They spend a lot of times while gluing things together. Some people like to say this will make them understand more and help them to finf out what’s under the hood and how things work, I don’t think so. It usually makes them get tired and hate the whole thing.</p><p>Advanced Developers should find out more what the beginners are trying to build and then suggest them the right tools.</p><h3>Conclusion</h3><p>Use the right tool for the job.</p><p>Choose <strong>Django</strong> if:</p><ul><li>It makes your development faster and your life easier.</li><li>Need database, forms, authentication, templating, etc.</li><li>Awesome Admin panel.</li><li>Great REST API framework.</li><li>Your database scheme changes once a while or frequently.</li><li>Lots of things are in the project.</li><li>The project will need more stuff and needs to be extended fast.</li><li>Unit testing out of the box with tons of extra sugar.</li><li>Things you don’t know you’d need in future.</li></ul><p>Go with <strong>Flask </strong>or any other micro-frameworks if:</p><ul><li>You don’t need what Django offers.</li><li>That’s it.</li></ul><p><strong>Otherwise, you’ll end up building a Django.</strong></p><figure><a href="http://bit.ly/HackernoonFB"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hqOaABQ7XGPT-OYNgiUBg.png" /></a></figure><figure><a href="https://goo.gl/k7XYbx"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vgw1jkA6hgnvwzTsfMlnpg.png" /></a></figure><figure><a href="https://goo.gl/4ofytp"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gKBpq1ruUi0FVK2UM_I4tQ.png" /></a></figure><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a> family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp; sponsorship</a> opportunities.</blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*35tCjoPcvq6LbB3I6Wegqw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cce65eb7255" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/use-django-or-end-up-building-a-django-6cce65eb7255">Use Django or end up building a Django</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I hate Python 2 and Python 3, but I love Python]]></title>
            <link>https://medium.com/hackernoon/i-hate-python-2-and-python-3-but-i-love-python-20b661100819?source=rss-7daf53925c96------2</link>
            <guid isPermaLink="false">https://medium.com/p/20b661100819</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Alireza Savand]]></dc:creator>
            <pubDate>Fri, 09 Dec 2016 13:58:29 GMT</pubDate>
            <atom:updated>2017-07-14T15:58:32.885Z</atom:updated>
            <content:encoded><![CDATA[<p>Even though the new version is around, people would like to call it “Python 3” which makes it sound like a different language.</p><p>“Python 2” and “Python 3”, I hate them both. I love Python!</p><p>I hate “Python 2” and “Python 3”, because people need to decide between them, project maintainers have to keep compatibility for both and sometimes even for multiple version of 2.7.x and 3.x. It slows down the development of my favorite libraries.</p><p>Seems Python is <strong>not cross-version compatible</strong>, what ? Yes, that’s right. A beautiful selling point of Python is being a <strong>cross-platform language</strong>, but lately it’s becoming non cross-version compatible due to the third party libraries support and some other factors.</p><p>Upgrading from legacy Python version to latest takes changing some statements and how you handle str or Unicode and some other tiny stuff, a tool like 2to3 would do it in 95% of the times, but the <strong>problem is not your code only</strong>, you have to deal with all of your third party libraries and your third party library developers have the same issue. That’s the bleeding wound.</p><p>Lemme tell you a cute short story .</p><h3>The Cute Short Story</h3><p>When I wanted to start a project, after discussion what should the stack be, we decided we need:</p><ul><li>Django</li><li>Django Rest Framework</li><li>Django Storages</li><li>Boto</li><li>Mongodb</li><li>Redis</li><li>PostgreSQL</li><li>Pillow</li><li>Python Requests</li><li>Twillio</li><li>Gevent</li><li>Gunicorn</li><li>Celery</li><li>Mock</li><li>Python Coverage</li><li>Fabric</li><li>ipdb</li></ul><p>And many more of these, so our team was insisting on using Python 2, why ? simply because we might need a third party dependency that is compatible only with “Python 2” and if we start with “Python 3” that might cause us loosing an eye or AKA money.</p><p>All of the above amazing third party libraries worked well with the latest version of Python except Fabric that has a “Python 3” fork.), all of them work exactly on latest or legacy version of Python and still we haven’t hit a issue about third party library compatibility with “Python 3”.</p><p>Still, we went with legacy version, that pissed me off, but in order to keep our work sane or fool each other, we wrote the code to be compatible with “Python 3”. There’s nothing special in the code base that is might break by using “Python 3” as run-time.</p><p>Our CI runs the test for both legacy version and latest and we never had to change the code to be “Python 3” compatible, it just works. The magic in there? We only follow <a href="https://docs.python.org/3/howto/pyporting.html">Python recommendation</a>.</p><p>The fear of dependencies incompatibilities with legacy and latest version of Python.</p><p><strong>Does that mean Python is becoming cross-version incompatible ?</strong></p><p>That’s scary and I don’t want to think about it, maybe I’m overreacting, maybe I took this seriously or making a big deal out of it.</p><p>Problem is, supporting legacy code is good for just some years, but not for a decade, Python 3 came out 2008 and people are still are suspicious or lazy to move on.</p><p>Dropping Python legacy should have started a long time ago, but still it’s not too late, we need to start and encourage others to drop it and move on. We are holding the development back.</p><p>Tons of awesome new features in Python now, features that people choose other languages to make their next projects.</p><ul><li>Coroutines async await.</li><li><a href="https://medium.com/@Alir3z4/python-is-great-for-large-code-base-992fa9233066">Type checking and hinting</a>.</li><li>Static static analysis tools.</li><li>Unicode</li><li>Better exception handling</li><li>String formatting</li><li>Bytes vs String</li><li>Much nicer multi-threading</li><li>etc…</li></ul><p>The list goes on and on…</p><p>Start your next project with latest version of Python, encourage and push third party library developers to move to latest, if they’re don’t or can’t, fork it and do it yourself, it’s Open Source!</p><p><strong>Choose the legacy version only and only when you have no other choices due to vendor lock or bleeding dependencies compatibility.</strong></p><p>A code for “Python 2” is not simply “code”, it’s a code that works with older version of “Python”, a legacy code that is not updated, if you write a code that Python (as latest version) cannot run it, that code is broken, that code is not working anymore. It has to be updated, upgraded to latest.</p><p>I understand the current dependencies and third party modules are the main player in this scenario, but would that worth having 2 separate languages or be a good excuse for it?</p><p>It’s a dilemma, an annoying one. Having 2 Python run-times on a system is weird. Using virtualenv to cover it up is not gonna work .</p><h3>PyBabel Rises!</h3><p>If we’re going to continue in this direction, Someday we might have to use another tool to write a language with a syntax like Python to produce “Python 2” and “Python 3” compatible source and later supports “Python 4”, people won’t be writing “Python” anymore but a language like “Python” that compile or transpile something that different Python implementation will run it.</p><p>That time we gonna think about a language that compiles to something to be runnable on:</p><ul><li>Python 2</li><li>Python 3</li><li>Python 4</li><li>PyPy</li><li>pyston</li><li>Jython</li><li>IronPython</li></ul><p>Having a distance between “Python 2” and “Python 3” will might end up in a situation like that. Who knows, something like like 2to3 might be just a start for tools like that.</p><p>Don’t let Python be[come] cross-version incompatible.</p><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a>family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp;sponsorship</a> opportunities.</blockquote><blockquote>To learn more, <a href="https://goo.gl/4ofytp">read our about page</a>, <a href="http://bit.ly/HackernoonFB">like/message us on Facebook</a>, or simply, <a href="https://goo.gl/k7XYbx">tweet/DM @HackerNoon.</a></blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20b661100819" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/i-hate-python-2-and-python-3-but-i-love-python-20b661100819">I hate Python 2 and Python 3, but I love Python</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It’s Python, Not Python 2, Not Python 3!]]></title>
            <link>https://medium.com/hackernoon/its-python-not-python-2-not-python-3-7caeef5adb29?source=rss-7daf53925c96------2</link>
            <guid isPermaLink="false">https://medium.com/p/7caeef5adb29</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Alireza Savand]]></dc:creator>
            <pubDate>Thu, 01 Dec 2016 14:14:03 GMT</pubDate>
            <atom:updated>2017-07-14T13:42:32.942Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s no “Python 2” or “Python 3”, the language is same as before.</p><blockquote><em>Python 2.x is legacy, Python 3.x is the present and future of the language — </em><a href="https://wiki.python.org/moin/Python2orPython3">Python2orPython3</a></blockquote><p>This whole debate makes newcomers to run away, it’s confusing, nonsense and more importantly a bubble, fairy dust, it doesn’t exist and it shouldn’t be there, It’s only the Python and that’s it.</p><p>If you’re on the older version (<em>“Python 2” as you say</em>), you’re a decade behind, you should have upgraded at 2008.</p><p>You wanna say Unicode or print statement or 2to3, or tiny stuff that are deprecated ? If you forget to upgrade you hit those too, no surprise.</p><p>This is all it takes to upgrade: <a href="https://docs.python.org/3/howto/pyporting.html">https://docs.python.org/3/howto/pyporting.html</a></p><p>People don’t like change, especially companies, they don’t like to change or upgrade, that product manager looks only to end product and not what’s under the hood, no one want to spend time on upgrading, everyone thinks they’re fine where they are. These cannot be the excuse to not update and keep with the latest amazing stuff that are coming in the language every day.</p><p>Python is not like the annoying JavaScript eco-system that has billions of versions of specification and no one know which one to use and plenty of transpilers and specifications that all give the same result. The ending result is JavaScript that the browser supports. Well there’re TypeScript, Elm, Dart, CoffeeScript, etc… You know what I mean.</p><p><strong>Python is in no way in that direction</strong>.</p><p>Stop saying “<em>Should I learn Python 2 or Python 3</em>”, just learn Python. It’s the same thing, nothing is there to be afraid of.</p><p>The rest is either you want to run your software with an older version of Python (2) or the current version (<strong>Not newer, but current!</strong>) which last time I checked was 3.5.2 and soon to be 3.6.</p><p>Just see if your third party packages are upgraded to use the current version of Python, if not then use the older one. Most of the famous and popular ones are using the current version.</p><p>Many say “yes, my current third party dependencies are compatible with the current version, but ‘<em>what if</em>’ in future I need a package that’s not compatible ?” Well, seriously that’s so stupid of that library maintainer.</p><p>Python 3 came out 2008, at the moment of writing this, it’s almost a decade and if your third party package has not been updated, then it’s really messed up.</p><p>People would line up for a new phone to buy it, always check for OS upgrades, etc… why not Python ? What kind of developer are you that wanna use decade old stuff ?</p><p>Current version of Python has many things to offer, tons of them , many things that developers where looking for to have, <a href="https://www.python.org/dev/peps/pep-0492/">async await</a>, <a href="https://medium.com/@Alir3z4/python-is-great-for-large-code-base-992fa9233066#.t2ea206ed">type annotation and type checking</a>, much better Unicode handling, being faster than before, <a href="https://www.python.org/dev/peps/pep-0523/">JIT API right into the CPython</a>, great string formatting and list goes on and on and on. You can check the release notes to get amazed.</p><p>Who doesn’t want those new great features right into the language, a fast evolving like Python should not be bashed just because some are lazy to update their legacy code or don’t like the changes.</p><p>Don’t slow down your development, don’t patch things up just because you’re not on the current Python version.</p><p>Python cures cancer and prevents early death.</p><p>To be continued …</p><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a>family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp;sponsorship</a> opportunities.</blockquote><blockquote>To learn more, <a href="https://goo.gl/4ofytp">read our about page</a>, <a href="http://bit.ly/HackernoonFB">like/message us on Facebook</a>, or simply, <a href="https://goo.gl/k7XYbx">tweet/DM @HackerNoon.</a></blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7caeef5adb29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/its-python-not-python-2-not-python-3-7caeef5adb29">It’s Python, Not Python 2, Not Python 3!</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python[3] is great for projects with large code base]]></title>
            <link>https://medium.com/hackernoon/python-is-great-for-large-code-base-992fa9233066?source=rss-7daf53925c96------2</link>
            <guid isPermaLink="false">https://medium.com/p/992fa9233066</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Alireza Savand]]></dc:creator>
            <pubDate>Thu, 24 Nov 2016 09:42:03 GMT</pubDate>
            <atom:updated>2017-07-14T13:24:02.990Z</atom:updated>
            <content:encoded><![CDATA[<p>People always suggest Java, C++, Go or any other kind of language that are statically typed over Python for projects with large code base due to their statically typed nature.</p><p>When the code grows or becomes old, no matter how much you apply clean code or readability principles, it becomes annoying and harder to understand when you’re going to modify or fix some bugs later, refactoring becomes risky, code review time increases and well, you might start develop a grudge against it. Modifying another lazy person code that doesn’t have any clue about clean code or documentation becomes insane, you might start developing the same grudge against humanity as well.</p><p>Python is great for fast development, taking an idea from zero to production but having a dynamic type nature has its own disadvantages as well.</p><p>Good news is, <strong>this is not true anymore.</strong></p><p>Python 3.6 + <a href="https://github.com/python/mypy">Mypy</a> comes with <em>type</em> checking now, you can check out PEP 526 and its previous PEPs regarding to type checking.</p><h3>What is mypy?</h3><p>Mypy is an optional static type checker for Python. You can add type hints to your Python programs using the standard for type annotations introduced in Python 3.5 (<a href="https://www.python.org/dev/peps/pep-0484/">PEP 484</a>), and use mypy to type check them statically. Find bugs in your programs without even running them!</p><p><a href="https://www.jetbrains.com/pycharm/">PyCharm</a> already supports type hinting and even type annotation syntax, we have project written in Python 3.5 on production with the code base fully written with these new feature, the code has amazing readabilities.</p><p><strong><em>“It has made the code review and maintenance much much easier.”</em></strong></p><p>When I say large code base, I’m mostly talking about projects with at least +100k lines.</p><p>Right now I’m working with multiple projects, each with at least around ~250k lines of code, and they’re growing in matter of code base.</p><p>I’m not saying it’s impossible, but it’s harder when types are not mentioned and hints are not there.</p><p>When I review code, I constantly find myself reading through the function body only to find out the arguments types and the return type of the function. It’s like constantly running the code in my brain to get a clear understanding of it.</p><p>I write DocString a lot, Sphinx style or Python style or any other kind of way to let my development tools such as PyCharm to understand the types.</p><p>For instance, do you know this fib method takes and return ?</p><pre>def fib(n):<br>    a, b = 0, 1<br>    while a &lt; n:<br>        yield a<br>        a, b = b, a+b</pre><p>I’m sure you know, since you just read the body of function to figure that out, but with new features you don’t need to do that anymore:</p><pre>def fib(n: int) -&gt; Iterator[int]:<br>    a, b = 0, 1<br>    while a &lt; n:<br>        yield a<br>        a, b = b, a+b</pre><p>So much better and cleaner.</p><p>This is a very simple example to show case the problem and how it can be solved.</p><p><strong>You can’t bring up this excuse anymore, to say Python is for small sized projects”, just because of dynamic typing nature.</strong></p><p>Some PEPs to read:</p><ul><li><a href="https://www.python.org/dev/peps/pep-0526/">https://www.python.org/dev/peps/pep-0526/</a></li><li><a href="https://www.python.org/dev/peps/pep-0484/">https://www.python.org/dev/peps/pep-0484/</a></li><li><a href="https://www.python.org/dev/peps/pep-3107/">https://www.python.org/dev/peps/pep-3107/</a></li></ul><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a>family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp;sponsorship</a> opportunities.</blockquote><blockquote>To learn more, <a href="https://goo.gl/4ofytp">read our about page</a>, <a href="http://bit.ly/HackernoonFB">like/message us on Facebook</a>, or simply, <a href="https://goo.gl/k7XYbx">tweet/DM @HackerNoon.</a></blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=992fa9233066" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/python-is-great-for-large-code-base-992fa9233066">Python[3] is great for projects with large code base</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing Linux (OpenVZ) images by Kloud51 — Anti-Hack Involved]]></title>
            <link>https://medium.com/@Alir3z4/securing-linux-openvz-images-by-kloud51-anti-hack-involved-f2930aa6e9e7?source=rss-7daf53925c96------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2930aa6e9e7</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[openvz]]></category>
            <dc:creator><![CDATA[Alireza Savand]]></dc:creator>
            <pubDate>Mon, 04 Apr 2016 15:15:21 GMT</pubDate>
            <atom:updated>2016-04-04T15:20:38.768Z</atom:updated>
            <content:encoded><![CDATA[<p>Securing Linux (OpenVZ) images by Kloud51 — Anti-Hack Involved</p><p>Lately, we had many reports from people that their server got blocked from us due to Anti-Hack reason.</p><p>Our users were stating that none of them did anything wrong, some of them didn’t even use the machines, their server would get blocked before they even gain access to it.</p><p>Kloud51 team started testing all of the official and unofficial OpenVZ OS templates that were available to users one by one, so far all of them were fine with not a single malicious files or activity. We ran many tests and different tools to find a hole or malicious file, absolutely nothing was there.</p><p>We launched hundreds of VPS machines and keep monitoring them, each with different OS templates and different kind of software installed on. Of course, we got some help from volunteers in this test from our clients, which they allow us to install our monitoring and log collectors on their machines.</p><p>The result was amazing, not only we found the source of the issues but the solution to fix them as well.</p><p>VPS machines would get hacked or cracked and get rootkit and back doors installed on them in less than 5 minutes, each attacks coming from many different IPs and changing attacks in seconds, once the hack attempt got successful, most of the time a rootkit would get installed or a script with root access would be created in the system. There were many different kinds of attacks that we were surprised how they were working.</p><p>Good news is we found the solution to prevent such attacks.</p><p>Below you can see what kind of customization we’ve done on each server image to get them working securely:</p><ul><li><strong>Configuring firewalls (iptables).</strong></li><li><strong>SSH Brute Force.</strong></li><li><strong>FTP Hardening.</strong></li><li><strong>Closing Unused Ports.</strong></li><li><strong>Removing unnecessary applications.</strong></li><li><strong>Disabled unused services and daemons.</strong></li></ul><p>Since then we have applied those basic security hardening features to most of the OpenVZ OS templates we’re offering and still recommend our users to don’t forget to do their best to prevent getting hacked.</p><p>The sad part is, almost all of the OpenVZ/KVM/XEN OS templates come with complete dummy and insecure default settings and web hosting providers don’t take the time to configure and fix the issue.</p><p>It hurts the users, give more opportunity for malicious activities and obviously a real good opportunity to companies that offer security hardening for lots of <strong>$$$ </strong>for applying basic stuff on people servers.</p><p>I’d like to note that having all of these won’t help if you have a <strong>weak</strong> password and <strong>root allowed</strong> login either with <em>authentication_key</em> or <em>password</em> you’ll be doomed most of the times.</p><p>Take care of your machines, secure them, change default SSH port and always be aware what is being running in the background of your machine. Tools like <strong>top</strong>, <strong>htop</strong> and <strong>ps</strong> are the wild bunch you’re looking for when going to find running processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2930aa6e9e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>