Truco de Python, como crear objetos “flojos” (Lazy objects)

Este es un “re-post” en español de este otro articulo que escribí en inglés: Python trick: How to make lazy objects?. Si ya leíste aquel articulo igual te invito a que leas este, compares y compartas.

Esta vez voy a hablar de los “lazy objects”, los he llamado así porque son mas o menos similar a lo que usaba con los “Lazy treeviews” en GTK donde el árbol muestra los expansiones pero no se cargan los nodos hijos hasta que expandes el nodo. Lo que quiero entonces es crear objetos que sirvan para contar, que tengan un tipo de dato, pero que no carguen nada de datos hasta que se necesite. read more

8 errores que todo programador novato comete

1. Escribir código sin planear

Este es el primero, cuando nos cuentan de un proyecto lo primero que hacemos es empezar a divagar, es mas, ni bien nos estan terminando de contar los requerimientos y ya hemos escogido el lenguaje, el framework y a veces hasta el pilón.

Siempre es importante pensar el proyecto, ¿es viable?, hay que investigar y planear, entonces, escribe, valida los resultados y modifica.

2. Planear demasiado las cosas

También este es un error, a veces sobrepasamos demasiado las cosas y terminamos creando un monstruo porque “en el futuro puede que llegue a necesitar esta característica”, es mejor implementar algo simple y que logre el propósito aunque despues tengamos que reescribr parte del código. read more

Yay! PyCharm 2018.3 !!

I’ve been using PyCharm for professional use since about 1 ½ years now ( I mean paying for the Pro license, I have more time using the Community Edition), and I like a lot what PyCharm help me to do, the Django support is pretty awesome and is super fast even when my computer is a 2012 model.

So, I’m pretty happy with every new version of PyCharm, there are several new features and improvements, you can see them here: What’s New in PyCharm

Podría la popularidad de Python ser superior a la de JavaScript en 5 años?

Respuesta corta: NO

La cuestión es que JavaScript está presente como bien dice el articulo, en cerca del 95% de los sitios web en el mundo, es un lenguaje de programación que domina la forma en la que las paginas web tienen cierto dinamismo, vaya, para nadie es raro escuchar de la tripleta HTML5+CSS+JavaScript, sin embargo otras tecnologias como Flash o Java decayeron tanto que solo un par de navegadores lo soportan aún.

Python por otro lado es un lenguaje de uso general, muy popular en el backend y en aplicaciones de Machine Learning y computo científico, es su sencillez y madurez lo que le da su popularidad, sin embargo no cuenta con esa exclusividad que tiene JavaScript.

Es JavaScript un mejor lenguaje que Python?. Lo dudo mucho, hay muchos ejemplos de lo que está roto en JavaScript, tanto que hasta juegos sobre sus patrones de igualdad hay. Incluso hay lenguajes que se compilan a JavaScript para hacer las cosas mas “sencillas” y menos susceptibles a errores. Sin embargo, como dije en el párrafo anterior, JavaScript cuenta con esa exclusividad en la web que hace casi imposible que otro lenguaje de programación sea tan popular como él. Si vas a aprender a hacer sitios web tienes por fuerza que aprender a usar JavaScript, incluso si usas algún framework. Otro punto fuerte de JavaScript son los dispositivos móviles, para muchos el tener que mantener la misma app en diferentes plataformas los ha llevado a tener un framework con un lenguaje de programación común, ahí es donde JS ha sido el que ha triunfado, es común encontrarse frameworks que usan JS y “convierten” estas instrucciones a una app nativa, o en el peor de los casos a una especie de web-view con el dinamismo dado por JS.

Como podría Python ganarle terreno a JavaScript?, lo está haciendo muy bien sirviendo desde el backend (como de costumbre), muchos sitios web estan construidos sobre Django, APIs que se han construido sobre Flask, en el computo científico es muy pero muy popular, pero seria genial que Python fuera la base para alguna plataforma móvil, te imaginas escribir apps para dispositivos móviles usando Python de forma nativa? es decir, que el dispositivo use Python directamente, que no se compile a JS, Java/Kotlin u ObjectiveC/Swift.

Cuál es tu predicción a 5 años?, Python será mas popular que JavaScript?.

JavaScript and Python are two influential programming languages for building a wide range of applications.

Source: Could Python’s Popularity Outperform JavaScript in the Next Five Years?

Python no tendrá Master/Slave en 3.8

Guido van Rossum hizo el merge del PR de Victor Stinner, por lo que los términos Master y Slave ya no aparecerán en la versión 3.8 de Python, aunque uno de los PRs quedó fue porque refleja la terminología de las pseudoterminales de UNIX.

Así que váyanse preparando, para eliminar los “child processes” porque como vas a tener a un niño trabajando. Igual los Daemons, y finger tendrá que ser renombrado porque, pues propone un dedo y no se me vayan a ofender por eso…

De saber que te marchitas no te corto florecita… read more

Remover “Master” y “Slave” de Python?

 

A ver que opina usted, ¿le gustaría que se dejaran de usar los términos “master” y “slave” o “Maestro” y “Esclavo” de la terminología en Python?.

En lo personal creo que hay muchas cosas mejores que hacer, un par de palabras que no me parecen en absoluto ofensivas porque desde un principio, no estan dirigidas a mi, no se refieren a mi, de hecho, no se refieren a una persona, se refieren a un par de procesos.

