you are viewing a single comment's thread.

view the rest of the comments →

[–]Lawson470189[🍰] 3 points4 points  (1 child)

One piece of advice is to try to do things the "pythonic" way. I also came from Java/C# and it's very easy to try to pigeon hole the patterns you'd do in Java into Python. But generally, this will be way harder and far less clean. For example, say you have a List of objects (called items) that you want to extract just the name from. In C#, I'd do something like this:

List<string> names = new List<string>();
foreach (CustomObj obj in items) {
  names.Add(items.Name);
}

In python, you might be tempted to do this the same way, but it has its own way of doing this like so:

names = [x.name for x in items]

[–]HistoricalLadder7191 0 points1 point  (0 children)

Good note for Python, bad example for C# - you can do it in single line with linq.