SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-11-19 18:56:11

apm
#! Junkie
From: loops and branches of reality
Registered: 2012-04-12
Posts: 328
Website

from C to python , tell us your story

cool  i recently switched from c to python as my primary programming language , why because it has a better approach to high level stuff
compared to c , being a c loyalist for 6 years i have grown accustomed to the preprocessor  and the headers and the makefiles  when building something.
tongue
but even when i am on the first step on the ladder to learn python , why is it so that every single sane brain cell of mine is urging me to learn python as fast as i could and leave c for the sake of making my life easier .

the above may not make sense to everyone but well i felt this is a place to talk abt tech that effects the mythical yet omnipresent
"common man "  angel


sometimes all you need is to face the worst fear you have and to overcome it.

Offline

Be excellent to each other!

#2 2012-11-19 19:14:41

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: from C to python , tell us your story

apm is back!

Offline

#3 2012-11-19 19:58:40

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,176

Re: from C to python , tell us your story

id like to learn py as well, what are some good resources? tools? approach? (if iam stealing the thread, ignore me)

Offline

#4 2012-11-19 22:11:36

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,494

Re: from C to python , tell us your story

@brontosaurusrex:  Learning Python the Hard Way is a great resource.


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#5 2012-11-19 22:36:42

lcafiero
The #! Guy
From: Felton, California, USA
Registered: 2011-07-21
Posts: 2,196
Website

Re: from C to python , tell us your story

What pvsage said. "Learning Python the Hard Way" is probably the best teaching tool for Python, IMNSHO.


Res publica non dominetur | Larry the CrunchBang Guy speaks of the pompetous of CrunchBang

CrunchBang Forum moderator

Offline

#6 2012-11-20 11:42:18

hashbanger
#! CrunchBanger
Registered: 2011-11-28
Posts: 234

Re: from C to python , tell us your story

Python code looks like a rough draft for a real programming language. No brackets? Meh.
Also, indenting should be for making code readable, not as a syntax element.


FreeBSD | OpenBSD | Windows. Randomly lurking.
Decentralized #! eD2k/Kad mirror.

Offline

#7 2012-11-20 12:50:55

joek
#! Junkie
Registered: 2011-09-06
Posts: 497

Re: from C to python , tell us your story

Python indenting is wonderful! Enforcing readable code can only be a good thing: I've seen some utterly horrible lack of any sane indentation scheme before now.
And semicolons and curly brackets as a syntax element instead? Ugh. It looks nasty, and makes code less readable.

(Disclaimer: I only use python and shell script, so C and Java are pretty unreadable to me anyway...)

Offline

#8 2012-11-20 13:04:06

hashbanger
#! CrunchBanger
Registered: 2011-11-28
Posts: 234

Re: from C to python , tell us your story

joek wrote:

Enforcing readable code can only be a good thing

Depends. First, it is not always easy to distinguish spaces from tabs. Second, "readable" is subjective.


FreeBSD | OpenBSD | Windows. Randomly lurking.
Decentralized #! eD2k/Kad mirror.

Offline

#9 2012-11-20 13:20:13

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,494

Re: from C to python , tell us your story

semicolons and curly brackets as a syntax element

Just out of curiosity, what language is used in gtkrc files?  (I see semicolons, parentheses, braces...)


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#10 2012-11-20 16:45:05

joek
#! Junkie
Registered: 2011-09-06
Posts: 497

Re: from C to python , tell us your story

