需要一些建议 [英] Need some advice

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

问题描述

我正在学习Python(痴迷于此)。我已经完成了一些教程并阅读了一本借给我的Python书籍。我现在正试图把我学到的东西改写成几年前我在VB写的

数字命理学课程。


有时候我我完全陷入困境(例如,我只是想把

的数字值放在一个函数中的字典中的字母表和一年中的几个月。然后,我可以导入

字典我需要从那个函数......好吧,我得到导入错误。)


所以问题是这个...当我像卡住一样这个似乎是在用我试试的所有东西敲打墙壁,是不是继续尝试不同的东西或者停下来,休息一下然后回去

来阅读教程还是一本Python书?或者,在我尝试了所有可以想到的一切之后,这是更好的,我只是在这里发布问题,得到答案并继续前进?


谢谢,杰夫

I am in the process of learning Python (obsessively so). I''ve been through a few tutorials and read
a Python book that was lent to me. I am now trying to put what I''ve learned to use by rewriting that
Numerology program I wrote years ago in VB.

There are times I am totally stuck (for instance, I just had an idea to put the numerical values of
the alphabet and months of the year in a dictionary located in a function. Then, I can import the
dictionary I need from that function ... well, I''m getting import errors).

So the question is this ... when I get stuck like this and seem to be banging into walls with
everything I try, is it better to continue trying different things or stop, take a break and go back
to reading a tutorial or a Python book? Or is it better that after I''ve tried everything I can think
of, I just post the question here, get the answer and move forward?

Thanks, Jeff

推荐答案

Jeff Wagner写道:
Jeff Wagner wrote:
我正在学习Python(痴迷于此)。我已经完成了一些教程并阅读了一本借给我的Python书。我现在正试图通过改写我多年前在VB中写的数字命理程序来学习我学到的东西。

有时候我完全陷入困境(例如,我我只想把字母表中的数字和一年中的几个月放在函数中的字典中。然后,我可以从该函数中导入我需要的字典......好吧,我得到导入错误)。


从函数中导入字典 ????

所以问题就是这个......当我像这样陷入困境并似乎正在敲打墙壁时,我尝试了一切,继续尝试不同的事情会更好吗?


最后,* no *,niet,nein,non等等......如果你不知道你在做什么,b $ b你在做什么,它不是编程,它是关于猴子的故事,

打字机和莎士比亚。

或停下来,休息一下然后回去阅读教程或Python书籍?


应该是首先要做的事情之一。如果

你对这门语言知之甚少,你就不会做任何好事。

或者在我尝试了一切后我能做的更好想想,[b $ b

尝试一切[你]可以想到的不是编程。见上文......

我只是在这里发布问题,得到答案并继续前进?
I am in the process of learning Python (obsessively so). I''ve been through a few tutorials and read
a Python book that was lent to me. I am now trying to put what I''ve learned to use by rewriting that
Numerology program I wrote years ago in VB.

There are times I am totally stuck (for instance, I just had an idea to put the numerical values of
the alphabet and months of the year in a dictionary located in a function. Then, I can import the
dictionary I need from that function ... well, I''m getting import errors).
"import the dictionnary from a function" ????
So the question is this ... when I get stuck like this and seem to be banging into walls with
everything I try, is it better to continue trying different things
Definitively, *no*, niet, nein, non, etc... If you don''t know what
you''re doing, it''s not programming, it''s a story about monkeys,
typewriters and Shakespeare.
or stop, take a break and go back
to reading a tutorial or a Python book?
Should be one of the first thing to do. You won''t do anything good if
you don''t know enough of the language.
Or is it better that after I''ve tried everything I can think
of,
"trying everything [you] can think of" is not programming. See above...
I just post the question here, get the answer and move forward?




首先尝试知道你的意思我试图这样做,为什么你要这样做呢?b $ b。问问自己,这是用最好的方式(或者至少是最明显的方式)用这种语言来做。然后通过你的教程,

书籍等来看看如何做到这一点。不要忘记Python

shell是一个很棒的工具。


如果那时你仍然被卡住了,你当然会受到欢迎在这里发布您的

问题,并解释您正在尝试做什么以及

你会被困在哪里! - )


我的0.2美分

布鲁诺



First try to know what you''re trying to do, and why you''re trying to do
it this way. Ask yourself if this is the best way (or at least the most
obvious way) to do it with the language. Then look thru your tutorials,
books, etc to see how this can be done. Don''t forget that the Python
shell is a great tool.

If then you''re still stuck, you''re of course welcome to post your
question here, with explanation about what you''re trying to do and what
you''re stuck with !-)

My 0.2 cents
Bruno


Jeff Wagner于2003年11月29日星期六将这条鱼喂给企鹅

16:19 pm:

Jeff Wagner fed this fish to the penguins on Saturday 29 November 2003
16:19 pm:

有些时候我完全陷入困境(例如,我只是有一个想法
到将字母表的数值和一年中的月份放在一个函数中的字典中。然后,我可以从该函数中导入我需要的字典......好吧,我得到了导入错误)。

正如我前面提到的那样,你似乎试图模块化

程序,甚至让逻辑工作......


首先尝试将其编码为一个文件,/那么/考虑什么是有意义的

一个导入的模块。注意:您导入模块,模块可能包含

函数,常量和(Python并不是真的有这样的)和课程

