Python vs C#

I have read the article

I think that deserves an answer –  so I take all points to answer to them. You can replicate the code in C# 10 / .NET 6 with a globalusings.cs with the following content:

global using static System.Console;
global using static System.Linq.Enumerable;
global using static System.IO.Directory;
global using static System.String;
global using static System.Math;

So let’s start:

Point 1 - Indented code blocks

//Point 1 - Indented code blocks
//With curly braces I can indent whatever way I want - I am not constrained

using System.Collections.Generic;

foreach (var i in Range(1, 11))
if (i % 3 == 0)
else if (i % 5 == 0)


Also , when I want to comment something , with C# I know when the else if is
terminating without counting tabs. Just see where the { is closing with }

Point 2 -  Self-declaring Variables

Seriously? What is the difference between Python
//meaning_of_life = 42
and C# ? Just a var ?

//Point 2 - Self-declaring Variables
var meaning_of_life = 42;
Point 3 -– Those modules

It is the same code as Python

foreach (var file in EnumerateFiles(@"C:\")){
Point 4 – Simplicity of Data Structures

Quoting : Purists will say that you need all the different data types that C# provides, but trust me, you don’t.
I want to think about how to modelate a CallCenter waiting for phones – Stack or Queue ?
I want to think about how to  modelate a CallCenter waiting for phones with business consumer that has priority ?

Point 5 - Slicing

Same code in C#

var sins = new[]{ "pride", "envy", "gluttony", "greed", "lust", "sloth", "wrath" };
//var selected_sins = sins[1..(sins.Length-1)];
var selected_sins = sins[1..^1];
WriteLine(Join(" ", selected_sins));
Point 6 – For loops

Same syntax in C#

foreach (var i in Range(0,5))
// words in a string
string[] words = { "Simple", "Talk" };
foreach (string word in words)

Quoting : “(unlike in C#, where sometimes you use for and sometimes foreach)”
Please enumerate an array backwards in python without reversing

7 – List comprehensions

This is similar code in C#

var nr = Range(1, 11).Where(it => it % 2 == 0).Select(it => Pow(it, 3));
WriteLine(Join(" ", nr));
8 – Sets

Same example

//this contains some duplicates
var languages = new[] { "C#", "Python", "VB", "Java", "C#", "Java", "C#" };
//more dense than Python
languages = new HashSet<string>(languages).ToArray();
//this will give: ['C#', 'Java', 'Python', 'VB']
WriteLine(Join(" ", languages));

Second example

//create two sets: Friends characters and large Antarctic ice shelves
var friends = new[] { "Rachel", "Phoebe", "Chandler", "Joey", "Monica", "Ross" };
var ice_shelves = new[] { "Ronnie-Filchner", "Ross", "McMurdo" };
// show the intersection (elements in both lists)
WriteLine(Join(" ", friends.Intersect(ice_shelves)));
//show the union (elements in either list)
WriteLine(Join(" ", friends.Union(ice_shelves)));
// show the friends who aren't ice shelves
WriteLine(Join(" ", friends.Except(ice_shelves)));
// elements in either set but not both -- more difficult
WriteLine(Join(" ", friends.Union(ice_shelves).Except(friends.Intersect(ice_shelves))));
9 – Working with files and folders
//# list of 3 people
var people = new[] { "Shadrach", "Meshach", "Abednego" };
//# write them to a file
File.WriteAllLines(@"C:\all\a.txt", people);
10 – The quality of online help

See – good tutorials

Friday Links 452

  • Idempotent DDL Scripts That Always Achieve The Same Result – Making Changes Only Once: Stairway to Exploring Database Metadata Level 6 SQLServerCentral
  • Overengineering in software development
  • Doom s classic re-releases now run at 60fps and support free add-ons – The Verge
  • .Net Core DI, How to register all existing assignable types in an assembly – CodeProject
  • uuidjs/uuid: Generate RFC-compliant UUIDs in JavaScript
  • 6 Ways to Unsubscribe from Observables in Angular – Bits and Pieces
  • 10 Chrome Console Utility APIs You Probably Never Used
  • Extremely useful lodash methods – Level Up Coding
  • A Decade of Cross Functional Requirements (CFRs) – Sarah Taraporewalla
  • Sagas
  • Database per service
  • How to Get the Most of Your Coverage Report – Typemock
  • Welcome | Applied Cloud Stories
  • cloud-annotations/cloud-annotations-client: Source for the Cloud Annotations tool
  • microsoft/VoTT: Visual Object Tagging Tool: An electron app for building end to end Object Detection Models from Images and Videos.
  • David K. <ع� on Twitter: “Developers sitting in meetings and fixing CSS bugs all day: “Funny how I get paid for this” Developers working on open-source software that thousands of companies and developers depend on: “Funny how I don’t get paid for this””
  • Copilot for VS Code – Visual Studio Marketplace
  • 3 Ways to Debounce HTTP Requests in Angular – Bits and Pieces
  • 11 Recommended Tools for Frontend Developers – Bits and Pieces
  • microsoft/ClearScript: A library for adding scripting to .NET applications. Supports JavaScript (via V8 and JScript) and VBScript.
  • Automatic release GitHub with version

    For having releases published automatically on Github , I use this tagged release.yml file as an workflow

    name: “tagged-release”
    – “v*”

    runs-on: ubuntu-latest

    – name: ‘Checkout Github Action’
    uses: actions/checkout@master

    # code to build the source
    – name: Archive production artifacts
    uses: actions/upload-artifact@v2
    name: nameOfTheApp
    path: ‘src/…/*’
    retention-days: 1

    – name: Archive Release
    uses: thedoctor0/zip-release@master
    type: ‘zip’
    filename: ‘’
    path: ‘${{github.workspace}}/src/…’
    exclusions: ‘*.git* /*node_modules/* .editorconfig’

    – name: Release
    uses: softprops/action-gh-release@v1
    files: |

    – name: delete older-releases@v0
    uses: dev-drprasad/delete-older-releases@v0.2.0
    #repo: / # defaults to current repo
    keep_latest: 2
    #delete_tag_pattern: beta # defaults to “”
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    FileExtension–PostMortem- part 7

    It was interesting to wrote this project.  At the final, it features an web site ( ) and a NuGet package ( ). Also , I have learned how to start Windows Terminal to start Angular / .NET Core / Tests

    wt new-tab -p “Windows PowerShell” -d . cmd /k “cd src && dotnet build && cd RecognizeFileExtWebAPI && dotnet watch run”  ;split-pane -p “Windows PowerShell” -d . cmd /k “cd src && dotnet build && cd TestFileExtensions && dotnet watch test” ;  split-pane -p “Windows PowerShell” -d . cmd /k “cd src && cd FileExtensionAng && npm i && ng serve -o”

    and refreshed my GitHub actions knowledge ( I am very fond of CI – and , if I can, CD )

    Also, I have now a better understanding of a csproj file in relation with nuget :

       <None Remove=”plugins\FileExtension.targets” />
    <Content Include=”plugins\FileExtension.targets”>

       <Content Include=”plugins\**\*.dll”>

    It was refreshing to know that, even I like the Skinny Controllers concept, however the WebAPI is not so light .

    Hopefully someone will find the package useful – or at least the site

    FileExtension–part 6 – CI/CD

    So now how to make visible all those coding ?

    For tests –CodeCov, hosts for free to see the coverage

    For documentation – ReadTheDocs, hosts for free.

    For packaging  – NuGEt

    For more detailed analysis Sonar can show code smells and bugs and more

    GitHub actions allows me to run all those automatically and gather results

    For showing a website – Azure  – can show the usage.

    I was thinking that it is enough for the people to understand the application

    [ADCES]Devops By Docker & Life after Java 8


    Presentation 1 : Practical DevOps: One-Click Deployment using Docker
    Presenter: Andrei Micuda,
    Every developer wants to deploy and maintain the applications he develops with ease. Although this seems like a daunting task at first, you can achieve a one-click deployment pipeline by only using a few Docker containers. Join us if you want to find how to use Docker to automate your development workflow and build a fully customizable and easy-to-understand CI/CD pipeline from scratch.
    Presentation 2: Life after Java 8
    Presenter : Cosmin Popescu,

    FileExtension–Tests–part 5

    The tests are the easy part. I have put some files on a folder( ) and test if the extension matches the recognizer.

    As NuGet packages I used




    FluentAssertion allows me to write more readable tests , like 


    LightBDD allows me to write tests in a more “business “ way :

    await Runner
         .AddAsyncSteps(_ => When_Read_The_File(fileName))
             _ => Then_Should_Recognize_File(fileName),
             _ => Then_The_Extension_Matches(fileName)

    You can see the result at = go down to see the Given / When /

    Also, for enumerating files from the folder to test, I use ClassData

    public async void TestMultipleFiles(string nameFile)

    Andrei Ignat weekly software news(mostly .NET)

    * indicates required

    Please select all the ways you would like to hear from me:

    You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

    We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.