没有OO的python [英] python without OO

查看:66
本文介绍了没有OO的python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在Python中编写纯粹的过程代码,或者语言和支持库中的OO

构造已经嵌入了这样的内容,这是不可能的避免他们?此外,是否有人知道

任何脚本语言可被视为Python减去OO

东西? (正如你所看到的,我对Python来说是全新的并且最初

相信它是一个很好的和简单的脚本语言,然后才能看到所有这些

OO添加的内容随着时间的推移)

谢谢,

Davor

解决方案

Davor写道:

是否有可能在Python中编写纯粹的过程代码,或者语言和支持库中的OO
结构已经嵌入,以至于无法避免他们?




嗯...... sorta取决于你如何定义写程序代码...如果你想要

,你能写Python吗?没有访问对象属性的代码

(例如lst.sort()),那么答案可能几乎肯定没有。如果

你的意思是你可以编写Python代码而无需编写类,

答案'可能是肯定的。它会使一些事情变得更难,而且它会让一些模块禁止进入,但它是可行的。


可以你澄清你的意思是写纯粹的程序代码?


史蒂夫


Davor写道:
< blockquote class =post_quotes>是否有可能在Python中编写纯粹的过程代码,或者语言和支持库中的OO
结构已经嵌入,以至于无法避免它们?


当然可以,但是你会遇到图书馆的问题。其中一些实际上是

框架,需要一些子类或其他OO绒毛。

此外,是否有人知道
任何脚本语言可被视为Python减去OO
东西? (正如你所看到的,我对Python来说是全新的,并且在看到所有这些随着时间推移而添加的OO内容之前,它们认为它是一种很好的和简单的脚本语言)




图标,OO仇恨者的语言。


我可以问你为什么这么讨厌OO?


-

Jarek Zgoda
http ://jpa.berlios.de/ | http://www.zgodowie.org/


"达沃尔" <哒***** @ gmail.com>在消息中写道

新闻:11 ********************* @ c13g2000cwb.googlegro ups.com ...

是否有可能在Python中编写纯粹的过程代码,...
当然!

或OO
构造在语言和支持库中都有这样的<嵌入它是不可能避免它们?


您可以随时*编写自己的*纯粹的程序代码。

更难的问题是没有丰富的支持库生活

写的代码OO。

此外,是否有人知道
任何可以被视为Python减去OO
东西的脚本语言?
有谁知道吗?不是我!

(你可以看到我对Python来说是全新的并且最初认为它是一个很好的和简单的脚本语言,然后才能看到所有这些OO的东西随着时间的推移被添加了)




随着时间的推移???

如果我错了,有人可以纠正我,但我相信所有那些脏的,

腐烂的OO东西从一开始就被纳入语言。

但是

如果你可以没有编码OO你可以用Python做到这一点。


我不确定它到底是什么,确切地说,你正试图避免。

很多很好& amp ;简单的脚本编写根本不需要创建和使用对象。

当然,Python的整个结构以及所有内置数据的结构都是面向对象的。但是,如果你希望生活在你自己的严格程序代码的范围内,我认为你不需要处理这个问题。

处理这个问题。 >

另一方面,这确实是乞丐,因为有理由在CSS / b
全部使用Python。看起来你可能很高兴为Linux或DOS批处理BASH脚本

文件用于Windows。两者都是漂亮和简单的。脚本语言免费

面向对象的污染。


如果你不想,你为什么要使用面向对象的语言?

Thomas Bartkus


Is it possible to write purely procedural code in Python, or the OO
constructs in both language and supporting libraries have got so
embedded that it''s impossible to avoid them? Also, is anyone aware of
any scripting language that could be considered as "Python minus OO
stuff"? (As you can see I''m completely new to Python and initially
believed it''s a nice&simple scripting language before seeing all this
OO stuff that was added in over time)
Thanks,
Davor

解决方案

Davor wrote:

Is it possible to write purely procedural code in Python, or the OO
constructs in both language and supporting libraries have got so
embedded that it''s impossible to avoid them?



Hmmm... sorta depends on how you define write procedural code... If
you mean, can you write Python code without accessing object attributes
(e.g. lst.sort()), then the answer''s probably almost certainly no. If
you mean can you write Python code without ever writing a class, the
answer''s probably yes. It''ll make some things harder, and it''ll
probably make some modules off-limits, but it''s doable.

Could you clarify what you mean by "write purely procedural code"?

Steve


Davor wrote:

Is it possible to write purely procedural code in Python, or the OO
constructs in both language and supporting libraries have got so
embedded that it''s impossible to avoid them?
Sure, but you will got problem with libraries. Some of them are in fact
frameworks and need some subclassing or other OO fluff.
Also, is anyone aware of
any scripting language that could be considered as "Python minus OO
stuff"? (As you can see I''m completely new to Python and initially
believed it''s a nice&simple scripting language before seeing all this
OO stuff that was added in over time)



Icon, the language for OO haters.

May I ask why you do you hate OO so much?

--
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/


"Davor" <da*****@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...

Is it possible to write purely procedural code in Python, ... Of course!
or the OO
constructs in both language and supporting libraries have got so
embedded that it''s impossible to avoid them?
You can always *write your own* purely procedure code.
A tougher problem would be living without the wealth of supporting library
code that is written OO.
Also, is anyone aware of
any scripting language that could be considered as "Python minus OO
stuff"? Anyone aware? Not I!
(As you can see I''m completely new to Python and initially
believed it''s a nice&simple scripting language before seeing all this
OO stuff that was added in over time)



Over time ???
Someone can correct me if I''m wrong but I do believe that all that dirty,
rotten OO stuff was incorporated in the language right from the start.
But
If you can live without coding OO, you can do it in Python.

I''m not sure what it is, exactly, you are trying to avoid.
Much "nice&simple scripting " simply has no need to create and use objects.
Of course, the entire structure of Python and all of it''s built in data
structures are object oriented. But, if you wish to live within the
confines of your own strictly procedural code, I don''t think you need to
deal with the issue.

On the other hand, this does beggar for a reason to bother with Python at
all. It seems you could be happy doing BASH scripts for Linux or DOS batch
files for Windows. Both are "nice&simple" scripting languages free of
object oriented contamination.

Why would you use an object oriented language if you don''t want to?
Thomas Bartkus


这篇关于没有OO的python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