#lambda python
Explore tagged Tumblr posts
Text
Dear reader, did I think to myself, "hey, so writing in a notion database per this advice seems like an interesting idea but slightly unwieldy because there appears to be no option to export all the scenes to a single document (if you choose markdown, which I prefer, each scene is exported to a separate markdown file in a subfolder), but wouldn't writing a python script to merge all those exported files in order be pretty simple?" and proceed to actually do that for about an hour, on the off chance that I hypothetically ever try to follow this writing advice, instead of doing any actual writing? Yes. Yes I did.
#musings#i say as if i will ever finish that one supercorp fic i've been “writing” for *checks notes* 6 years at this point#my skill level in python is very much “fumbling in the dark while searching for the most basic shit that i can never remember���#like how to construct a lambda expression -- but the internet provides and somehow i DID manage to cobble something together that works!#which has left me feeling somehow simultaneously extremely productive and the least productive person on the planet
2 notes
·
View notes
Text
#Custom Python Runtime#Streaming with AWS Lambda#Amazon Streaming Services#Serverless Streaming Solutions#Streaming Architecture AWS#Spotify
0 notes
Text
WHY. IS THE PYTHON. BEING WEIRD.
AHHHHHHHHHHHHH
#end.txt#why is my lambda only using the last index#and not ALL THE OTHERS BEING ASSIGNED#AHHHHHHHHHHHHHHHHHHH#this is probably so stupid#but i choose to believe python is the stupid one
1 note
·
View note
Text
LinkedIn....
#This is a community for Python devs; why are people applauding *basic* knowledge?#“look lambdas are good for .map() and .filter()!” “woah!!” “[one-word AI response]”#those people better be Python beginniners; cause lambdas are not exactly arcana; .filter() is even less#Maybe map() and reduce() are. But filter()??#they deserve to be kicked out pronto#💡 slime's unoriginals
0 notes
Text
Implementing API Gateway with Lambda Authorizer Using Terraform
Implementing a secure and scalable API Gateway with Lambda authorizer. Leverage Terraform to manage your resources efficiently.
Background: API Gateway with Lambda AuthorizerBenefits of Using API Gateway with Lambda AuthorizerOverview of the Terraform ImplementationDetailed Explanation of the Terraform CodeProviderVariableLocalsData SourcesIAM Roles and PoliciesIAM Role for Core FunctionIAM Role for Lambda Authorizer FunctionLambda Core FunctionLambda Authorizer FunctionBenefits of Using Environment VariablesAPI Gateway…
0 notes
Text
HOW TO BE NICE
Beginning at Johns Hopkins in 1876, the bedrooms don't have closets. The more anomalies you've seen, the more the rest will want to come here. When there's something we can't say, in any normal family, a fixed-size equity round can take weeks, because all the angels sit around waiting for the others to commit, have different values for startups, accumulated knowledge about how to make them work, and the best startup ideas seem at first like bad ideas. Running code at read-time, and part of the reason Y Combinator is that founders are more motivated by the fear of Microsoft. Smile at everyone, and don't tell them what you're thinking.1 Violating moral fashions can get you fired, ostracized, imprisoned, or even killed. Om Malik is the most economical route to the sea.2 If the anti-yellowists.3 Aikido, you can make a graph of all the things we could do was Viaweb, which we disliked at first. If anything, it's more like the first five.
We'd hire 30 tomorrow morning. Companies often claim to be benevolent, but because it's so much easier than building something great. In every period, people believed things that were just ridiculous, and believed them so strongly that you would be reluctant to express in front of me. Instead IBM ended up using all its power in the market to any manufacturer.4 They're not.5 Since we did continuous releases, our software didn't actually have versions. They preferred good programmers to bad ones, but they don't need a big development team, so our costs would be lower. This applies to dating too. Outside writers tend to supply editorials of the defend-a-position writing that would be a better sign that someone was satisfied with a search result than going to the site and buying something?
This tradeoff predates programming languages. We decided we ought to be writing about literature, turns out to be a good thing if there are a lot of people who'd make great founders who never end up starting a company.6 They work well enough in everyday life that you don't see the scary part upfront. I conclude with a few vague questions and then drift off to get a tiny bit less occasional to compensate for the opportunity cost of the board seat it consumes. When I was about as observant as a lump of rock.7 One piece of evidence is what happened to the application after I left. The main character is an assassin who is hired to kill the president of France. Companies often claim to be benevolent, but because he spent all his time on it and neglected his studies, he was skeptical about Artix.
And in this economy I bet they got a good deal about patterns. Their hand-made objects become store-bought ones.8 It was natural to have this distinction in Fortran because not surprisingly in a language where you have to be a distinct, inferior, sort of thing? In Lisp, all variables are effectively pointers to strings stored in a hash table.9 If you look at it this way, you wonder why anyone would think there was. I know of one couple who couldn't retire to the town they preferred because they couldn't afford to pay lawyers to turn every a lot of work, done by a class of people called philosophers. 84421706 same 0. So if doing good for people gives you a sense of humor.
What that means is that there are about 15 companies a year that will be very close. Lisp's power is multiplied by the fact that the founders of Chatterous told me recently that he and his cofounder had decided that this service was something the world needed, so they were going to make money and maybe be cool, not to be too difficult for programmers used to C. The distributors want to prevent the sort of economic violence that nineteenth century magnates practiced against one another and communist countries practiced against their citizens. There are a handful of angels who'd be interested in—the language if I did, it would be: you need to give someone a present and don't have any immediate use for it, you probably never will. Whereas if an investor is notorious for taking a long time coming. Because their current business model depends on overcharging people who have x-ray vision for character. And it follows inexorably that, except in pathological examples you can treat them as identical.
But when you understand the origins of this sort of disobedience shows signs of becoming rampant. He was doing something quite different from what they expected? One thing we can say, which are the most technophobic people on earth. Startups are often described as emotional roller-coasters. We're looking for things we can't say, what do you do research on? Soon after, the western world fell on intellectual hard times. In fact there are limits on what programmers can do.10 Which makes it easier to remember that Dublin was also established by Vikings in the 840s. On Lisp.11 Search was only 6% of our traffic, and he will automatically get paid proportionally more.
And that's where the volume of our imaginary solid is growing fastest. Startups rarely die in mid keystroke. Do whatever's best for your users. Make something worth investing in, you have to do it is to use it. No one knows whether a startup is thus as close as you can. Usually you can find, use the same matter-of-the-envelope calculations, this one has a lot of those individually readable lines. There's a lot of immigrants working in it. 40% of the company sold in series A rounds—so those are good places to look now. Instead IBM ended up using all its power in the market to any manufacturer. Whatever their ideas were, they were. Who's right? So parents are giving their kids an inaccurate idea of the right thing, which is the number of series A investments they can do is so small.
Notes
For example, there are no startups to have figured out how to be. But there's a continuum here. N i n Goo: df foo n lambda i set! On the verge of the clumps of smart people are these days.
I don't mean to imply that the web was going to drunken parties.
So managers are constrained too; instead of uebfgbsb.
But this is also to the environment. Convertible debt can be huge.
If the next investor. Ditto for case: I once explained this to users than where you went to school. This wipes out the words won't be able to distinguish between people, but the programmers had seen what GUIs had done for desktop computers. So much better to be employees, or some vague thing like that.
FreeBSD 1.
My first job was scooping ice cream in the US is partly a reaction to drugs.
New York. And while we have. Top VC firms regularly cold email startups. I think I know when this happened because it depends on the grounds that a person's work is a list of the false positives caused by blacklists, for example, probably did more drugs in his twenties than any of the word philosophy has changed is how important it is more efficient: the company goes public.
This of course some uncertainty about how to be a founder; and with that of whatever they copied.
For example, understanding French will help you in? Some urban renewal experts took a shot at destroying Boston's in the Greek classics. Rice and Beans for 2n olive oil or mining equipment, such a dangerous mistake to do.
At one point in the country would buy one. No big deal. When you fix one bug, the manager, which have varied dramatically.
#automatically generated text#Markov chains#Paul Graham#Python#Patrick Mooney#startups#questions#kids#companies#investor#df#application#weeks#people#deal#founder#Malik#managers#anything#something#lambda#humor#front#idea#series#sup#li#number
0 notes
Text
0 notes
Text
【AWS】Lambda関数の基本設定で詰まった!ハンドラとランタイムって一体なんだ?
Lambda関数を利用する際、コンソール画面に2つの見慣れない単語が出てきまして。。。 利用する上で、(本当に)基本になるところだったので備忘として記載させてください。 【ランタイム】と【ハンドラ】 ランタイムとは? ランタイムはアプリの実行に必要なパッケージ、またはライブラリのことです。 開発をされている方だと「ランタイム」と聞くと、プログラムを実行した時の、特定の時点を指すと思われるかもしれません。 よくよく調べてみると、広義には、アプリ実行時��必要なライブラリやパッケージを含んで、「ランタイム」と呼ぶそうです。 そのため、PythonをLambdaで実行する場合は、実行時に必要なパッケージ等をimportしてあげる必要があります。 対応する言語は、いくつかありますがそれらはAWSの公式ドキュメントに記載されています。 また、このランタイムについては、Lambdaで…

