This gives a more realistic ranking of weapons, as hitting more often can help shore up weaker weaons (e.g. the crysknife has a +3 intrinsic to-hit value, and tends to do more average damage in battle than its simple damage numbers might indicate).
Some weapons have built-in (intrinsic) to-hit bonus, and this bonus is shown in parenthesis after the weapon name. For regular weapons this is a number of plusses or minuses: (++) means that 2 is added to the to-hit value. For artifacts the bonus is the regular weapon bonus, plus a die-roll (which varies from one artifact to the next), so a number is shown in parenthesis which is the average additional to-hit bonus.
When you first select a character, the output shows you their skills based on the start of the game, which means unskilled in everything except their starting weapons (which will be basic). You can click on higher skills on each weapon to advance that skill and see how its rank changes. Advancing a weapon also advances all weapons in the same class, e.g. advancing one polearm advances them all. Advancing everything (though tedious) will show you what your best possible weapons are (I know, there should be a one-click way of doing this; perhaps I'll add that feature someday).
As you advance skills, the number of skill slots used is displayed at the top of the output. Remember that in actual gameplay, the number of skill slots used can not be greater than your current experience level.
For more information on the skill system, see my article on Nethack Weapon Skills
Another thing to keep in mind with artifacts is that if the artifact does double damage, the enchantment is added in before doubling, so for late in the game when you can usually have high enchantments on your weapons, its more worthwhile to enchant a good artifact.