Someone who is using both spaces and tabs for indentation, though, deserves to be shot in any case... tongue
(Readable is totally subjective, but if you can't have a good religious war over indentation styles, what can it be over? tongue )

@pvsage: my .gtkrc-2.0 looks just like a plain text config file. I can't see any semicolons, curly brackets or parentheses anywhere...

Offline

#11 2012-11-20 16:58:54

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,176

Re: from C to python , tell us your story

ok, just did

var = "6"
print "exercise %s of hard ways!" % var

Last edited by brontosaurusrex (2012-11-20 17:00:39)

Offline

#12 2012-11-20 22:09:28

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,494

Re: from C to python , tell us your story

@joek:  Here's a snippet of the default Statler gtkrc:

style "evolution-hack" = "murrine-default"
{
    bg[NORMAL] = shade (1.14, @bg_color)
    bg[PRELIGHT] = shade (1.18, @bg_color)
    bg[ACTIVE] = shade (0.75, @bg_color)
    bg[SELECTED] = @selected_bg_color
    fg[ACTIVE] = @selected_fg_color
    fg[SELECTED] = @selected_fg_color
}
style "murrine-wide"
{
    xthickness = 2
    ythickness = 2
}
style "murrine-wider"
{
    xthickness = 3
    ythickness = 3
}
style "murrine-entry" = "murrine-wider"
{
    bg[SELECTED] = mix (0.4, @selected_bg_color, @base_color)
    fg[SELECTED] = @text_color
    engine "murrine" {
        focus_color = shade (0.65, @selected_bg_color)
    }
}
style "murrine-button" = "murrine-wider"
{	
	bg[NORMAL]        = shade (1.06, @bg_color) 
	bg[PRELIGHT]      = shade (1.35, @selected_bg_color)  
	bg[ACTIVE]        = shade (0.85, @bg_color)
	bg[SELECTED]      = shade (1.0, @selected_bg_color)  
	bg[INSENSITIVE]   = shade (0.95, @bg_color)

  	engine "murrine" 
	{
		contrast            = .8
		highlight_shade     = 1.00
		lightborder_shade   = 1.7
		gradient_shades     = {1.1,1.05,0.95,0.95} 
		border_shades       = { 1.1, 0.9 }
		shadow_shades       = {0.5,0.0}
		reliefstyle         = 3
		roundness	    = 0
	}
}
style "murrine-notebook-bg"
{
    bg[NORMAL] = shade (1.02, @bg_color)
    bg[ACTIVE] = shade (0.92, @bg_color)
}
style "murrine-notebook" = "murrine-notebook-bg"
{
    xthickness = 1
    ythickness = 1
    engine "murrine"
    {
        roundness = 0
        contrast = 0.6
    }
}

OK, so there's no semicolon in sight, but parentheses and braces all over the place.  (And I agree, mixing types of whitespace for code indents is a shot-worthy offense. yikes I'll have a slippery nipple! monkey )


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#13 2012-11-20 22:36:08

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: from C to python , tell us your story

That's not a language, that's an API. The way I understand it, the instructions talk to the engines, and all of that composes a toolkit, which talks to Xlib or XCB. These are somehow exported to C, but I've always lost track somewhere in the middle of it all.

Last edited by el_koraco (2012-11-20 22:37:10)

Offline

#14 2012-11-21 14:08:22

HMW
#! CrunchBanger
From: Sweden
Registered: 2011-10-09
Posts: 199

Re: from C to python , tell us your story

Well. I'm about to do the exact opposite: learning C. It's gonna be hard considering how much stuff you get ”for free” in Python. Still, it seems to be worth it somehow.

Offline

#15 2012-11-21 22:24:12

stolid
#! CrunchBanger
Registered: 2012-09-06
Posts: 206

Re: from C to python , tell us your story

I love Python. I started out with PHP, then Python, and now at university we're using C++.

Python is my favorite, but I don't think one can shove compiled languages aside altogether. They still have their place and do well at making programmers know some of the lower level things they should know about computers. Just use the right tool for the job.

I hate the PEP8 standard of using spaces in Python for indentation. Tabs make a lot more sense, given that the goal of those spaces is to indent things, but the purpose of tabs is *always* indentation. Also, editors are welcome to customize the displayed width of a tab. I use tabs personally.


Registered Linux User #555399
crunchbox:     Phenom II X6 1055T | 8GB RAM | OCZ Vertex 4 128GB | Radeon 7870XT | Win7 / #! 11 (i3 WM)
lambdacore:     4x Opteron 8431 | 16GB RAM | 2x1TB mirrored (ZFSoL) | Debian 7 (headless)
crunchtop:     Acer Aspire 1410 11.6" | 2GB RAM | Crucial M4 128GB | #! 11 (i3 WM)

Offline

#16 2012-11-24 14:17:39

nikki
Member
Registered: 2012-11-12
Posts: 33

Re: from C to python , tell us your story

+1 for "Learn Python the hard way" (actually the follow up "Learn C the hard way is very cool too") .

This quote "First, it is not always easy to distinguish spaces from tabs. " is not very smart, I believe lesson one in setting up your editor is *don't mix tabs and spaces*; only use spaces and make tab enter 4 spaces. 
Or maybe number one is turn line numbers on...

The thing I like the most about Python is that it made me a more cautious and precise programmer because of its weirdness (strictness in whitespace and indentation, no semicolon, double colon, no braces) compared to ecma/braces languages.
The REPL way of working is very sweet too!

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo