-
এপার বাংলা ওপার বাংলা
নিজস্ব গ্রন্থাগারে আমার যতগুলো বাংলা বই আছে, তার বেশীরভাগের লেখকই ওপার বাংলার অর্থাৎ পশ্চিমবঙ্গের। ওদের লেখায় নতুন নতুন শব্দ পাই। যেমন – গঙ্গার ইলিশ গল্পে ‘ব্লিৎসক্রিগ’, মহাবন্যা গল্পে ‘অভ্রংলিহ’ কিংবা সেই সময়ের ‘নিষ্ঠীবন’। অযথা শব্দবাহুল্য মনে হয় না, বরং এগুলো ভাষাকে এনে দেয় পরিমিত ওজন। স্বল্প পরিসরে অনেক কথা বলা হয়ে যায়। অথবা বর্ননার একঘেয়েমি…
-
গ্রন্থতালিকা
দেখছি, বাংলা লিখতে কেমন লাগে। দেশ শারদীয় গল্পসংকলন আমার প্রিয় বই। ওখানকার কিছু লেখকের বই পরেরবার বাংলাদেশ থেকে নিয়ে আসব। অনলাইনেও কেনা যায়। কিন্তু বইয়ের দোকানে ঘোরাঘুরি করতে ভালো লাগে। আর, যে কটা বই বাসায় আছে, যেমন – রবীন্দ্রনাথ, শরৎ অথবা মুজতবা আলী সমগ্র, সেগুলো তারিয়ে উপভোগ করব আগে। যা হোক, ভবিষ্যতের গ্রন্থতালিকাঃ ১। বিভূতিভূষণ…
-
Python: Generators
Generator is for lazy iteration. Using yield in a function makes it a generator. Like async function, calling a generator does not execute the code. While executing an async function requires say asyncio.run(), a generator executes when it is iterated on say with next(). Normally a generator is consumed by a for loop. finally block in…
-
Python: Decorators
Wrap to alter or enhance the object being wrapped. Like: Function metadata like doc string is now hidden for the wrapped function square. Best practice: @wraps() decorator from functools copies function metadata into the replacement function. When there are multiple decorators, the order might matter: For example: A decorator can accept arguments. The temp above…
-
Python: Anonymous function
Multiple statements or nonexpression statements like try or while cannot appear in lambda expression. If free variables (not specified as parameters) are used in a lambda, the value of the variable is not the one when the lambda was defined, instead the value at the time of lambda evaluation is used (late binding). To capture…
-
Python: Function Scope
On each call to a function a local namespace is created which includes the names of the function arguments and the variables locally assigned within the function. Other variables accessed in the function belong to (enclosing) global namespace. The method globals() returns the dict __globals__ which is the global namespace. The method locals() concocts and…
-
Python: Function parameters
Default arguments Default parameter values are evaluated once when the function is defined, not on each call. Best practice: Variadic arguments Below function accept variable number of arguments. All extra arguments are placed in rest variable as a tuple. Keyword arguments Below, debug variable must be supplied as keyword argument like read_data(‘foo.txt’, debug=True). Variadic keyword…