View On WordPress
0 notes
Text
Day-6: Python Functions
Day-6: Python Fuctions - Python Boot Camp 2023
Introduction to Python functions Python functions are blocks of reusable code designed to perform specific tasks. They allow you to break down complex programs into smaller, manageable pieces. Functions enhance code reusability and readability, making it easier for developers to maintain and understand their programs. In this article, we will explore various aspects of Python functions, from…

View On WordPress
#Built-in functions in Python#Function annotations in Python#Function definition in Python#How to call a function in Python#Lambda functions in Python#Python decorators#Python function advantages#Python function best practices#Python function disadvantages#Python function examples#Python function parameters#Python function scope and lifetime#Python function tutorial#Python functions#Recursive functions in Python
0 notes
Text
เพิ่มความเร็วให้ Python บน Lambda ด้วย Variable Cache
สร้าง Decorator Cache ให้กับ Lambda ที่ใช้ Python Runtime ด้วยการทำ Variable Cache (MemoryCache) ด้วยที่ว่า Lambda ถ้าไม่มีการเรียกใช้งาน ชักระยะนึ่ง Lambda ก็จะถึงทำลายทิ้งไป ทำให้เราสามารถใช้ Variable Cache ช่วยในการเพิ่มความเร็วได้ โดยมีผลกระทบน้อยต่อ ram ที่ใช้งาน ด้วย Code ต่อไปนี้ ไฟล์ MemoryCacheModel.py from datetime import datetime, timedelta import os import uuid import…
View On WordPress
0 notes
Text
Feeling inspired by a post I saw a few months ago, I programmed a simple game of tic-tac-toe in python, in a single expression. Like regular functional programming, this means I can't mutate variables. But more than functional programming, this also means I can't
Declare variables at all
Declare functions
Use most loops and branch structures
The resulting program is 1730 characters long after removing all the non-strictly necessary whitespace and contains "lambda" 9 times.
The players are asked where they want to play using a number for each cell, in the configuration of a standard numpad. The program checks for invalid input too.
Source code under the cut
(lambda grid,toggle,players,cells_filled,print_grid,check_victory,ask_xy,validate_input,the_game:(lambda victor:print('=====\n'+('Draw.'if victor is None else f"{victor} wins!")))(the_game(grid,players,cells_filled,toggle,print_grid,check_victory,ask_xy,validate_input,the_game)))([[7,8,9],[4,5,6],[1,2,3]],True,['X','O'],0,lambda grid:print('\n'+'\n'.join(' '.join(map(str,ligne))for ligne in grid)),lambda grid,players:([player for player in players if any(set(grid[i][col]for i in[0,1,2])=={player}for col in[0,1,2])or any(set(grid[row])=={player}for row in[0,1,2])or set(grid[i][i]for i in[0,1,2])=={player}or set(grid[i][2-i]for i in[0,1,2])=={player}]+[None])[0],lambda players,toggle,grid,ask_xy,validate_input:validate_input(input(f"{players[toggle]}, place your symbol: "),grid,players,toggle,ask_xy,validate_input),lambda selection,grid,players,toggle,ask_xy,validate_input:(lambda selection,grid,players,toggle,ask_xy,validate_input:(selection%3,2-selection//3)if grid[2-selection//3][selection%3]not in players else ask_xy(players,toggle,grid,ask_xy,validate_input))(int(selection)-1,grid,players,toggle,ask_xy,validate_input)if len(selection)==1 and'0'<selection<='9'else ask_xy(players,toggle,grid,ask_xy,validate_input),lambda grid,players,cells_filled,toggle,print_grid,check_victory,ask_xy,validate_input,the_game:(print_grid(grid),the_game((lambda players,toggle,xy,grid:[[players[not toggle]if(j,i)==xy else grid[i][j]for j in[0,1,2]]for i in[0,1,2]])(players,toggle,ask_xy(players,not toggle,grid,ask_xy,validate_input),grid),players,cells_filled+1,not toggle,print_grid,check_victory,ask_xy,validate_input,the_game)if check_victory(grid,players)is None and cells_filled<9 else check_victory(grid,players))[1])
If you can't read any of this, don't worry, I can't either.
You can find the original code and a slightly more readable version on my gitlab: https://gitlab.com/Rijaja/gaae/-/tree/main/tttaae (but careful, the game is in French)
96 notes
·
View notes
Text
Rambling About C# Being Alright
I think C# is an alright language. This is one of the highest distinctions I can give to a language.
Warning: This post is verbose and rambly and probably only good at telling you why someone might like C# and not much else.
~~~
There's something I hate about every other language. Worst, there's things I hate about other languages that I know will never get better. Even worse, some of those things ALSO feel like unforced errors.
With C# there's a few things I dislike or that are missing. C#'s feature set does not obviously excel at anything, but it avoids making any huge misstep in things I care about. Nothing in C# makes me feel like the language designer has personally harmed me.
C# is a very tolerable language.
C# is multi-paradigm.
C# is the Full Middle Malcomist language.
C# will try to not hurt you.
A good way to describe C# is "what if Java sucked less". This, of course, already sounds unappealing to many, but that's alright. I'm not trying to gas it up too much here.
C# has sins, but let's try to put them into some context here and perhaps the reason why I'm posting will become more obvious:
C# didn't try to avoid generics and then implement them in a way that is very limiting (cough Go).
C# doesn't hamstring your ability to have statement lambdas because the language designer dislikes them and also because the language designer decided to have semantic whitespace making statement lambdas harder to deal with (cough Python).
C# doesn't require you to explicitly wrap value types into reference types so you can put value types into collections (cough Java).
C# doesn't ruin your ability to interact with memory efficiently because it forbids you from creating custom value types, ergo everything goes to the heap (cough cough Java, Minecraft).
C# doesn't have insane implicit type coercions that have become the subject of language design comedy (cough JavaScript).
C# doesn't keep privacy accessors as a suggestion and has the developers pinkie swear about it instead of actually enforcing it (cough cough Python).
Plainly put, a lot of the time I find C# to be alright by process of elimination. I'm not trying to shit on your favorite language. Everyone has different things they find tolerable. I have the Buddha nature so I wish for all things to find their tolerable language.
I do also think that C# is notable for being a mainstream language (aka not Haskell) that has a smaller amount of egregious mistakes, quirks and Faustian bargains.
The Typerrrrr
C# is statically typed, but the typing is largely effortless to navigate unlike something like Rust, and the GC gives a greater degree of safety than something like C++.
Of course, the typing being easy to work it also makes it less safe than Rust. But this is an appropriate trade-off for certain kinds of applications, especially considering that C# is memory safe by virtue of running on a VM. Don't come at me, I'm a Rust respecter!!
You know how some people talk about Python being amazing for prototyping? That's how I feel about C#. No matter how much time I would dedicate to Python, C# would still be a more productive language for me. The type system would genuinely make me faster for the vast majority of cases. Of course Python has gradual typing now, so any comparison gets more difficult when you consider that. But what I'm trying to say is that I never understood the idea that doing away entirely with static typing is good for fast iteration.
Also yes, C# can be used as a repl. Leave me alone with your repls. Also, while the debugger is active you can also evaluate arbitrary code within the current scope.
I think that going full dynamic typing is a mistake in almost every situation. The fact that C# doesn't do that already puts it above other languages for me. This stance on typing is controversial, but it's my opinion that is really shouldn't be. And the wind has constantly been blowing towards adding gradual typing to dynamic languages.
The modest typing capabilities C# coupled with OOP and inheritance lets you create pretty awful OOP slop. But that's whatever. At work we use inheritance in very few places where it results in neat code reuse, and then it's just mostly interfaces getting implemented.
C#'s typing and generic system is powerful enough to offer you a plethora of super-ergonomic collection transformation methods via the LINQ library. There's a lot of functional-style programming you can do with that. You know, map, filter, reduce, that stuff?
Even if you make a completely new collection type, if it implements IEnumerable<T> it will benefit from LINQ automatically. Every language these days has something like this, but it's so ridiculously easy to use in C#. Coupled with how C# lets you (1) easily define immutable data types, (2) explicitly control access to struct or class members, (3) do pattern matching, you can end up with code that flows really well.
A Friendly Kitchen Sink
Some people have described C#'s feature set as bloated. It is getting some syntactic diversity which makes it a bit harder to read someone else's code. But it doesn't make C# harder to learn, since it takes roughly the same amount of effort to get to a point where you can be effective in it.
Most of the more specific features can be effortlessly ignored. The ones that can't be effortlessly ignored tend to bring something genuinely useful to the language -- such as tuples and destructuring. Tuples have their own syntax, the syntax is pretty intuitive, but the first time you run into it, you will have to do a bit of learning.
C# has an immense amount of small features meant to make the language more ergonomic. They're too numerous to mention and they just keep getting added.
I'd like to draw attention to some features not because they're the most important but rather because it feels like they communicate the "personality" of C#. Not sure what level of detail was appropriate, so feel free to skim.
Stricter Null Handling. If you think not having to explicitly deal with null is the billion dollar mistake, then C# tries to fix a bit of the problem by allowing you to enable a strict context where you have to explicitly tell it that something can be null, otherwise it will assume that the possibility of a reference type being null is an error. It's a bit more complicated than that, but it definitely helps with safety around nullability.
Default Interface Implementation. A problem in C# which drives usage of inheritance is that with just interfaces there is no way to reuse code outside of passing function pointers. A lot of people don't get this and think that inheritance is just used because other people are stupid or something. If you have a couple of methods that would be implemented exactly the same for classes 1 through 99, but somewhat differently for classes 100 through 110, then without inheritance you're fucked. A much better way would be Rust's trait system, but for that to work you need really powerful generics, so it's too different of a path for C# to trod it. Instead what C# did was make it so that you can write an implementation for methods declared in an interface, as long as that implementation only uses members defined in the interface (this makes sense, why would it have access to anything else?). So now you can have a default implementation for the 1 through 99 case and save some of your sanity. Of course, it's not a panacea, if the implementation of the method requires access to the internal state of the 1 through 99 case, default interface implementation won't save you. But it can still make it easier via some techniques I won't get into. The important part is that default interface implementation allows code reuse and reduces reasons to use inheritance.
Performance Optimization. C# has a plethora of features regarding that. Most of which will never be encountered by the average programmer. Examples: (1) stackalloc - forcibly allocate reference types to the stack if you know they won't outlive the current scope. (2) Specialized APIs for avoiding memory allocations in happy paths. (3) Lazy initialization APIs. (4) APIs for dealing with memory more directly that allow high performance when interoping with C/C++ while still keeping a degree of safety.
Fine Control Over Async Runtime. C# lets you write your own... async builder and scheduler? It's a bit esoteric and hard to describe. But basically all the functionality of async/await that does magic under the hood? You can override that magic to do some very specific things that you'll rarely need. Unity3D takes advantage of this in order to allow async/await to work on WASM even though it is a single-threaded environment. It implements a cooperative scheduler so the program doesn't immediately freeze the moment you do await in a single-threaded environment. Most people don't know this capability exists and it doesn't affect them.
Tremendous Amount Of Synchronization Primitives and API. This ones does actually make multithreaded code harder to deal with, but basically C# erred a lot in favor of having many different ways to do multithreading because they wanted to suit different usecases. Most people just deal with idiomatic async/await code, but a very small minority of C# coders deal with locks, atomics, semaphores, mutex, monitors, interlocked, spin waiting etc. They knew they couldn't make this shit safe, so they tried to at least let you have ready-made options for your specific use case, even if it causes some balkanization.
Shortly Begging For Tagged Unions
What I miss from C# is more powerful generic bounds/constraints and tagged unions (or sum types or discriminated unions or type unions or any of the other 5 names this concept has).
The generic constraints you can use in C# are anemic and combined with the lack of tagged unions this is rather painful at times.
I remember seeing Microsoft devs saying they don't see enough of a usecase for tagged unions. I've at times wanted to strangle certain people. These two facts are related to one another.
My stance is that if you think your language doesn't need or benefit from tagged unions, either your language is very weird, or, more likely you're out of your goddamn mind. You are making me do really stupid things every time I need to represent a structure that can EITHER have a value of type A or a value of type B.
But I think C# will eventually get tagged unions. There's a proposal for it here. I would be overjoyed if it got implemented. It seems like it's been getting traction.
Also there was an entire section on unchecked exceptions that I removed because it wasn't interesting enough. Yes, C# could probably have checked exceptions and it didn't and it's a mistake. But ultimately it doesn't seem to have caused any make-or-break in a comparison with Java, which has them. They'd all be better off with returning an Error<T>. Short story is that the consequences of unchecked exceptions have been highly tolerable in practice.
Ecosystem State & FOSSness
C# is better than ever and the tooling ecosystem is better than ever. This is true of almost every language, but I think C# receives a rather high amount of improvements per version. Additionally the FOSS story is at its peak.
Roslyn, the bedrock of the toolchain, the compiler and analysis provider, is under MIT license. The fact that it does analysis as well is important, because this means you can use the wealth of Roslyn analyzers to do linting.
If your FOSS tooling lets you compile but you don't get any checking as you type, then your development experience is wildly substandard.
A lot of stupid crap with cross-platform compilation that used to be confusing or difficult is now rather easy to deal with. It's basically as easy as (1) use NET Core, (2) tell dotnet to build for Linux. These steps take no extra effort and the first step is the default way to write C# these days.
Dotnet is part of the SDK and contains functionality to create NET Core projects and to use other tools to build said projects. Dotnet is published under MIT, because the whole SDK and runtime are published under MIT.
Yes, the debugger situation is still bad -- there's no FOSS option for it, but this is more because nobody cares enough to go and solve it. Jetbrains proved anyone can do it if they have enough development time, since they wrote a debugger from scratch for their proprietary C# IDE Rider.
Where C# falls flat on its face is the "userspace" ecosystem. Plainly put, because C# is a Microsoft product, people with FOSS inclinations have steered clear of it to such a degree that the packages you have available are not even 10% of what packages a Python user has available, for example. People with FOSS inclinations are generally the people who write packages for your language!!
I guess if you really really hate leftpad, you might think this is a small bonus though.
Where-in I talk about Cross-Platform
The biggest thing the ecosystem has been lacking for me is a package, preferably FOSS, for developing cross-platform applications. Even if it's just cross-platform desktop applications.
Like yes, you can build C# to many platforms, no sweat. The same way you can build Rust to many platforms, some sweat. But if you can't show a good GUI on Linux, then it's not practically-speaking cross-platform for that purpose.
Microsoft has repeatedly done GUI stuff that, predictably, only works on Windows. And yes, Linux desktop is like 4%, but that 4% contains >50% of the people who create packages for your language's ecosystem, almost the exact point I made earlier. If a developer runs Linux and they can't have their app run on Linux, they are not going to touch your language with a ten foot pole for that purpose. I think this largely explains why C#'s ecosystem feels stunted.
The thing is, I'm not actually sure how bad or good the situation is, since most people just don't even try using C# for this usecase. There's a general... ecosystem malaise where few care to use the language for this, chiefly because of the tone that Microsoft set a decade ago. It's sad.
HOWEVER.
Avalonia, A New Hope?
Today we have Avalonia. Avalonia is an open-source framework that lets you build cross-platform applications in C#. It's MIT licensed. It will work on Windows, macOS, Linux, iOS, Android and also somehow in the browser. It seems to this by actually drawing pixels via SkiaSharp (or optionally Direct2D on Windows).
They make money by offering migration services from WPF app to Avalonia. Plus general support.
I can't say how good Avalonia is yet. I've researched a bit and it's not obviously bad, which is distinct from being good. But if it's actually good, this would be a holy grail for the ecosystem:
You could use a statically typed language that is productive for this type of software development to create cross-platform applications that have higher performance than the Electron slop. That's valuable!
This possibility warrants a much higher level of enthusiasm than I've seen, especially within the ecosystem itself. This is an ecosystem that was, for a while, entirely landlocked, only able to make Windows desktop applications.
I cannot overstate how important it is for a language's ecosystem to have a package like this and have it be good. Rust is still missing a good option. Gnome is unpleasant to use and buggy. Falling back to using Electron while writing Rust just seems like a bad joke. A lot of the Rust crates that are neither Electron nor Gnome tend to be really really undercooked.
And now I've actually talked myself into checking out Avalonia... I mean after writing all of that I feel like a charlatan for not having investigated it already.
72 notes
·
View notes
Text
Python Operator Basics
x or y - Logical or (y is evaluated only if x is false)
lambda args: expression - Anonymous functions (I don't know what the fuck is this, I have to look into it)
x and y - Logical and (Y is evaluated only if x is true)
<, <=, >, >=, ==, <>, != - comparison tests
is, is not - identity tests
in, in not - membership tests
x | y - bitwise or (I still have to learn bitwise operation)
x^y - bitwise exclusive or (I read this somewhere now I don't remember it)
x&y - bitwise and (again I have to read bitwise operations)
x<;<y, x>>y - shift x left or right by y bits
x+y, x-y - addition/concatenation , subtraction
x*y, x/y, x%y - multiplication/repetition, division, remainder/format (i don't know what format is this? should ask bard)
-x, +x, ~x - unary negation, identity(what identity?), bitwise complement (complement?)
x[i], x[i:j], x.y, x(...) - indexing, slicing, qualification (i think its member access), function call
(...), [...], {...} `...` - Tuple , list dictionary , conversion to string
#kumar's python study notes#study notes#study blog#coding#programmer#programming#python#studyblr#codeblr#progblr
67 notes
·
View notes
Text
Serverless Deployment using AWS Lambda and API Gateway with Terraform
Learn how to automate the deployment of serverless infrastructure on AWS using Terraform. Create Lambda functions and API Gateways with ease.
In my previous blog post, I explored the benefits of serverless architecture using AWS Lambda and API Gateway. Now, let’s dive deeper and see how we can leverage Terraform to automate the deployment of this infrastructure. Terraform is an Infrastructure as Code (IaC) tool that defines infrastructure resources (like Lambda functions and API Gateways) in a human-readable format. This blog post…
0 notes
Text
Expanding and cleaning up on a conversion I had with @suntreehq in the comments of this post:
Ruby is fine, I'm just being dramatic. It's not nearly as incomprehensible as I find JavaScript, Perl, or Python. I think it makes some clumsy missteps, and it wouldn't be my first (or even fifth) choice if I were starting a new project, but insofar as I need to use it in my Software Engineering class I can adapt.
There are even things I like about it -- it's just that all of them are better implemented in the languages Ruby borrows them from. I don't want Lisp with Eiffel's semantics, I want Lisp with Lisp's semantics. I don't want Ada with Perl's type system, I want Ada with Ada's type system.
One of these missteps to me is how it (apparently) refuses to adopt popular convention when it comes to the names and purposes of its keywords.
Take yield. In every language I've ever used, yield has been used for one purpose: suspending the current execution frame and returning to something else. In POSIX C, this is done with pthread_yield(), which signals the thread implementation that the current thread isn't doing anything and something else should be scheduled instead. In languages with coroutines, like unstable Rust, the yield keyword is used to pause execution of the current coroutine and optionally return a value (e.g. yield 7; or yield foo.bar;), execution can then be resumed by calling x.resume(), where x is some coroutine. In languages with generators, like Python, the behavior is very similar.
In Ruby, this is backwards. It doesn't behave like a return, it behaves like a call. It's literally just syntax sugar for using the call method of blocks/procs/lambdas. We're not temporarily returning to another execution frame, we're entering a new one! Those are very similar actions, but they're not the same. Why not call it "run" or "enter" or "call" or something else less likely to confuse?
Another annoyance comes in the form of the throw and catch keywords. These are almost universally (in my experience) associated with exception handling, as popularized by Java. Not so in Ruby! For some unfathomable reason, throw is used to mean the same thing as Rust or C2Y's break-label -- i.e. to quickly get out of tightly nested control flow when no more work needs to be done. Ruby does have keywords that behave identically to e.g. Java or C++'s throw and catch, but they're called raise and rescue, respectively.
That's not to say raise and rescue aren't precedented (e.g. Eiffel and Python) but they're less common, and it doesn't change the fact that it's goofy to have both them and throw/catch with such similar but different purposes. It's just going to trip people up! Matsumoto could have picked any keywords he could have possibly wanted, and yet he picked the ones (in my opinion) most likely to confuse.
I have plenty more and deeper grievances with Ruby too (sigils, throws being able to unwind the call stack, object member variables being determined at runtime, OOP in general being IMO a clumsy paradigm, the confusing and non-orthogonal ways it handles object references and allocation, the attr_ pseudo-methods feeling hacky, initialization implying declaration, the existence of "instance_variable_get" totally undermining scope visibility, etc., etc.) but these are I think particularly glaring (if inconsequential).
5 notes
·
View notes