Trying to Switch from C# to Python - Having Issues

Cnotey

Power Member
Joined
Jun 25, 2010
Messages
730
Reaction score
984
Hey there,

Haven't posted in a while but I need some advice from my fellow bot programmers.

I've been writing in C# for a while for my scraping utilities. I am looking at switching to Python so I can take advantage of the Django and Scrapy framework, as I am not really that impressed with the HTMLagilitypack for C#.

Is the productivity all that much better in Python? I've always read that C# is a much harder language than Python, but for some reason I am having a lot of trouble with the concept of dynamic typing.

Anyone have any good resources specifically to help a C# guy like me understand how to switch to Python?

Thanks in advance!

Cnotey
 
Well, when I started writing python, someone told me to code like I was talking. That's the cool thing about python, its written so it can be read and understood properly later. Forget about those lousy semicolons and just hit return at the end of a line of code. As for training... I don't know of to much, ask I know is that it's much easier then C#
 
The question is rather, what does python(and these frameworks) offer over anything that c# has?
 
The question is rather, what does python(and these frameworks) offer over anything that c# has?

Being open source, Python tends to have better curated libraries that help out quite a bit with development time. In addition the line to line code comparison is about 5:1 in Python's favor. These two factors lead and about 250k other people to believe that Python is a more productive environment than C#.
 
Hi, it really depends on what you are trying to accomplish. There are many things python can't do that c# can. That does not apply the other way around though. c# can do anything python can and it's libraries are very extensive.

Additionally, if your focus are command line script(on linux?) then you could also definitely accomplish all that with PHP as well.
 
What is that you are finding difficult in c# writing screen scrapers ?
 
What is that you are finding difficult in c# writing screen scrapers ?


Isn't that python2?

Should really learn python3 IMO


But as stated, anything you can do in python you can do in c# and anything you can do in c# you can do in python.

Python does have extensive projects you can use, which c# doesn't have. But for botting, they are not really needed in my opinion. But learning a new language is always a good thing.



To whoever said python is so readable I disagree, a semi colon doesn't effect things at all.


Which is more readable here

Code:
//c#
var csv = listAccountIds.Split(',');


#python
csv = ",".join([str(acc_id) for acc_id in list_account_ids ])


It is more a case of the programmer writing readble code, than a languae in my opinion




Moving to a dynamic language, the thing you will probably miss most is the compiler catching all those stupid typo bugs, or refactors you make, forgetting to change all function calls if you change the parameters. Really it is a case of changing your workflow, to be more careful, writing more tests that replace the compiler that you would need to write in a compiled language as the compiler is there for you

The way code is written is also different, less patterns , oo strict structure in python

At the end of the day, you just need to keep at it, complete more projects in python, you will soon figure out what you could have done better, read through some src of the projects you are utilizing to understand best practises etc. The more you do the better you get
 
What's difficult about dynamic typing? The lack of compile time type checks? Write unit tests if that's what you're worried about. Otherwise, can you give some specifics?
 
If you're planning on selling your bots you should stick with C++ or some other compiled language. Even C# can be easily decompiled.
 
Hey there,Haven't posted in a while but I need some advice from my fellow bot programmers.I've been writing in C# for a while for my scraping utilities. I am looking at switching to Python so I can take advantage of the Django and Scrapy framework, as I am not really that impressed with the HTMLagilitypack for C#.Is the productivity all that much better in Python? I've always read that C# is a much harder language than Python, but for some reason I am having a lot of trouble with the concept of dynamic typing.Anyone have any good resources specifically to help a C# guy like me understand how to switch to Python?Thanks in advance!Cnotey
Practice is the best. You'll be glad you did just for Scrapy once you'll write efficient spiders in less then 100-200 lines of code.
 
there are many things python can't do that c# can.

lol. I want what you are smoking bro.

If you're planning on selling your bots you should stick with C++ or some other compiled language. Even C# can be easily decompiled.

And C++ can't be modified or reverse-engineered? .NET just made it easier but it's still the same for other languages. It can still be analyzed and then patched according to the cracker's needs - even if you virtualize everything with lots of time in hand it's still inevitable for your software to be cracked. In the end, everything comes to machine language.
 
This is one of the great source for learning python: learnpythonthehardway.org/book

If you've been working on C, C++, or C#, you'll grasp the concept easily.

Nice book.. Thanks..

If you're planning on selling your bots you should stick with C++ or some other compiled language. Even C# can be easily decompiled.

Any application can be decompiled!

Hey there,

Haven't posted in a while but I need some advice from my fellow bot programmers.

I've been writing in C# for a while for my scraping utilities. I am looking at switching to Python so I can take advantage of the Django and Scrapy framework, as I am not really that impressed with the HTMLagilitypack for C#.

Is the productivity all that much better in Python? I've always read that C# is a much harder language than Python, but for some reason I am having a lot of trouble with the concept of dynamic typing.

Anyone have any good resources specifically to help a C# guy like me understand how to switch to Python?

Thanks in advance!

Cnotey

If you still want to try C# before you move your code to python, try using AngleSharp or CSQuery in your existing C# code.

nuget.org/packages/AngleSharp/
 
Well depends what you are going to code. If you want to distribude your programs best is C++.

But to not being offtopic, python is as powerfull as C# and both are pretty fast to learn. Scrapy is using very good libs and it fast anyway, even you can deploy your code to their Cloud for free.

Btw best HTML parsing library is Beautifulsoup if you decide to go your own way as I did. It was for me simpler to create my own crawler implementation rather than using scrapy...
 
Back
Top