This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#51 2011-10-02 16:17:04

Vurb
Scratcher
Registered: 2010-05-09
Posts: 100+

Re: Various Areas of Python

maxskywalker wrote:

Vurb wrote:

maxskywalker wrote:


Yeah, I know.  I just don't get what makes it better to say, for example, 'g.say()' instead of 'say()'.  But yeah, I guess so.

Who builds classes just for a say()? Your example of classes is like this example of functions - "who needs funcprint(this) instead of cout  < this?

Yes, I know, I know.  I was just using that as an example, from a classic Ruby Hello World program (

class Greeter
def initialize( name )
@name = name.capitalize
end
def say
puts "Hello #{@name}!"
end
end
g = Greeter.new( "world" )
g.say

in case you were wondering).

It's not a hello world for nothing isn't it. Simple examples are what make it.

Offline

 

#52 2011-10-02 18:33:54

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Vurb wrote:

maxskywalker wrote:

Vurb wrote:

Who builds classes just for a say()? Your example of classes is like this example of functions - "who needs funcprint(this) instead of cout  < this?

Yes, I know, I know.  I was just using that as an example, from a classic Ruby Hello World program (

class Greeter
def initialize( name )
@name = name.capitalize
end
def say
puts "Hello #{@name}!"
end
end
g = Greeter.new( "world" )
g.say

in case you were wondering).

It's not a hello world for nothing isn't it. Simple examples are what make it.

Um, not quite sure what that means, but yeah, sure, I think so.  So… back on topic?

Last edited by maxskywalker (2011-10-03 12:45:53)

Offline

 

#53 2011-10-03 12:45:29

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Back on topic... anyone?

Offline

 

#54 2011-10-04 10:38:28

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

. . .

Offline

 

#55 2011-10-04 18:10:32

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

. . .

Offline

 

#56 2011-10-04 19:40:52

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

???

Anybody???

Offline

 

#57 2011-10-05 12:38:30

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Okay, I'm starting to think that someone closed the topic or something.

Offline

 

#58 2011-10-05 14:47:36

Vurb
Scratcher
Registered: 2010-05-09
Posts: 100+

Re: Various Areas of Python

maxskywalker wrote:

Okay, I'm starting to think that someone closed the topic or something.

No it's just that "..." and "???" aren't good points of discussion

Offline

 

#59 2011-10-05 17:39:41

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Well then, what's the difference between

Code:

class Class:

and

Code:

class Class(object):

?  I can't figure out what functions are in the object class.

Offline

 

#60 2011-10-26 23:19:18

alldaykade28471
Scratcher
Registered: 2011-05-25
Posts: 1000+

Re: Various Areas of Python

maxskywalker wrote:

Okay, I'm starting to think that someone closed the topic or something.

If someone closed it, you would not be able to post on it.

Offline

 

#61 2011-10-27 08:14:26

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

alldaykade28471 wrote:

maxskywalker wrote:

Okay, I'm starting to think that someone closed the topic or something.

If someone closed it, you would not be able to post on it.

I know.  I was testing it.

Offline

 

#62 2011-10-27 08:59:06

CheeseMunchy
Scratcher
Registered: 2008-10-13
Posts: 1000+

Re: Various Areas of Python

nickbrickmaster wrote:

maxskywalker wrote:

7.  Is Python capable of handling time (as in 'wait so-and-so seconds')?

You can use

Code:

sleep 5000

That's for 5 secs.
I'm just learning python.

not quite  hmm

Code:

import time
    sleep (5)

this will sleep 5 seconds


6418,

Offline

 

#63 2011-10-27 09:51:18

alldaykade28471
Scratcher
Registered: 2011-05-25
Posts: 1000+

Re: Various Areas of Python

maxskywalker wrote:

alldaykade28471 wrote:

maxskywalker wrote:

Okay, I'm starting to think that someone closed the topic or something.

If someone closed it, you would not be able to post on it.

I know.  I was testing it.

It says "Topic closed" at the top... If it was...

Offline

 

#64 2011-10-27 16:15:15

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Various Areas of Python

maxskywalker wrote:

Well then, what's the difference between

Code:

class Class:

and

Code:

class Class(object):

?  I can't figure out what functions are in the object class.

in 3, it's the same. Class inherits automatically from object if no superclass is present.
use dir(object) to get list of functions in it

Offline

 

#65 2011-10-27 17:19:04

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

roijac wrote:

maxskywalker wrote:

Well then, what's the difference between

Code:

class Class:

and

Code:

class Class(object):

?  I can't figure out what functions are in the object class.

in 3, it's the same. Class inherits automatically from object if no superclass is present.
use dir(object) to get list of functions in it

but dir(object) doesn't tell me what they do.

Offline

 

#66 2011-10-28 11:25:08

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Bump.  Oh, and also, check my capitalization.

Offline

 

#67 2011-10-28 11:34:47

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Various Areas of Python

maxskywalker wrote:

...
but dir(object) doesn't tell me what they do.

nothing, actually  tongue

Offline

 

#68 2011-10-28 11:36:40

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

roijac wrote:

maxskywalker wrote:

...
but dir(object) doesn't tell me what they do.

nothing, actually  tongue

smile h.  L tongue L

Offline

 

#69 2011-10-28 15:43:35

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Various Areas of Python

Check my capitalization in the original post.  Then tell me if you can figure out the riddle.

Offline

 

Board footer