- 你一年中的几个月不需要成为一个函数,只需要一个

"恒定"列表,以及字母表的值?如果它们是连续的b
(没有跳过或重复),一个简短的函数可以计算它们

(在ASCII中,由于字母表不是,因此EBCDIC会更难。

连续)。看几个小时前的帖子......

所以问题就是这个...当我像这样被卡住并且好像是用我尝试的所有东西敲打墙壁时,是最好继续尝试不同的事情或停下来,休息一下,然后回去阅读一本
教程或一本Python书?或者,在我尝试了一切我能想到的事情之后,我只是更好了,我只是在这里发布问题,得到
答案并继续前进?

忽略课程现在(虽然我确实在我的示例代码中添加了一个)

我还建议忽略模块导入(除了Python提供的

之外的东西)...努力理解将参数传递给函数和从函数返回值(尝试,上面

all,以避免依赖于全局变量 - global" ;常数可能是

允许< G>)。

毕竟,没有上下文的零碎方法确实会造成一些

的混乱(主要是你为什么要这样做?类型)。

一旦你链接了你的主号码。计算数字的东西

来自名字我能够设想数字命理并快速解决整个问题(减去特殊数字,而不是

通过手工计算完全测试,但仍然......)


- ==================== ============================== ============<
wl ***** @ ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG<
wu******@dm.net | Bestiaria支持人员<
========================================= ========= ============<
Bestiaria主页: http://www.beastie.dm.net/ <
主页: http://www.dm.net/~wulfraed/ <
There are times I am totally stuck (for instance, I just had an idea
to put the numerical values of the alphabet and months of the year in
a dictionary located in a function. Then, I can import the dictionary
I need from that function ... well, I''m getting import errors).
As I mentioned earlier it seems you are trying to modularize the
program before even getting the logic working...

Try coding it as one file first, /then/ consider what makes sense as
an imported module. NOTE: you import modules, modules may contain
functions, "constants" (Python doesn''t really have such), and classes
-- your months of the year wouldn''t need to be a function, just a
"constant" list, and as for the values of the alphabet? If they are
sequential (no skips or duplicates) a short function can calculate them
(in ASCII, EBCDIC would be more difficult as the alphabet is not
contiguous). See my post of a few hours ago...
So the question is this ... when I get stuck like this and seem to be
banging into walls with everything I try, is it better to continue
trying different things or stop, take a break and go back to reading a
tutorial or a Python book? Or is it better that after I''ve tried
everything I can think of, I just post the question here, get the
answer and move forward?
Ignoring classes for now (though I did stick one into my example code)
I''d also suggest ignoring module import (except for Python supplied
stuff) at this time... Work on understanding the passing of arguments
to a function and the return of values from the function (try, above
all, to avoid relying on global variables -- global "constants" may be
permissible <G>).
After all, your piece-meal approach without context did cause some
confusion (mostly of the "why would you want to even do this?" type).
As soon as you linked your "master number" stuff to calculating numbers
from names I was able to envision numerology and hack a quick first
approach to the entire problem (less your special numbers, and not
fully tested by hand computations, but still...)

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Bestiaria Home Page: http://www.beastie.dm.net/ <
Home Page: http://www.dm.net/~wulfraed/ <








我从一位老大学教授那里得到的一课:通常情况下更好

有一些有用的东西并且不是100%比一个程序更正确

100%正确无效。


当然,你说你的目标是学习Python,所以工作
计划只是副作用。


我会得到所有信息并且做得对......


Jay Bird


Jeff Wagner写道:

One lesson that I remember from an old college prof: Often it is better
to have something that works and isn''t 100% correct than a program that
does nothing 100% correctly.

Of course, you stated that you goal is to learn Python, so a working
program is only a side effect.

I''d get all the info and do it right....

Jay Bird

Jeff Wagner wrote:
我正在学习Python (痴迷于此)。我已经完成了一些教程并阅读了一本借给我的Python书。我现在正试图通过改写我多年前在VB中写的数字命理程序来学习我学到的东西。

有时候我完全陷入困境(例如,我我只想把字母表中的数字和一年中的几个月放在函数中的字典中。然后,我可以从该函数中导入我需要的字典......好吧,我得到了导入错误。

所以问题就是这个......当我遇到这样的问题并且似乎在敲打墙壁时,我尝试了一切,是不是更好继续尝试不同的事情或停下来,休息一下然后回去阅读教程或Python书籍?或者,在我尝试了所有我能想到的一切之后,这是更好的,我只是在这里发布问题,得到答案并继续前进?

谢谢,杰夫
I am in the process of learning Python (obsessively so). I''ve been through a few tutorials and read
a Python book that was lent to me. I am now trying to put what I''ve learned to use by rewriting that
Numerology program I wrote years ago in VB.

There are times I am totally stuck (for instance, I just had an idea to put the numerical values of
the alphabet and months of the year in a dictionary located in a function. Then, I can import the
dictionary I need from that function ... well, I''m getting import errors).

So the question is this ... when I get stuck like this and seem to be banging into walls with
everything I try, is it better to continue trying different things or stop, take a break and go back
to reading a tutorial or a Python book? Or is it better that after I''ve tried everything I can think
of, I just post the question here, get the answer and move forward?

Thanks, Jeff






这篇关于需要一些建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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