Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31184 > unrolled thread
| Started by | nbvfour@gmail.com |
|---|---|
| First post | 2012-10-12 21:49 -0700 |
| Last post | 2012-10-13 10:44 -0400 |
| Articles | 20 on this page of 24 — 10 participants |
Back to article view | Back to comp.lang.python
Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-12 21:49 -0700
Re: Feedback on my python framework I'm building. Etienne Robillard <animelovin@gmail.com> - 2012-10-13 04:18 -0400
Re: Feedback on my python framework I'm building. Chris Angelico <rosuav@gmail.com> - 2012-10-14 01:12 +1100
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 08:57 -0700
Re: Feedback on my python framework I'm building. Etienne Robillard <animelovin@gmail.com> - 2012-10-13 12:10 -0400
Re: Feedback on my python framework I'm building. Chris Angelico <rosuav@gmail.com> - 2012-10-14 03:48 +1100
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 11:18 -0700
Re: Feedback on my python framework I'm building. Chris Angelico <rosuav@gmail.com> - 2012-10-14 05:33 +1100
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 15:24 -0700
Re: Feedback on my python framework I'm building. Chris Angelico <rosuav@gmail.com> - 2012-10-14 10:06 +1100
Re: Feedback on my python framework I'm building. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-14 02:25 +0000
Re: one obvious parser (was "Feedback on my python framework I'm building.") Tim Chase <python.list@tim.thechases.com> - 2012-10-13 21:53 -0500
Re: Feedback on my python framework I'm building. MRAB <python@mrabarnett.plus.com> - 2012-10-14 03:58 +0100
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 15:24 -0700
Re: Feedback on my python framework I'm building. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-14 03:37 +0000
Re: Feedback on my python framework I'm building. Chris Angelico <rosuav@gmail.com> - 2012-10-14 15:20 +1100
Re: Feedback on my python framework I'm building. Roy Smith <roy@panix.com> - 2012-10-14 08:48 -0400
Re: Feedback on my python framework I'm building. Dave Angel <d@davea.name> - 2012-10-14 18:38 -0400
Re: Feedback on my python framework I'm building. MRAB <python@mrabarnett.plus.com> - 2012-10-15 00:40 +0100
Re: Feedback on my python framework I'm building. Roel Schroeven <roel@roelschroeven.net> - 2012-10-15 19:29 +0200
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 11:18 -0700
Re: Feedback on my python framework I'm building. Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-14 01:43 +0100
Re: Feedback on my python framework I'm building. nbvfour@gmail.com - 2012-10-13 08:57 -0700
Re: Feedback on my python framework I'm building. Etienne Robillard <animelovin@gmail.com> - 2012-10-13 10:44 -0400
Page 1 of 2 [1] 2 Next page →
| From | nbvfour@gmail.com |
|---|---|
| Date | 2012-10-12 21:49 -0700 |
| Subject | Feedback on my python framework I'm building. |
| Message-ID | <634c9dca-e64d-40c6-b9d5-cf04a86a220a@googlegroups.com> |
http://giotto.readthedocs.org/en/latest/tutorial.html Can someone give me some feedback on what they think of this framework? I came up with the idea of this framework a few months ago. I gave a talk at a local python user group regarding these ideas, but no one seemed to think I was onto anything special or useful. Basically its a framework that forces the developer(s) to strictly separate the model from the view and controller. You can 'hook up' multiple controllers to a project. The model layer can be completely mocked out so front end designers don't have to bother setting up Postgres/rabbitmq/whatever. Does anyone have any throughts or feedback?
[toc] | [next] | [standalone]
| From | Etienne Robillard <animelovin@gmail.com> |
|---|---|
| Date | 2012-10-13 04:18 -0400 |
| Message-ID | <mailman.2108.1350116303.27098.python-list@python.org> |
| In reply to | #31184 |
On Fri, 12 Oct 2012 21:49:55 -0700 (PDT) nbvfour@gmail.com wrote: > http://giotto.readthedocs.org/en/latest/tutorial.html > > Can someone give me some feedback on what they think of this framework? I came up with the idea of this framework a few months ago. I gave a talk at a local python user group regarding these ideas, but no one seemed to think I was onto anything special or useful. > > Basically its a framework that forces the developer(s) to strictly separate the model from the view and controller. You can 'hook up' multiple controllers to a project. The model layer can be completely mocked out so front end designers don't have to bother setting up Postgres/rabbitmq/whatever. > > Does anyone have any throughts or feedback? Docs are useless for developers with an quarter of imagination. :-) -- Etienne Robillard Green Tea Hackers Club Fine Software Carpentry For The Rest Of Us! http://gthc.org/ erob@gthcfoundation.org
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-14 01:12 +1100 |
| Message-ID | <mailman.2116.1350137553.27098.python-list@python.org> |
| In reply to | #31184 |
On Sat, Oct 13, 2012 at 3:49 PM, <nbvfour@gmail.com> wrote: > Basically its a framework that forces the developer(s) to strictly separate the model from the view and controller. You can 'hook up' multiple controllers to a project. The model layer can be completely mocked out so front end designers don't have to bother setting up Postgres/rabbitmq/whatever. I don't like frameworks that force too much. Actually, I guess that means I don't like frameworks at all, I like toolsets. Let the programmer decide what he wants to do. That said, though, there are times when a good framework can do 90% of your work for you. The trouble comes when you want to do something the author didn't think of - you might well end up either fighting against the system, or modifying the framework to suit your task (and that works only if you created it yourself). Thin frameworks are usually immune to this, but on the flip side, they're less likely to be doing most of your work for you. It's really easy to demo something and show how awesome it is. How easily can it be turned to a task it was never built for? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | nbvfour@gmail.com |
|---|---|
| Date | 2012-10-13 08:57 -0700 |
| Message-ID | <4c7a82ca-de0c-4b8b-a128-9ecd1b4c8b31@googlegroups.com> |
| In reply to | #31197 |
On Saturday, October 13, 2012 10:13:22 AM UTC-4, Chris Angelico wrote: > On Sat, Oct 13, 2012 at 3:49 PM, <nbvfour@gmail.com> wrote: > > > Basically its a framework that forces the developer(s) to strictly separate the model from the view and controller. You can 'hook up' multiple controllers to a project. The model layer can be completely mocked out so front end designers don't have to bother setting up Postgres/rabbitmq/whatever. > > > > I don't like frameworks that force too much. Actually, I guess that > > means I don't like frameworks at all, I like toolsets. Let the > > programmer decide what he wants to do. > > > > That said, though, there are times when a good framework can do 90% of > > your work for you. The trouble comes when you want to do something the > > author didn't think of - you might well end up either fighting against > > the system, or modifying the framework to suit your task (and that > > works only if you created it yourself). Thin frameworks are usually > > immune to this, but on the flip side, they're less likely to be doing > > most of your work for you. > > > > It's really easy to demo something and show how awesome it is. How > > easily can it be turned to a task it was never built for? > > > > ChrisA Do you have an example of a task that giotto can't handle that other frameworks can? One of my goals is to have this framework "turing complete" in the sense that everything that other frameworks can do, giotto should be able to do. I think my controller -> input_middleware -> model -> cache -> view -> output_middleware pattern pretty much allows for anything. Throughout the development process, I've radically changed the API many times when it was discovered that a certain task would be very hard (for instance authentication)
[toc] | [prev] | [next] | [standalone]
| From | Etienne Robillard <animelovin@gmail.com> |
|---|---|
| Date | 2012-10-13 12:10 -0400 |
| Message-ID | <mailman.2121.1350144585.27098.python-list@python.org> |
| In reply to | #31201 |
On Sat, 13 Oct 2012 08:57:47 -0700 (PDT) nbvfour@gmail.com wrote: > Do you have an example of a task that giotto can't handle that other frameworks can? One of my goals is to have this framework "turing complete" in the sense that everything that other frameworks can do, giotto should be able to do. I think my controller -> input_middleware -> model -> cache -> view -> output_middleware pattern pretty much allows for anything. Throughout the development process, I've radically changed the API many times when it was discovered that a certain task would be very hard (for instance authentication) > -- > http://mail.python.org/mailman/listinfo/python-list how about eliminating poverty and employment discrimination? Or can your script prevent childs to kill themselves on facebook? let me know!
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-14 03:48 +1100 |
| Message-ID | <mailman.2124.1350146902.27098.python-list@python.org> |
| In reply to | #31201 |
On Sun, Oct 14, 2012 at 2:57 AM, <nbvfour@gmail.com> wrote: > Do you have an example of a task that giotto can't handle that other frameworks can? One of my goals is to have this framework "turing complete" in the sense that everything that other frameworks can do, giotto should be able to do. I think my controller -> input_middleware -> model -> cache -> view -> output_middleware pattern pretty much allows for anything. No, I don't, because I haven't tried to use it. But allow me to give two examples, one on each side of the argument. The 'tee' utility is primarily for writing a pipe to disk AND to further pipelining, for instance: ./grind | tee grind.log | egrep '(2012|tps|@)' It'll show me, in real-time, the lines that are of interest to me, but it also writes the whole log to disk. But tee can be used in a quite different way: echo "Hello, world!" | sudo tee /some/file/owned/by/root Unix is full of utilities of this nature. They each do one thing and do it well, so when someone wants to use them in unusual ways, the tools perform as expected. On the contrary, Magic: The Gathering Online is designed for one purpose: human interaction. There are a number of bot accounts that function as shopkeepers, but their owners have to either use GUI level monitoring and automation facilities, or hack the existing client brutally. These people are trying to use an application in a way that it wasn't designed to do, and no matter how reasonable the goal is, the program just isn't built with toolchaining in mind. > Throughout the development process, I've radically changed the API many times when it was discovered that a certain task would be very hard (for instance authentication) This is, in my opinion, not a good thing. If you have to change your API radically to support something you just thought of, then something you still haven't thought of may require another radical API change. That's not too bad if it's a personal system that you don't share with anyone (though even then, you have to consider whether you'll be spending more time fiddling with the framework than actually getting stuff done), but is potentially disastrous in something you publish - you can't afford to break everyone else's code, which means that you'll be unable to support things you didn't think of. The only way to support *absolutely everything* is to do nothing - to be a framework so thin you're invisible. (That's not to say you're useless; there are bridge modules that do exactly this - ctypes can call on any library function from Python; it must therefore abstract away nothing. But that's a very specific sort of case.) Anything else must by nature make some things easier and some things harder. The easiest way to avoid making things very much harder is to have a way to ignore the framework - in the same way that most file compression formats have a way to mark data as having not been compressed (PKZip uses the term "Stored" rather than, eg, "Deflated"). This is why I say it's likely not a good thing that your framework *forces* the separation of model/view/controller. You make it impossible to temporarily ignore the framework. I haven't tested your specific case, but what I've seen happen in similar situations is a ridiculous set of "pass-through" methods or parameters, getting sent up the line and back down the line, carrying opaque information that really ought to have been manipulated at a different level in the chain. I can't show you demo code as I don't own copyright on it, but the git repository at work has, shall we say, a certain amount of TheDailyWTF-level code in it... But please don't take this post as _entirely_ doom and gloom. For a number of reasons, I do not want to start coding within your framework; but I would recommend that you DO (continue to) do so. You'll learn a lot about what you do and don't like, and that's a good thing. You'll quite possibly end up building something that saves you a heap of time, and that's also a good thing. And at very worst, it'll be an exploration. All programmers benefit from writing more code :) But so long as you keep it personal, you're free to change it around completely every time you need to. Keep that flexibility and you won't feel constrained. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | nbvfour@gmail.com |
|---|---|
| Date | 2012-10-13 11:18 -0700 |
| Message-ID | <5f18f5d1-1442-4a10-922c-783dc6ddf657@googlegroups.com> |
| In reply to | #31204 |
On Saturday, October 13, 2012 12:48:23 PM UTC-4, Chris Angelico wrote: > No, I don't, because I haven't tried to use it. But allow me to give > two examples, one on each side of the argument. > > The 'tee' utility is primarily for writing a pipe to disk AND to > further pipelining, for instance: Could you please spent 10 minutes to read through the tutorial? The 'tee' unix utility and ctypes describes the way giotto goes about it business very well. Traditional web frameworks (such as django and rails) are too much of a 'magic the gathering' for my taste, which is why I'm writing giotto. I'm really not looking for general "why I hate frameworks" criticism. I'm looking for specific criticism of the framework that I am writing. > This is, in my opinion, not a good thing. If you have to change your > API radically to support something you just thought of, then something > you still haven't thought of may require another radical API change. Not all api's get it right on the first shot. I'm more interested in getting it right, rather than patching together a bunch of random 'fixes' ala PHP. > The only way to support *absolutely everything* is to do nothing - to > be a framework so thin you're invisible. (That's not to say you're You just described what Giotto is trying to do, since Giotto doesn't touch the model at all. > This is why I say it's likely not a good thing that your framework > *forces* the separation of model/view/controller. You make it > impossible to temporarily ignore the framework. Exactly. When you 'break out of the framework' you pile on technical debt. I want to force developers to not do that.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-14 05:33 +1100 |
| Message-ID | <mailman.2132.1350153223.27098.python-list@python.org> |
| In reply to | #31211 |
On Sun, Oct 14, 2012 at 5:18 AM, <nbvfour@gmail.com> wrote: > On Saturday, October 13, 2012 12:48:23 PM UTC-4, Chris Angelico wrote: >> No, I don't, because I haven't tried to use it. But allow me to give >> two examples, one on each side of the argument. >> >> The 'tee' utility is primarily for writing a pipe to disk AND to >> further pipelining, for instance: > > Could you please spent 10 minutes to read through the tutorial? A fair criticism, and I am duly chastised. Okay. Now reading through your web site... alright, I'm back. >> This is why I say it's likely not a good thing that your framework >> *forces* the separation of model/view/controller. You make it >> impossible to temporarily ignore the framework. > > Exactly. When you 'break out of the framework' you pile on technical debt. I want to force developers to not do that. Philosophy point 2: Giotto does force users to do things the “Giotto way”. In other words, convention over configuration Nice theory, but this is the bit that I fundamentally disagree with. Forcing programmers to work in one particular style is usually not the job of the language/framework/library. That should be up to the programmer, or at least the local style guide. I do like your plan of having identical interfaces to the same functionality (your example of web-based and command-line is particularly appealing to my personal tastes), but the same can usually be achieved with a well-built library. In fact, all you need to do is have your model as a simple Python module, and then the view and controller call on its functions. What does your framework offer over a basic system like that? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | nbvfour@gmail.com |
|---|---|
| Date | 2012-10-13 15:24 -0700 |
| Message-ID | <9c958a7c-04db-4c6d-a8a2-38400e67e718@googlegroups.com> |
| In reply to | #31213 |
On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: > > Nice theory, but this is the bit that I fundamentally disagree with. > Forcing programmers to work in one particular style is usually not the > job of the language/framework/library. That should be up to the > programmer, or at least the local style guide. Have you ever read the zen of python? "Theres only one way to do it" is a core motto of the python language. In my opinion, this is the most important aspect of python and is what makes python so much better than PHP and perl and all the other "do it however you want, the more convoluted and obfuscated the better!" languages. > I do like your plan of > having identical interfaces to the same functionality (your example of > web-based and command-line is particularly appealing to my personal > tastes), but the same can usually be achieved with a well-built > library. In fact, all you need to do is have your model as a simple > Python module, and then the view and controller call on its functions. > > What does your framework offer over a basic system like that? This "well built library" you mention basically describes my framework. You write a model method/function that takes data and then returns data. All giotto does is extract that data from the controller, pass it on to the model, then take the output of the model and pass it in to the view. You write the view, you write the model. Giotto provides the API for making al this happen. Giotto doesn't care if your model calls Postgres or Mysql or Redis or RabbitMQ, thats not of any concern to the framework. The advantage of this is that the framework can 'mock' out the model layer very easily. For instance, your front end designers can work on the HTML without needing to run postgres, and the backend developers can work on the backend through the command line.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-14 10:06 +1100 |
| Message-ID | <mailman.2155.1350169584.27098.python-list@python.org> |
| In reply to | #31225 |
On Sun, Oct 14, 2012 at 9:24 AM, <nbvfour@gmail.com> wrote: > On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: >> >> Nice theory, but this is the bit that I fundamentally disagree with. >> Forcing programmers to work in one particular style is usually not the >> job of the language/framework/library. That should be up to the >> programmer, or at least the local style guide. > > Have you ever read the zen of python? "Theres only one way to do it" is a core motto of the python language. In my opinion, this is the most important aspect of python and is what makes python so much better than PHP and perl and all the other "do it however you want, the more convoluted and obfuscated the better!" languages. Many times, but 'import this' doesn't translate into a language rule that all classes have an uppercase first letter and all non-classes don't; nor does it require that it be impossible to combine two simple statements onto one line (because it's equally "obvious" to put them onto two lines). Some things are questions of style, and are and should be both implemented. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-10-14 02:25 +0000 |
| Message-ID | <507a2298$0$6574$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #31225 |
On Sat, 13 Oct 2012 15:24:04 -0700, nbvfour wrote: > On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: >> >> Nice theory, but this is the bit that I fundamentally disagree with. >> Forcing programmers to work in one particular style is usually not the >> job of the language/framework/library. That should be up to the >> programmer, or at least the local style guide. > > Have you ever read the zen of python? "Theres only one way to do it" is > a core motto of the python language. Have *you* ever read the Zen of Python? The line from the Zen is: "There should be one-- and preferably only one --obvious way to do it." Paraphrasing for emphasis: There SHOULD be one (or more, but one is best) OBVIOUS way to do it. as opposed to languages where there are no obvious ways to things, or thirty. Don't believe me that the emphasis is on *obvious* rather than "only"? The very next line of the Zen tells you: "Although that way may not be OBVIOUS at first unless you're Dutch." [emphasis added] Not being Dutch, I don't know whether the obvious way to do command line argument handling is the getopt module or argparse. But there certainly isn't *only one way* to do command line argument handling. It is a gross canard, mostly spread by Perl programmers, that Python is "limited" to "only one way to do it" and therefore isn't as good as Perl which gives you "more freedom" (to write unreadable, unmaintainable code). It simply isn't true that Python only gives you "only one way". The acronym OOWTDI stands for *one obvious way to do it*. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2012-10-13 21:53 -0500 |
| Subject | Re: one obvious parser (was "Feedback on my python framework I'm building.") |
| Message-ID | <mailman.2159.1350183150.27098.python-list@python.org> |
| In reply to | #31232 |
On 10/13/12 21:25, Steven D'Aprano wrote: > Not being Dutch, I don't know whether the obvious way to do command line > argument handling is the getopt module or argparse. But there certainly > isn't *only one way* to do command line argument handling. As an aside, I just watched a fascinating video[1] on docopt[2] which seems like an amazingly simple way to build command-line UIs. I haven't toyed with it yet, but I just wanted to share my "wow, that's slick" experience with the list. -tkc [1] http://www.youtube.com/watch?v=pXhcPJK5cMc [2] http://docopt.org/
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2012-10-14 03:58 +0100 |
| Message-ID | <mailman.2160.1350183518.27098.python-list@python.org> |
| In reply to | #31232 |
On 2012-10-14 03:25, Steven D'Aprano wrote: > On Sat, 13 Oct 2012 15:24:04 -0700, nbvfour wrote: > >> On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: >>> >>> Nice theory, but this is the bit that I fundamentally disagree with. >>> Forcing programmers to work in one particular style is usually not the >>> job of the language/framework/library. That should be up to the >>> programmer, or at least the local style guide. >> >> Have you ever read the zen of python? "Theres only one way to do it" is >> a core motto of the python language. > > Have *you* ever read the Zen of Python? The line from the Zen is: > > "There should be one-- and preferably only one --obvious way to do it." > > Paraphrasing for emphasis: > > There SHOULD be one (or more, but one is best) OBVIOUS way to do it. > > as opposed to languages where there are no obvious ways to things, or > thirty. > > Don't believe me that the emphasis is on *obvious* rather than "only"? > The very next line of the Zen tells you: > > "Although that way may not be OBVIOUS at first unless you're Dutch." > > [emphasis added] > > Not being Dutch, I don't know whether the obvious way to do command line > argument handling is the getopt module or argparse. But there certainly > isn't *only one way* to do command line argument handling. > > It is a gross canard, mostly spread by Perl programmers, that Python is > "limited" to "only one way to do it" and therefore isn't as good as Perl > which gives you "more freedom" (to write unreadable, unmaintainable code). > > It simply isn't true that Python only gives you "only one way". The > acronym OOWTDI stands for *one obvious way to do it*. > I think it's the "Paradox of Choice". The more choices there are, the more time you'll spend trying to decide which one is "best".
[toc] | [prev] | [next] | [standalone]
| From | nbvfour@gmail.com |
|---|---|
| Date | 2012-10-13 15:24 -0700 |
| Message-ID | <mailman.2150.1350167052.27098.python-list@python.org> |
| In reply to | #31213 |
On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: > > Nice theory, but this is the bit that I fundamentally disagree with. > Forcing programmers to work in one particular style is usually not the > job of the language/framework/library. That should be up to the > programmer, or at least the local style guide. Have you ever read the zen of python? "Theres only one way to do it" is a core motto of the python language. In my opinion, this is the most important aspect of python and is what makes python so much better than PHP and perl and all the other "do it however you want, the more convoluted and obfuscated the better!" languages. > I do like your plan of > having identical interfaces to the same functionality (your example of > web-based and command-line is particularly appealing to my personal > tastes), but the same can usually be achieved with a well-built > library. In fact, all you need to do is have your model as a simple > Python module, and then the view and controller call on its functions. > > What does your framework offer over a basic system like that? This "well built library" you mention basically describes my framework. You write a model method/function that takes data and then returns data. All giotto does is extract that data from the controller, pass it on to the model, then take the output of the model and pass it in to the view. You write the view, you write the model. Giotto provides the API for making al this happen. Giotto doesn't care if your model calls Postgres or Mysql or Redis or RabbitMQ, thats not of any concern to the framework. The advantage of this is that the framework can 'mock' out the model layer very easily. For instance, your front end designers can work on the HTML without needing to run postgres, and the backend developers can work on the backend through the command line.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-10-14 03:37 +0000 |
| Message-ID | <507a3365$0$6574$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #31213 |
On Sun, 14 Oct 2012 05:33:40 +1100, Chris Angelico wrote: > Forcing programmers to work in one particular style is usually not the > job of the language/framework/library. Have you actually programmed before? *grin* I've never come across a language/framework/library that DOESN'T force programmers to work in a particular style, at least to some degree. Every language encourages certain styles, discourages others, and makes some impossible. Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. Perl probably has a way to do it *wink* but few others do, and thank goodness we've moved on. The sort of code you'll write in Fortran77 will be significantly different from that you'll write in Lisp or Java or Forth or Ocaml. Languages don't just differ in syntax, they differ in what they consider good idioms, or even *possible* idioms. Hence: http://dirtsimple.org/2004/12/python-is-not-java.html http://dirtsimple.org/2004/12/java-is-not-python-either.html Can you write "Java in Python"? Well, to some degree you can. Any Turing complete language can be written in any other Turing complete language, with sufficient layers of indirection, modulo things which are completely impossible. You simply cannot do C-style pointer manipulations in Python, not without breaking out of Python (e.g. with ctypes). Libraries and frameworks are in a similar boat. Can you write CherryPy in Django? Not easily. Generally the way to ignore a framework or library and write in a different style is to, well, ignore the framework or library and write in a different style :) You can always step outside the bounds of the framework or library and write something in the programming language level. Just because numpy doesn't have some function I want, doesn't mean that I can't write it in Python -- and just because numpy wants to work with arrays doesn't mean I can't insist in using XML for my data, provided I convert it into an array each time I pass it to a numpy function and back to XML when it returns. (For my next trick, watch as I eat three pounds of high-level radioactive waste!) Now clearly some frameworks are lighter than others, some impose their style on your code like a big heavy weight on a rubber sheet, distorting everything for miles around. Others not so much. But I really don't see the problem here: if you don't like the "Twisted style" that it imposes, don't use Twisted, use another framework, or no framework at all. I think it is a *good* thing that different languages/frameworks/ libraries have their own styles. The alternative isn't "many styles" but "one style": an unstylish mess. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-10-14 15:20 +1100 |
| Message-ID | <mailman.2162.1350188431.27098.python-list@python.org> |
| In reply to | #31235 |
On Sun, Oct 14, 2012 at 2:37 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > On Sun, 14 Oct 2012 05:33:40 +1100, Chris Angelico wrote: > >> Forcing programmers to work in one particular style is usually not the >> job of the language/framework/library. > > Have you actually programmed before? > > *grin* > > I've never come across a language/framework/library that DOESN'T force > programmers to work in a particular style, at least to some degree. Style and technique aren't quite the same thing, though. Where you draw the line between aspects the language should enforce and aspects that should be up to the programmer is a tricky question. A language's standard library certainly encourages a particular naming style, but nothing enforces it. Of course the language has to enforce something. I just don't think that the MVC model should be part of what's enforced. What next? Require that one file be one class and have nothing else in it? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-10-14 08:48 -0400 |
| Message-ID | <roy-275D3A.08482414102012@news.panix.com> |
| In reply to | #31235 |
In article <507a3365$0$6574$c3e8da3$5496439d@news.astraweb.com>, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Remember using PEEK and POKE commands with BASIC back in > 1978? Pretty much impossible in Python. But, trivial to implement as an extension :-)
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <d@davea.name> |
|---|---|
| Date | 2012-10-14 18:38 -0400 |
| Message-ID | <mailman.2184.1350254344.27098.python-list@python.org> |
| In reply to | #31250 |
On 10/14/2012 08:48 AM, Roy Smith wrote: > In article <507a3365$0$6574$c3e8da3$5496439d@news.astraweb.com>, > Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > >> Remember using PEEK and POKE commands with BASIC back in >> 1978? Pretty much impossible in Python. > But, trivial to implement as an extension :-) PEEK and POKE were intended to be used with memory mapped devices. Simplest example is the 6502 chip, which had no I/O bus -- it was all memory mapped. Want to change baud rate? poke a byte somewhere. These days, the only device I can think of that's usually memory mapped is the video. And few programs talk to it that way. Now, INP and OUT (or various similar names) were for doing port I/o. But I suspect that modern systems aren't going to let you do much of that either. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2012-10-15 00:40 +0100 |
| Message-ID | <mailman.2185.1350258052.27098.python-list@python.org> |
| In reply to | #31250 |
On 2012-10-14 23:38, Dave Angel wrote: > On 10/14/2012 08:48 AM, Roy Smith wrote: >> In article <507a3365$0$6574$c3e8da3$5496439d@news.astraweb.com>, >> Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: >> >>> Remember using PEEK and POKE commands with BASIC back in >>> 1978? Pretty much impossible in Python. >> But, trivial to implement as an extension :-) > PEEK and POKE were intended to be used with memory mapped devices. > Simplest example is the 6502 chip, which had no I/O bus -- it was all > memory mapped. Want to change baud rate? poke a byte somewhere. > > These days, the only device I can think of that's usually memory mapped > is the video. And few programs talk to it that way. > > Now, INP and OUT (or various similar names) were for doing port I/o. > But I suspect that modern systems aren't going to let you do much of > that either. > It depends on the CPU. Some have specialised instructions for I/O, others don't.
[toc] | [prev] | [next] | [standalone]
| From | Roel Schroeven <roel@roelschroeven.net> |
|---|---|
| Date | 2012-10-15 19:29 +0200 |
| Message-ID | <mailman.2225.1350322212.27098.python-list@python.org> |
| In reply to | #31250 |
MRAB schreef:
> On 2012-10-14 23:38, Dave Angel wrote:
>> On 10/14/2012 08:48 AM, Roy Smith wrote:
>>> In article <507a3365$0$6574$c3e8da3$5496439d@news.astraweb.com>,
>>> Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>>>
>>>> Remember using PEEK and POKE commands with BASIC back in
>>>> 1978? Pretty much impossible in Python.
>>> But, trivial to implement as an extension :-)
>> PEEK and POKE were intended to be used with memory mapped devices.
>> Simplest example is the 6502 chip, which had no I/O bus -- it was all
>> memory mapped. Want to change baud rate? poke a byte somewhere.
>>
>> These days, the only device I can think of that's usually memory mapped
>> is the video. And few programs talk to it that way.
>>
>> Now, INP and OUT (or various similar names) were for doing port I/o.
>> But I suspect that modern systems aren't going to let you do much of
>> that either.
>>
> It depends on the CPU. Some have specialised instructions for I/O,
> others don't.
I think Roy Smith meant that the OS on modern systems generally prevents
direct access from user space to either memory mapped I/O or port mapped
I/O. Embedded systems might allow direct access, but AFAIK Python
doesn't run on those.
Best regards,
Roel
--
"Too often we hold fast to the cliches of our forebears. We subject all
facts to a prefabricated set of interpretations. Too often we enjoy the
comfort of opinion without the discomfort of thought."
-- John F Kennedy
roel@roelschroeven.net
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web