Me da un poco de coraje mezclado con tristeza el hecho de que haya personas que con cosas tan triviales como un par de palabras se sientan ofendidas, deberían entender que son solo palabras, las palabras sin contexto no tienen un verdadero significado y dentro del contexto en Python solo se refiere a un proceso que tiene el control sobre otro que no, lo que dice que no es el maestro y el otro el esclavo. read more

Tips and tricks: Django – Mostrar cierto contenido seleccionado en un ChoiceField

Si hemos usado Django seguro nos hemos enamorado de su forma de hacer formularios, sobre todo los que están relacionados con un modelo, puesto que son simplísimos. Hay que reconocer lo simple de Django, y gracias a esta simplicidad que no busca satisfacer completamente todas las necesidades podemos encontrarnos con situaciones que pues, no se apegan a lo que queremos hacer.

Python is growing up, you know that because tools are getting better 

Microsoft, a company that have their very own tools  and programming languages is now making it easier for developers to use their favorite language. This time Python have better support in the Visual Studio Code, more specifically in the IntelliSense autocomplete System.

Visual Studio Code is the source code editor that Microsoft released as Open Source and is available in Linux, Windows and MacOS. and thanks to the Python Language Server now have better support for Python. I mean, Python support has been there for a while, but is greatly improved by the PLS.

Do you use Python or Visual Studio?, leave your thoughts in the comment section.

Python Language Server an option for those that code

Source: Microsoft Visual Studio Code replumbed for better Python taming • The Register

GitHub adds Python support for security alerts – Help Net Security

This is good, as a developer is a PITA to follow all the dependencies your app have. There are several tools to keep them up to date (updating your requirements.txt file) for future builds/updates of your app. But sometimes we just don’t follow the security flaws.

GitHub’s Security Alerts now also work for Python projects, notifying developers about vulnerabilities in software packages that their projects depend on.

Source: GitHub adds Python support for security alerts – Help Net Security

GIMP now hosted by GNOME on GitLab

Many projects are now migrating from github to #GitLab, this is not because GitHub is a bad service, it’s just because its being acquired by Microsoft.

Even when the official statement says that GitHub will operate independent and with the same policies used right now, many (me included) don’t trust Microsoft. then.. the need to move away from GitHub.

GNOME already made the transition and GIMP is now in GitLab. Are you moving your projects?. Do you think GitHub will finish like Skype did?.

 

Just yesterday, we shared that The GNOME Project moved to GitLab. This was a major score for GitLab, but also, an important move for GNOME as well — it should greatly improve collaboration between its contributors. GNOME is not alone in its move to that Git-repository manager, however, as GIMP (plus the babl and GEGL libraries) also made the transition. Actually, believe it or not, GNOME is hosting GIMP there.

Source: GIMP now hosted by GNOME on GitLab

What would you do if Microsoft acquires GitHub??

Quite probably you have a repo in GitHub, and probably the company you work for does too. Aside from the fact that they have to stick with the terms and policies that already govern GitHub, what would you do ?.

For many Linux/OpenSource users this is a dilemma, Microsoft is the “enemy” because for so many years Microsoft tried to kill Linux and now is using it in their cloud offering just because no-one beats Linux in the server (or VPS or whatever the fuck buzz-name you choose), and it seems they like to embrace-extend-extinguish Linux.

Would you keep your code in GitHub knowing Microsoft is behind?. would you move to any other provider?. Would you prefer to use your own Git Server?. Think about it! a leave a comment.

 

Microsoft may be talking to GitHub about possible acquiring the hosting and development service, according to a report. If it happens, the move may not be as crazy as some might think.

Source: Microsoft has been talking to GitHub about possible acquisition: Report | ZDNet

GitLab Web IDE now open source

Useful for quick edits, maybe not a full featured IDE (I don’t know why it is called Web IDE instead of Web CodeEditor or something…) because it lacks of several features of the complete IDE, for instance you cannot do debugging in it, just an editor but still useful.

I like the idea that this “web IDE” is Open Source, is available for everyone and it will be integrated in many other parts of gitlab.

Java, JavaScript, C#? No, Python is the fastest growing programming language | ZDNet

There is a reason for that. Python is

  • Simple, easy to read, easy to write; then, easy to learn
  • Powerful with all that bunch of packages/modules included and all others created by the community freely accesible with a simple pip  call.
  • All purpose, use to automize something, use it to run a web site, an API, even to create desktop apps.
  • Multi-platform, Windows, Linux, Mac, BSD’s, even in embedded systems.
  • Fast enough,

You can find some of those in another languages, but not all achieve that.

Python is now the fastest-growing major programming language, according to Stack Overflow. read more

Quick tip when using vagrant+django

I started to use vagrant to hold my development environment, it helps to keep the development environment isolated, since the app will run on a Linux server, with a specific database engine and probably some other specific modules, I don’t want to clutter my OS with all that stuff. More if I plan to work on another project that maybe, have a dependency on other versions of the same base (legacy Django perhaps?)

Java vs. Python: Which One Is Best for You? | @DevOpsSummit #APM #Java #Python | news.sys-con.com

So, basically, both are fine but it depends on what you need (as with most tools).

In my opinion a less verbose language is better, also, python have tons of packages installable via pip, is C++ extensible (for those scenarios where speed matters) and is present in most platforms.

Also, although there is an Open Source Java implementation, not all the “core” libraries are, I mean, you can’t just replace Oracle’s Java with the Open Source and expect everything will run just fine, probably will, but slower.

 

Language affiliations are sometimes spread more loosely and broadly across different codebases, frameworks, and platforms

Source: Java vs. Python: Which One Is Best for You? | @DevOpsSummit #APM #Java #Python | news.sys-con.com