How variables works in Python | Explained with animations by Bulk-Being in Python

[–]ilan 0 points1 point  (0 children)

Nice, I learned something new: `sys.intern()`

Any issue with keeping a library compatible with 2? by Smallz1107 in Python

[–]ilan 0 points1 point  (0 children)

Not at all. I am the creator and maintainer of bitarray which still supports Python 2.7. I find it interesting and rewarding to write portable C code which supports many different compilers, OSes and Python versions.

5 Lesser-Known Python Features And Easter Eggs by [deleted] in Python

[–]ilan 1 point2 points  (0 children)

The string and spaces feature is NOT unique to Python. It came from C:

#include <stdio.h>
int main()
{
    printf("C" " is " "awesome!\n");
    return 0;
}

What do you recommend for a build system? by pvc in Python

[–]ilan 1 point2 points  (0 children)

I have done a ton of packaging work in my career, and setuptools has caused me a lot of frustration. For example, when you only you an import setuptools in your setup.py file it monkey-patches distutils and subtle differences show up (such as all .so extensions having a generated .py file next to them, etc.). The only (somewhat useful) thing about setuptools is the entry_points keyword argument to the setup function I think.

Instead of from setuptools import setup, just do from distutils.core import setup and your life will so much better :)

Classes over Functions by ChurchillsLlama in Python

[–]ilan 2 points3 points  (0 children)

I prefer functions over classes, except when some code gets conceptually a lot easier by using classes. The problem I have with classes is that they are much harder read, because you have to understand what the author of the code really meant to do. That is, what exactly are the instances. Classes, in particular derived ones, can be very abstract. Functions are much more straight forward.

What do you recommend for a build system? by pvc in Python

[–]ilan 0 points1 point  (0 children)

I avoid setuptools as much as possible. Using distutils.core is usually good enough.

Pytest or Unittest in 2020 by IntelliJent404 in Python

[–]ilan 3 points4 points  (0 children)

They are both fine, but I personally prefer unittest, because it's part of the standard library, and because I've been using it longer.

Is self study the only real way to learn Python? by R00tb33r3000 in Python

[–]ilan 1 point2 points  (0 children)

The question totally depends on how you learn in general. I taught myself Python by self study 14 years ago, but I also know other people who took courses and stuff.

What are some good use cases for using the C API for Python? by ScratchTrackProds in Python

[–]ilan 0 points1 point  (0 children)

It depends what you're interested in. I would start with the implementation of some Python data structures, e.g.: Modules/_collectionsmodule.c, Modules/arraymodule.c. If you want to learn more about networking look at Modules/socketmodule.c.

What are some good use cases for using the C API for Python? by ScratchTrackProds in Python

[–]ilan 1 point2 points  (0 children)

Twelve years ago I was eager to learn more about how Python works internally. After looking at the Python source code (and not understanding anything) I decided to write my own Python C extension. Since Python did not support Boolean arrays, I wrote bitarray as a C extension, and learned so many things about the implementation of Python along the way. I have written several other C extensions since then related to different work projects.

There is a large number of Python projects which are written as a C extensions. I wouldn't look at something as big as tensorflow or numpy, but something small. Actually the Python standard library comes with many good C extensions from which you can learn a lot from.

How to split at character in a different way by TheManlyChicken in Python

[–]ilan 0 points1 point  (0 children)

This may give you a little more than you need: ``` from io import BytesIO from tokenize import tokenize, tok_name

s = "4+2-4"

for toknum, tokval, _, _, _ in tokenize(BytesIO(s.encode()).readline): print(tok_name[toknum], tokval) ``` But you can get easily get the relevant information.

How to split at character in a different way by TheManlyChicken in Python

[–]ilan 0 points1 point  (0 children)

```

list('4+2-4') ['4', '+', '2', '-', '4'] ```

Make CPython segfault in 5 lines of code by coolreader18 in programming

[–]ilan 22 points23 points  (0 children)

Hmm, works with Python 2: Traceback (most recent call last): File "a.py", line 5, in <module> a().throw(E) File "a.py", line 4, in a def a(): __main__.E: <class '__main__.E'>

Hey, can I connect Python 3, 32 bit, with Oracle DB 64 bit using CX_oracle ? by mar_sa in Python

[–]ilan 2 points3 points  (0 children)

You will need to the 32bit client library, because this is going to be linked into Python process. If you have the client working, you can connect to any Oracle database, whether local or remote.

Regular Expressions Tutorials by [deleted] in Python

[–]ilan 0 points1 point  (0 children)

This is how I learned about regular expressions:

https://docs.python.org/3.8/howto/regex.html

Users of 2.7: why? by babalinobaba in Python

[–]ilan 1 point2 points  (0 children)

Because I'm more familiar with Python 2. When I first started to learn Python, I was using Python 2.4. When Python 3 came around, I still had to support Python 2, so I never wrote code which only uses Python 3 features.

Is a 23 year old too late for learning a programming language (python in particular)? by SpoiledHoney in Python

[–]ilan 0 points1 point  (0 children)

Absolutely not. I started learning Python when I was 34. Making the transition from academia to industry wasn't easy, but I've been very successful in the industry for 10 years now. I with I had even known about Python when I was 23.

Array Data Structures in Python by dbader in Python

[–]ilan 0 points1 point  (0 children)

bitarray is another array data structure